From c2ebba9e2585558fead5677ffd19a318212158ab Mon Sep 17 00:00:00 2001 From: kaltenbe <kaltenbe@mycompany.com> Date: Wed, 19 Aug 2015 08:55:10 +0000 Subject: [PATCH] moving openairITS from trunk to extras git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7778 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openairITS/ieee80211p_compile_modules.sh | 41 - openairITS/ieee80211p_configure_interface.sh | 20 - openairITS/ieee80211p_insert_modules.sh | 6 - openairITS/ieee80211p_setup_vars.sh | 21 - openairITS/mac/DOT11/.gitignore | 25 - openairITS/mac/DOT11/COPYRIGHT | 356 - openairITS/mac/DOT11/MAINTAINERS | 7651 ---------------- openairITS/mac/DOT11/Makefile | 248 - openairITS/mac/DOT11/README | 417 - openairITS/mac/DOT11/code-metrics.txt | 14 - openairITS/mac/DOT11/compat/Makefile | 102 - openairITS/mac/DOT11/compat/compat-2.6.14.c | 14 - openairITS/mac/DOT11/compat/compat-2.6.18.c | 14 - openairITS/mac/DOT11/compat/compat-2.6.19.c | 14 - openairITS/mac/DOT11/compat/compat-2.6.21.c | 14 - openairITS/mac/DOT11/compat/compat-2.6.22.c | 14 - openairITS/mac/DOT11/compat/compat-2.6.23.c | 239 - openairITS/mac/DOT11/compat/compat-2.6.24.c | 158 - openairITS/mac/DOT11/compat/compat-2.6.25.c | 97 - openairITS/mac/DOT11/compat/compat-2.6.26.c | 87 - openairITS/mac/DOT11/compat/compat-2.6.27.c | 239 - openairITS/mac/DOT11/compat/compat-2.6.28.c | 463 - openairITS/mac/DOT11/compat/compat-2.6.29.c | 166 - openairITS/mac/DOT11/compat/compat-2.6.32.c | 216 - openairITS/mac/DOT11/compat/compat-2.6.33.c | 132 - openairITS/mac/DOT11/compat/compat-2.6.35.c | 48 - openairITS/mac/DOT11/compat/compat-2.6.36.c | 185 - openairITS/mac/DOT11/compat/compat-2.6.37.c | 358 - openairITS/mac/DOT11/compat/compat-2.6.38.c | 50 - openairITS/mac/DOT11/compat/compat-2.6.39.c | 114 - openairITS/mac/DOT11/compat/compat-3.0.c | 62 - openairITS/mac/DOT11/compat/compat-3.2.c | 34 - openairITS/mac/DOT11/compat/compat-3.3.c | 173 - openairITS/mac/DOT11/compat/compat-3.5.c | 20 - openairITS/mac/DOT11/compat/compat_atomic.c | 33 - .../mac/DOT11/compat/compat_firmware_class.c | 759 -- openairITS/mac/DOT11/compat/cordic.c | 101 - openairITS/mac/DOT11/compat/crc8.c | 87 - openairITS/mac/DOT11/compat/kfifo.c | 608 -- openairITS/mac/DOT11/compat/kstrtox.c | 236 - openairITS/mac/DOT11/compat/main.c | 66 - openairITS/mac/DOT11/compat/modules.order | 1 - openairITS/mac/DOT11/compat/pm_qos_params.c | 477 - .../compat/scripts/compat_firmware_install | 21 - .../compat/scripts/gen-compat-autoconf.sh | 105 - .../DOT11/compat/scripts/gen-compat-config.sh | 64 - .../mac/DOT11/compat/scripts/skip-colors | 2 - openairITS/mac/DOT11/compat_base_tree | 1 - openairITS/mac/DOT11/compat_base_tree_version | 1 - openairITS/mac/DOT11/compat_version | 1 - openairITS/mac/DOT11/config.mk | 677 -- .../mac/DOT11/include/N/pcmcia/cistpl.h | 10 - .../mac/DOT11/include/N/trace/define_trace.h | 5 - openairITS/mac/DOT11/include/crypto/aes.h | 21 - .../mac/DOT11/include/linux/ath9k_platform.h | 37 - openairITS/mac/DOT11/include/linux/atomic.h | 46 - openairITS/mac/DOT11/include/linux/average.h | 5 - .../mac/DOT11/include/linux/bcma/bcma.h | 307 - .../linux/bcma/bcma_driver_chipcommon.h | 415 - .../include/linux/bcma/bcma_driver_mips.h | 51 - .../include/linux/bcma/bcma_driver_pci.h | 214 - .../mac/DOT11/include/linux/bcma/bcma_regs.h | 86 - .../mac/DOT11/include/linux/bcma/bcma_soc.h | 16 - openairITS/mac/DOT11/include/linux/bitops.h | 211 - .../mac/DOT11/include/linux/compat-2.6.14.h | 13 - .../mac/DOT11/include/linux/compat-2.6.18.h | 13 - .../mac/DOT11/include/linux/compat-2.6.19.h | 24 - .../mac/DOT11/include/linux/compat-2.6.20.h | 21 - .../mac/DOT11/include/linux/compat-2.6.21.h | 18 - .../mac/DOT11/include/linux/compat-2.6.22.h | 104 - .../mac/DOT11/include/linux/compat-2.6.23.h | 136 - .../mac/DOT11/include/linux/compat-2.6.24.h | 247 - .../mac/DOT11/include/linux/compat-2.6.25.h | 274 - .../mac/DOT11/include/linux/compat-2.6.26.h | 455 - .../mac/DOT11/include/linux/compat-2.6.27.h | 263 - .../mac/DOT11/include/linux/compat-2.6.28.h | 268 - .../mac/DOT11/include/linux/compat-2.6.29.h | 379 - .../mac/DOT11/include/linux/compat-2.6.30.h | 47 - .../mac/DOT11/include/linux/compat-2.6.31.h | 221 - .../mac/DOT11/include/linux/compat-2.6.32.h | 178 - .../mac/DOT11/include/linux/compat-2.6.33.h | 172 - .../mac/DOT11/include/linux/compat-2.6.34.h | 309 - .../mac/DOT11/include/linux/compat-2.6.35.h | 59 - .../mac/DOT11/include/linux/compat-2.6.36.h | 212 - .../mac/DOT11/include/linux/compat-2.6.37.h | 140 - .../mac/DOT11/include/linux/compat-2.6.38.h | 95 - .../mac/DOT11/include/linux/compat-2.6.39.h | 169 - .../mac/DOT11/include/linux/compat-2.6.h | 67 - .../mac/DOT11/include/linux/compat-3.0.h | 130 - .../mac/DOT11/include/linux/compat-3.1.h | 62 - .../mac/DOT11/include/linux/compat-3.2.h | 81 - .../mac/DOT11/include/linux/compat-3.3.h | 60 - .../mac/DOT11/include/linux/compat-3.4.h | 67 - .../mac/DOT11/include/linux/compat-3.5.h | 13 - .../mac/DOT11/include/linux/compat_autoconf.h | 767 -- openairITS/mac/DOT11/include/linux/cordic.h | 48 - openairITS/mac/DOT11/include/linux/crc8.h | 101 - .../mac/DOT11/include/linux/eeprom_93cx6.h | 82 - openairITS/mac/DOT11/include/linux/export.h | 12 - .../mac/DOT11/include/linux/ieee80211.h | 1878 ---- openairITS/mac/DOT11/include/linux/kfifo.h | 857 -- openairITS/mac/DOT11/include/linux/math64.h | 10 - openairITS/mac/DOT11/include/linux/nl80211.h | 2870 ------ openairITS/mac/DOT11/include/linux/of.h | 16 - openairITS/mac/DOT11/include/linux/pci-aspm.h | 5 - openairITS/mac/DOT11/include/linux/pci_ids.h | 2907 ------ openairITS/mac/DOT11/include/linux/pm_qos.h | 12 - .../mac/DOT11/include/linux/pm_qos_params.h | 36 - .../mac/DOT11/include/linux/pm_runtime.h | 14 - openairITS/mac/DOT11/include/linux/printk.h | 12 - openairITS/mac/DOT11/include/linux/rfkill.h | 32 - .../mac/DOT11/include/linux/rfkill_backport.h | 359 - .../mac/DOT11/include/linux/semaphore.h | 12 - .../DOT11/include/linux/spi/libertas_spi.h | 29 - openairITS/mac/DOT11/include/linux/ssb/ssb.h | 625 -- .../include/linux/ssb/ssb_driver_chipcommon.h | 665 -- .../include/linux/ssb/ssb_driver_extif.h | 214 - .../DOT11/include/linux/ssb/ssb_driver_gige.h | 180 - .../DOT11/include/linux/ssb/ssb_driver_mips.h | 46 - .../DOT11/include/linux/ssb/ssb_driver_pci.h | 130 - .../DOT11/include/linux/ssb/ssb_embedded.h | 18 - .../mac/DOT11/include/linux/ssb/ssb_regs.h | 594 -- .../mac/DOT11/include/linux/tracepoint.h | 41 - .../DOT11/include/linux/unaligned/access_ok.h | 67 - .../include/linux/unaligned/be_byteshift.h | 70 - .../include/linux/unaligned/be_memmove.h | 36 - .../DOT11/include/linux/unaligned/be_struct.h | 36 - .../DOT11/include/linux/unaligned/generic.h | 68 - .../include/linux/unaligned/le_byteshift.h | 70 - .../include/linux/unaligned/le_memmove.h | 36 - .../DOT11/include/linux/unaligned/le_struct.h | 36 - .../DOT11/include/linux/unaligned/memmove.h | 45 - .../include/linux/unaligned/packed_struct.h | 46 - .../mac/DOT11/include/linux/usb/rndis_host.h | 272 - .../mac/DOT11/include/linux/usb/usbnet.h | 231 - openairITS/mac/DOT11/include/linux/wireless.h | 1162 --- openairITS/mac/DOT11/include/linux/wl12xx.h | 81 - .../mac/DOT11/include/net/cfg80211-wext.h | 55 - openairITS/mac/DOT11/include/net/cfg80211.h | 3419 ------- .../DOT11/include/net/ieee80211_radiotap.h | 294 - openairITS/mac/DOT11/include/net/lib80211.h | 124 - openairITS/mac/DOT11/include/net/mac80211.h | 3724 -------- .../mac/DOT11/include/net/net_namespace.h | 10 - openairITS/mac/DOT11/include/net/regulatory.h | 122 - openairITS/mac/DOT11/net/mac80211/Makefile | 63 - openairITS/mac/DOT11/net/mac80211/aes_ccm.c | 150 - openairITS/mac/DOT11/net/mac80211/aes_ccm.h | 24 - openairITS/mac/DOT11/net/mac80211/aes_cmac.c | 132 - openairITS/mac/DOT11/net/mac80211/aes_cmac.h | 19 - openairITS/mac/DOT11/net/mac80211/agg-rx.c | 347 - openairITS/mac/DOT11/net/mac80211/agg-tx.c | 898 -- openairITS/mac/DOT11/net/mac80211/cfg.c | 2815 ------ openairITS/mac/DOT11/net/mac80211/cfg.h | 9 - openairITS/mac/DOT11/net/mac80211/chan.c | 163 - openairITS/mac/DOT11/net/mac80211/debugfs.c | 347 - openairITS/mac/DOT11/net/mac80211/debugfs.h | 14 - .../mac/DOT11/net/mac80211/debugfs_key.c | 344 - .../mac/DOT11/net/mac80211/debugfs_key.h | 33 - .../mac/DOT11/net/mac80211/debugfs_netdev.c | 721 -- .../mac/DOT11/net/mac80211/debugfs_netdev.h | 22 - .../mac/DOT11/net/mac80211/debugfs_sta.c | 387 - .../mac/DOT11/net/mac80211/debugfs_sta.h | 14 - .../mac/DOT11/net/mac80211/driver-ops.h | 794 -- .../mac/DOT11/net/mac80211/driver-trace.c | 9 - .../mac/DOT11/net/mac80211/driver-trace.h | 1559 ---- openairITS/mac/DOT11/net/mac80211/event.c | 27 - openairITS/mac/DOT11/net/mac80211/ht.c | 407 - openairITS/mac/DOT11/net/mac80211/ibss.c | 1223 --- .../mac/DOT11/net/mac80211/ieee80211_i.h | 1529 ---- openairITS/mac/DOT11/net/mac80211/iface.c | 1473 --- openairITS/mac/DOT11/net/mac80211/key.c | 702 -- openairITS/mac/DOT11/net/mac80211/key.h | 150 - openairITS/mac/DOT11/net/mac80211/led.c | 309 - openairITS/mac/DOT11/net/mac80211/led.h | 73 - openairITS/mac/DOT11/net/mac80211/main.c | 1124 --- openairITS/mac/DOT11/net/mac80211/mesh.c | 764 -- openairITS/mac/DOT11/net/mac80211/mesh.h | 342 - openairITS/mac/DOT11/net/mac80211/mesh_hwmp.c | 1153 --- .../mac/DOT11/net/mac80211/mesh_pathtbl.c | 1126 --- .../mac/DOT11/net/mac80211/mesh_plink.c | 867 -- openairITS/mac/DOT11/net/mac80211/michael.c | 86 - openairITS/mac/DOT11/net/mac80211/michael.h | 24 - openairITS/mac/DOT11/net/mac80211/mlme.c | 3534 ------- .../mac/DOT11/net/mac80211/modules.order | 1 - .../mac/DOT11/net/mac80211/offchannel.c | 266 - openairITS/mac/DOT11/net/mac80211/pm.c | 147 - openairITS/mac/DOT11/net/mac80211/rate.c | 534 -- openairITS/mac/DOT11/net/mac80211/rate.h | 161 - .../mac/DOT11/net/mac80211/rc80211_minstrel.c | 578 -- .../mac/DOT11/net/mac80211/rc80211_minstrel.h | 109 - .../net/mac80211/rc80211_minstrel_debugfs.c | 144 - .../DOT11/net/mac80211/rc80211_minstrel_ht.c | 911 -- .../DOT11/net/mac80211/rc80211_minstrel_ht.h | 130 - .../mac80211/rc80211_minstrel_ht_debugfs.c | 120 - .../mac/DOT11/net/mac80211/rc80211_pid.h | 278 - .../mac/DOT11/net/mac80211/rc80211_pid_algo.c | 477 - .../DOT11/net/mac80211/rc80211_pid_debugfs.c | 228 - openairITS/mac/DOT11/net/mac80211/rx.c | 3320 ------- openairITS/mac/DOT11/net/mac80211/scan.c | 974 -- openairITS/mac/DOT11/net/mac80211/spectmgmt.c | 82 - openairITS/mac/DOT11/net/mac80211/sta_info.c | 1443 --- openairITS/mac/DOT11/net/mac80211/sta_info.h | 544 -- openairITS/mac/DOT11/net/mac80211/status.c | 662 -- openairITS/mac/DOT11/net/mac80211/tkip.c | 360 - openairITS/mac/DOT11/net/mac80211/tkip.h | 35 - openairITS/mac/DOT11/net/mac80211/tx.c | 2886 ------ openairITS/mac/DOT11/net/mac80211/util.c | 1761 ---- openairITS/mac/DOT11/net/mac80211/wep.c | 348 - openairITS/mac/DOT11/net/mac80211/wep.h | 34 - openairITS/mac/DOT11/net/mac80211/wme.c | 193 - openairITS/mac/DOT11/net/mac80211/wme.h | 29 - openairITS/mac/DOT11/net/mac80211/work.c | 373 - openairITS/mac/DOT11/net/mac80211/wpa.c | 684 -- openairITS/mac/DOT11/net/mac80211/wpa.h | 38 - openairITS/mac/DOT11/net/wireless/Makefile | 42 - openairITS/mac/DOT11/net/wireless/chan.c | 137 - openairITS/mac/DOT11/net/wireless/core.c | 1107 --- openairITS/mac/DOT11/net/wireless/core.h | 468 - openairITS/mac/DOT11/net/wireless/db.txt | 17 - openairITS/mac/DOT11/net/wireless/debugfs.c | 115 - openairITS/mac/DOT11/net/wireless/debugfs.h | 11 - openairITS/mac/DOT11/net/wireless/ethtool.c | 78 - openairITS/mac/DOT11/net/wireless/ethtool.h | 6 - .../mac/DOT11/net/wireless/genregdb.awk | 126 - openairITS/mac/DOT11/net/wireless/ibss.c | 527 -- openairITS/mac/DOT11/net/wireless/lib80211.c | 292 - .../DOT11/net/wireless/lib80211_crypt_ccmp.c | 491 - .../DOT11/net/wireless/lib80211_crypt_tkip.c | 783 -- .../DOT11/net/wireless/lib80211_crypt_wep.c | 290 - openairITS/mac/DOT11/net/wireless/mesh.c | 171 - openairITS/mac/DOT11/net/wireless/mlme.c | 956 -- .../mac/DOT11/net/wireless/modules.order | 1 - openairITS/mac/DOT11/net/wireless/nl80211.c | 8117 ----------------- openairITS/mac/DOT11/net/wireless/nl80211.h | 126 - openairITS/mac/DOT11/net/wireless/radiotap.c | 358 - openairITS/mac/DOT11/net/wireless/reg.c | 2408 ----- openairITS/mac/DOT11/net/wireless/reg.h | 103 - openairITS/mac/DOT11/net/wireless/regdb.h | 23 - openairITS/mac/DOT11/net/wireless/scan.c | 1366 --- openairITS/mac/DOT11/net/wireless/sme.c | 1025 --- openairITS/mac/DOT11/net/wireless/sysfs.c | 157 - openairITS/mac/DOT11/net/wireless/sysfs.h | 9 - openairITS/mac/DOT11/net/wireless/util.c | 1059 --- .../mac/DOT11/net/wireless/wext-compat.c | 1531 ---- .../mac/DOT11/net/wireless/wext-compat.h | 57 - openairITS/mac/DOT11/net/wireless/wext-core.c | 1125 --- openairITS/mac/DOT11/net/wireless/wext-priv.c | 249 - openairITS/mac/DOT11/net/wireless/wext-proc.c | 159 - openairITS/mac/DOT11/net/wireless/wext-sme.c | 408 - openairITS/mac/DOT11/net/wireless/wext-spy.c | 232 - openairITS/mac/DOT11/scripts/admin-clean.sh | 15 - openairITS/mac/DOT11/scripts/admin-refresh.sh | 3 - openairITS/mac/DOT11/scripts/admin-update.sh | 647 -- openairITS/mac/DOT11/scripts/alx-enable | 47 - openairITS/mac/DOT11/scripts/athenable | 46 - openairITS/mac/DOT11/scripts/athload | 57 - openairITS/mac/DOT11/scripts/b43enable | 59 - openairITS/mac/DOT11/scripts/b43load | 65 - openairITS/mac/DOT11/scripts/btunload.sh | 14 - openairITS/mac/DOT11/scripts/check_config.sh | 34 - openairITS/mac/DOT11/scripts/check_depmod | 83 - openairITS/mac/DOT11/scripts/compress_modules | 40 - openairITS/mac/DOT11/scripts/driver-select | 499 - .../mac/DOT11/scripts/gen-compat-autoconf.sh | 204 - .../mac/DOT11/scripts/gen-stable-release.sh | 184 - openairITS/mac/DOT11/scripts/iwl-enable | 56 - openairITS/mac/DOT11/scripts/iwl-load | 58 - openairITS/mac/DOT11/scripts/madwifi-unload | 58 - openairITS/mac/DOT11/scripts/modlib.sh | 87 - openairITS/mac/DOT11/scripts/skip-colors | 2 - openairITS/mac/DOT11/scripts/unload.sh | 67 - openairITS/mac/DOT11/scripts/update-initramfs | 33 - openairITS/mac/DOT11/scripts/wlunload.sh | 59 - openairITS/phy/DOT11/Makefile.inc | 17 - openairITS/phy/DOT11/STS_LTS_F.h | 3 - openairITS/phy/DOT11/commonvars.h | 1 - openairITS/phy/DOT11/crc32.c | 29 - openairITS/phy/DOT11/data_detection.c | 505 - openairITS/phy/DOT11/defs.h | 46 - openairITS/phy/DOT11/generate_STSLTS_corr.m | 61 - openairITS/phy/DOT11/initial_sync.c | 506 - openairITS/phy/DOT11/interleaver.c | 36 - openairITS/phy/DOT11/phy_tx_start.c | 467 - openairITS/phy/DOT11/scrambler.c | 27 - openairITS/phy/DOT11/txvars.h | 54 - openairITS/phy/DRIVERS/.cproject | 209 - openairITS/phy/DRIVERS/.project | 77 - openairITS/phy/DRIVERS/Makefile | 20 - openairITS/phy/DRIVERS/ieee80211p-driver.c | 701 -- openairITS/phy/DRIVERS/ieee80211p-driver.h | 189 - .../phy/DRIVERS/ieee80211p-netlinkapi.c | 195 - .../phy/DRIVERS/ieee80211p-netlinkapi.h | 55 - openairITS/phy/DRIVERS/ieee80211p-softmodem.c | 141 - openairITS/phy/SIMULATION/Makefile | 69 - .../phy/SIMULATION/PER_PLOTS/SNR_0_1024.m | 26 - .../phy/SIMULATION/PER_PLOTS/SNR_0_256.m | 26 - .../phy/SIMULATION/PER_PLOTS/SNR_1_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/SNR_1_256.m | 26 - .../phy/SIMULATION/PER_PLOTS/SNR_2_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/SNR_2_256.m | 27 - .../phy/SIMULATION/PER_PLOTS/SNR_3_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/SNR_3_256.m | 27 - .../phy/SIMULATION/PER_PLOTS/SNR_4_1024.m | 17 - .../phy/SIMULATION/PER_PLOTS/SNR_4_256.m | 27 - .../phy/SIMULATION/PER_PLOTS/SNR_5_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/SNR_5_256.m | 27 - .../phy/SIMULATION/PER_PLOTS/errors_0_1024.m | 26 - .../phy/SIMULATION/PER_PLOTS/errors_0_256.m | 26 - .../phy/SIMULATION/PER_PLOTS/errors_1_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/errors_1_256.m | 26 - .../phy/SIMULATION/PER_PLOTS/errors_2_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/errors_2_256.m | 27 - .../phy/SIMULATION/PER_PLOTS/errors_3_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/errors_3_256.m | 27 - .../phy/SIMULATION/PER_PLOTS/errors_4_1024.m | 17 - .../phy/SIMULATION/PER_PLOTS/errors_4_256.m | 27 - .../phy/SIMULATION/PER_PLOTS/errors_5_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/errors_5_256.m | 27 - openairITS/phy/SIMULATION/PER_PLOTS/plots.m | 73 - .../PER_PLOTS/signal_errors_0_1024.m | 26 - .../PER_PLOTS/signal_errors_0_256.m | 26 - .../PER_PLOTS/signal_errors_1_1024.m | 27 - .../PER_PLOTS/signal_errors_1_256.m | 26 - .../PER_PLOTS/signal_errors_2_1024.m | 27 - .../PER_PLOTS/signal_errors_2_256.m | 27 - .../PER_PLOTS/signal_errors_3_1024.m | 27 - .../PER_PLOTS/signal_errors_3_256.m | 27 - .../PER_PLOTS/signal_errors_4_1024.m | 17 - .../PER_PLOTS/signal_errors_4_256.m | 27 - .../PER_PLOTS/signal_errors_5_1024.m | 27 - .../PER_PLOTS/signal_errors_5_256.m | 27 - .../phy/SIMULATION/PER_PLOTS/trials_0_1024.m | 26 - .../phy/SIMULATION/PER_PLOTS/trials_0_256.m | 26 - .../phy/SIMULATION/PER_PLOTS/trials_1_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/trials_1_256.m | 26 - .../phy/SIMULATION/PER_PLOTS/trials_2_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/trials_2_256.m | 27 - .../phy/SIMULATION/PER_PLOTS/trials_3_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/trials_3_256.m | 27 - .../phy/SIMULATION/PER_PLOTS/trials_4_1024.m | 17 - .../phy/SIMULATION/PER_PLOTS/trials_4_256.m | 27 - .../phy/SIMULATION/PER_PLOTS/trials_5_1024.m | 27 - .../phy/SIMULATION/PER_PLOTS/trials_5_256.m | 27 - openairITS/phy/SIMULATION/dot11sim.c | 439 - 344 files changed, 116687 deletions(-) delete mode 100644 openairITS/ieee80211p_compile_modules.sh delete mode 100644 openairITS/ieee80211p_configure_interface.sh delete mode 100644 openairITS/ieee80211p_insert_modules.sh delete mode 100644 openairITS/ieee80211p_setup_vars.sh delete mode 100644 openairITS/mac/DOT11/.gitignore delete mode 100644 openairITS/mac/DOT11/COPYRIGHT delete mode 100644 openairITS/mac/DOT11/MAINTAINERS delete mode 100644 openairITS/mac/DOT11/Makefile delete mode 100644 openairITS/mac/DOT11/README delete mode 100644 openairITS/mac/DOT11/code-metrics.txt delete mode 100644 openairITS/mac/DOT11/compat/Makefile delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.14.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.18.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.19.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.21.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.22.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.23.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.24.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.25.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.26.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.27.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.28.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.29.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.32.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.33.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.35.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.36.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.37.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.38.c delete mode 100644 openairITS/mac/DOT11/compat/compat-2.6.39.c delete mode 100644 openairITS/mac/DOT11/compat/compat-3.0.c delete mode 100644 openairITS/mac/DOT11/compat/compat-3.2.c delete mode 100644 openairITS/mac/DOT11/compat/compat-3.3.c delete mode 100644 openairITS/mac/DOT11/compat/compat-3.5.c delete mode 100644 openairITS/mac/DOT11/compat/compat_atomic.c delete mode 100644 openairITS/mac/DOT11/compat/compat_firmware_class.c delete mode 100644 openairITS/mac/DOT11/compat/cordic.c delete mode 100644 openairITS/mac/DOT11/compat/crc8.c delete mode 100644 openairITS/mac/DOT11/compat/kfifo.c delete mode 100644 openairITS/mac/DOT11/compat/kstrtox.c delete mode 100644 openairITS/mac/DOT11/compat/main.c delete mode 100644 openairITS/mac/DOT11/compat/modules.order delete mode 100644 openairITS/mac/DOT11/compat/pm_qos_params.c delete mode 100755 openairITS/mac/DOT11/compat/scripts/compat_firmware_install delete mode 100755 openairITS/mac/DOT11/compat/scripts/gen-compat-autoconf.sh delete mode 100755 openairITS/mac/DOT11/compat/scripts/gen-compat-config.sh delete mode 100755 openairITS/mac/DOT11/compat/scripts/skip-colors delete mode 100644 openairITS/mac/DOT11/compat_base_tree delete mode 100644 openairITS/mac/DOT11/compat_base_tree_version delete mode 100644 openairITS/mac/DOT11/compat_version delete mode 100644 openairITS/mac/DOT11/config.mk delete mode 100644 openairITS/mac/DOT11/include/N/pcmcia/cistpl.h delete mode 100644 openairITS/mac/DOT11/include/N/trace/define_trace.h delete mode 100644 openairITS/mac/DOT11/include/crypto/aes.h delete mode 100644 openairITS/mac/DOT11/include/linux/ath9k_platform.h delete mode 100644 openairITS/mac/DOT11/include/linux/atomic.h delete mode 100644 openairITS/mac/DOT11/include/linux/average.h delete mode 100644 openairITS/mac/DOT11/include/linux/bcma/bcma.h delete mode 100644 openairITS/mac/DOT11/include/linux/bcma/bcma_driver_chipcommon.h delete mode 100644 openairITS/mac/DOT11/include/linux/bcma/bcma_driver_mips.h delete mode 100644 openairITS/mac/DOT11/include/linux/bcma/bcma_driver_pci.h delete mode 100644 openairITS/mac/DOT11/include/linux/bcma/bcma_regs.h delete mode 100644 openairITS/mac/DOT11/include/linux/bcma/bcma_soc.h delete mode 100644 openairITS/mac/DOT11/include/linux/bitops.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.14.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.18.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.19.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.20.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.21.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.22.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.23.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.24.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.25.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.26.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.27.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.28.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.29.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.30.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.31.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.32.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.33.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.34.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.35.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.36.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.37.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.38.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.39.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-2.6.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-3.0.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-3.1.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-3.2.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-3.3.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-3.4.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat-3.5.h delete mode 100644 openairITS/mac/DOT11/include/linux/compat_autoconf.h delete mode 100644 openairITS/mac/DOT11/include/linux/cordic.h delete mode 100644 openairITS/mac/DOT11/include/linux/crc8.h delete mode 100644 openairITS/mac/DOT11/include/linux/eeprom_93cx6.h delete mode 100644 openairITS/mac/DOT11/include/linux/export.h delete mode 100644 openairITS/mac/DOT11/include/linux/ieee80211.h delete mode 100644 openairITS/mac/DOT11/include/linux/kfifo.h delete mode 100644 openairITS/mac/DOT11/include/linux/math64.h delete mode 100644 openairITS/mac/DOT11/include/linux/nl80211.h delete mode 100644 openairITS/mac/DOT11/include/linux/of.h delete mode 100644 openairITS/mac/DOT11/include/linux/pci-aspm.h delete mode 100644 openairITS/mac/DOT11/include/linux/pci_ids.h delete mode 100644 openairITS/mac/DOT11/include/linux/pm_qos.h delete mode 100644 openairITS/mac/DOT11/include/linux/pm_qos_params.h delete mode 100644 openairITS/mac/DOT11/include/linux/pm_runtime.h delete mode 100644 openairITS/mac/DOT11/include/linux/printk.h delete mode 100644 openairITS/mac/DOT11/include/linux/rfkill.h delete mode 100644 openairITS/mac/DOT11/include/linux/rfkill_backport.h delete mode 100644 openairITS/mac/DOT11/include/linux/semaphore.h delete mode 100644 openairITS/mac/DOT11/include/linux/spi/libertas_spi.h delete mode 100644 openairITS/mac/DOT11/include/linux/ssb/ssb.h delete mode 100644 openairITS/mac/DOT11/include/linux/ssb/ssb_driver_chipcommon.h delete mode 100644 openairITS/mac/DOT11/include/linux/ssb/ssb_driver_extif.h delete mode 100644 openairITS/mac/DOT11/include/linux/ssb/ssb_driver_gige.h delete mode 100644 openairITS/mac/DOT11/include/linux/ssb/ssb_driver_mips.h delete mode 100644 openairITS/mac/DOT11/include/linux/ssb/ssb_driver_pci.h delete mode 100644 openairITS/mac/DOT11/include/linux/ssb/ssb_embedded.h delete mode 100644 openairITS/mac/DOT11/include/linux/ssb/ssb_regs.h delete mode 100644 openairITS/mac/DOT11/include/linux/tracepoint.h delete mode 100644 openairITS/mac/DOT11/include/linux/unaligned/access_ok.h delete mode 100644 openairITS/mac/DOT11/include/linux/unaligned/be_byteshift.h delete mode 100644 openairITS/mac/DOT11/include/linux/unaligned/be_memmove.h delete mode 100644 openairITS/mac/DOT11/include/linux/unaligned/be_struct.h delete mode 100644 openairITS/mac/DOT11/include/linux/unaligned/generic.h delete mode 100644 openairITS/mac/DOT11/include/linux/unaligned/le_byteshift.h delete mode 100644 openairITS/mac/DOT11/include/linux/unaligned/le_memmove.h delete mode 100644 openairITS/mac/DOT11/include/linux/unaligned/le_struct.h delete mode 100644 openairITS/mac/DOT11/include/linux/unaligned/memmove.h delete mode 100644 openairITS/mac/DOT11/include/linux/unaligned/packed_struct.h delete mode 100644 openairITS/mac/DOT11/include/linux/usb/rndis_host.h delete mode 100644 openairITS/mac/DOT11/include/linux/usb/usbnet.h delete mode 100644 openairITS/mac/DOT11/include/linux/wireless.h delete mode 100644 openairITS/mac/DOT11/include/linux/wl12xx.h delete mode 100644 openairITS/mac/DOT11/include/net/cfg80211-wext.h delete mode 100644 openairITS/mac/DOT11/include/net/cfg80211.h delete mode 100644 openairITS/mac/DOT11/include/net/ieee80211_radiotap.h delete mode 100644 openairITS/mac/DOT11/include/net/lib80211.h delete mode 100644 openairITS/mac/DOT11/include/net/mac80211.h delete mode 100644 openairITS/mac/DOT11/include/net/net_namespace.h delete mode 100644 openairITS/mac/DOT11/include/net/regulatory.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/Makefile delete mode 100644 openairITS/mac/DOT11/net/mac80211/aes_ccm.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/aes_ccm.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/aes_cmac.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/aes_cmac.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/agg-rx.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/agg-tx.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/cfg.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/cfg.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/chan.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/debugfs.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/debugfs.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/debugfs_key.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/debugfs_key.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/debugfs_netdev.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/debugfs_netdev.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/debugfs_sta.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/debugfs_sta.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/driver-ops.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/driver-trace.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/driver-trace.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/event.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/ht.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/ibss.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/ieee80211_i.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/iface.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/key.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/key.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/led.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/led.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/main.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/mesh.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/mesh.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/mesh_hwmp.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/mesh_pathtbl.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/mesh_plink.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/michael.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/michael.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/mlme.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/modules.order delete mode 100644 openairITS/mac/DOT11/net/mac80211/offchannel.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/pm.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/rate.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/rate.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/rc80211_minstrel.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/rc80211_minstrel.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_debugfs.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht_debugfs.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/rc80211_pid.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/rc80211_pid_algo.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/rc80211_pid_debugfs.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/rx.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/scan.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/spectmgmt.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/sta_info.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/sta_info.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/status.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/tkip.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/tkip.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/tx.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/util.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/wep.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/wep.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/wme.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/wme.h delete mode 100644 openairITS/mac/DOT11/net/mac80211/work.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/wpa.c delete mode 100644 openairITS/mac/DOT11/net/mac80211/wpa.h delete mode 100644 openairITS/mac/DOT11/net/wireless/Makefile delete mode 100644 openairITS/mac/DOT11/net/wireless/chan.c delete mode 100644 openairITS/mac/DOT11/net/wireless/core.c delete mode 100644 openairITS/mac/DOT11/net/wireless/core.h delete mode 100644 openairITS/mac/DOT11/net/wireless/db.txt delete mode 100644 openairITS/mac/DOT11/net/wireless/debugfs.c delete mode 100644 openairITS/mac/DOT11/net/wireless/debugfs.h delete mode 100644 openairITS/mac/DOT11/net/wireless/ethtool.c delete mode 100644 openairITS/mac/DOT11/net/wireless/ethtool.h delete mode 100644 openairITS/mac/DOT11/net/wireless/genregdb.awk delete mode 100644 openairITS/mac/DOT11/net/wireless/ibss.c delete mode 100644 openairITS/mac/DOT11/net/wireless/lib80211.c delete mode 100644 openairITS/mac/DOT11/net/wireless/lib80211_crypt_ccmp.c delete mode 100644 openairITS/mac/DOT11/net/wireless/lib80211_crypt_tkip.c delete mode 100644 openairITS/mac/DOT11/net/wireless/lib80211_crypt_wep.c delete mode 100644 openairITS/mac/DOT11/net/wireless/mesh.c delete mode 100644 openairITS/mac/DOT11/net/wireless/mlme.c delete mode 100644 openairITS/mac/DOT11/net/wireless/modules.order delete mode 100644 openairITS/mac/DOT11/net/wireless/nl80211.c delete mode 100644 openairITS/mac/DOT11/net/wireless/nl80211.h delete mode 100644 openairITS/mac/DOT11/net/wireless/radiotap.c delete mode 100644 openairITS/mac/DOT11/net/wireless/reg.c delete mode 100644 openairITS/mac/DOT11/net/wireless/reg.h delete mode 100644 openairITS/mac/DOT11/net/wireless/regdb.h delete mode 100644 openairITS/mac/DOT11/net/wireless/scan.c delete mode 100644 openairITS/mac/DOT11/net/wireless/sme.c delete mode 100644 openairITS/mac/DOT11/net/wireless/sysfs.c delete mode 100644 openairITS/mac/DOT11/net/wireless/sysfs.h delete mode 100644 openairITS/mac/DOT11/net/wireless/util.c delete mode 100644 openairITS/mac/DOT11/net/wireless/wext-compat.c delete mode 100644 openairITS/mac/DOT11/net/wireless/wext-compat.h delete mode 100644 openairITS/mac/DOT11/net/wireless/wext-core.c delete mode 100644 openairITS/mac/DOT11/net/wireless/wext-priv.c delete mode 100644 openairITS/mac/DOT11/net/wireless/wext-proc.c delete mode 100644 openairITS/mac/DOT11/net/wireless/wext-sme.c delete mode 100644 openairITS/mac/DOT11/net/wireless/wext-spy.c delete mode 100755 openairITS/mac/DOT11/scripts/admin-clean.sh delete mode 100755 openairITS/mac/DOT11/scripts/admin-refresh.sh delete mode 100755 openairITS/mac/DOT11/scripts/admin-update.sh delete mode 100755 openairITS/mac/DOT11/scripts/alx-enable delete mode 100755 openairITS/mac/DOT11/scripts/athenable delete mode 100755 openairITS/mac/DOT11/scripts/athload delete mode 100755 openairITS/mac/DOT11/scripts/b43enable delete mode 100755 openairITS/mac/DOT11/scripts/b43load delete mode 100755 openairITS/mac/DOT11/scripts/btunload.sh delete mode 100755 openairITS/mac/DOT11/scripts/check_config.sh delete mode 100755 openairITS/mac/DOT11/scripts/check_depmod delete mode 100755 openairITS/mac/DOT11/scripts/compress_modules delete mode 100755 openairITS/mac/DOT11/scripts/driver-select delete mode 100755 openairITS/mac/DOT11/scripts/gen-compat-autoconf.sh delete mode 100755 openairITS/mac/DOT11/scripts/gen-stable-release.sh delete mode 100755 openairITS/mac/DOT11/scripts/iwl-enable delete mode 100755 openairITS/mac/DOT11/scripts/iwl-load delete mode 100755 openairITS/mac/DOT11/scripts/madwifi-unload delete mode 100755 openairITS/mac/DOT11/scripts/modlib.sh delete mode 100755 openairITS/mac/DOT11/scripts/skip-colors delete mode 100755 openairITS/mac/DOT11/scripts/unload.sh delete mode 100755 openairITS/mac/DOT11/scripts/update-initramfs delete mode 100755 openairITS/mac/DOT11/scripts/wlunload.sh delete mode 100644 openairITS/phy/DOT11/Makefile.inc delete mode 100644 openairITS/phy/DOT11/STS_LTS_F.h delete mode 100644 openairITS/phy/DOT11/commonvars.h delete mode 100644 openairITS/phy/DOT11/crc32.c delete mode 100644 openairITS/phy/DOT11/data_detection.c delete mode 100644 openairITS/phy/DOT11/defs.h delete mode 100644 openairITS/phy/DOT11/generate_STSLTS_corr.m delete mode 100644 openairITS/phy/DOT11/initial_sync.c delete mode 100644 openairITS/phy/DOT11/interleaver.c delete mode 100644 openairITS/phy/DOT11/phy_tx_start.c delete mode 100644 openairITS/phy/DOT11/scrambler.c delete mode 100644 openairITS/phy/DOT11/txvars.h delete mode 100644 openairITS/phy/DRIVERS/.cproject delete mode 100644 openairITS/phy/DRIVERS/.project delete mode 100644 openairITS/phy/DRIVERS/Makefile delete mode 100644 openairITS/phy/DRIVERS/ieee80211p-driver.c delete mode 100644 openairITS/phy/DRIVERS/ieee80211p-driver.h delete mode 100644 openairITS/phy/DRIVERS/ieee80211p-netlinkapi.c delete mode 100644 openairITS/phy/DRIVERS/ieee80211p-netlinkapi.h delete mode 100644 openairITS/phy/DRIVERS/ieee80211p-softmodem.c delete mode 100644 openairITS/phy/SIMULATION/Makefile delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_0_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_0_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_1_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_1_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_2_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_2_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_3_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_3_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_4_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_4_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_5_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/SNR_5_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_0_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_0_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_1_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_1_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_2_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_2_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_3_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_3_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_4_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_4_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_5_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/errors_5_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/plots.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_0_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_0_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_1_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_1_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_2_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_2_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_3_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_3_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_4_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_4_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_5_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_5_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_0_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_0_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_1_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_1_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_2_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_2_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_3_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_3_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_4_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_4_256.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_5_1024.m delete mode 100644 openairITS/phy/SIMULATION/PER_PLOTS/trials_5_256.m delete mode 100644 openairITS/phy/SIMULATION/dot11sim.c diff --git a/openairITS/ieee80211p_compile_modules.sh b/openairITS/ieee80211p_compile_modules.sh deleted file mode 100644 index 5715a6dd395..00000000000 --- a/openairITS/ieee80211p_compile_modules.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -## INSTRUCTIONS -## - check the coherence of the OPENAIRITS_DIR and MOD_DIR with YOUR platform -## - configure the module dependencies by running the following command: -## sudo depmod -a -## - install 'iw' by the following command: -## sudo apt-get install iw -## - allow Ubuntu to reply to a PING in Broadcast by the following command: -## echo 0 | sudo tee /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts -## run the following shell -## voila !! - -#Path configuration -MOD_DIR=/lib/modules/`uname -r`/kernel -#MOD_DIR=/lib/modules/2.6.32.11+drm33.2.openairinterface.bigphys.rtai/updates - -#Modules compilation -cd ${OPENAIRITS_DIR}/mac/DOT11/ -sudo make clean -sudo make MAC=1 - -sudo rm ${MOD_DIR}/compat/compat.ko -sudo rm ${MOD_DIR}/net/wireless/cfg80211.ko -sudo rm ${MOD_DIR}/net/mac80211/mac80211_eurecom.ko - -sudo mkdir ${MOD_DIR}/compat -sudo mkdir ${MOD_DIR}/net/wireless -sudo mkdir ${MOD_DIR}/net/mac80211 - -sudo cp ${OPENAIRITS_DIR}/mac/DOT11/compat/compat.ko ${MOD_DIR}/compat/compat.ko -sudo cp ${OPENAIRITS_DIR}/mac/DOT11/net/wireless/cfg80211.ko ${MOD_DIR}/net/wireless/cfg80211.ko -sudo cp ${OPENAIRITS_DIR}/mac/DOT11/net/mac80211/mac80211_eurecom.ko ${MOD_DIR}/net/mac80211/mac80211_eurecom.ko - -cd ${OPENAIRITS_DIR}/phy/DRIVERS/ -sudo make clean -sudo make - -#Go back to the source directory -cd ${OPENAIRITS_DIR} - diff --git a/openairITS/ieee80211p_configure_interface.sh b/openairITS/ieee80211p_configure_interface.sh deleted file mode 100644 index 9f4e93ecbb1..00000000000 --- a/openairITS/ieee80211p_configure_interface.sh +++ /dev/null @@ -1,20 +0,0 @@ -## INSTRUCTIONS -## - check the coherence of the OPENAIRITS_DIR and MOD_DIR with YOUR platform -## - configure the module dependencies by running the following command: -## sudo depmod -a -## - install 'iw' by the following command: -## sudo apt-get install iw -## - allow Ubuntu to reply to a PING in Broadcast by the following command: -## echo 0 | sudo tee /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts -## run the following shell -## voila !! - -# Interface configuration (interface type, MAC address, IP address, disable ARP) -sudo iw phy phy0 interface add wlan0 type ibss 4addr off -sudo ifconfig wlan0 hw ether 10:11:12:13:14:15 -sudo ifconfig wlan0 192.168.1.1 up -arp - -# Static ARP table -sudo arp -i wlan0 -s 192.168.1.2 10:21:22:23:24:25 -sudo arp -i wlan0 -s 192.168.1.255 FF:FF:FF:FF:FF:FF - diff --git a/openairITS/ieee80211p_insert_modules.sh b/openairITS/ieee80211p_insert_modules.sh deleted file mode 100644 index 8ef5adbfd2d..00000000000 --- a/openairITS/ieee80211p_insert_modules.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# Module loading -sudo depmod -a -sudo modprobe mac80211_eurecom -sudo insmod ${OPENAIRITS_DIR}/phy/DRIVERS/ieee80211p.ko diff --git a/openairITS/ieee80211p_setup_vars.sh b/openairITS/ieee80211p_setup_vars.sh deleted file mode 100644 index b416c21d330..00000000000 --- a/openairITS/ieee80211p_setup_vars.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -## INSTRUCTIONS -## - check the coherence of the OPENAIRITS_DIR and MOD_DIR with YOUR platform -## - configure the module dependencies by running the following command: -## sudo depmod -a -## - install 'iw' by the following command: -## sudo apt-get install iw -## - allow Ubuntu to reply to a PING in Broadcast by the following command: -## echo 0 | sudo tee /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts -## run the following shell -## voila !! - -#Environment variables -export OPENAIR_HOME=/home/thales/openair4G -export OPENAIR1_DIR=$OPENAIR_HOME/openair1 -export OPENAIR2_DIR=$OPENAIR_HOME/openair2 -export OPENAIR3_DIR=$OPENAIR_HOME/openair3 -export OPENAIR_TARGETS=$OPENAIR_HOME/targets -export OPENAIRITS_DIR=$OPENAIR_HOME/openairITS - diff --git a/openairITS/mac/DOT11/.gitignore b/openairITS/mac/DOT11/.gitignore deleted file mode 100644 index 068e2176d56..00000000000 --- a/openairITS/mac/DOT11/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -drivers -mac80211 -bluetooth -include -net -compat -udev -*~ -git-describe -compat-release -master-tag -Module.symvers -module.order -.pc -code-metrics.txt -compat_base_tree -compat_base_tree_version -compat_version -.compat_autoconf_compat-* -.config -.config.mk_md5sum.txt -.tmp_versions/ -MAINTAINERS -modules -modules.order diff --git a/openairITS/mac/DOT11/COPYRIGHT b/openairITS/mac/DOT11/COPYRIGHT deleted file mode 100644 index ca442d313d8..00000000000 --- a/openairITS/mac/DOT11/COPYRIGHT +++ /dev/null @@ -1,356 +0,0 @@ - - NOTE! This copyright does *not* cover user programs that use kernel - services by normal system calls - this is merely considered normal use - of the kernel, and does *not* fall under the heading of "derived work". - Also note that the GPL below is copyrighted by the Free Software - Foundation, but the instance of code that it refers to (the Linux - kernel) is copyrighted by me and others who actually wrote it. - - Also note that the only valid version of the GPL as far as the kernel - is concerned is _this_ particular version of the license (ie v2, not - v2.2 or v3.x or whatever), unless explicitly otherwise stated. - - Linus Torvalds - ----------------------------------------- - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/openairITS/mac/DOT11/MAINTAINERS b/openairITS/mac/DOT11/MAINTAINERS deleted file mode 100644 index b0f1073c40b..00000000000 --- a/openairITS/mac/DOT11/MAINTAINERS +++ /dev/null @@ -1,7651 +0,0 @@ - - - List of maintainers and how to submit kernel changes - -Please try to follow the guidelines below. This will make things -easier on the maintainers. Not all of these guidelines matter for every -trivial patch so apply some common sense. - -1. Always _test_ your changes, however small, on at least 4 or - 5 people, preferably many more. - -2. Try to release a few ALPHA test versions to the net. Announce - them onto the kernel channel and await results. This is especially - important for device drivers, because often that's the only way - you will find things like the fact version 3 firmware needs - a magic fix you didn't know about, or some clown changed the - chips on a board and not its name. (Don't laugh! Look at the - SMC etherpower for that.) - -3. Make sure your changes compile correctly in multiple - configurations. In particular check that changes work both as a - module and built into the kernel. - -4. When you are happy with a change make it generally available for - testing and await feedback. - -5. Make a patch available to the relevant maintainer in the list. Use - 'diff -u' to make the patch easy to merge. Be prepared to get your - changes sent back with seemingly silly requests about formatting - and variable names. These aren't as silly as they seem. One - job the maintainers (and especially Linus) do is to keep things - looking the same. Sometimes this means that the clever hack in - your driver to get around a problem actually needs to become a - generalized kernel feature ready for next time. - - PLEASE check your patch with the automated style checker - (scripts/checkpatch.pl) to catch trival style violations. - See Documentation/CodingStyle for guidance here. - - PLEASE CC: the maintainers and mailing lists that are generated - by scripts/get_maintainer.pl. The results returned by the - script will be best if you have git installed and are making - your changes in a branch derived from Linus' latest git tree. - See Documentation/SubmittingPatches for details. - - PLEASE try to include any credit lines you want added with the - patch. It avoids people being missed off by mistake and makes - it easier to know who wants adding and who doesn't. - - PLEASE document known bugs. If it doesn't work for everything - or does something very odd once a month document it. - - PLEASE remember that submissions must be made under the terms - of the OSDL certificate of contribution and should include a - Signed-off-by: line. The current version of this "Developer's - Certificate of Origin" (DCO) is listed in the file - Documentation/SubmittingPatches. - -6. Make sure you have the right to send any changes you make. If you - do changes at work you may find your employer owns the patch - not you. - -7. When sending security related changes or reports to a maintainer - please Cc: security@kernel.org, especially if the maintainer - does not respond. - -8. Happy hacking. - -Descriptions of section entries: - - P: Person (obsolete) - M: Mail patches to: FullName <address@domain> - L: Mailing list that is relevant to this area - W: Web-page with status/info - Q: Patchwork web based patch tracking system site - T: SCM tree type and location. Type is one of: git, hg, quilt, stgit, topgit. - S: Status, one of the following: - Supported: Someone is actually paid to look after this. - Maintained: Someone actually looks after it. - Odd Fixes: It has a maintainer but they don't have time to do - much other than throw the odd patch in. See below.. - Orphan: No current maintainer [but maybe you could take the - role as you write your new code]. - Obsolete: Old code. Something tagged obsolete generally means - it has been replaced by a better system and you - should be using that. - F: Files and directories with wildcard patterns. - A trailing slash includes all files and subdirectory files. - F: drivers/net/ all files in and below drivers/net - F: drivers/net/* all files in drivers/net, but not below - F: */net/* all files in "any top level directory"/net - One pattern per line. Multiple F: lines acceptable. - X: Files and directories that are NOT maintained, same rules as F: - Files exclusions are tested before file matches. - Can be useful for excluding a specific subdirectory, for instance: - F: net/ - X: net/ipv6/ - matches all files in and below net excluding net/ipv6/ - K: Keyword perl extended regex pattern to match content in a - patch or file. For instance: - K: of_get_profile - matches patches or files that contain "of_get_profile" - K: \b(printk|pr_(info|err))\b - matches patches or files that contain one or more of the words - printk, pr_info or pr_err - One regex pattern per line. Multiple K: lines acceptable. - -Note: For the hard of thinking, this list is meant to remain in alphabetical -order. If you could add yourselves to it in alphabetical order that would be -so much easier [Ed] - -Maintainers List (try to look for most precise areas first) - - ----------------------------------- - -3C505 NETWORK DRIVER -M: Philip Blundell <philb@gnu.org> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/i825xx/3c505* - -3C59X NETWORK DRIVER -M: Steffen Klassert <klassert@mathematik.tu-chemnitz.de> -L: netdev@vger.kernel.org -S: Maintained -F: Documentation/networking/vortex.txt -F: drivers/net/ethernet/3com/3c59x.c - -3CR990 NETWORK DRIVER -M: David Dillow <dave@thedillows.org> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/3com/typhoon* - -3WARE SAS/SATA-RAID SCSI DRIVERS (3W-XXXX, 3W-9XXX, 3W-SAS) -M: Adam Radford <linuxraid@lsi.com> -L: linux-scsi@vger.kernel.org -W: http://www.lsi.com -S: Supported -F: drivers/scsi/3w-* - -53C700 AND 53C700-66 SCSI DRIVER -M: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/53c700* - -6PACK NETWORK DRIVER FOR AX.25 -M: Andreas Koensgen <ajk@comnets.uni-bremen.de> -L: linux-hams@vger.kernel.org -S: Maintained -F: drivers/net/hamradio/6pack.c - -8169 10/100/1000 GIGABIT ETHERNET DRIVER -M: Realtek linux nic maintainers <nic_swsd@realtek.com> -M: Francois Romieu <romieu@fr.zoreil.com> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/realtek/r8169.c - -8250/16?50 (AND CLONE UARTS) SERIAL DRIVER -M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -L: linux-serial@vger.kernel.org -W: http://serial.sourceforge.net -S: Maintained -T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git -F: drivers/tty/serial/8250* -F: include/linux/serial_8250.h - -8390 NETWORK DRIVERS [WD80x3/SMC-ELITE, SMC-ULTRA, NE2000, 3C503, etc.] -L: netdev@vger.kernel.org -S: Orphan / Obsolete -F: drivers/net/ethernet/8390/ - -9P FILE SYSTEM -M: Eric Van Hensbergen <ericvh@gmail.com> -M: Ron Minnich <rminnich@sandia.gov> -M: Latchesar Ionkov <lucho@ionkov.net> -L: v9fs-developer@lists.sourceforge.net -W: http://swik.net/v9fs -Q: http://patchwork.kernel.org/project/v9fs-devel/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs.git -S: Maintained -F: Documentation/filesystems/9p.txt -F: fs/9p/ - -AACRAID SCSI RAID DRIVER -M: Adaptec OEM Raid Solutions <aacraid@adaptec.com> -L: linux-scsi@vger.kernel.org -W: http://www.adaptec.com/ -S: Supported -F: Documentation/scsi/aacraid.txt -F: drivers/scsi/aacraid/ - -ABIT UGURU 1,2 HARDWARE MONITOR DRIVER -M: Hans de Goede <hdegoede@redhat.com> -L: lm-sensors@lm-sensors.org -S: Maintained -F: drivers/hwmon/abituguru.c - -ABIT UGURU 3 HARDWARE MONITOR DRIVER -M: Alistair John Strachan <alistair@devzero.co.uk> -L: lm-sensors@lm-sensors.org -S: Maintained -F: drivers/hwmon/abituguru3.c - -ACENIC DRIVER -M: Jes Sorensen <jes@trained-monkey.org> -L: linux-acenic@sunsite.dk -S: Maintained -F: drivers/net/ethernet/alteon/acenic* - -ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER -M: Peter Feuerer <peter@piie.net> -L: platform-driver-x86@vger.kernel.org -W: http://piie.net/?section=acerhdf -S: Maintained -F: drivers/platform/x86/acerhdf.c - -ACER WMI LAPTOP EXTRAS -M: Joey Lee <jlee@novell.com> -L: platform-driver-x86@vger.kernel.org -S: Maintained -F: drivers/platform/x86/acer-wmi.c - -ACPI -M: Len Brown <lenb@kernel.org> -L: linux-acpi@vger.kernel.org -W: http://www.lesswatts.org/projects/acpi/ -Q: http://patchwork.kernel.org/project/linux-acpi/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux -S: Supported -F: drivers/acpi/ -F: drivers/pnp/pnpacpi/ -F: include/linux/acpi.h -F: include/acpi/ - -ACPI FAN DRIVER -M: Zhang Rui <rui.zhang@intel.com> -L: linux-acpi@vger.kernel.org -W: http://www.lesswatts.org/projects/acpi/ -S: Supported -F: drivers/acpi/fan.c - -ACPI PROCESSOR AGGREGATOR DRIVER -M: Shaohua Li <shaohua.li@intel.com> -L: linux-acpi@vger.kernel.org -W: http://www.lesswatts.org/projects/acpi/ -S: Supported -F: drivers/acpi/acpi_pad.c - -ACPI THERMAL DRIVER -M: Zhang Rui <rui.zhang@intel.com> -L: linux-acpi@vger.kernel.org -W: http://www.lesswatts.org/projects/acpi/ -S: Supported -F: drivers/acpi/*thermal* - -ACPI VIDEO DRIVER -M: Zhang Rui <rui.zhang@intel.com> -L: linux-acpi@vger.kernel.org -W: http://www.lesswatts.org/projects/acpi/ -S: Supported -F: drivers/acpi/video.c - -ACPI WMI DRIVER -L: platform-driver-x86@vger.kernel.org -S: Orphan -F: drivers/platform/x86/wmi.c - -AD1889 ALSA SOUND DRIVER -M: Thibaut Varene <T-Bone@parisc-linux.org> -W: http://wiki.parisc-linux.org/AD1889 -L: linux-parisc@vger.kernel.org -S: Maintained -F: sound/pci/ad1889.* - -AD525X ANALOG DEVICES DIGITAL POTENTIOMETERS DRIVER -M: Michael Hennerich <michael.hennerich@analog.com> -L: device-drivers-devel@blackfin.uclinux.org -W: http://wiki.analog.com/AD5254 -S: Supported -F: drivers/misc/ad525x_dpot.c - -AD5398 CURRENT REGULATOR DRIVER (AD5398/AD5821) -M: Michael Hennerich <michael.hennerich@analog.com> -L: device-drivers-devel@blackfin.uclinux.org -W: http://wiki.analog.com/AD5398 -S: Supported -F: drivers/regulator/ad5398.c - -AD714X CAPACITANCE TOUCH SENSOR DRIVER (AD7142/3/7/8/7A) -M: Michael Hennerich <michael.hennerich@analog.com> -L: device-drivers-devel@blackfin.uclinux.org -W: http://wiki.analog.com/AD7142 -S: Supported -F: drivers/input/misc/ad714x.c - -AD7877 TOUCHSCREEN DRIVER -M: Michael Hennerich <michael.hennerich@analog.com> -L: device-drivers-devel@blackfin.uclinux.org -W: http://wiki.analog.com/AD7877 -S: Supported -F: drivers/input/touchscreen/ad7877.c - -AD7879 TOUCHSCREEN DRIVER (AD7879/AD7889) -M: Michael Hennerich <michael.hennerich@analog.com> -L: device-drivers-devel@blackfin.uclinux.org -W: http://wiki.analog.com/AD7879 -S: Supported -F: drivers/input/touchscreen/ad7879.c - -ADDRESS SPACE LAYOUT RANDOMIZATION (ASLR) -M: Jiri Kosina <jkosina@suse.cz> -S: Maintained - -ADM1025 HARDWARE MONITOR DRIVER -M: Jean Delvare <khali@linux-fr.org> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/adm1025 -F: drivers/hwmon/adm1025.c - -ADM1029 HARDWARE MONITOR DRIVER -M: Corentin Labbe <corentin.labbe@geomatys.fr> -L: lm-sensors@lm-sensors.org -S: Maintained -F: drivers/hwmon/adm1029.c - -ADM8211 WIRELESS DRIVER -L: linux-wireless@vger.kernel.org -W: http://linuxwireless.org/ -S: Orphan -F: drivers/net/wireless/adm8211.* - -ADP5520 BACKLIGHT DRIVER WITH IO EXPANDER (ADP5520/ADP5501) -M: Michael Hennerich <michael.hennerich@analog.com> -L: device-drivers-devel@blackfin.uclinux.org -W: http://wiki.analog.com/ADP5520 -S: Supported -F: drivers/mfd/adp5520.c -F: drivers/video/backlight/adp5520_bl.c -F: drivers/leds/leds-adp5520.c -F: drivers/gpio/gpio-adp5520.c -F: drivers/input/keyboard/adp5520-keys.c - -ADP5588 QWERTY KEYPAD AND IO EXPANDER DRIVER (ADP5588/ADP5587) -M: Michael Hennerich <michael.hennerich@analog.com> -L: device-drivers-devel@blackfin.uclinux.org -W: http://wiki.analog.com/ADP5588 -S: Supported -F: drivers/input/keyboard/adp5588-keys.c -F: drivers/gpio/gpio-adp5588.c - -ADP8860 BACKLIGHT DRIVER (ADP8860/ADP8861/ADP8863) -M: Michael Hennerich <michael.hennerich@analog.com> -L: device-drivers-devel@blackfin.uclinux.org -W: http://wiki.analog.com/ADP8860 -S: Supported -F: drivers/video/backlight/adp8860_bl.c - -ADS1015 HARDWARE MONITOR DRIVER -M: Dirk Eibach <eibach@gdsys.de> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/ads1015 -F: drivers/hwmon/ads1015.c -F: include/linux/i2c/ads1015.h - -ADT746X FAN DRIVER -M: Colin Leroy <colin@colino.net> -S: Maintained -F: drivers/macintosh/therm_adt746x.c - -ADT7475 HARDWARE MONITOR DRIVER -M: Jean Delvare <khali@linux-fr.org> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/adt7475 -F: drivers/hwmon/adt7475.c - -ADXL34X THREE-AXIS DIGITAL ACCELEROMETER DRIVER (ADXL345/ADXL346) -M: Michael Hennerich <michael.hennerich@analog.com> -L: device-drivers-devel@blackfin.uclinux.org -W: http://wiki.analog.com/ADXL345 -S: Supported -F: drivers/input/misc/adxl34x.c - -ADVANSYS SCSI DRIVER -M: Matthew Wilcox <matthew@wil.cx> -L: linux-scsi@vger.kernel.org -S: Maintained -F: Documentation/scsi/advansys.txt -F: drivers/scsi/advansys.c - -AEDSP16 DRIVER -M: Riccardo Facchetti <fizban@tin.it> -S: Maintained -F: sound/oss/aedsp16.c - -AFFS FILE SYSTEM -L: linux-fsdevel@vger.kernel.org -S: Orphan -F: Documentation/filesystems/affs.txt -F: fs/affs/ - -AFS FILESYSTEM & AF_RXRPC SOCKET DOMAIN -M: David Howells <dhowells@redhat.com> -L: linux-afs@lists.infradead.org -S: Supported -F: fs/afs/ -F: include/net/af_rxrpc.h -F: net/rxrpc/af_rxrpc.c - -AGPGART DRIVER -M: David Airlie <airlied@linux.ie> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git -S: Maintained -F: drivers/char/agp/ -F: include/linux/agp* - -AHA152X SCSI DRIVER -M: "Juergen E. Fischer" <fischer@norbit.de> -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/aha152x* -F: drivers/scsi/pcmcia/aha152x* - -AIC7XXX / AIC79XX SCSI DRIVER -M: Hannes Reinecke <hare@suse.de> -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/aic7xxx/ -F: drivers/scsi/aic7xxx_old/ - -AIO -M: Benjamin LaHaise <bcrl@kvack.org> -L: linux-aio@kvack.org -S: Supported -F: fs/aio.c -F: include/linux/*aio*.h - -ALCATEL SPEEDTOUCH USB DRIVER -M: Duncan Sands <duncan.sands@free.fr> -L: linux-usb@vger.kernel.org -W: http://www.linux-usb.org/SpeedTouch/ -S: Maintained -F: drivers/usb/atm/speedtch.c -F: drivers/usb/atm/usbatm.c - -ALCHEMY AU1XX0 MMC DRIVER -M: Manuel Lauss <manuel.lauss@gmail.com> -S: Maintained -F: drivers/mmc/host/au1xmmc.c - -ALI1563 I2C DRIVER -M: Rudolf Marek <r.marek@assembler.cz> -L: linux-i2c@vger.kernel.org -S: Maintained -F: Documentation/i2c/busses/i2c-ali1563 -F: drivers/i2c/busses/i2c-ali1563.c - -ALPHA PORT -M: Richard Henderson <rth@twiddle.net> -M: Ivan Kokshaysky <ink@jurassic.park.msu.ru> -M: Matt Turner <mattst88@gmail.com> -S: Odd Fixes -L: linux-alpha@vger.kernel.org -F: arch/alpha/ - -ALTERA UART/JTAG UART SERIAL DRIVERS -M: Tobias Klauser <tklauser@distanz.ch> -L: linux-serial@vger.kernel.org -L: nios2-dev@sopc.et.ntust.edu.tw (moderated for non-subscribers) -S: Maintained -F: drivers/tty/serial/altera_uart.c -F: drivers/tty/serial/altera_jtaguart.c -F: include/linux/altera_uart.h -F: include/linux/altera_jtaguart.h - -AMD FAM15H PROCESSOR POWER MONITORING DRIVER -M: Andreas Herrmann <andreas.herrmann3@amd.com> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/fam15h_power -F: drivers/hwmon/fam15h_power.c - -AMD GEODE CS5536 USB DEVICE CONTROLLER DRIVER -M: Thomas Dahlmann <dahlmann.thomas@arcor.de> -L: linux-geode@lists.infradead.org (moderated for non-subscribers) -S: Supported -F: drivers/usb/gadget/amd5536udc.* - -AMD GEODE PROCESSOR/CHIPSET SUPPORT -P: Andres Salomon <dilinger@queued.net> -L: linux-geode@lists.infradead.org (moderated for non-subscribers) -W: http://www.amd.com/us-en/ConnectivitySolutions/TechnicalResources/0,,50_2334_2452_11363,00.html -S: Supported -F: drivers/char/hw_random/geode-rng.c -F: drivers/crypto/geode* -F: drivers/video/geode/ -F: arch/x86/include/asm/geode.h - -AMD IOMMU (AMD-VI) -M: Joerg Roedel <joerg.roedel@amd.com> -L: iommu@lists.linux-foundation.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git -S: Supported -F: drivers/iommu/amd_iommu*.[ch] -F: include/linux/amd-iommu.h - -AMD MICROCODE UPDATE SUPPORT -M: Andreas Herrmann <andreas.herrmann3@amd.com> -L: amd64-microcode@amd64.org -S: Supported -F: arch/x86/kernel/microcode_amd.c - -AMS (Apple Motion Sensor) DRIVER -M: Michael Hanselmann <linux-kernel@hansmi.ch> -S: Supported -F: drivers/macintosh/ams/ - -AMSO1100 RNIC DRIVER -M: Tom Tucker <tom@opengridcomputing.com> -M: Steve Wise <swise@opengridcomputing.com> -L: linux-rdma@vger.kernel.org -S: Maintained -F: drivers/infiniband/hw/amso1100/ - -ANALOG DEVICES INC ASOC CODEC DRIVERS -M: Lars-Peter Clausen <lars@metafoo.de> -L: device-drivers-devel@blackfin.uclinux.org -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -W: http://wiki.analog.com/ -S: Supported -F: sound/soc/codecs/adau* -F: sound/soc/codecs/adav* -F: sound/soc/codecs/ad1* -F: sound/soc/codecs/ssm* -F: sound/soc/codecs/sigmadsp.* - -ANALOG DEVICES INC ASOC DRIVERS -L: uclinux-dist-devel@blackfin.uclinux.org -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -W: http://blackfin.uclinux.org/ -S: Supported -F: sound/soc/blackfin/* - -AOA (Apple Onboard Audio) ALSA DRIVER -M: Johannes Berg <johannes@sipsolutions.net> -L: linuxppc-dev@lists.ozlabs.org -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -S: Maintained -F: sound/aoa/ - -APM DRIVER -M: Jiri Kosina <jkosina@suse.cz> -S: Odd fixes -F: arch/x86/kernel/apm_32.c -F: include/linux/apm_bios.h -F: drivers/char/apm-emulation.c - -APPLE BCM5974 MULTITOUCH DRIVER -M: Henrik Rydberg <rydberg@euromail.se> -L: linux-input@vger.kernel.org -S: Maintained -F: drivers/input/mouse/bcm5974.c - -APPLE SMC DRIVER -M: Henrik Rydberg <rydberg@euromail.se> -L: lm-sensors@lm-sensors.org -S: Maintained -F: drivers/hwmon/applesmc.c - -APPLETALK NETWORK LAYER -M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> -S: Maintained -F: drivers/net/appletalk/ -F: net/appletalk/ - -ARASAN COMPACT FLASH PATA CONTROLLER -M: Viresh Kumar <viresh.kumar@st.com> -L: linux-ide@vger.kernel.org -S: Maintained -F: include/linux/pata_arasan_cf_data.h -F: drivers/ata/pata_arasan_cf.c - -ARC FRAMEBUFFER DRIVER -M: Jaya Kumar <jayalk@intworks.biz> -S: Maintained -F: drivers/video/arcfb.c -F: drivers/video/fb_defio.c - -ARM MFM AND FLOPPY DRIVERS -M: Ian Molton <spyro@f2s.com> -S: Maintained -F: arch/arm/lib/floppydma.S -F: arch/arm/include/asm/floppy.h - -ARM PMU PROFILING AND DEBUGGING -M: Will Deacon <will.deacon@arm.com> -S: Maintained -F: arch/arm/kernel/perf_event* -F: arch/arm/oprofile/common.c -F: arch/arm/kernel/pmu.c -F: arch/arm/include/asm/pmu.h -F: arch/arm/kernel/hw_breakpoint.c -F: arch/arm/include/asm/hw_breakpoint.h - -ARM PORT -M: Russell King <linux@arm.linux.org.uk> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.arm.linux.org.uk/ -S: Maintained -F: arch/arm/ - -ARM PRIMECELL AACI PL041 DRIVER -M: Russell King <linux@arm.linux.org.uk> -S: Maintained -F: sound/arm/aaci.* - -ARM PRIMECELL CLCD PL110 DRIVER -M: Russell King <linux@arm.linux.org.uk> -S: Maintained -F: drivers/video/amba-clcd.* - -ARM PRIMECELL KMI PL050 DRIVER -M: Russell King <linux@arm.linux.org.uk> -S: Maintained -F: drivers/input/serio/ambakmi.* -F: include/linux/amba/kmi.h - -ARM PRIMECELL MMCI PL180/1 DRIVER -S: Orphan -F: drivers/mmc/host/mmci.* - -ARM PRIMECELL BUS SUPPORT -M: Russell King <linux@arm.linux.org.uk> -S: Maintained -F: drivers/amba/ -F: include/linux/amba/bus.h - -ARM/ADI ROADRUNNER MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-ixp23xx/ -F: arch/arm/mach-ixp23xx/include/mach/ - -ARM/ADS SPHERE MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/AFEB9260 MACHINE SUPPORT -M: Sergey Lapin <slapin@ossfans.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/AJECO 1ARM MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/ATMEL AT91RM9200 AND AT91SAM ARM ARCHITECTURES -M: Andrew Victor <linux@maxim.org.za> -M: Nicolas Ferre <nicolas.ferre@atmel.com> -M: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://maxim.org.za/at91_26.html -W: http://www.linux4sam.org -S: Supported -F: arch/arm/mach-at91/ - -ARM/BCMRING ARM ARCHITECTURE -M: Jiandong Zheng <jdzheng@broadcom.com> -M: Scott Branden <sbranden@broadcom.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-bcmring - -ARM/BCMRING MTD NAND DRIVER -M: Jiandong Zheng <jdzheng@broadcom.com> -M: Scott Branden <sbranden@broadcom.com> -L: linux-mtd@lists.infradead.org -S: Maintained -F: drivers/mtd/nand/bcm_umi_nand.c -F: drivers/mtd/nand/bcm_umi_bch.c -F: drivers/mtd/nand/nand_bcm_umi.h - -ARM/CALXEDA HIGHBANK ARCHITECTURE -M: Rob Herring <rob.herring@calxeda.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-highbank/ - -ARM/CAVIUM NETWORKS CNS3XXX MACHINE SUPPORT -M: Anton Vorontsov <avorontsov@mvista.com> -S: Maintained -F: arch/arm/mach-cns3xxx/ -T: git git://git.infradead.org/users/cbou/linux-cns3xxx.git - -ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE -M: Hartley Sweeten <hsweeten@visionengravers.com> -M: Ryan Mallon <rmallon@gmail.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-ep93xx/ -F: arch/arm/mach-ep93xx/include/mach/ - -ARM/CIRRUS LOGIC EDB9315A MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/CLKDEV SUPPORT -M: Russell King <linux@arm.linux.org.uk> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/include/asm/clkdev.h -F: drivers/clk/clkdev.c - -ARM/COMPULAB CM-X270/EM-X270 and CM-X300 MACHINE SUPPORT -M: Mike Rapoport <mike@compulab.co.il> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/CONTEC MICRO9 MACHINE SUPPORT -M: Hubert Feurstein <hubert.feurstein@contec.at> -S: Maintained -F: arch/arm/mach-ep93xx/micro9.c - -ARM/CORGI MACHINE SUPPORT -M: Richard Purdie <rpurdie@rpsys.net> -S: Maintained - -ARM/CORTINA SYSTEMS GEMINI ARM ARCHITECTURE -M: Hans Ulli Kroll <ulli.kroll@googlemail.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -T: git git://git.berlios.de/gemini-board -S: Maintained -F: arch/arm/mach-gemini/ - -ARM/CSR SIRFPRIMA2 MACHINE SUPPORT -M: Barry Song <baohua.song@csr.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-prima2/ -F: drivers/dma/sirf-dma* - -ARM/EBSA110 MACHINE SUPPORT -M: Russell King <linux@arm.linux.org.uk> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.arm.linux.org.uk/ -S: Maintained -F: arch/arm/mach-ebsa110/ -F: drivers/net/ethernet/amd/am79c961a.* - -ARM/EZX SMARTPHONES (A780, A910, A1200, E680, ROKR E2 and ROKR E6) -M: Daniel Ribeiro <drwyrm@gmail.com> -M: Stefan Schmidt <stefan@openezx.org> -M: Harald Welte <laforge@openezx.org> -L: openezx-devel@lists.openezx.org (moderated for non-subscribers) -W: http://www.openezx.org/ -S: Maintained -T: topgit git://git.openezx.org/openezx.git -F: arch/arm/mach-pxa/ezx.c - -ARM/FARADAY FA526 PORT -M: Hans Ulli Kroll <ulli.kroll@googlemail.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -T: git git://git.berlios.de/gemini-board -F: arch/arm/mm/*-fa* - -ARM/FOOTBRIDGE ARCHITECTURE -M: Russell King <linux@arm.linux.org.uk> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.arm.linux.org.uk/ -S: Maintained -F: arch/arm/include/asm/hardware/dec21285.h -F: arch/arm/mach-footbridge/ - -ARM/FREESCALE IMX / MXC ARM ARCHITECTURE -M: Sascha Hauer <kernel@pengutronix.de> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -T: git git://git.pengutronix.de/git/imx/linux-2.6.git -F: arch/arm/mach-imx/ -F: arch/arm/plat-mxc/ - -ARM/FREESCALE IMX6 -M: Shawn Guo <shawn.guo@linaro.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -T: git git://git.linaro.org/people/shawnguo/linux-2.6.git -F: arch/arm/mach-imx/*imx6* - -ARM/FREESCALE MXS ARM ARCHITECTURE -M: Shawn Guo <shawn.guo@linaro.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -T: git git://git.linaro.org/people/shawnguo/linux-2.6.git -F: arch/arm/mach-mxs/ - -ARM/GLOMATION GESBC9312SX MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/GUMSTIX MACHINE SUPPORT -M: Steve Sakoman <sakoman@gmail.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/H4700 (HP IPAQ HX4700) MACHINE SUPPORT -M: Philipp Zabel <philipp.zabel@gmail.com> -M: Paul Parsons <lost.distance@yahoo.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-pxa/hx4700.c -F: arch/arm/mach-pxa/include/mach/hx4700.h -F: sound/soc/pxa/hx4700.c - -ARM/HP JORNADA 7XX MACHINE SUPPORT -M: Kristoffer Ericson <kristoffer.ericson@gmail.com> -W: www.jlime.com -S: Maintained -T: git git://git.kernel.org/pub/scm/linux/kernel/git/kristoffer/linux-hpc.git -F: arch/arm/mach-sa1100/jornada720.c -F: arch/arm/mach-sa1100/include/mach/jornada720.h - -ARM/INCOME PXA270 SUPPORT -M: Marek Vasut <marek.vasut@gmail.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-pxa/colibri-pxa270-income.c - -ARM/INTEL IOP32X ARM ARCHITECTURE -M: Lennert Buytenhek <kernel@wantstofly.org> -M: Dan Williams <dan.j.williams@intel.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/INTEL IOP33X ARM ARCHITECTURE -M: Dan Williams <dan.j.williams@intel.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/INTEL IOP13XX ARM ARCHITECTURE -M: Lennert Buytenhek <kernel@wantstofly.org> -M: Dan Williams <dan.j.williams@intel.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/INTEL IQ81342EX MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -M: Dan Williams <dan.j.williams@intel.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/INTEL IXP2000 ARM ARCHITECTURE -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/INTEL IXDP2850 MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/INTEL IXP23XX ARM ARCHITECTURE -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/INTEL IXP4XX ARM ARCHITECTURE -M: Imre Kaloz <kaloz@openwrt.org> -M: Krzysztof Halasa <khc@pm.waw.pl> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-ixp4xx/ - -ARM/INTEL RESEARCH IMOTE/STARGATE 2 MACHINE SUPPORT -M: Jonathan Cameron <jic23@cam.ac.uk> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-pxa/stargate2.c -F: drivers/pcmcia/pxa2xx_stargate2.c - -ARM/INTEL XSC3 (MANZANO) ARM CORE -M: Lennert Buytenhek <kernel@wantstofly.org> -M: Dan Williams <dan.j.williams@intel.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/IP FABRICS DOUBLE ESPRESSO MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/LOGICPD PXA270 MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/MAGICIAN MACHINE SUPPORT -M: Philipp Zabel <philipp.zabel@gmail.com> -S: Maintained - -ARM/Marvell Loki/Kirkwood/MV78xx0/Orion SOC support -M: Lennert Buytenhek <kernel@wantstofly.org> -M: Nicolas Pitre <nico@fluxnic.net> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Odd Fixes -F: arch/arm/mach-kirkwood/ -F: arch/arm/mach-mv78xx0/ -F: arch/arm/mach-orion5x/ -F: arch/arm/plat-orion/ - -ARM/Orion SoC/Technologic Systems TS-78xx platform support -M: Alexander Clouter <alex@digriz.org.uk> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.digriz.org.uk/ts78xx/kernel -S: Maintained -F: arch/arm/mach-orion5x/ts78xx-* - -ARM/MIOA701 MACHINE SUPPORT -M: Robert Jarzmik <robert.jarzmik@free.fr> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -F: arch/arm/mach-pxa/mioa701.c -S: Maintained - -ARM/NEC MOBILEPRO 900/c MACHINE SUPPORT -M: Michael Petchkovsky <mkpetch@internode.on.net> -S: Maintained - -ARM/NOMADIK ARCHITECTURE -M: Alessandro Rubini <rubini@unipv.it> -M: Linus Walleij <linus.walleij@stericsson.com> -M: STEricsson <STEricsson_nomadik_linux@list.st.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-nomadik/ -F: arch/arm/plat-nomadik/ -F: drivers/i2c/busses/i2c-nomadik.c -T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git - -ARM/OPENMOKO NEO FREERUNNER (GTA02) MACHINE SUPPORT -M: Nelson Castillo <arhuaco@freaks-unidos.net> -L: openmoko-kernel@lists.openmoko.org (subscribers-only) -W: http://wiki.openmoko.org/wiki/Neo_FreeRunner -S: Supported - -ARM/QUALCOMM MSM MACHINE SUPPORT -M: David Brown <davidb@codeaurora.org> -M: Daniel Walker <dwalker@fifo99.com> -M: Bryan Huntsman <bryanh@codeaurora.org> -L: linux-arm-msm@vger.kernel.org -F: arch/arm/mach-msm/ -F: drivers/video/msm/ -F: drivers/mmc/host/msm_sdcc.c -F: drivers/mmc/host/msm_sdcc.h -F: drivers/tty/serial/msm_serial.h -F: drivers/tty/serial/msm_serial.c -F: drivers/platform/msm/ -F: drivers/*/pm8???-* -F: include/linux/mfd/pm8xxx/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davidb/linux-msm.git -S: Maintained - -ARM/TOSA MACHINE SUPPORT -M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> -M: Dirk Opfer <dirk@opfer-online.de> -S: Maintained - -ARM/PALMTX,PALMT5,PALMLD,PALMTE2,PALMTC SUPPORT -M: Marek Vasut <marek.vasut@gmail.com> -L: linux-arm-kernel@lists.infradead.org -W: http://hackndev.com -S: Maintained -F: arch/arm/mach-pxa/include/mach/palmtx.h -F: arch/arm/mach-pxa/palmtx.c -F: arch/arm/mach-pxa/include/mach/palmt5.h -F: arch/arm/mach-pxa/palmt5.c -F: arch/arm/mach-pxa/include/mach/palmld.h -F: arch/arm/mach-pxa/palmld.c -F: arch/arm/mach-pxa/include/mach/palmte2.h -F: arch/arm/mach-pxa/palmte2.c -F: arch/arm/mach-pxa/include/mach/palmtc.h -F: arch/arm/mach-pxa/palmtc.c - -ARM/PALM TREO SUPPORT -M: Tomas Cech <sleep_walker@suse.cz> -L: linux-arm-kernel@lists.infradead.org -W: http://hackndev.com -S: Maintained -F: arch/arm/mach-pxa/include/mach/palmtreo.h -F: arch/arm/mach-pxa/palmtreo.c - -ARM/PALMZ72 SUPPORT -M: Sergey Lapin <slapin@ossfans.org> -L: linux-arm-kernel@lists.infradead.org -W: http://hackndev.com -S: Maintained -F: arch/arm/mach-pxa/include/mach/palmz72.h -F: arch/arm/mach-pxa/palmz72.c - -ARM/PLEB SUPPORT -M: Peter Chubb <pleb@gelato.unsw.edu.au> -W: http://www.disy.cse.unsw.edu.au/Hardware/PLEB -S: Maintained - -ARM/PT DIGITAL BOARD PORT -M: Stefan Eletzhofer <stefan.eletzhofer@eletztrick.de> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.arm.linux.org.uk/ -S: Maintained - -ARM/RADISYS ENP2611 MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/RISCPC ARCHITECTURE -M: Russell King <linux@arm.linux.org.uk> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.arm.linux.org.uk/ -S: Maintained -F: arch/arm/common/time-acorn.c -F: arch/arm/include/asm/hardware/entry-macro-iomd.S -F: arch/arm/include/asm/hardware/ioc.h -F: arch/arm/include/asm/hardware/iomd.h -F: arch/arm/include/asm/hardware/memc.h -F: arch/arm/mach-rpc/ -F: drivers/net/ethernet/8390/etherh.c -F: drivers/net/ethernet/i825xx/ether1* -F: drivers/net/ethernet/seeq/ether3* -F: drivers/scsi/arm/ - -ARM/SHARK MACHINE SUPPORT -M: Alexander Schulz <alex@shark-linux.de> -W: http://www.shark-linux.de/shark.html -S: Maintained - -ARM/SAMSUNG ARM ARCHITECTURES -M: Ben Dooks <ben-linux@fluff.org> -M: Kukjin Kim <kgene.kim@samsung.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) -W: http://www.fluff.org/ben/linux/ -S: Maintained -F: arch/arm/plat-samsung/ -F: arch/arm/plat-s3c24xx/ -F: arch/arm/plat-s5p/ -F: arch/arm/mach-s3c24*/ -F: arch/arm/mach-s3c64xx/ -F: drivers/*/*s3c2410* -F: drivers/*/*/*s3c2410* -F: drivers/spi/spi-s3c* -F: sound/soc/samsung/* - -ARM/S5P EXYNOS ARM ARCHITECTURES -M: Kukjin Kim <kgene.kim@samsung.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-s5p*/ -F: arch/arm/mach-exynos*/ - -ARM/SAMSUNG MOBILE MACHINE SUPPORT -M: Kyungmin Park <kyungmin.park@samsung.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-s5pv210/mach-aquila.c -F: arch/arm/mach-s5pv210/mach-goni.c -F: arch/arm/mach-exynos/mach-universal_c210.c -F: arch/arm/mach-exynos/mach-nuri.c - -ARM/SAMSUNG S5P SERIES FIMC SUPPORT -M: Kyungmin Park <kyungmin.park@samsung.com> -M: Sylwester Nawrocki <s.nawrocki@samsung.com> -L: linux-arm-kernel@lists.infradead.org -L: linux-media@vger.kernel.org -S: Maintained -F: arch/arm/plat-s5p/dev-fimc* -F: arch/arm/plat-samsung/include/plat/*fimc* -F: drivers/media/video/s5p-fimc/ - -ARM/SAMSUNG S5P SERIES Multi Format Codec (MFC) SUPPORT -M: Kyungmin Park <kyungmin.park@samsung.com> -M: Kamil Debski <k.debski@samsung.com> -M: Jeongtae Park <jtp.park@samsung.com> -L: linux-arm-kernel@lists.infradead.org -L: linux-media@vger.kernel.org -S: Maintained -F: arch/arm/plat-s5p/dev-mfc.c -F: drivers/media/video/s5p-mfc/ - -ARM/SAMSUNG S5P SERIES TV SUBSYSTEM SUPPORT -M: Kyungmin Park <kyungmin.park@samsung.com> -M: Tomasz Stanislawski <t.stanislaws@samsung.com> -L: linux-arm-kernel@lists.infradead.org -L: linux-media@vger.kernel.org -S: Maintained -F: drivers/media/video/s5p-tv/ - -ARM/SHMOBILE ARM ARCHITECTURE -M: Paul Mundt <lethal@linux-sh.org> -M: Magnus Damm <magnus.damm@gmail.com> -L: linux-sh@vger.kernel.org -W: http://oss.renesas.com -Q: http://patchwork.kernel.org/project/linux-sh/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6.git rmobile-latest -S: Supported -F: arch/arm/mach-shmobile/ -F: drivers/sh/ - -ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/TETON BGA MACHINE SUPPORT -M: "Mark F. Brown" <mark.brown314@gmail.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/THECUS N2100 MACHINE SUPPORT -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained - -ARM/NUVOTON W90X900 ARM ARCHITECTURE -M: Wan ZongShun <mcuos.com@gmail.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.mcuos.com -S: Maintained -F: arch/arm/mach-w90x900/ -F: drivers/input/keyboard/w90p910_keypad.c -F: drivers/input/touchscreen/w90p910_ts.c -F: drivers/watchdog/nuc900_wdt.c -F: drivers/net/ethernet/nuvoton/w90p910_ether.c -F: drivers/mtd/nand/nuc900_nand.c -F: drivers/rtc/rtc-nuc900.c -F: drivers/spi/spi-nuc900.c -F: drivers/usb/host/ehci-w90x900.c -F: drivers/video/nuc900fb.c - -ARM/U300 MACHINE SUPPORT -M: Linus Walleij <linus.walleij@stericsson.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Supported -F: arch/arm/mach-u300/ -F: drivers/i2c/busses/i2c-stu300.c -F: drivers/rtc/rtc-coh901331.c -F: drivers/watchdog/coh901327_wdt.c -F: drivers/dma/coh901318* -F: drivers/mfd/ab3100* -F: drivers/rtc/rtc-ab3100.c -F: drivers/rtc/rtc-coh901331.c -T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git - -ARM/Ux500 ARM ARCHITECTURE -M: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> -M: Linus Walleij <linus.walleij@stericsson.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-ux500/ -F: drivers/dma/ste_dma40* -F: drivers/mfd/abx500* -F: drivers/mfd/ab8500* -F: drivers/mfd/stmpe* -F: drivers/rtc/rtc-ab8500.c -T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git - -ARM/VFP SUPPORT -M: Russell King <linux@arm.linux.org.uk> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.arm.linux.org.uk/ -S: Maintained -F: arch/arm/vfp/ - -ARM/VOIPAC PXA270 SUPPORT -M: Marek Vasut <marek.vasut@gmail.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-pxa/vpac270.c -F: arch/arm/mach-pxa/include/mach/vpac270.h - -ARM/ZIPIT Z2 SUPPORT -M: Marek Vasut <marek.vasut@gmail.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/mach-pxa/z2.c -F: arch/arm/mach-pxa/include/mach/z2.h - -ASC7621 HARDWARE MONITOR DRIVER -M: George Joseph <george.joseph@fairview5.com> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/asc7621 -F: drivers/hwmon/asc7621.c - -ASUS NOTEBOOKS AND EEEPC ACPI/WMI EXTRAS DRIVERS -M: Corentin Chary <corentincj@iksaif.net> -L: acpi4asus-user@lists.sourceforge.net -L: platform-driver-x86@vger.kernel.org -W: http://acpi4asus.sf.net -S: Maintained -F: drivers/platform/x86/asus*.c -F: drivers/platform/x86/eeepc*.c - -ASUS ASB100 HARDWARE MONITOR DRIVER -M: "Mark M. Hoffman" <mhoffman@lightlink.com> -L: lm-sensors@lm-sensors.org -S: Maintained -F: drivers/hwmon/asb100.c - -ASYNCHRONOUS TRANSFERS/TRANSFORMS (IOAT) API -M: Dan Williams <dan.j.williams@intel.com> -W: http://sourceforge.net/projects/xscaleiop -S: Supported -F: Documentation/crypto/async-tx-api.txt -F: crypto/async_tx/ -F: drivers/dma/ -F: include/linux/dmaengine.h -F: include/linux/async_tx.h - -AT24 EEPROM DRIVER -M: Wolfram Sang <w.sang@pengutronix.de> -L: linux-i2c@vger.kernel.org -S: Maintained -F: drivers/misc/eeprom/at24.c -F: include/linux/i2c/at24.h - -ATA OVER ETHERNET (AOE) DRIVER -M: "Ed L. Cashin" <ecashin@coraid.com> -W: http://www.coraid.com/support/linux -S: Supported -F: Documentation/aoe/ -F: drivers/block/aoe/ - -ATHEROS ATH GENERIC UTILITIES -M: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com> -L: linux-wireless@vger.kernel.org -S: Supported -F: drivers/net/wireless/ath/* - -ATHEROS ATH5K WIRELESS DRIVER -M: Jiri Slaby <jirislaby@gmail.com> -M: Nick Kossifidis <mickflemm@gmail.com> -M: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com> -L: linux-wireless@vger.kernel.org -L: ath5k-devel@lists.ath5k.org -W: http://wireless.kernel.org/en/users/Drivers/ath5k -S: Maintained -F: drivers/net/wireless/ath/ath5k/ - -ATHEROS ATH6KL WIRELESS DRIVER -M: Kalle Valo <kvalo@qca.qualcomm.com> -L: linux-wireless@vger.kernel.org -W: http://wireless.kernel.org/en/users/Drivers/ath6kl -T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath6kl.git -S: Supported -F: drivers/net/wireless/ath/ath6kl/ - -ATHEROS ATH9K WIRELESS DRIVER -M: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com> -M: Jouni Malinen <jouni@qca.qualcomm.com> -M: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> -M: Senthil Balasubramanian <senthilb@qca.qualcomm.com> -L: linux-wireless@vger.kernel.org -L: ath9k-devel@lists.ath9k.org -W: http://wireless.kernel.org/en/users/Drivers/ath9k -S: Supported -F: drivers/net/wireless/ath/ath9k/ - -CARL9170 LINUX COMMUNITY WIRELESS DRIVER -M: Christian Lamparter <chunkeey@googlemail.com> -L: linux-wireless@vger.kernel.org -W: http://wireless.kernel.org/en/users/Drivers/carl9170 -S: Maintained -F: drivers/net/wireless/ath/carl9170/ - -ATK0110 HWMON DRIVER -M: Luca Tettamanti <kronos.it@gmail.com> -L: lm-sensors@lm-sensors.org -S: Maintained -F: drivers/hwmon/asus_atk0110.c - -ATI_REMOTE2 DRIVER -M: Ville Syrjala <syrjala@sci.fi> -S: Maintained -F: drivers/input/misc/ati_remote2.c - -ATLX ETHERNET DRIVERS -M: Jay Cliburn <jcliburn@gmail.com> -M: Chris Snook <chris.snook@gmail.com> -L: netdev@vger.kernel.org -W: http://sourceforge.net/projects/atl1 -W: http://atl1.sourceforge.net -S: Maintained -F: drivers/net/ethernet/atheros/ - -ATM -M: Chas Williams <chas@cmf.nrl.navy.mil> -L: linux-atm-general@lists.sourceforge.net (moderated for non-subscribers) -L: netdev@vger.kernel.org -W: http://linux-atm.sourceforge.net -S: Maintained -F: drivers/atm/ -F: include/linux/atm* - -ATMEL AT91 MCI DRIVER -M: Ludovic Desroches <ludovic.desroches@atmel.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.atmel.com/products/AT91/ -W: http://www.at91.com/ -S: Maintained -F: drivers/mmc/host/at91_mci.c - -ATMEL AT91 / AT32 MCI DRIVER -M: Ludovic Desroches <ludovic.desroches@atmel.com> -S: Maintained -F: drivers/mmc/host/atmel-mci.c -F: drivers/mmc/host/atmel-mci-regs.h - -ATMEL AT91 / AT32 SERIAL DRIVER -M: Nicolas Ferre <nicolas.ferre@atmel.com> -S: Supported -F: drivers/tty/serial/atmel_serial.c - -ATMEL LCDFB DRIVER -M: Nicolas Ferre <nicolas.ferre@atmel.com> -L: linux-fbdev@vger.kernel.org -S: Maintained -F: drivers/video/atmel_lcdfb.c -F: include/video/atmel_lcdc.h - -ATMEL MACB ETHERNET DRIVER -M: Nicolas Ferre <nicolas.ferre@atmel.com> -S: Supported -F: drivers/net/ethernet/cadence/ - -ATMEL SPI DRIVER -M: Nicolas Ferre <nicolas.ferre@atmel.com> -S: Supported -F: drivers/spi/spi-atmel.* - -ATMEL USBA UDC DRIVER -M: Nicolas Ferre <nicolas.ferre@atmel.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://avr32linux.org/twiki/bin/view/Main/AtmelUsbDeviceDriver -S: Supported -F: drivers/usb/gadget/atmel_usba_udc.* - -ATMEL WIRELESS DRIVER -M: Simon Kelley <simon@thekelleys.org.uk> -L: linux-wireless@vger.kernel.org -W: http://www.thekelleys.org.uk/atmel -W: http://atmelwlandriver.sourceforge.net/ -S: Maintained -F: drivers/net/wireless/atmel* - -AUDIT SUBSYSTEM -M: Al Viro <viro@zeniv.linux.org.uk> -M: Eric Paris <eparis@redhat.com> -L: linux-audit@redhat.com (subscribers-only) -W: http://people.redhat.com/sgrubb/audit/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit-current.git -S: Maintained -F: include/linux/audit.h -F: kernel/audit* - -AUXILIARY DISPLAY DRIVERS -M: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com> -W: http://miguelojeda.es/auxdisplay.htm -W: http://jair.lab.fi.uva.es/~migojed/auxdisplay.htm -S: Maintained -F: drivers/auxdisplay/ -F: include/linux/cfag12864b.h - -AVR32 ARCHITECTURE -M: Haavard Skinnemoen <hskinnemoen@gmail.com> -M: Hans-Christian Egtvedt <egtvedt@samfundet.no> -W: http://www.atmel.com/products/AVR32/ -W: http://avr32linux.org/ -W: http://avrfreaks.net/ -S: Maintained -F: arch/avr32/ - -AVR32/AT32AP MACHINE SUPPORT -M: Haavard Skinnemoen <hskinnemoen@gmail.com> -M: Hans-Christian Egtvedt <egtvedt@samfundet.no> -S: Maintained -F: arch/avr32/mach-at32ap/ - -AX.25 NETWORK LAYER -M: Ralf Baechle <ralf@linux-mips.org> -L: linux-hams@vger.kernel.org -W: http://www.linux-ax25.org/ -S: Maintained -F: include/linux/ax25.h -F: include/net/ax25.h -F: net/ax25/ - -B43 WIRELESS DRIVER -M: Stefano Brivio <stefano.brivio@polimi.it> -L: linux-wireless@vger.kernel.org -L: b43-dev@lists.infradead.org -W: http://linuxwireless.org/en/users/Drivers/b43 -S: Maintained -F: drivers/net/wireless/b43/ - -B43LEGACY WIRELESS DRIVER -M: Larry Finger <Larry.Finger@lwfinger.net> -M: Stefano Brivio <stefano.brivio@polimi.it> -L: linux-wireless@vger.kernel.org -L: b43-dev@lists.infradead.org -W: http://linuxwireless.org/en/users/Drivers/b43 -S: Maintained -F: drivers/net/wireless/b43legacy/ - -BACKLIGHT CLASS/SUBSYSTEM -M: Richard Purdie <rpurdie@rpsys.net> -S: Maintained -F: drivers/video/backlight/ -F: include/linux/backlight.h - -BATMAN ADVANCED -M: Marek Lindner <lindner_marek@yahoo.de> -M: Simon Wunderlich <siwu@hrz.tu-chemnitz.de> -L: b.a.t.m.a.n@lists.open-mesh.org -W: http://www.open-mesh.org/ -S: Maintained -F: net/batman-adv/ - -BAYCOM/HDLCDRV DRIVERS FOR AX.25 -M: Thomas Sailer <t.sailer@alumni.ethz.ch> -L: linux-hams@vger.kernel.org -W: http://www.baycom.org/~tom/ham/ham.html -S: Maintained -F: drivers/net/hamradio/baycom* - -BEFS FILE SYSTEM -S: Orphan -F: Documentation/filesystems/befs.txt -F: fs/befs/ - -BFS FILE SYSTEM -M: "Tigran A. Aivazian" <tigran@aivazian.fsnet.co.uk> -S: Maintained -F: Documentation/filesystems/bfs.txt -F: fs/bfs/ -F: include/linux/bfs_fs.h - -BLACKFIN ARCHITECTURE -M: Mike Frysinger <vapier@gentoo.org> -L: uclinux-dist-devel@blackfin.uclinux.org -W: http://blackfin.uclinux.org -S: Supported -F: arch/blackfin/ - -BLACKFIN EMAC DRIVER -L: uclinux-dist-devel@blackfin.uclinux.org -W: http://blackfin.uclinux.org -S: Supported -F: drivers/net/ethernet/adi/ - -BLACKFIN RTC DRIVER -M: Mike Frysinger <vapier.adi@gmail.com> -L: uclinux-dist-devel@blackfin.uclinux.org -W: http://blackfin.uclinux.org -S: Supported -F: drivers/rtc/rtc-bfin.c - -BLACKFIN SDH DRIVER -M: Cliff Cai <cliff.cai@analog.com> -L: uclinux-dist-devel@blackfin.uclinux.org -W: http://blackfin.uclinux.org -S: Supported -F: drivers/mmc/host/bfin_sdh.c - -BLACKFIN SERIAL DRIVER -M: Sonic Zhang <sonic.zhang@analog.com> -L: uclinux-dist-devel@blackfin.uclinux.org -W: http://blackfin.uclinux.org -S: Supported -F: drivers/tty/serial/bfin_uart.c - -BLACKFIN WATCHDOG DRIVER -M: Mike Frysinger <vapier.adi@gmail.com> -L: uclinux-dist-devel@blackfin.uclinux.org -W: http://blackfin.uclinux.org -S: Supported -F: drivers/watchdog/bfin_wdt.c - -BLACKFIN I2C TWI DRIVER -M: Sonic Zhang <sonic.zhang@analog.com> -L: uclinux-dist-devel@blackfin.uclinux.org -W: http://blackfin.uclinux.org/ -S: Supported -F: drivers/i2c/busses/i2c-bfin-twi.c - -BLOCK LAYER -M: Jens Axboe <axboe@kernel.dk> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git -S: Maintained -F: block/ - -BLOCK2MTD DRIVER -M: Joern Engel <joern@lazybastard.org> -L: linux-mtd@lists.infradead.org -S: Maintained -F: drivers/mtd/devices/block2mtd.c - -BLUETOOTH DRIVERS -M: Marcel Holtmann <marcel@holtmann.org> -M: Gustavo Padovan <gustavo@padovan.org> -M: Johan Hedberg <johan.hedberg@gmail.com> -L: linux-bluetooth@vger.kernel.org -W: http://www.bluez.org/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git -T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git -S: Maintained -F: drivers/bluetooth/ - -BLUETOOTH SUBSYSTEM -M: Marcel Holtmann <marcel@holtmann.org> -M: Gustavo Padovan <gustavo@padovan.org> -M: Johan Hedberg <johan.hedberg@gmail.com> -L: linux-bluetooth@vger.kernel.org -W: http://www.bluez.org/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git -T: git git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git -S: Maintained -F: net/bluetooth/ -F: include/net/bluetooth/ - -BONDING DRIVER -M: Jay Vosburgh <fubar@us.ibm.com> -M: Andy Gospodarek <andy@greyhouse.net> -L: netdev@vger.kernel.org -W: http://sourceforge.net/projects/bonding/ -S: Supported -F: drivers/net/bonding/ -F: include/linux/if_bonding.h - -BROADCOM B44 10/100 ETHERNET DRIVER -M: Gary Zambrano <zambrano@broadcom.com> -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/ethernet/broadcom/b44.* - -BROADCOM BNX2 GIGABIT ETHERNET DRIVER -M: Michael Chan <mchan@broadcom.com> -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/ethernet/broadcom/bnx2.* -F: drivers/net/ethernet/broadcom/bnx2_* - -BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER -M: Eilon Greenstein <eilong@broadcom.com> -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/ethernet/broadcom/bnx2x/ - -BROADCOM TG3 GIGABIT ETHERNET DRIVER -M: Matt Carlson <mcarlson@broadcom.com> -M: Michael Chan <mchan@broadcom.com> -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/ethernet/broadcom/tg3.* - -BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER -M: Brett Rudley <brudley@broadcom.com> -M: Roland Vossen <rvossen@broadcom.com> -M: Arend van Spriel <arend@broadcom.com> -M: Franky (Zhenhui) Lin <frankyl@broadcom.com> -M: Kan Yan <kanyan@broadcom.com> -L: linux-wireless@vger.kernel.org -S: Supported -F: drivers/net/wireless/brcm80211/ - -BROADCOM BNX2FC 10 GIGABIT FCOE DRIVER -M: Bhanu Prakash Gollapudi <bprakash@broadcom.com> -L: linux-scsi@vger.kernel.org -S: Supported -F: drivers/scsi/bnx2fc/ - -BROADCOM SPECIFIC AMBA DRIVER (BCMA) -M: RafaÅ‚ MiÅ‚ecki <zajec5@gmail.com> -L: linux-wireless@vger.kernel.org -S: Maintained -F: drivers/bcma/ -F: include/linux/bcma/ - -BROCADE BFA FC SCSI DRIVER -M: Jing Huang <huangj@brocade.com> -L: linux-scsi@vger.kernel.org -S: Supported -F: drivers/scsi/bfa/ - -BROCADE BNA 10 GIGABIT ETHERNET DRIVER -M: Rasesh Mody <rmody@brocade.com> -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/ethernet/brocade/bna/ - -BSG (block layer generic sg v4 driver) -M: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> -L: linux-scsi@vger.kernel.org -S: Supported -F: block/bsg.c -F: include/linux/bsg.h - -BT87X AUDIO DRIVER -M: Clemens Ladisch <clemens@ladisch.de> -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -T: git git://git.alsa-project.org/alsa-kernel.git -S: Maintained -F: Documentation/sound/alsa/Bt87x.txt -F: sound/pci/bt87x.c - -BT8XXGPIO DRIVER -M: Michael Buesch <m@bues.ch> -W: http://bu3sch.de/btgpio.php -S: Maintained -F: drivers/gpio/gpio-bt8xx.c - -BTRFS FILE SYSTEM -M: Chris Mason <chris.mason@oracle.com> -L: linux-btrfs@vger.kernel.org -W: http://btrfs.wiki.kernel.org/ -Q: http://patchwork.kernel.org/project/linux-btrfs/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable.git -S: Maintained -F: Documentation/filesystems/btrfs.txt -F: fs/btrfs/ - -BTTV VIDEO4LINUX DRIVER -M: Mauro Carvalho Chehab <mchehab@infradead.org> -L: linux-media@vger.kernel.org -W: http://linuxtv.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: Documentation/video4linux/bttv/ -F: drivers/media/video/bt8xx/bttv* - -C-MEDIA CMI8788 DRIVER -M: Clemens Ladisch <clemens@ladisch.de> -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -T: git git://git.alsa-project.org/alsa-kernel.git -S: Maintained -F: sound/pci/oxygen/ - -C6X ARCHITECTURE -M: Mark Salter <msalter@redhat.com> -M: Aurelien Jacquiot <a-jacquiot@ti.com> -L: linux-c6x-dev@linux-c6x.org -W: http://www.linux-c6x.org/wiki/index.php/Main_Page -S: Maintained -F: arch/c6x/ - -CACHEFILES: FS-CACHE BACKEND FOR CACHING ON MOUNTED FILESYSTEMS -M: David Howells <dhowells@redhat.com> -L: linux-cachefs@redhat.com -S: Supported -F: Documentation/filesystems/caching/cachefiles.txt -F: fs/cachefiles/ - -CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER -M: Jonathan Corbet <corbet@lwn.net> -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: Documentation/video4linux/cafe_ccic -F: drivers/media/video/marvell-ccic/ - -CAIF NETWORK LAYER -M: Sjur Braendeland <sjur.brandeland@stericsson.com> -L: netdev@vger.kernel.org -S: Supported -F: Documentation/networking/caif/ -F: drivers/net/caif/ -F: include/linux/caif/ -F: include/net/caif/ -F: net/caif/ - -CALGARY x86-64 IOMMU -M: Muli Ben-Yehuda <muli@il.ibm.com> -M: "Jon D. Mason" <jdmason@kudzu.us> -L: discuss@x86-64.org -S: Maintained -F: arch/x86/kernel/pci-calgary_64.c -F: arch/x86/kernel/tce_64.c -F: arch/x86/include/asm/calgary.h -F: arch/x86/include/asm/tce.h - -CAN NETWORK LAYER -M: Oliver Hartkopp <socketcan@hartkopp.net> -L: linux-can@vger.kernel.org -W: http://gitorious.org/linux-can -T: git git://gitorious.org/linux-can/linux-can-next.git -S: Maintained -F: net/can/ -F: include/linux/can.h -F: include/linux/can/core.h -F: include/linux/can/bcm.h -F: include/linux/can/raw.h -F: include/linux/can/gw.h - -CAN NETWORK DRIVERS -M: Wolfgang Grandegger <wg@grandegger.com> -M: Marc Kleine-Budde <mkl@pengutronix.de> -L: linux-can@vger.kernel.org -W: http://gitorious.org/linux-can -T: git git://gitorious.org/linux-can/linux-can-next.git -S: Maintained -F: drivers/net/can/ -F: include/linux/can/dev.h -F: include/linux/can/error.h -F: include/linux/can/netlink.h -F: include/linux/can/platform/ - -CAPABILITIES -M: Serge Hallyn <serge.hallyn@canonical.com> -L: linux-security-module@vger.kernel.org -S: Supported -F: include/linux/capability.h -F: security/capability.c -F: security/commoncap.c - -CELL BROADBAND ENGINE ARCHITECTURE -M: Arnd Bergmann <arnd@arndb.de> -L: linuxppc-dev@lists.ozlabs.org -L: cbe-oss-dev@lists.ozlabs.org -W: http://www.ibm.com/developerworks/power/cell/ -S: Supported -F: arch/powerpc/include/asm/cell*.h -F: arch/powerpc/include/asm/spu*.h -F: arch/powerpc/oprofile/*cell* -F: arch/powerpc/platforms/cell/ - -CEPH DISTRIBUTED FILE SYSTEM CLIENT -M: Sage Weil <sage@newdream.net> -L: ceph-devel@vger.kernel.org -W: http://ceph.newdream.net/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git -S: Supported -F: Documentation/filesystems/ceph.txt -F: fs/ceph -F: net/ceph -F: include/linux/ceph - -CERTIFIED WIRELESS USB (WUSB) SUBSYSTEM: -L: linux-usb@vger.kernel.org -S: Orphan -F: Documentation/usb/WUSB-Design-overview.txt -F: Documentation/usb/wusb-cbaf -F: drivers/usb/host/hwa-hc.c -F: drivers/usb/host/whci/ -F: drivers/usb/wusbcore/ -F: include/linux/usb/wusb* - -CFAG12864B LCD DRIVER -M: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com> -W: http://miguelojeda.es/auxdisplay.htm -W: http://jair.lab.fi.uva.es/~migojed/auxdisplay.htm -S: Maintained -F: drivers/auxdisplay/cfag12864b.c -F: include/linux/cfag12864b.h - -CFAG12864BFB LCD FRAMEBUFFER DRIVER -M: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com> -W: http://miguelojeda.es/auxdisplay.htm -W: http://jair.lab.fi.uva.es/~migojed/auxdisplay.htm -S: Maintained -F: drivers/auxdisplay/cfag12864bfb.c -F: include/linux/cfag12864b.h - -CFG80211 and NL80211 -M: Johannes Berg <johannes@sipsolutions.net> -L: linux-wireless@vger.kernel.org -S: Maintained -F: include/linux/nl80211.h -F: include/net/cfg80211.h -F: net/wireless/* -X: net/wireless/wext* - -CHAR and MISC DRIVERS -M: Arnd Bergmann <arnd@arndb.de> -M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git -S: Supported -F: drivers/char/* -F: drivers/misc/* - -CHECKPATCH -M: Andy Whitcroft <apw@canonical.com> -S: Supported -F: scripts/checkpatch.pl - -CHINESE DOCUMENTATION -M: Harry Wei <harryxiyou@gmail.com> -L: xiyoulinuxkernelgroup@googlegroups.com -L: linux-kernel@zh-kernel.org (moderated for non-subscribers) -S: Maintained -F: Documentation/zh_CN/ - -CISCO VIC ETHERNET NIC DRIVER -M: Christian Benvenuti <benve@cisco.com> -M: Roopa Prabhu <roprabhu@cisco.com> -M: Neel Patel <neepatel@cisco.com> -M: Nishank Trivedi <nistrive@cisco.com> -S: Supported -F: drivers/net/ethernet/cisco/enic/ - -CIRRUS LOGIC EP93XX ETHERNET DRIVER -M: Hartley Sweeten <hsweeten@visionengravers.com> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/cirrus/ep93xx_eth.c - -CIRRUS LOGIC EP93XX OHCI USB HOST DRIVER -M: Lennert Buytenhek <kernel@wantstofly.org> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/usb/host/ohci-ep93xx.c - -CIRRUS LOGIC CS4270 SOUND DRIVER -M: Timur Tabi <timur@freescale.com> -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -S: Supported -F: sound/soc/codecs/cs4270* - -CLEANCACHE API -M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> -L: linux-kernel@vger.kernel.org -S: Maintained -F: mm/cleancache.c -F: include/linux/cleancache.h - -CLK API -M: Russell King <linux@arm.linux.org.uk> -S: Maintained -F: include/linux/clk.h - -CISCO FCOE HBA DRIVER -M: Abhijeet Joglekar <abjoglek@cisco.com> -M: Venkata Siva Vijayendra Bhamidipati <vbhamidi@cisco.com> -M: Brian Uchino <buchino@cisco.com> -L: linux-scsi@vger.kernel.org -S: Supported -F: drivers/scsi/fnic/ - -CMPC ACPI DRIVER -M: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> -M: Daniel Oliveira Nascimento <don@syst.com.br> -L: platform-driver-x86@vger.kernel.org -S: Supported -F: drivers/platform/x86/classmate-laptop.c - -COCCINELLE/Semantic Patches (SmPL) -M: Julia Lawall <julia@diku.dk> -M: Gilles Muller <Gilles.Muller@lip6.fr> -M: Nicolas Palix <npalix.work@gmail.com> -L: cocci@diku.dk (moderated for non-subscribers) -W: http://coccinelle.lip6.fr/ -S: Supported -F: scripts/coccinelle/ -F: scripts/coccicheck - -CODA FILE SYSTEM -M: Jan Harkes <jaharkes@cs.cmu.edu> -M: coda@cs.cmu.edu -L: codalist@coda.cs.cmu.edu -W: http://www.coda.cs.cmu.edu/ -S: Maintained -F: Documentation/filesystems/coda.txt -F: fs/coda/ -F: include/linux/coda*.h - -COMMON INTERNET FILE SYSTEM (CIFS) -M: Steve French <sfrench@samba.org> -L: linux-cifs@vger.kernel.org -L: samba-technical@lists.samba.org (moderated for non-subscribers) -W: http://linux-cifs.samba.org/ -Q: http://patchwork.ozlabs.org/project/linux-cifs-client/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6.git -S: Supported -F: Documentation/filesystems/cifs.txt -F: fs/cifs/ - -COMPACTPCI HOTPLUG CORE -M: Scott Murray <scott@spiteful.org> -L: linux-pci@vger.kernel.org -S: Maintained -F: drivers/pci/hotplug/cpci_hotplug* - -COMPACTPCI HOTPLUG ZIATECH ZT5550 DRIVER -M: Scott Murray <scott@spiteful.org> -L: linux-pci@vger.kernel.org -S: Maintained -F: drivers/pci/hotplug/cpcihp_zt5550.* - -COMPACTPCI HOTPLUG GENERIC DRIVER -M: Scott Murray <scott@spiteful.org> -L: linux-pci@vger.kernel.org -S: Maintained -F: drivers/pci/hotplug/cpcihp_generic.c - -COMPAL LAPTOP SUPPORT -M: Cezary Jackiewicz <cezary.jackiewicz@gmail.com> -L: platform-driver-x86@vger.kernel.org -S: Maintained -F: drivers/platform/x86/compal-laptop.c - -CONEXANT ACCESSRUNNER USB DRIVER -M: Simon Arlott <cxacru@fire.lp0.eu> -L: accessrunner-general@lists.sourceforge.net -W: http://accessrunner.sourceforge.net/ -S: Maintained -F: drivers/usb/atm/cxacru.c - -CONFIGFS -M: Joel Becker <jlbec@evilplan.org> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/configfs.git -S: Supported -F: fs/configfs/ -F: include/linux/configfs.h - -CONNECTOR -M: Evgeniy Polyakov <zbr@ioremap.net> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/connector/ - -CONTROL GROUPS (CGROUPS) -M: Tejun Heo <tj@kernel.org> -M: Li Zefan <lizefan@huawei.com> -L: containers@lists.linux-foundation.org -L: cgroups@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git -S: Maintained -F: include/linux/cgroup* -F: kernel/cgroup* -F: mm/*cgroup* - -CORETEMP HARDWARE MONITORING DRIVER -M: Fenghua Yu <fenghua.yu@intel.com> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/coretemp -F: drivers/hwmon/coretemp.c - -COSA/SRP SYNC SERIAL DRIVER -M: Jan "Yenya" Kasprzak <kas@fi.muni.cz> -W: http://www.fi.muni.cz/~kas/cosa/ -S: Maintained -F: drivers/net/wan/cosa* - -CPMAC ETHERNET DRIVER -M: Florian Fainelli <florian@openwrt.org> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/ti/cpmac.c - -CPU FREQUENCY DRIVERS -M: Dave Jones <davej@redhat.com> -L: cpufreq@vger.kernel.org -W: http://www.codemonkey.org.uk/projects/cpufreq/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq.git -S: Maintained -F: drivers/cpufreq/ -F: include/linux/cpufreq.h - -CPUID/MSR DRIVER -M: "H. Peter Anvin" <hpa@zytor.com> -S: Maintained -F: arch/x86/kernel/cpuid.c -F: arch/x86/kernel/msr.c - -CPU POWER MONITORING SUBSYSTEM -M: Dominik Brodowski <linux@dominikbrodowski.net> -M: Thomas Renninger <trenn@suse.de> -S: Maintained -F: tools/power/cpupower - -CPUSETS -M: Paul Menage <paul@paulmenage.org> -W: http://www.bullopensource.org/cpuset/ -W: http://oss.sgi.com/projects/cpusets/ -S: Supported -F: Documentation/cgroups/cpusets.txt -F: include/linux/cpuset.h -F: kernel/cpuset.c - -CRAMFS FILESYSTEM -W: http://sourceforge.net/projects/cramfs/ -S: Orphan -F: Documentation/filesystems/cramfs.txt -F: fs/cramfs/ - -CRIS PORT -M: Mikael Starvik <starvik@axis.com> -M: Jesper Nilsson <jesper.nilsson@axis.com> -L: linux-cris-kernel@axis.com -W: http://developer.axis.com -S: Maintained -F: arch/cris/ -F: drivers/tty/serial/crisv10.* - -CRYPTO API -M: Herbert Xu <herbert@gondor.apana.org.au> -M: "David S. Miller" <davem@davemloft.net> -L: linux-crypto@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6.git -S: Maintained -F: Documentation/crypto/ -F: arch/*/crypto/ -F: crypto/ -F: drivers/crypto/ -F: include/crypto/ - -CRYPTOGRAPHIC RANDOM NUMBER GENERATOR -M: Neil Horman <nhorman@tuxdriver.com> -L: linux-crypto@vger.kernel.org -S: Maintained -F: crypto/ansi_cprng.c -F: crypto/rng.c - -CS5535 Audio ALSA driver -M: Jaya Kumar <jayakumar.alsa@gmail.com> -S: Maintained -F: sound/pci/cs5535audio/ - -CX18 VIDEO4LINUX DRIVER -M: Andy Walls <awalls@md.metrocast.net> -L: ivtv-devel@ivtvdriver.org (moderated for non-subscribers) -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -W: http://linuxtv.org -W: http://www.ivtvdriver.org/index.php/Cx18 -S: Maintained -F: Documentation/video4linux/cx18.txt -F: drivers/media/video/cx18/ - -CXGB3 ETHERNET DRIVER (CXGB3) -M: Divy Le Ray <divy@chelsio.com> -L: netdev@vger.kernel.org -W: http://www.chelsio.com -S: Supported -F: drivers/net/ethernet/chelsio/cxgb3/ - -CXGB3 IWARP RNIC DRIVER (IW_CXGB3) -M: Steve Wise <swise@chelsio.com> -L: linux-rdma@vger.kernel.org -W: http://www.openfabrics.org -S: Supported -F: drivers/infiniband/hw/cxgb3/ - -CXGB4 ETHERNET DRIVER (CXGB4) -M: Dimitris Michailidis <dm@chelsio.com> -L: netdev@vger.kernel.org -W: http://www.chelsio.com -S: Supported -F: drivers/net/ethernet/chelsio/cxgb4/ - -CXGB4 IWARP RNIC DRIVER (IW_CXGB4) -M: Steve Wise <swise@chelsio.com> -L: linux-rdma@vger.kernel.org -W: http://www.openfabrics.org -S: Supported -F: drivers/infiniband/hw/cxgb4/ - -CXGB4VF ETHERNET DRIVER (CXGB4VF) -M: Casey Leedom <leedom@chelsio.com> -L: netdev@vger.kernel.org -W: http://www.chelsio.com -S: Supported -F: drivers/net/ethernet/chelsio/cxgb4vf/ - -STMMAC ETHERNET DRIVER -M: Giuseppe Cavallaro <peppe.cavallaro@st.com> -L: netdev@vger.kernel.org -W: http://www.stlinux.com -S: Supported -F: drivers/net/ethernet/stmicro/stmmac/ - -CYBERPRO FB DRIVER -M: Russell King <linux@arm.linux.org.uk> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.arm.linux.org.uk/ -S: Maintained -F: drivers/video/cyber2000fb.* - -CYCLADES 2X SYNC CARD DRIVER -M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> -W: http://oops.ghostprotocols.net:81/blog -S: Maintained -F: drivers/net/wan/cycx* - -CYCLADES ASYNC MUX DRIVER -W: http://www.cyclades.com/ -S: Orphan -F: drivers/tty/cyclades.c -F: include/linux/cyclades.h - -CYCLADES PC300 DRIVER -W: http://www.cyclades.com/ -S: Orphan -F: drivers/net/wan/pc300* - -CYTTSP TOUCHSCREEN DRIVER -M: Javier Martinez Canillas <javier@dowhile0.org> -L: linux-input@vger.kernel.org -S: Maintained -F: drivers/input/touchscreen/cyttsp* -F: include/linux/input/cyttsp.h - -DAMA SLAVE for AX.25 -M: Joerg Reuter <jreuter@yaina.de> -W: http://yaina.de/jreuter/ -W: http://www.qsl.net/dl1bke/ -L: linux-hams@vger.kernel.org -S: Maintained -F: net/ax25/af_ax25.c -F: net/ax25/ax25_dev.c -F: net/ax25/ax25_ds_* -F: net/ax25/ax25_in.c -F: net/ax25/ax25_out.c -F: net/ax25/ax25_timer.c -F: net/ax25/sysctl_net_ax25.c - -DAVICOM FAST ETHERNET (DMFE) NETWORK DRIVER -L: netdev@vger.kernel.org -S: Orphan -F: Documentation/networking/dmfe.txt -F: drivers/net/ethernet/dec/tulip/dmfe.c - -DC390/AM53C974 SCSI driver -M: Kurt Garloff <garloff@suse.de> -W: http://www.garloff.de/kurt/linux/dc390/ -M: Guennadi Liakhovetski <g.liakhovetski@gmx.de> -S: Maintained -F: drivers/scsi/tmscsim.* - -DC395x SCSI driver -M: Oliver Neukum <oliver@neukum.name> -M: Ali Akcaagac <aliakc@web.de> -M: Jamie Lenehan <lenehan@twibble.org> -W: http://twibble.org/dist/dc395x/ -L: dc395x@twibble.org -L: http://lists.twibble.org/mailman/listinfo/dc395x/ -S: Maintained -F: Documentation/scsi/dc395x.txt -F: drivers/scsi/dc395x.* - -DCCP PROTOCOL -M: Gerrit Renker <gerrit@erg.abdn.ac.uk> -L: dccp@vger.kernel.org -W: http://www.linuxfoundation.org/collaborate/workgroups/networking/dccp -S: Maintained -F: include/linux/dccp.h -F: include/linux/tfrc.h -F: net/dccp/ - -DECnet NETWORK LAYER -W: http://linux-decnet.sourceforge.net -L: linux-decnet-user@lists.sourceforge.net -S: Orphan -F: Documentation/networking/decnet.txt -F: net/decnet/ - -DEFXX FDDI NETWORK DRIVER -M: "Maciej W. Rozycki" <macro@linux-mips.org> -S: Maintained -F: drivers/net/fddi/defxx.* - -DELL LAPTOP DRIVER -M: Matthew Garrett <mjg59@srcf.ucam.org> -L: platform-driver-x86@vger.kernel.org -S: Maintained -F: drivers/platform/x86/dell-laptop.c - -DELL LAPTOP SMM DRIVER -M: Massimo Dal Zotto <dz@debian.org> -W: http://www.debian.org/~dz/i8k/ -S: Maintained -F: drivers/char/i8k.c -F: include/linux/i8k.h - -DELL SYSTEMS MANAGEMENT BASE DRIVER (dcdbas) -M: Doug Warzecha <Douglas_Warzecha@dell.com> -S: Maintained -F: Documentation/dcdbas.txt -F: drivers/firmware/dcdbas.* - -DELL WMI EXTRAS DRIVER -M: Matthew Garrett <mjg59@srcf.ucam.org> -S: Maintained -F: drivers/platform/x86/dell-wmi.c - -DESIGNWARE USB3 DRD IP DRIVER -M: Felipe Balbi <balbi@ti.com> -L: linux-usb@vger.kernel.org -L: linux-omap@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git -S: Maintained -F: drivers/usb/dwc3/ - -DEVICE FREQUENCY (DEVFREQ) -M: MyungJoo Ham <myungjoo.ham@samsung.com> -M: Kyungmin Park <kyungmin.park@samsung.com> -L: linux-kernel@vger.kernel.org -S: Maintained -F: drivers/devfreq/ - -DEVICE NUMBER REGISTRY -M: Torben Mathiasen <device@lanana.org> -W: http://lanana.org/docs/device-list/index.html -S: Maintained - -DEVICE-MAPPER (LVM) -M: Alasdair Kergon <agk@redhat.com> -M: dm-devel@redhat.com -L: dm-devel@redhat.com -W: http://sources.redhat.com/dm -Q: http://patchwork.kernel.org/project/dm-devel/list/ -T: quilt http://people.redhat.com/agk/patches/linux/editing/ -S: Maintained -F: Documentation/device-mapper/ -F: drivers/md/dm* -F: drivers/md/persistent-data/ -F: include/linux/device-mapper.h -F: include/linux/dm-*.h - -DIOLAN U2C-12 I2C DRIVER -M: Guenter Roeck <guenter.roeck@ericsson.com> -L: linux-i2c@vger.kernel.org -S: Maintained -F: drivers/i2c/busses/i2c-diolan-u2c.c - -DIRECTORY NOTIFICATION (DNOTIFY) -M: Eric Paris <eparis@parisplace.org> -S: Maintained -F: Documentation/filesystems/dnotify.txt -F: fs/notify/dnotify/ -F: include/linux/dnotify.h - -DISK GEOMETRY AND PARTITION HANDLING -M: Andries Brouwer <aeb@cwi.nl> -W: http://www.win.tue.nl/~aeb/linux/Large-Disk.html -W: http://www.win.tue.nl/~aeb/linux/zip/zip-1.html -W: http://www.win.tue.nl/~aeb/partitions/partition_types-1.html -S: Maintained - -DISKQUOTA -M: Jan Kara <jack@suse.cz> -S: Maintained -F: Documentation/filesystems/quota.txt -F: fs/quota/ -F: include/linux/quota*.h - -DISPLAYLINK USB 2.0 FRAMEBUFFER DRIVER (UDLFB) -M: Bernie Thompson <bernie@plugable.com> -L: linux-fbdev@vger.kernel.org -S: Maintained -W: http://plugable.com/category/projects/udlfb/ -F: drivers/video/udlfb.c -F: include/video/udlfb.h -F: Documentation/fb/udlfb.txt - -DISTRIBUTED LOCK MANAGER (DLM) -M: Christine Caulfield <ccaulfie@redhat.com> -M: David Teigland <teigland@redhat.com> -L: cluster-devel@redhat.com -W: http://sources.redhat.com/cluster/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm.git -S: Supported -F: fs/dlm/ - -DMA BUFFER SHARING FRAMEWORK -M: Sumit Semwal <sumit.semwal@linaro.org> -S: Maintained -L: linux-media@vger.kernel.org -L: dri-devel@lists.freedesktop.org -L: linaro-mm-sig@lists.linaro.org -F: drivers/base/dma-buf* -F: include/linux/dma-buf* -F: Documentation/dma-buf-sharing.txt -T: git git://git.linaro.org/people/sumitsemwal/linux-dma-buf.git - -DMA GENERIC OFFLOAD ENGINE SUBSYSTEM -M: Vinod Koul <vinod.koul@intel.com> -M: Dan Williams <dan.j.williams@intel.com> -S: Supported -F: drivers/dma/ -F: include/linux/dma* -T: git git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx.git -T: git git://git.infradead.org/users/vkoul/slave-dma.git (slave-dma) - -DME1737 HARDWARE MONITOR DRIVER -M: Juerg Haefliger <juergh@gmail.com> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/dme1737 -F: drivers/hwmon/dme1737.c - -DOCBOOK FOR DOCUMENTATION -M: Randy Dunlap <rdunlap@xenotime.net> -S: Maintained -F: scripts/kernel-doc - -DOCKING STATION DRIVER -M: Shaohua Li <shaohua.li@intel.com> -L: linux-acpi@vger.kernel.org -S: Supported -F: drivers/acpi/dock.c - -DOCUMENTATION -M: Randy Dunlap <rdunlap@xenotime.net> -L: linux-doc@vger.kernel.org -T: quilt http://xenotime.net/kernel-doc-patches/current/ -S: Maintained -F: Documentation/ - -DOUBLETALK DRIVER -M: "James R. Van Zandt" <jrv@vanzandt.mv.com> -L: blinux-list@redhat.com -S: Maintained -F: drivers/char/dtlk.c -F: include/linux/dtlk.h - -DPT_I2O SCSI RAID DRIVER -M: Adaptec OEM Raid Solutions <aacraid@adaptec.com> -L: linux-scsi@vger.kernel.org -W: http://www.adaptec.com/ -S: Maintained -F: drivers/scsi/dpt* -F: drivers/scsi/dpt/ - -DRBD DRIVER -P: Philipp Reisner -P: Lars Ellenberg -M: drbd-dev@lists.linbit.com -L: drbd-user@lists.linbit.com -W: http://www.drbd.org -T: git git://git.drbd.org/linux-2.6-drbd.git drbd -T: git git://git.drbd.org/drbd-8.3.git -S: Supported -F: drivers/block/drbd/ -F: lib/lru_cache.c -F: Documentation/blockdev/drbd/ - -DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS -M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git -S: Supported -F: Documentation/kobject.txt -F: drivers/base/ -F: fs/sysfs/ -F: fs/debugfs/ -F: include/linux/kobj* -F: include/linux/debugfs.h -F: lib/kobj* - -DRM DRIVERS -M: David Airlie <airlied@linux.ie> -L: dri-devel@lists.freedesktop.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git -S: Maintained -F: drivers/gpu/drm/ -F: include/drm/ - -INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets) -M: Keith Packard <keithp@keithp.com> -L: intel-gfx@lists.freedesktop.org (subscribers-only) -L: dri-devel@lists.freedesktop.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/keithp/linux.git -S: Supported -F: drivers/gpu/drm/i915 -F: include/drm/i915* - -DRM DRIVERS FOR EXYNOS -M: Inki Dae <inki.dae@samsung.com> -M: Joonyoung Shim <jy0922.shim@samsung.com> -M: Seung-Woo Kim <sw0312.kim@samsung.com> -M: Kyungmin Park <kyungmin.park@samsung.com> -L: dri-devel@lists.freedesktop.org -S: Supported -F: drivers/gpu/drm/exynos -F: include/drm/exynos* - -DSCC4 DRIVER -M: Francois Romieu <romieu@fr.zoreil.com> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/wan/dscc4.c - -DYNAMIC DEBUG -M: Jason Baron <jbaron@redhat.com> -S: Maintained -F: lib/dynamic_debug.c -F: include/linux/dynamic_debug.h - -DZ DECSTATION DZ11 SERIAL DRIVER -M: "Maciej W. Rozycki" <macro@linux-mips.org> -S: Maintained -F: drivers/tty/serial/dz.* - -EATA-DMA SCSI DRIVER -M: Michael Neuffer <mike@i-Connect.Net> -L: linux-eata@i-connect.net -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/eata* - -EATA ISA/EISA/PCI SCSI DRIVER -M: Dario Ballabio <ballabio_dario@emc.com> -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/eata.c - -EATA-PIO SCSI DRIVER -M: Michael Neuffer <mike@i-Connect.Net> -L: linux-eata@i-connect.net -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/eata_pio.* - -EBTABLES -M: Bart De Schuymer <bart.de.schuymer@pandora.be> -L: netfilter-devel@vger.kernel.org -W: http://ebtables.sourceforge.net/ -S: Maintained -F: include/linux/netfilter_bridge/ebt_*.h -F: net/bridge/netfilter/ebt*.c - -ECRYPT FILE SYSTEM -M: Tyler Hicks <tyhicks@canonical.com> -M: Dustin Kirkland <dustin.kirkland@gazzang.com> -L: ecryptfs@vger.kernel.org -W: https://launchpad.net/ecryptfs -S: Supported -F: Documentation/filesystems/ecryptfs.txt -F: fs/ecryptfs/ - -EDAC-CORE -M: Doug Thompson <dougthompson@xmission.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Supported -F: Documentation/edac.txt -F: drivers/edac/ -F: include/linux/edac.h - -EDAC-AMD64 -M: Doug Thompson <dougthompson@xmission.com> -M: Borislav Petkov <borislav.petkov@amd.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Supported -F: drivers/edac/amd64_edac* - -EDAC-E752X -M: Mark Gross <mark.gross@intel.com> -M: Doug Thompson <dougthompson@xmission.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/e752x_edac.c - -EDAC-E7XXX -M: Doug Thompson <dougthompson@xmission.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/e7xxx_edac.c - -EDAC-I82443BXGX -M: Tim Small <tim@buttersideup.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/i82443bxgx_edac.c - -EDAC-I3000 -M: Jason Uhlenkott <juhlenko@akamai.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/i3000_edac.c - -EDAC-I5000 -M: Doug Thompson <dougthompson@xmission.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/i5000_edac.c - -EDAC-I5400 -M: Mauro Carvalho Chehab <mchehab@redhat.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/i5400_edac.c - -EDAC-I7300 -M: Mauro Carvalho Chehab <mchehab@redhat.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/i7300_edac.c - -EDAC-I7CORE -M: Mauro Carvalho Chehab <mchehab@redhat.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/i7core_edac.c - -EDAC-I82975X -M: Ranganathan Desikan <ravi@jetztechnologies.com> -M: "Arvind R." <arvino55@gmail.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/i82975x_edac.c - -EDAC-PASEMI -M: Egor Martovetsky <egor@pasemi.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/pasemi_edac.c - -EDAC-R82600 -M: Tim Small <tim@buttersideup.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/r82600_edac.c - -EDAC-SBRIDGE -M: Mauro Carvalho Chehab <mchehab@redhat.com> -L: linux-edac@vger.kernel.org -W: bluesmoke.sourceforge.net -S: Maintained -F: drivers/edac/sb_edac.c - -EDIROL UA-101/UA-1000 DRIVER -M: Clemens Ladisch <clemens@ladisch.de> -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -T: git git://git.alsa-project.org/alsa-kernel.git -S: Maintained -F: sound/usb/misc/ua101.c - -EFIFB FRAMEBUFFER DRIVER -L: linux-fbdev@vger.kernel.org -M: Peter Jones <pjones@redhat.com> -S: Maintained -F: drivers/video/efifb.c - -EFS FILESYSTEM -W: http://aeschi.ch.eu.org/efs/ -S: Orphan -F: fs/efs/ - -EHCA (IBM GX bus InfiniBand adapter) DRIVER -M: Hoang-Nam Nguyen <hnguyen@de.ibm.com> -M: Christoph Raisch <raisch@de.ibm.com> -L: linux-rdma@vger.kernel.org -S: Supported -F: drivers/infiniband/hw/ehca/ - -EHEA (IBM pSeries eHEA 10Gb ethernet adapter) DRIVER -M: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/ibm/ehea/ - -EMBEDDED LINUX -M: Paul Gortmaker <paul.gortmaker@windriver.com> -M: Matt Mackall <mpm@selenic.com> -M: David Woodhouse <dwmw2@infradead.org> -L: linux-embedded@vger.kernel.org -S: Maintained - -EMULEX LPFC FC SCSI DRIVER -M: James Smart <james.smart@emulex.com> -L: linux-scsi@vger.kernel.org -W: http://sourceforge.net/projects/lpfcxxxx -S: Supported -F: drivers/scsi/lpfc/ - -ENE CB710 FLASH CARD READER DRIVER -M: MichaÅ‚ MirosÅ‚aw <mirq-linux@rere.qmqm.pl> -S: Maintained -F: drivers/misc/cb710/ -F: drivers/mmc/host/cb710-mmc.* -F: include/linux/cb710.h - -ENE KB2426 (ENE0100/ENE020XX) INFRARED RECEIVER -M: Maxim Levitsky <maximlevitsky@gmail.com> -S: Maintained -F: drivers/media/rc/ene_ir.* - -EPSON 1355 FRAMEBUFFER DRIVER -M: Christopher Hoover <ch@murgatroid.com> -M: Christopher Hoover <ch@hpl.hp.com> -S: Maintained -F: drivers/video/epson1355fb.c - -EPSON S1D13XXX FRAMEBUFFER DRIVER -M: Kristoffer Ericson <kristoffer.ericson@gmail.com> -S: Maintained -T: git git://git.kernel.org/pub/scm/linux/kernel/git/kristoffer/linux-hpc.git -F: drivers/video/s1d13xxxfb.c -F: include/video/s1d13xxxfb.h - -ETHEREXPRESS-16 NETWORK DRIVER -M: Philip Blundell <philb@gnu.org> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/i825xx/eexpress.* - -ETHERNET BRIDGE -M: Stephen Hemminger <shemminger@vyatta.com> -L: bridge@lists.linux-foundation.org -L: netdev@vger.kernel.org -W: http://www.linuxfoundation.org/en/Net:Bridge -S: Maintained -F: include/linux/netfilter_bridge/ -F: net/bridge/ - -ETHERTEAM 16I DRIVER -M: Mika Kuoppala <miku@iki.fi> -S: Maintained -F: drivers/net/ethernet/fujitsu/eth16i.c - -EXT2 FILE SYSTEM -M: Jan Kara <jack@suse.cz> -L: linux-ext4@vger.kernel.org -S: Maintained -F: Documentation/filesystems/ext2.txt -F: fs/ext2/ -F: include/linux/ext2* - -EXT3 FILE SYSTEM -M: Jan Kara <jack@suse.cz> -M: Andrew Morton <akpm@linux-foundation.org> -M: Andreas Dilger <adilger.kernel@dilger.ca> -L: linux-ext4@vger.kernel.org -S: Maintained -F: Documentation/filesystems/ext3.txt -F: fs/ext3/ -F: include/linux/ext3* - -EXT4 FILE SYSTEM -M: "Theodore Ts'o" <tytso@mit.edu> -M: Andreas Dilger <adilger.kernel@dilger.ca> -L: linux-ext4@vger.kernel.org -W: http://ext4.wiki.kernel.org -Q: http://patchwork.ozlabs.org/project/linux-ext4/list/ -S: Maintained -F: Documentation/filesystems/ext4.txt -F: fs/ext4/ - -Extended Verification Module (EVM) -M: Mimi Zohar <zohar@us.ibm.com> -S: Supported -F: security/integrity/evm/ - -EXYNOS DP DRIVER -M: Jingoo Han <jg1.han@samsung.com> -L: linux-fbdev@vger.kernel.org -S: Maintained -F: drivers/video/exynos/exynos_dp* - -EXYNOS MIPI DISPLAY DRIVERS -M: Inki Dae <inki.dae@samsung.com> -M: Donghwa Lee <dh09.lee@samsung.com> -M: Kyungmin Park <kyungmin.park@samsung.com> -L: linux-fbdev@vger.kernel.org -S: Maintained -F: drivers/video/exynos/exynos_mipi* -F: include/video/exynos_mipi* - -F71805F HARDWARE MONITORING DRIVER -M: Jean Delvare <khali@linux-fr.org> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/f71805f -F: drivers/hwmon/f71805f.c - -FANOTIFY -M: Eric Paris <eparis@redhat.com> -S: Maintained -F: fs/notify/fanotify/ -F: include/linux/fanotify.h - -FARSYNC SYNCHRONOUS DRIVER -M: Kevin Curtis <kevin.curtis@farsite.co.uk> -W: http://www.farsite.co.uk/ -S: Supported -F: drivers/net/wan/farsync.* - -FAULT INJECTION SUPPORT -M: Akinobu Mita <akinobu.mita@gmail.com> -S: Supported -F: Documentation/fault-injection/ -F: lib/fault-inject.c - -FCOE SUBSYSTEM (libfc, libfcoe, fcoe) -M: Robert Love <robert.w.love@intel.com> -L: devel@open-fcoe.org -W: www.Open-FCoE.org -S: Supported -F: drivers/scsi/libfc/ -F: drivers/scsi/fcoe/ -F: include/scsi/fc/ -F: include/scsi/libfc.h -F: include/scsi/libfcoe.h - -FILE LOCKING (flock() and fcntl()/lockf()) -M: Matthew Wilcox <matthew@wil.cx> -L: linux-fsdevel@vger.kernel.org -S: Maintained -F: include/linux/fcntl.h -F: include/linux/fs.h -F: fs/fcntl.c -F: fs/locks.c - -FILESYSTEMS (VFS and infrastructure) -M: Alexander Viro <viro@zeniv.linux.org.uk> -L: linux-fsdevel@vger.kernel.org -S: Maintained -F: fs/* - -FINTEK F75375S HARDWARE MONITOR AND FAN CONTROLLER DRIVER -M: Riku Voipio <riku.voipio@iki.fi> -L: lm-sensors@lm-sensors.org -S: Maintained -F: drivers/hwmon/f75375s.c -F: include/linux/f75375s.h - -FIREWIRE AUDIO DRIVERS -M: Clemens Ladisch <clemens@ladisch.de> -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -T: git git://git.alsa-project.org/alsa-kernel.git -S: Maintained -F: sound/firewire/ - -FIREWIRE SUBSYSTEM -M: Stefan Richter <stefanr@s5r6.in-berlin.de> -L: linux1394-devel@lists.sourceforge.net -W: http://ieee1394.wiki.kernel.org/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394.git -S: Maintained -F: drivers/firewire/ -F: include/linux/firewire*.h -F: tools/firewire/ - -FIRMWARE LOADER (request_firmware) -S: Orphan -F: Documentation/firmware_class/ -F: drivers/base/firmware*.c -F: include/linux/firmware.h - -FPU EMULATOR -M: Bill Metzenthen <billm@melbpc.org.au> -W: http://floatingpoint.sourceforge.net/emulator/index.html -S: Maintained -F: arch/x86/math-emu/ - -FRAME RELAY DLCI/FRAD (Sangoma drivers too) -L: netdev@vger.kernel.org -S: Orphan -F: drivers/net/wan/dlci.c -F: drivers/net/wan/sdla.c - -FRAMEBUFFER LAYER -M: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> -L: linux-fbdev@vger.kernel.org -W: http://linux-fbdev.sourceforge.net/ -Q: http://patchwork.kernel.org/project/linux-fbdev/list/ -T: git git://github.com/schandinat/linux-2.6.git fbdev-next -S: Maintained -F: Documentation/fb/ -F: Documentation/devicetree/bindings/fb/ -F: drivers/video/ -F: include/video/ -F: include/linux/fb.h - -FREESCALE DMA DRIVER -M: Li Yang <leoli@freescale.com> -M: Zhang Wei <zw@zh-kernel.org> -L: linuxppc-dev@lists.ozlabs.org -S: Maintained -F: drivers/dma/fsldma.* - -FREESCALE I2C CPM DRIVER -M: Jochen Friedrich <jochen@scram.de> -L: linuxppc-dev@lists.ozlabs.org -L: linux-i2c@vger.kernel.org -S: Maintained -F: drivers/i2c/busses/i2c-cpm.c - -FREESCALE IMX / MXC FRAMEBUFFER DRIVER -M: Sascha Hauer <kernel@pengutronix.de> -L: linux-fbdev@vger.kernel.org -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: arch/arm/plat-mxc/include/mach/imxfb.h -F: drivers/video/imxfb.c - -FREESCALE SOC FS_ENET DRIVER -M: Pantelis Antoniou <pantelis.antoniou@gmail.com> -M: Vitaly Bordug <vbordug@ru.mvista.com> -L: linuxppc-dev@lists.ozlabs.org -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/freescale/fs_enet/ -F: include/linux/fs_enet_pd.h - -FREESCALE QUICC ENGINE LIBRARY -M: Timur Tabi <timur@freescale.com> -L: linuxppc-dev@lists.ozlabs.org -S: Supported -F: arch/powerpc/sysdev/qe_lib/ -F: arch/powerpc/include/asm/*qe.h - -FREESCALE USB PERIPHERAL DRIVERS -M: Li Yang <leoli@freescale.com> -L: linux-usb@vger.kernel.org -L: linuxppc-dev@lists.ozlabs.org -S: Maintained -F: drivers/usb/gadget/fsl* - -FREESCALE QUICC ENGINE UCC ETHERNET DRIVER -M: Li Yang <leoli@freescale.com> -L: netdev@vger.kernel.org -L: linuxppc-dev@lists.ozlabs.org -S: Maintained -F: drivers/net/ethernet/freescale/ucc_geth* - -FREESCALE QUICC ENGINE UCC UART DRIVER -M: Timur Tabi <timur@freescale.com> -L: linuxppc-dev@lists.ozlabs.org -S: Supported -F: drivers/tty/serial/ucc_uart.c - -FREESCALE SOC SOUND DRIVERS -M: Timur Tabi <timur@freescale.com> -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -L: linuxppc-dev@lists.ozlabs.org -S: Supported -F: sound/soc/fsl/fsl* -F: sound/soc/fsl/mpc8610_hpcd.c - -FREEVXFS FILESYSTEM -M: Christoph Hellwig <hch@infradead.org> -W: ftp://ftp.openlinux.org/pub/people/hch/vxfs -S: Maintained -F: fs/freevxfs/ - -FREEZER -M: Pavel Machek <pavel@ucw.cz> -M: "Rafael J. Wysocki" <rjw@sisk.pl> -L: linux-pm@vger.kernel.org -S: Supported -F: Documentation/power/freezing-of-tasks.txt -F: include/linux/freezer.h -F: kernel/freezer.c - -FS-CACHE: LOCAL CACHING FOR NETWORK FILESYSTEMS -M: David Howells <dhowells@redhat.com> -L: linux-cachefs@redhat.com -S: Supported -F: Documentation/filesystems/caching/ -F: fs/fscache/ -F: include/linux/fscache*.h - -FUJITSU FR-V (FRV) PORT -M: David Howells <dhowells@redhat.com> -S: Maintained -F: arch/frv/ - -FUJITSU LAPTOP EXTRAS -M: Jonathan Woithe <jwoithe@physics.adelaide.edu.au> -L: platform-driver-x86@vger.kernel.org -S: Maintained -F: drivers/platform/x86/fujitsu-laptop.c - -FUJITSU M-5MO LS CAMERA ISP DRIVER -M: Kyungmin Park <kyungmin.park@samsung.com> -M: Heungjun Kim <riverful.kim@samsung.com> -L: linux-media@vger.kernel.org -S: Maintained -F: drivers/media/video/m5mols/ -F: include/media/m5mols.h - -FUJITSU TABLET EXTRAS -M: Robert Gerlach <khnz@gmx.de> -L: platform-driver-x86@vger.kernel.org -S: Maintained -F: drivers/platform/x86/fujitsu-tablet.c - -FUSE: FILESYSTEM IN USERSPACE -M: Miklos Szeredi <miklos@szeredi.hu> -L: fuse-devel@lists.sourceforge.net -W: http://fuse.sourceforge.net/ -S: Maintained -F: fs/fuse/ -F: include/linux/fuse.h - -FUTURE DOMAIN TMC-16x0 SCSI DRIVER (16-bit) -M: Rik Faith <faith@cs.unc.edu> -L: linux-scsi@vger.kernel.org -S: Odd Fixes (e.g., new signatures) -F: drivers/scsi/fdomain.* - -GDT SCSI DISK ARRAY CONTROLLER DRIVER -M: Achim Leubner <achim_leubner@adaptec.com> -L: linux-scsi@vger.kernel.org -W: http://www.icp-vortex.com/ -S: Supported -F: drivers/scsi/gdt* - -GENERIC GPIO I2C DRIVER -M: Haavard Skinnemoen <hskinnemoen@gmail.com> -S: Supported -F: drivers/i2c/busses/i2c-gpio.c -F: include/linux/i2c-gpio.h - -GENERIC GPIO I2C MULTIPLEXER DRIVER -M: Peter Korsgaard <peter.korsgaard@barco.com> -L: linux-i2c@vger.kernel.org -S: Supported -F: drivers/i2c/muxes/gpio-i2cmux.c -F: include/linux/gpio-i2cmux.h -F: Documentation/i2c/muxes/gpio-i2cmux - -GENERIC HDLC (WAN) DRIVERS -M: Krzysztof Halasa <khc@pm.waw.pl> -W: http://www.kernel.org/pub/linux/utils/net/hdlc/ -S: Maintained -F: drivers/net/wan/c101.c -F: drivers/net/wan/hd6457* -F: drivers/net/wan/hdlc* -F: drivers/net/wan/n2.c -F: drivers/net/wan/pc300too.c -F: drivers/net/wan/pci200syn.c -F: drivers/net/wan/wanxl* - -GENERIC INCLUDE/ASM HEADER FILES -M: Arnd Bergmann <arnd@arndb.de> -L: linux-arch@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic.git -S: Maintained -F: include/asm-generic - -GENERIC UIO DRIVER FOR PCI DEVICES -M: "Michael S. Tsirkin" <mst@redhat.com> -L: kvm@vger.kernel.org -S: Supported -F: drivers/uio/uio_pci_generic.c - -GFS2 FILE SYSTEM -M: Steven Whitehouse <swhiteho@redhat.com> -L: cluster-devel@redhat.com -W: http://sources.redhat.com/cluster/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes.git -T: git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw.git -S: Supported -F: Documentation/filesystems/gfs2*.txt -F: fs/gfs2/ -F: include/linux/gfs2_ondisk.h - -GIGASET ISDN DRIVERS -M: Hansjoerg Lipp <hjlipp@web.de> -M: Tilman Schmidt <tilman@imap.cc> -L: gigaset307x-common@lists.sourceforge.net -W: http://gigaset307x.sourceforge.net/ -S: Maintained -F: Documentation/isdn/README.gigaset -F: drivers/isdn/gigaset/ -F: include/linux/gigaset_dev.h - -GPIO SUBSYSTEM -M: Grant Likely <grant.likely@secretlab.ca> -M: Linus Walleij <linus.walleij@stericsson.com> -S: Maintained -T: git git://git.secretlab.ca/git/linux-2.6.git -F: Documentation/gpio.txt -F: drivers/gpio/ -F: include/linux/gpio* - -GRE DEMULTIPLEXER DRIVER -M: Dmitry Kozlov <xeb@mail.ru> -L: netdev@vger.kernel.org -S: Maintained -F: net/ipv4/gre.c -F: include/net/gre.h - -GRETH 10/100/1G Ethernet MAC device driver -M: Kristoffer Glembo <kristoffer@gaisler.com> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/aeroflex/ - -GSPCA FINEPIX SUBDRIVER -M: Frank Zago <frank@zago.net> -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: drivers/media/video/gspca/finepix.c - -GSPCA GL860 SUBDRIVER -M: Olivier Lorin <o.lorin@laposte.net> -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: drivers/media/video/gspca/gl860/ - -GSPCA M5602 SUBDRIVER -M: Erik Andren <erik.andren@gmail.com> -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: drivers/media/video/gspca/m5602/ - -GSPCA PAC207 SONIXB SUBDRIVER -M: Hans de Goede <hdegoede@redhat.com> -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: drivers/media/video/gspca/pac207.c - -GSPCA SN9C20X SUBDRIVER -M: Brian Johnson <brijohn@gmail.com> -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: drivers/media/video/gspca/sn9c20x.c - -GSPCA T613 SUBDRIVER -M: Leandro Costantino <lcostantino@gmail.com> -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: drivers/media/video/gspca/t613.c - -GSPCA USB WEBCAM DRIVER -M: Jean-Francois Moine <moinejf@free.fr> -W: http://moinejf.free.fr -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: drivers/media/video/gspca/ - -HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER -M: Frank Seidel <frank@f-seidel.de> -L: platform-driver-x86@vger.kernel.org -W: http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/ -S: Maintained -F: drivers/platform/x86/hdaps.c - -HWPOISON MEMORY FAILURE HANDLING -M: Andi Kleen <andi@firstfloor.org> -L: linux-mm@kvack.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6.git hwpoison -S: Maintained -F: mm/memory-failure.c -F: mm/hwpoison-inject.c - -HYPERVISOR VIRTUAL CONSOLE DRIVER -L: linuxppc-dev@lists.ozlabs.org -S: Odd Fixes -F: drivers/tty/hvc/ - -HARDWARE MONITORING -M: Jean Delvare <khali@linux-fr.org> -M: Guenter Roeck <guenter.roeck@ericsson.com> -L: lm-sensors@lm-sensors.org -W: http://www.lm-sensors.org/ -T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-hwmon/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git -S: Maintained -F: Documentation/hwmon/ -F: drivers/hwmon/ -F: include/linux/hwmon*.h - -HARDWARE RANDOM NUMBER GENERATOR CORE -M: Matt Mackall <mpm@selenic.com> -M: Herbert Xu <herbert@gondor.apana.org.au> -S: Odd fixes -F: Documentation/hw_random.txt -F: drivers/char/hw_random/ -F: include/linux/hw_random.h - -HARDWARE SPINLOCK CORE -M: Ohad Ben-Cohen <ohad@wizery.com> -S: Maintained -F: Documentation/hwspinlock.txt -F: drivers/hwspinlock/hwspinlock_* -F: include/linux/hwspinlock.h - -HARMONY SOUND DRIVER -L: linux-parisc@vger.kernel.org -S: Maintained -F: sound/parisc/harmony.* - -HEWLETT-PACKARD SMART2 RAID DRIVER -M: Chirag Kantharia <chirag.kantharia@hp.com> -L: iss_storagedev@hp.com -S: Maintained -F: Documentation/blockdev/cpqarray.txt -F: drivers/block/cpqarray.* - -HEWLETT-PACKARD SMART ARRAY RAID DRIVER (hpsa) -M: "Stephen M. Cameron" <scameron@beardog.cce.hp.com> -L: iss_storagedev@hp.com -S: Supported -F: Documentation/scsi/hpsa.txt -F: drivers/scsi/hpsa*.[ch] -F: include/linux/cciss*.h - -HEWLETT-PACKARD SMART CISS RAID DRIVER (cciss) -M: Mike Miller <mike.miller@hp.com> -L: iss_storagedev@hp.com -S: Supported -F: Documentation/blockdev/cciss.txt -F: drivers/block/cciss* -F: include/linux/cciss_ioctl.h - -HFS FILESYSTEM -L: linux-fsdevel@vger.kernel.org -S: Orphan -F: Documentation/filesystems/hfs.txt -F: fs/hfs/ - -HGA FRAMEBUFFER DRIVER -M: Ferenc Bakonyi <fero@drama.obuda.kando.hu> -L: linux-nvidia@lists.surfsouth.com -W: http://drama.obuda.kando.hu/~fero/cgi-bin/hgafb.shtml -S: Maintained -F: drivers/video/hgafb.c - -HIBERNATION (aka Software Suspend, aka swsusp) -M: Pavel Machek <pavel@ucw.cz> -M: "Rafael J. Wysocki" <rjw@sisk.pl> -L: linux-pm@vger.kernel.org -S: Supported -F: arch/x86/power/ -F: drivers/base/power/ -F: kernel/power/ -F: include/linux/suspend.h -F: include/linux/freezer.h -F: include/linux/pm.h -F: arch/*/include/asm/suspend*.h - -HID CORE LAYER -M: Jiri Kosina <jkosina@suse.cz> -L: linux-input@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git -S: Maintained -F: drivers/hid/ -F: include/linux/hid* - -HIGH-RESOLUTION TIMERS, CLOCKEVENTS, DYNTICKS -M: Thomas Gleixner <tglx@linutronix.de> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core -S: Maintained -F: Documentation/timers/ -F: kernel/hrtimer.c -F: kernel/time/clockevents.c -F: kernel/time/tick*.* -F: kernel/time/timer_*.c -F: include/linux/clockchips.h -F: include/linux/hrtimer.h - -HIGH-SPEED SCC DRIVER FOR AX.25 -M: Klaus Kudielka <klaus.kudielka@ieee.org> -L: linux-hams@vger.kernel.org -W: http://www.nt.tuwien.ac.at/~kkudielk/Linux/ -S: Maintained -F: drivers/net/hamradio/dmascc.c -F: drivers/net/hamradio/scc.c - -HIGHPOINT ROCKETRAID 3xxx RAID DRIVER -M: HighPoint Linux Team <linux@highpoint-tech.com> -W: http://www.highpoint-tech.com -S: Supported -F: Documentation/scsi/hptiop.txt -F: drivers/scsi/hptiop.c - -HIPPI -M: Jes Sorensen <jes@trained-monkey.org> -L: linux-hippi@sunsite.dk -S: Maintained -F: include/linux/hippidevice.h -F: include/linux/if_hippi.h -F: net/802/hippi.c -F: drivers/net/hippi/ - -HOST AP DRIVER -M: Jouni Malinen <j@w1.fi> -L: hostap@shmoo.com (subscribers-only) -L: linux-wireless@vger.kernel.org -W: http://hostap.epitest.fi/ -S: Maintained -F: drivers/net/wireless/hostap/ - -HP COMPAQ TC1100 TABLET WMI EXTRAS DRIVER -L: platform-driver-x86@vger.kernel.org -S: Orphan -F: drivers/platform/x86/tc1100-wmi.c - -HP100: Driver for HP 10/100 Mbit/s Voice Grade Network Adapter Series -M: Jaroslav Kysela <perex@perex.cz> -S: Maintained -F: drivers/net/ethernet/hp/hp100.* - -HPET: High Precision Event Timers driver -M: Clemens Ladisch <clemens@ladisch.de> -S: Maintained -F: Documentation/timers/hpet.txt -F: drivers/char/hpet.c -F: include/linux/hpet.h - -HPET: x86 -M: "Venkatesh Pallipadi (Venki)" <venki@google.com> -S: Maintained -F: arch/x86/kernel/hpet.c -F: arch/x86/include/asm/hpet.h - -HPFS FILESYSTEM -M: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> -W: http://artax.karlin.mff.cuni.cz/~mikulas/vyplody/hpfs/index-e.cgi -S: Maintained -F: fs/hpfs/ - -HSO 3G MODEM DRIVER -M: Jan Dumon <j.dumon@option.com> -W: http://www.pharscape.org -S: Maintained -F: drivers/net/usb/hso.c - -HTCPEN TOUCHSCREEN DRIVER -M: Pau Oliva Fora <pof@eslack.org> -L: linux-input@vger.kernel.org -S: Maintained -F: drivers/input/touchscreen/htcpen.c - -HUGETLB FILESYSTEM -M: William Irwin <wli@holomorphy.com> -S: Maintained -F: fs/hugetlbfs/ - -Hyper-V CORE AND DRIVERS -M: K. Y. Srinivasan <kys@microsoft.com> -M: Haiyang Zhang <haiyangz@microsoft.com> -L: devel@linuxdriverproject.org -S: Maintained -F: drivers/hv/ -F: drivers/hid/hid-hyperv.c -F: drivers/net/hyperv/ -F: drivers/staging/hv/ - -I2C/SMBUS STUB DRIVER -M: "Mark M. Hoffman" <mhoffman@lightlink.com> -L: linux-i2c@vger.kernel.org -S: Maintained -F: drivers/i2c/busses/i2c-stub.c - -I2C SUBSYSTEM -M: "Jean Delvare (PC drivers, core)" <khali@linux-fr.org> -M: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org> -M: "Wolfram Sang (embedded platforms)" <w.sang@pengutronix.de> -L: linux-i2c@vger.kernel.org -W: http://i2c.wiki.kernel.org/ -T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-i2c/ -T: git git://git.fluff.org/bjdooks/linux.git -S: Maintained -F: Documentation/i2c/ -F: drivers/i2c/ -F: include/linux/i2c.h -F: include/linux/i2c-*.h - -I2C-TINY-USB DRIVER -M: Till Harbaum <till@harbaum.org> -L: linux-i2c@vger.kernel.org -W: http://www.harbaum.org/till/i2c_tiny_usb -S: Maintained -F: drivers/i2c/busses/i2c-tiny-usb.c - -i386 BOOT CODE -M: "H. Peter Anvin" <hpa@zytor.com> -S: Maintained -F: arch/x86/boot/ - -i386 SETUP CODE / CPU ERRATA WORKAROUNDS -M: "H. Peter Anvin" <hpa@zytor.com> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup.git -S: Maintained - -IA64 (Itanium) PLATFORM -M: Tony Luck <tony.luck@intel.com> -M: Fenghua Yu <fenghua.yu@intel.com> -L: linux-ia64@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git -S: Maintained -F: arch/ia64/ - -IBM MCA SCSI SUBSYSTEM DRIVER -M: Michael Lang <langa2@kph.uni-mainz.de> -W: http://www.uni-mainz.de/~langm000/linux.html -S: Maintained -F: drivers/scsi/ibmmca.c - -IBM Power Linux RAID adapter -M: Brian King <brking@us.ibm.com> -S: Supported -F: drivers/scsi/ipr.* - -IBM Power Virtual Ethernet Device Driver -M: Santiago Leon <santil@linux.vnet.ibm.com> -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/ethernet/ibm/ibmveth.* - -IBM ServeRAID RAID DRIVER -P: Jack Hammer -M: Dave Jeffery <ipslinux@adaptec.com> -W: http://www.developer.ibm.com/welcome/netfinity/serveraid.html -S: Supported -F: drivers/scsi/ips.* - -IDE SUBSYSTEM -M: "David S. Miller" <davem@davemloft.net> -L: linux-ide@vger.kernel.org -Q: http://patchwork.ozlabs.org/project/linux-ide/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide.git -S: Maintained -F: Documentation/ide/ -F: drivers/ide/ -F: include/linux/ide.h - -IDEAPAD LAPTOP EXTRAS DRIVER -M: Ike Panhc <ike.pan@canonical.com> -L: platform-driver-x86@vger.kernel.org -W: http://launchpad.net/ideapad-laptop -S: Maintained -F: drivers/platform/x86/ideapad-laptop.c - -IDE/ATAPI DRIVERS -M: Borislav Petkov <petkovbb@gmail.com> -L: linux-ide@vger.kernel.org -S: Maintained -F: Documentation/cdrom/ide-cd -F: drivers/ide/ide-cd* - -IDLE-I7300 -M: Andy Henroid <andrew.d.henroid@intel.com> -L: linux-pm@vger.kernel.org -S: Supported -F: drivers/idle/i7300_idle.c - -IEEE 802.15.4 SUBSYSTEM -M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> -M: Sergey Lapin <slapin@ossfans.org> -L: linux-zigbee-devel@lists.sourceforge.net (moderated for non-subscribers) -W: http://apps.sourceforge.net/trac/linux-zigbee -T: git git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan.git -S: Maintained -F: net/ieee802154/ -F: drivers/ieee802154/ - -IIO SUBSYSTEM AND DRIVERS -M: Jonathan Cameron <jic23@cam.ac.uk> -L: linux-iio@vger.kernel.org -S: Maintained -F: drivers/staging/iio/ - -IKANOS/ADI EAGLE ADSL USB DRIVER -M: Matthieu Castet <castet.matthieu@free.fr> -M: Stanislaw Gruszka <stf_xl@wp.pl> -S: Maintained -F: drivers/usb/atm/ueagle-atm.c - -INTEGRITY MEASUREMENT ARCHITECTURE (IMA) -M: Mimi Zohar <zohar@us.ibm.com> -S: Supported -F: security/integrity/ima/ - -IMS TWINTURBO FRAMEBUFFER DRIVER -L: linux-fbdev@vger.kernel.org -S: Orphan -F: drivers/video/imsttfb.c - -INFINIBAND SUBSYSTEM -M: Roland Dreier <roland@kernel.org> -M: Sean Hefty <sean.hefty@intel.com> -M: Hal Rosenstock <hal.rosenstock@gmail.com> -L: linux-rdma@vger.kernel.org -W: http://www.openfabrics.org/ -Q: http://patchwork.kernel.org/project/linux-rdma/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband.git -S: Supported -F: Documentation/infiniband/ -F: drivers/infiniband/ -F: include/linux/if_infiniband.h - -INOTIFY -M: John McCutchan <john@johnmccutchan.com> -M: Robert Love <rlove@rlove.org> -M: Eric Paris <eparis@parisplace.org> -S: Maintained -F: Documentation/filesystems/inotify.txt -F: fs/notify/inotify/ -F: include/linux/inotify.h - -INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS -M: Dmitry Torokhov <dmitry.torokhov@gmail.com> -M: Dmitry Torokhov <dtor@mail.ru> -L: linux-input@vger.kernel.org -Q: http://patchwork.kernel.org/project/linux-input/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git -S: Maintained -F: drivers/input/ - -INPUT MULTITOUCH (MT) PROTOCOL -M: Henrik Rydberg <rydberg@euromail.se> -L: linux-input@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/rydberg/input-mt.git -S: Maintained -F: Documentation/input/multi-touch-protocol.txt -F: drivers/input/input-mt.c -K: \b(ABS|SYN)_MT_ - -INTEL C600 SERIES SAS CONTROLLER DRIVER -M: Intel SCU Linux support <intel-linux-scu@intel.com> -M: Dan Williams <dan.j.williams@intel.com> -M: Dave Jiang <dave.jiang@intel.com> -M: Ed Nadolski <edmund.nadolski@intel.com> -L: linux-scsi@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git -S: Maintained -F: drivers/scsi/isci/ -F: firmware/isci/ - -INTEL IDLE DRIVER -M: Len Brown <lenb@kernel.org> -L: linux-pm@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git -S: Supported -F: drivers/idle/intel_idle.c - -INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) -M: Maik Broemme <mbroemme@plusserver.de> -L: linux-fbdev@vger.kernel.org -S: Maintained -F: Documentation/fb/intelfb.txt -F: drivers/video/intelfb/ - -INTEL 810/815 FRAMEBUFFER DRIVER -M: Antonino Daplas <adaplas@gmail.com> -L: linux-fbdev@vger.kernel.org -S: Maintained -F: drivers/video/i810/ - -INTEL MENLOW THERMAL DRIVER -M: Sujith Thomas <sujith.thomas@intel.com> -L: platform-driver-x86@vger.kernel.org -W: http://www.lesswatts.org/projects/acpi/ -S: Supported -F: drivers/platform/x86/intel_menlow.c - -INTEL IA32 MICROCODE UPDATE SUPPORT -M: Tigran Aivazian <tigran@aivazian.fsnet.co.uk> -S: Maintained -F: arch/x86/kernel/microcode_core.c -F: arch/x86/kernel/microcode_intel.c - -INTEL I/OAT DMA DRIVER -M: Dan Williams <dan.j.williams@intel.com> -S: Supported -F: drivers/dma/ioat* - -INTEL IOMMU (VT-d) -M: David Woodhouse <dwmw2@infradead.org> -L: iommu@lists.linux-foundation.org -T: git git://git.infradead.org/iommu-2.6.git -S: Supported -F: drivers/iommu/intel-iommu.c -F: include/linux/intel-iommu.h - -INTEL IOP-ADMA DMA DRIVER -M: Dan Williams <dan.j.williams@intel.com> -S: Maintained -F: drivers/dma/iop-adma.c - -INTEL IXP4XX QMGR, NPE, ETHERNET and HSS SUPPORT -M: Krzysztof Halasa <khc@pm.waw.pl> -S: Maintained -F: arch/arm/mach-ixp4xx/include/mach/qmgr.h -F: arch/arm/mach-ixp4xx/include/mach/npe.h -F: arch/arm/mach-ixp4xx/ixp4xx_qmgr.c -F: arch/arm/mach-ixp4xx/ixp4xx_npe.c -F: drivers/net/ethernet/xscale/ixp4xx_eth.c -F: drivers/net/wan/ixp4xx_hss.c - -INTEL IXP4XX RANDOM NUMBER GENERATOR SUPPORT -M: Deepak Saxena <dsaxena@plexity.net> -S: Maintained -F: drivers/char/hw_random/ixp4xx-rng.c - -INTEL IXP2000 ETHERNET DRIVER -M: Lennert Buytenhek <kernel@wantstofly.org> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/xscale/ixp2000/ - -INTEL ETHERNET DRIVERS (e100/e1000/e1000e/igb/igbvf/ixgb/ixgbe/ixgbevf) -M: Jeff Kirsher <jeffrey.t.kirsher@intel.com> -M: Jesse Brandeburg <jesse.brandeburg@intel.com> -M: Bruce Allan <bruce.w.allan@intel.com> -M: Carolyn Wyborny <carolyn.wyborny@intel.com> -M: Don Skidmore <donald.c.skidmore@intel.com> -M: Greg Rose <gregory.v.rose@intel.com> -M: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> -M: Alex Duyck <alexander.h.duyck@intel.com> -M: John Ronciak <john.ronciak@intel.com> -L: e1000-devel@lists.sourceforge.net -W: http://e1000.sourceforge.net/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net.git -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next.git -S: Supported -F: Documentation/networking/e100.txt -F: Documentation/networking/e1000.txt -F: Documentation/networking/e1000e.txt -F: Documentation/networking/igb.txt -F: Documentation/networking/igbvf.txt -F: Documentation/networking/ixgb.txt -F: Documentation/networking/ixgbe.txt -F: Documentation/networking/ixgbevf.txt -F: drivers/net/ethernet/intel/ - -INTEL MRST PMU DRIVER -M: Len Brown <len.brown@intel.com> -L: linux-pm@vger.kernel.org -S: Supported -F: arch/x86/platform/mrst/pmu.* - -INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT -M: Stanislav Yakovlev <stas.yakovlev@gmail.com> -L: linux-wireless@vger.kernel.org -S: Maintained -F: Documentation/networking/README.ipw2100 -F: Documentation/networking/README.ipw2200 -F: drivers/net/wireless/ipw2x00/ - -INTEL(R) TRUSTED EXECUTION TECHNOLOGY (TXT) -M: Joseph Cihula <joseph.cihula@intel.com> -M: Shane Wang <shane.wang@intel.com> -L: tboot-devel@lists.sourceforge.net -W: http://tboot.sourceforge.net -T: Mercurial http://www.bughost.org/repos.hg/tboot.hg -S: Supported -F: Documentation/intel_txt.txt -F: include/linux/tboot.h -F: arch/x86/kernel/tboot.c - -INTEL WIRELESS WIMAX CONNECTION 2400 -M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> -M: linux-wimax@intel.com -L: wimax@linuxwimax.org -S: Supported -W: http://linuxwimax.org -F: Documentation/wimax/README.i2400m -F: drivers/net/wimax/i2400m/ -F: include/linux/wimax/i2400m.h - -INTEL WIRELESS 3945ABG/BG, 4965AGN (iwlegacy) -M: Stanislaw Gruszka <sgruszka@redhat.com> -L: linux-wireless@vger.kernel.org -S: Supported -F: drivers/net/wireless/iwlegacy/ - -INTEL WIRELESS WIFI LINK (iwlwifi) -M: Wey-Yi Guy <wey-yi.w.guy@intel.com> -M: Intel Linux Wireless <ilw@linux.intel.com> -L: linux-wireless@vger.kernel.org -W: http://intellinuxwireless.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi.git -S: Supported -F: drivers/net/wireless/iwlwifi/ - -INTEL WIRELESS MULTICOMM 3200 WIFI (iwmc3200wifi) -M: Samuel Ortiz <samuel.ortiz@intel.com> -M: Intel Linux Wireless <ilw@linux.intel.com> -L: linux-wireless@vger.kernel.org -S: Supported -W: http://wireless.kernel.org/en/users/Drivers/iwmc3200wifi -F: drivers/net/wireless/iwmc3200wifi/ - -IOC3 ETHERNET DRIVER -M: Ralf Baechle <ralf@linux-mips.org> -L: linux-mips@linux-mips.org -S: Maintained -F: drivers/net/ethernet/sgi/ioc3-eth.c - -IOC3 SERIAL DRIVER -M: Pat Gefre <pfg@sgi.com> -L: linux-serial@vger.kernel.org -S: Maintained -F: drivers/tty/serial/ioc3_serial.c - -IP MASQUERADING -M: Juanjo Ciarlante <jjciarla@raiz.uncu.edu.ar> -S: Maintained -F: net/ipv4/netfilter/ipt_MASQUERADE.c - -IP1000A 10/100/1000 GIGABIT ETHERNET DRIVER -M: Francois Romieu <romieu@fr.zoreil.com> -M: Sorbica Shieh <sorbica@icplus.com.tw> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/icplus/ipg.* - -IPATH DRIVER -M: Mike Marciniszyn <infinipath@qlogic.com> -L: linux-rdma@vger.kernel.org -S: Maintained -F: drivers/infiniband/hw/ipath/ - -IPMI SUBSYSTEM -M: Corey Minyard <minyard@acm.org> -L: openipmi-developer@lists.sourceforge.net (moderated for non-subscribers) -W: http://openipmi.sourceforge.net/ -S: Supported -F: Documentation/IPMI.txt -F: drivers/char/ipmi/ -F: include/linux/ipmi* - -IPS SCSI RAID DRIVER -M: Adaptec OEM Raid Solutions <aacraid@adaptec.com> -L: linux-scsi@vger.kernel.org -W: http://www.adaptec.com/ -S: Maintained -F: drivers/scsi/ips* - -IPVS -M: Wensong Zhang <wensong@linux-vs.org> -M: Simon Horman <horms@verge.net.au> -M: Julian Anastasov <ja@ssi.bg> -L: netdev@vger.kernel.org -L: lvs-devel@vger.kernel.org -S: Maintained -F: Documentation/networking/ipvs-sysctl.txt -F: include/net/ip_vs.h -F: include/linux/ip_vs.h -F: net/netfilter/ipvs/ - -IPWIRELESS DRIVER -M: Jiri Kosina <jkosina@suse.cz> -M: David Sterba <dsterba@suse.cz> -S: Odd Fixes -F: drivers/tty/ipwireless/ - -IPX NETWORK LAYER -M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> -L: netdev@vger.kernel.org -S: Maintained -F: include/linux/ipx.h -F: include/net/ipx.h -F: net/ipx/ - -IRDA SUBSYSTEM -M: Samuel Ortiz <samuel@sortiz.org> -L: irda-users@lists.sourceforge.net (subscribers-only) -L: netdev@vger.kernel.org -W: http://irda.sourceforge.net/ -S: Maintained -T: git git://git.kernel.org/pub/scm/linux/kernel/git/sameo/irda-2.6.git -F: Documentation/networking/irda.txt -F: drivers/net/irda/ -F: include/net/irda/ -F: net/irda/ - -IRQ SUBSYSTEM -M: Thomas Gleixner <tglx@linutronix.de> -S: Maintained -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core -F: kernel/irq/ - -IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY) -M: Benjamin Herrenschmidt <benh@kernel.crashing.org> -M: Grant Likely <grant.likely@secretlab.ca> -T: git git://git.secretlab.ca/git/linux-2.6.git irqdomain/next -S: Maintained -F: Documentation/IRQ-domain.txt -F: include/linux/irqdomain.h -F: kernel/irq/irqdomain.c - -ISAPNP -M: Jaroslav Kysela <perex@perex.cz> -S: Maintained -F: Documentation/isapnp.txt -F: drivers/pnp/isapnp/ -F: include/linux/isapnp.h - -iSCSI BOOT FIRMWARE TABLE (iBFT) DRIVER -M: Peter Jones <pjones@redhat.com> -M: Konrad Rzeszutek Wilk <konrad@kernel.org> -S: Maintained -F: drivers/firmware/iscsi_ibft* - -ISCSI -M: Mike Christie <michaelc@cs.wisc.edu> -L: open-iscsi@googlegroups.com -W: www.open-iscsi.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mnc/linux-2.6-iscsi.git -S: Maintained -F: drivers/scsi/*iscsi* -F: include/scsi/*iscsi* - -ISDN SUBSYSTEM -M: Karsten Keil <isdn@linux-pingi.de> -L: isdn4linux@listserv.isdn4linux.de (subscribers-only) -L: netdev@vger.kernel.org -W: http://www.isdn4linux.de -T: git git://git.kernel.org/pub/scm/linux/kernel/git/kkeil/isdn-2.6.git -S: Maintained -F: Documentation/isdn/ -F: drivers/isdn/ -F: include/linux/isdn.h -F: include/linux/isdn/ - -ISDN SUBSYSTEM (Eicon active card driver) -M: Armin Schindler <mac@melware.de> -L: isdn4linux@listserv.isdn4linux.de (subscribers-only) -W: http://www.melware.de -S: Maintained -F: drivers/isdn/hardware/eicon/ - -IT87 HARDWARE MONITORING DRIVER -M: Jean Delvare <khali@linux-fr.org> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/it87 -F: drivers/hwmon/it87.c - -IVTV VIDEO4LINUX DRIVER -M: Andy Walls <awalls@md.metrocast.net> -L: ivtv-devel@ivtvdriver.org (moderated for non-subscribers) -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -W: http://www.ivtvdriver.org -S: Maintained -F: Documentation/video4linux/*.ivtv -F: drivers/media/video/ivtv/ -F: include/linux/ivtv* - -JC42.4 TEMPERATURE SENSOR DRIVER -M: Guenter Roeck <linux@roeck-us.net> -L: lm-sensors@lm-sensors.org -S: Maintained -F: drivers/hwmon/jc42.c -F: Documentation/hwmon/jc42 - -JFS FILESYSTEM -M: Dave Kleikamp <shaggy@kernel.org> -L: jfs-discussion@lists.sourceforge.net -W: http://jfs.sourceforge.net/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git -S: Maintained -F: Documentation/filesystems/jfs.txt -F: fs/jfs/ - -JME NETWORK DRIVER -M: Guo-Fu Tseng <cooldavid@cooldavid.org> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/jme.* - -JOURNALLING FLASH FILE SYSTEM V2 (JFFS2) -M: David Woodhouse <dwmw2@infradead.org> -L: linux-mtd@lists.infradead.org -W: http://www.linux-mtd.infradead.org/doc/jffs2.html -S: Maintained -F: fs/jffs2/ -F: include/linux/jffs2.h - -JOURNALLING LAYER FOR BLOCK DEVICES (JBD) -M: Andrew Morton <akpm@linux-foundation.org> -M: Jan Kara <jack@suse.cz> -L: linux-ext4@vger.kernel.org -S: Maintained -F: fs/jbd/ -F: include/linux/ext3_jbd.h -F: include/linux/jbd.h - -JOURNALLING LAYER FOR BLOCK DEVICES (JBD2) -M: "Theodore Ts'o" <tytso@mit.edu> -L: linux-ext4@vger.kernel.org -S: Maintained -F: fs/jbd2/ -F: include/linux/jbd2.h - -JSM Neo PCI based serial card -M: Lucas Tavares <lucaskt@linux.vnet.ibm.com> -L: linux-serial@vger.kernel.org -S: Maintained -F: drivers/tty/serial/jsm/ - -K10TEMP HARDWARE MONITORING DRIVER -M: Clemens Ladisch <clemens@ladisch.de> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/k10temp -F: drivers/hwmon/k10temp.c - -K8TEMP HARDWARE MONITORING DRIVER -M: Rudolf Marek <r.marek@assembler.cz> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/k8temp -F: drivers/hwmon/k8temp.c - -KCONFIG -M: Michal Marek <mmarek@suse.cz> -L: linux-kbuild@vger.kernel.org -S: Odd Fixes -F: Documentation/kbuild/kconfig-language.txt -F: scripts/kconfig/ - -KDUMP -M: Vivek Goyal <vgoyal@redhat.com> -M: Haren Myneni <hbabu@us.ibm.com> -L: kexec@lists.infradead.org -W: http://lse.sourceforge.net/kdump/ -S: Maintained -F: Documentation/kdump/ - -KERNEL AUTOMOUNTER v4 (AUTOFS4) -M: Ian Kent <raven@themaw.net> -L: autofs@vger.kernel.org -S: Maintained -F: fs/autofs4/ - -KERNEL BUILD + files below scripts/ (unless maintained elsewhere) -M: Michal Marek <mmarek@suse.cz> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git for-next -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git rc-fixes -L: linux-kbuild@vger.kernel.org -S: Maintained -F: Documentation/kbuild/ -F: Makefile -F: scripts/Makefile.* -F: scripts/basic/ -F: scripts/mk* -F: scripts/package/ - -KERNEL JANITORS -L: kernel-janitors@vger.kernel.org -W: http://kernelnewbies.org/KernelJanitors -S: Odd Fixes - -KERNEL NFSD, SUNRPC, AND LOCKD SERVERS -M: "J. Bruce Fields" <bfields@fieldses.org> -L: linux-nfs@vger.kernel.org -W: http://nfs.sourceforge.net/ -S: Supported -F: fs/nfsd/ -F: include/linux/nfsd/ -F: fs/lockd/ -F: fs/nfs_common/ -F: net/sunrpc/ -F: include/linux/lockd/ -F: include/linux/sunrpc/ - -KERNEL VIRTUAL MACHINE (KVM) -M: Avi Kivity <avi@redhat.com> -M: Marcelo Tosatti <mtosatti@redhat.com> -L: kvm@vger.kernel.org -W: http://kvm.qumranet.com -S: Supported -F: Documentation/*/kvm.txt -F: arch/*/kvm/ -F: arch/*/include/asm/kvm* -F: include/linux/kvm* -F: virt/kvm/ - -KERNEL VIRTUAL MACHINE (KVM) FOR AMD-V -M: Joerg Roedel <joerg.roedel@amd.com> -L: kvm@vger.kernel.org -W: http://kvm.qumranet.com -S: Supported -F: arch/x86/include/asm/svm.h -F: arch/x86/kvm/svm.c - -KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC -M: Alexander Graf <agraf@suse.de> -L: kvm-ppc@vger.kernel.org -W: http://kvm.qumranet.com -S: Supported -F: arch/powerpc/include/asm/kvm* -F: arch/powerpc/kvm/ - -KERNEL VIRTUAL MACHINE For Itanium (KVM/IA64) -M: Xiantao Zhang <xiantao.zhang@intel.com> -L: kvm-ia64@vger.kernel.org -W: http://kvm.qumranet.com -S: Supported -F: Documentation/ia64/kvm.txt -F: arch/ia64/include/asm/kvm* -F: arch/ia64/kvm/ - -KERNEL VIRTUAL MACHINE for s390 (KVM/s390) -M: Carsten Otte <cotte@de.ibm.com> -M: Christian Borntraeger <borntraeger@de.ibm.com> -M: linux390@de.ibm.com -L: linux-s390@vger.kernel.org -W: http://www.ibm.com/developerworks/linux/linux390/ -S: Supported -F: Documentation/s390/kvm.txt -F: arch/s390/include/asm/kvm* -F: arch/s390/kvm/ -F: drivers/s390/kvm/ - -KEXEC -M: Eric Biederman <ebiederm@xmission.com> -W: http://kernel.org/pub/linux/utils/kernel/kexec/ -L: kexec@lists.infradead.org -S: Maintained -F: include/linux/kexec.h -F: kernel/kexec.c - -KEYS/KEYRINGS: -M: David Howells <dhowells@redhat.com> -L: keyrings@linux-nfs.org -S: Maintained -F: Documentation/security/keys.txt -F: include/linux/key.h -F: include/linux/key-type.h -F: include/keys/ -F: security/keys/ - -KEYS-TRUSTED -M: David Safford <safford@watson.ibm.com> -M: Mimi Zohar <zohar@us.ibm.com> -L: linux-security-module@vger.kernel.org -L: keyrings@linux-nfs.org -S: Supported -F: Documentation/security/keys-trusted-encrypted.txt -F: include/keys/trusted-type.h -F: security/keys/trusted.c -F: security/keys/trusted.h - -KEYS-ENCRYPTED -M: Mimi Zohar <zohar@us.ibm.com> -M: David Safford <safford@watson.ibm.com> -L: linux-security-module@vger.kernel.org -L: keyrings@linux-nfs.org -S: Supported -F: Documentation/security/keys-trusted-encrypted.txt -F: include/keys/encrypted-type.h -F: security/keys/encrypted-keys/ - -KGDB / KDB /debug_core -M: Jason Wessel <jason.wessel@windriver.com> -W: http://kgdb.wiki.kernel.org/ -L: kgdb-bugreport@lists.sourceforge.net -S: Maintained -F: Documentation/DocBook/kgdb.tmpl -F: drivers/misc/kgdbts.c -F: drivers/tty/serial/kgdboc.c -F: include/linux/kdb.h -F: include/linux/kgdb.h -F: kernel/debug/ - -KMEMCHECK -M: Vegard Nossum <vegardno@ifi.uio.no> -M: Pekka Enberg <penberg@kernel.org> -S: Maintained -F: Documentation/kmemcheck.txt -F: arch/x86/include/asm/kmemcheck.h -F: arch/x86/mm/kmemcheck/ -F: include/linux/kmemcheck.h -F: mm/kmemcheck.c - -KMEMLEAK -M: Catalin Marinas <catalin.marinas@arm.com> -S: Maintained -F: Documentation/kmemleak.txt -F: include/linux/kmemleak.h -F: mm/kmemleak.c -F: mm/kmemleak-test.c - -KPROBES -M: Ananth N Mavinakayanahalli <ananth@in.ibm.com> -M: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> -M: "David S. Miller" <davem@davemloft.net> -M: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> -S: Maintained -F: Documentation/kprobes.txt -F: include/linux/kprobes.h -F: kernel/kprobes.c - -KS0108 LCD CONTROLLER DRIVER -M: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com> -W: http://miguelojeda.es/auxdisplay.htm -W: http://jair.lab.fi.uva.es/~migojed/auxdisplay.htm -S: Maintained -F: Documentation/auxdisplay/ks0108 -F: drivers/auxdisplay/ks0108.c -F: include/linux/ks0108.h - -LAPB module -L: linux-x25@vger.kernel.org -S: Orphan -F: Documentation/networking/lapb-module.txt -F: include/*/lapb.h -F: net/lapb/ - -LASI 53c700 driver for PARISC -M: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> -L: linux-scsi@vger.kernel.org -S: Maintained -F: Documentation/scsi/53c700.txt -F: drivers/scsi/53c700* - -LED SUBSYSTEM -M: Richard Purdie <rpurdie@rpsys.net> -S: Maintained -F: drivers/leds/ -F: include/linux/leds.h - -LEGACY EEPROM DRIVER -M: Jean Delvare <khali@linux-fr.org> -S: Maintained -F: Documentation/misc-devices/eeprom -F: drivers/misc/eeprom/eeprom.c - -LEGO USB Tower driver -M: Juergen Stuber <starblue@users.sourceforge.net> -L: legousb-devel@lists.sourceforge.net -W: http://legousb.sourceforge.net/ -S: Maintained -F: drivers/usb/misc/legousbtower.c - -LGUEST -M: Rusty Russell <rusty@rustcorp.com.au> -L: lguest@lists.ozlabs.org -W: http://lguest.ozlabs.org/ -S: Odd Fixes -F: arch/x86/include/asm/lguest*.h -F: arch/x86/lguest/ -F: drivers/lguest/ -F: include/linux/lguest*.h -F: tools/lguest/ - -LINUX FOR IBM pSERIES (RS/6000) -M: Paul Mackerras <paulus@au.ibm.com> -W: http://www.ibm.com/linux/ltc/projects/ppc -S: Supported -F: arch/powerpc/boot/rs6000.h - -LINUX FOR POWERPC (32-BIT AND 64-BIT) -M: Benjamin Herrenschmidt <benh@kernel.crashing.org> -M: Paul Mackerras <paulus@samba.org> -W: http://www.penguinppc.org/ -L: linuxppc-dev@lists.ozlabs.org -Q: http://patchwork.ozlabs.org/project/linuxppc-dev/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git -S: Supported -F: Documentation/powerpc/ -F: arch/powerpc/ - -LINUX FOR POWER MACINTOSH -M: Benjamin Herrenschmidt <benh@kernel.crashing.org> -W: http://www.penguinppc.org/ -L: linuxppc-dev@lists.ozlabs.org -S: Maintained -F: arch/powerpc/platforms/powermac/ -F: drivers/macintosh/ - -LINUX FOR POWERPC EMBEDDED MPC5XXX -M: Anatolij Gustschin <agust@denx.de> -L: linuxppc-dev@lists.ozlabs.org -T: git git://git.denx.de/linux-2.6-agust.git -S: Maintained -F: arch/powerpc/platforms/512x/ -F: arch/powerpc/platforms/52xx/ - -LINUX FOR POWERPC EMBEDDED PPC4XX -M: Josh Boyer <jwboyer@gmail.com> -M: Matt Porter <mporter@kernel.crashing.org> -W: http://www.penguinppc.org/ -L: linuxppc-dev@lists.ozlabs.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/powerpc-4xx.git -S: Maintained -F: arch/powerpc/platforms/40x/ -F: arch/powerpc/platforms/44x/ - -LINUX FOR POWERPC EMBEDDED XILINX VIRTEX -M: Grant Likely <grant.likely@secretlab.ca> -W: http://wiki.secretlab.ca/index.php/Linux_on_Xilinx_Virtex -L: linuxppc-dev@lists.ozlabs.org -T: git git://git.secretlab.ca/git/linux-2.6.git -S: Maintained -F: arch/powerpc/*/*virtex* -F: arch/powerpc/*/*/*virtex* - -LINUX FOR POWERPC EMBEDDED PPC8XX -M: Vitaly Bordug <vitb@kernel.crashing.org> -M: Marcelo Tosatti <marcelo@kvack.org> -W: http://www.penguinppc.org/ -L: linuxppc-dev@lists.ozlabs.org -S: Maintained -F: arch/powerpc/platforms/8xx/ - -LINUX FOR POWERPC EMBEDDED PPC83XX AND PPC85XX -M: Kumar Gala <galak@kernel.crashing.org> -W: http://www.penguinppc.org/ -L: linuxppc-dev@lists.ozlabs.org -S: Maintained -F: arch/powerpc/platforms/83xx/ -F: arch/powerpc/platforms/85xx/ - -LINUX FOR POWERPC PA SEMI PWRFICIENT -M: Olof Johansson <olof@lixom.net> -L: linuxppc-dev@lists.ozlabs.org -S: Maintained -F: arch/powerpc/platforms/pasemi/ -F: drivers/*/*pasemi* -F: drivers/*/*/*pasemi* - -LINUX SECURITY MODULE (LSM) FRAMEWORK -M: Chris Wright <chrisw@sous-sol.org> -L: linux-security-module@vger.kernel.org -S: Supported - -LIS3LV02D ACCELEROMETER DRIVER -M: Eric Piel <eric.piel@tremplin-utc.net> -S: Maintained -F: Documentation/misc-devices/lis3lv02d -F: drivers/misc/lis3lv02d/ -F: drivers/platform/x86/hp_accel.c - -LLC (802.2) -M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> -S: Maintained -F: include/linux/llc.h -F: include/net/llc* -F: net/llc/ - -LM73 HARDWARE MONITOR DRIVER -M: Guillaume Ligneul <guillaume.ligneul@gmail.com> -L: lm-sensors@lm-sensors.org -S: Maintained -F: drivers/hwmon/lm73.c - -LM78 HARDWARE MONITOR DRIVER -M: Jean Delvare <khali@linux-fr.org> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/lm78 -F: drivers/hwmon/lm78.c - -LM83 HARDWARE MONITOR DRIVER -M: Jean Delvare <khali@linux-fr.org> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/lm83 -F: drivers/hwmon/lm83.c - -LM90 HARDWARE MONITOR DRIVER -M: Jean Delvare <khali@linux-fr.org> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/lm90 -F: drivers/hwmon/lm90.c - -LOCKDEP AND LOCKSTAT -M: Peter Zijlstra <peterz@infradead.org> -M: Ingo Molnar <mingo@redhat.com> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/locking -S: Maintained -F: Documentation/lockdep*.txt -F: Documentation/lockstat.txt -F: include/linux/lockdep.h -F: kernel/lockdep* - -LOGICAL DISK MANAGER SUPPORT (LDM, Windows 2000/XP/Vista Dynamic Disks) -M: "Richard Russon (FlatCap)" <ldm@flatcap.org> -L: linux-ntfs-dev@lists.sourceforge.net -W: http://www.linux-ntfs.org/content/view/19/37/ -S: Maintained -F: Documentation/ldm.txt -F: block/partitions/ldm.* - -LogFS -M: Joern Engel <joern@logfs.org> -M: Prasad Joshi <prasadjoshi.linux@gmail.com> -L: logfs@logfs.org -W: logfs.org -S: Maintained -F: fs/logfs/ - -LSILOGIC MPT FUSION DRIVERS (FC/SAS/SPI) -M: Eric Moore <Eric.Moore@lsi.com> -M: support@lsi.com -L: DL-MPTFusionLinux@lsi.com -L: linux-scsi@vger.kernel.org -W: http://www.lsilogic.com/support -S: Supported -F: drivers/message/fusion/ - -LSILOGIC/SYMBIOS/NCR 53C8XX and 53C1010 PCI-SCSI drivers -M: Matthew Wilcox <matthew@wil.cx> -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/sym53c8xx_2/ - -LTC4261 HARDWARE MONITOR DRIVER -M: Guenter Roeck <linux@roeck-us.net> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/ltc4261 -F: drivers/hwmon/ltc4261.c - -LTP (Linux Test Project) -M: Shubham Goyal <shubham@linux.vnet.ibm.com> -M: Mike Frysinger <vapier@gentoo.org> -M: Cyril Hrubis <chrubis@suse.cz> -M: Caspar Zhang <caspar@casparzhang.com> -M: Wanlong Gao <gaowanlong@cn.fujitsu.com> -L: ltp-list@lists.sourceforge.net (subscribers-only) -W: http://ltp.sourceforge.net/ -T: git git://github.com/linux-test-project/ltp.git -T: git git://ltp.git.sourceforge.net/gitroot/ltp/ltp-dev -S: Maintained - -M32R ARCHITECTURE -M: Hirokazu Takata <takata@linux-m32r.org> -L: linux-m32r@ml.linux-m32r.org (moderated for non-subscribers) -L: linux-m32r-ja@ml.linux-m32r.org (in Japanese) -W: http://www.linux-m32r.org/ -S: Maintained -F: arch/m32r/ - -M68K ARCHITECTURE -M: Geert Uytterhoeven <geert@linux-m68k.org> -L: linux-m68k@lists.linux-m68k.org -W: http://www.linux-m68k.org/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git -S: Maintained -F: arch/m68k/ -F: drivers/zorro/ - -M68K ON APPLE MACINTOSH -M: Joshua Thompson <funaho@jurai.org> -W: http://www.mac.linux-m68k.org/ -L: linux-m68k@lists.linux-m68k.org -S: Maintained -F: arch/m68k/mac/ - -M68K ON HP9000/300 -M: Philip Blundell <philb@gnu.org> -W: http://www.tazenda.demon.co.uk/phil/linux-hp -S: Maintained -F: arch/m68k/hp300/ - -MAC80211 -M: Johannes Berg <johannes@sipsolutions.net> -L: linux-wireless@vger.kernel.org -W: http://linuxwireless.org/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git -S: Maintained -F: Documentation/networking/mac80211-injection.txt -F: include/net/mac80211.h -F: net/mac80211/ - -MAC80211 PID RATE CONTROL -M: Stefano Brivio <stefano.brivio@polimi.it> -M: Mattias Nissler <mattias.nissler@gmx.de> -L: linux-wireless@vger.kernel.org -W: http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/PID -T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git -S: Maintained -F: net/mac80211/rc80211_pid* - -MACVLAN DRIVER -M: Patrick McHardy <kaber@trash.net> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/macvlan.c -F: include/linux/if_macvlan.h - -MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7 -M: Michael Kerrisk <mtk.manpages@gmail.com> -W: http://www.kernel.org/doc/man-pages -L: linux-man@vger.kernel.org -S: Maintained - -MARVELL GIGABIT ETHERNET DRIVERS (skge/sky2) -M: Mirko Lindner <mlindner@marvell.com> -M: Stephen Hemminger <shemminger@vyatta.com> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/marvell/sk* - -MARVELL LIBERTAS WIRELESS DRIVER -M: Dan Williams <dcbw@redhat.com> -L: libertas-dev@lists.infradead.org -S: Maintained -F: drivers/net/wireless/libertas/ - -MARVELL MV643XX ETHERNET DRIVER -M: Lennert Buytenhek <buytenh@wantstofly.org> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/marvell/mv643xx_eth.* -F: include/linux/mv643xx.h - -MARVELL MWIFIEX WIRELESS DRIVER -M: Bing Zhao <bzhao@marvell.com> -L: linux-wireless@vger.kernel.org -S: Maintained -F: drivers/net/wireless/mwifiex/ - -MARVELL MWL8K WIRELESS DRIVER -M: Lennert Buytenhek <buytenh@wantstofly.org> -L: linux-wireless@vger.kernel.org -S: Odd Fixes -F: drivers/net/wireless/mwl8k.c - -MARVELL SOC MMC/SD/SDIO CONTROLLER DRIVER -M: Nicolas Pitre <nico@fluxnic.net> -S: Odd Fixes -F: drivers/mmc/host/mvsdio.* - -MATROX FRAMEBUFFER DRIVER -L: linux-fbdev@vger.kernel.org -S: Orphan -F: drivers/video/matrox/matroxfb_* -F: include/linux/matroxfb.h - -MAX6650 HARDWARE MONITOR AND FAN CONTROLLER DRIVER -M: "Hans J. Koch" <hjk@hansjkoch.de> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/max6650 -F: drivers/hwmon/max6650.c - -MEDIA INPUT INFRASTRUCTURE (V4L/DVB) -M: Mauro Carvalho Chehab <mchehab@infradead.org> -P: LinuxTV.org Project -L: linux-media@vger.kernel.org -W: http://linuxtv.org -Q: http://patchwork.kernel.org/project/linux-media/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: Documentation/dvb/ -F: Documentation/video4linux/ -F: Documentation/DocBook/media/ -F: drivers/media/ -F: drivers/staging/media/ -F: include/media/ -F: include/linux/dvb/ -F: include/linux/videodev*.h - -MEGARAID SCSI DRIVERS -M: Neela Syam Kolli <megaraidlinux@lsi.com> -L: linux-scsi@vger.kernel.org -W: http://megaraid.lsilogic.com -S: Maintained -F: Documentation/scsi/megaraid.txt -F: drivers/scsi/megaraid.* -F: drivers/scsi/megaraid/ - -MEMORY MANAGEMENT -L: linux-mm@kvack.org -W: http://www.linux-mm.org -S: Maintained -F: include/linux/mm.h -F: mm/ - -MEMORY RESOURCE CONTROLLER -M: Johannes Weiner <hannes@cmpxchg.org> -M: Michal Hocko <mhocko@suse.cz> -M: Balbir Singh <bsingharora@gmail.com> -M: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> -L: cgroups@vger.kernel.org -L: linux-mm@kvack.org -S: Maintained -F: mm/memcontrol.c -F: mm/page_cgroup.c - -MEMORY TECHNOLOGY DEVICES (MTD) -M: David Woodhouse <dwmw2@infradead.org> -L: linux-mtd@lists.infradead.org -W: http://www.linux-mtd.infradead.org/ -Q: http://patchwork.ozlabs.org/project/linux-mtd/list/ -T: git git://git.infradead.org/mtd-2.6.git -S: Maintained -F: drivers/mtd/ -F: include/linux/mtd/ -F: include/mtd/ - -MICROBLAZE ARCHITECTURE -M: Michal Simek <monstr@monstr.eu> -L: microblaze-uclinux@itee.uq.edu.au (moderated for non-subscribers) -W: http://www.monstr.eu/fdt/ -T: git git://git.monstr.eu/linux-2.6-microblaze.git -S: Supported -F: arch/microblaze/ - -MICROCHANNEL ARCHITECTURE (MCA) -M: James Bottomley <James.Bottomley@HansenPartnership.com> -S: Maintained -F: Documentation/mca.txt -F: drivers/mca/ -F: include/linux/mca* - -MICROTEK X6 SCANNER -M: Oliver Neukum <oliver@neukum.name> -S: Maintained -F: drivers/usb/image/microtek.* - -MIPS -M: Ralf Baechle <ralf@linux-mips.org> -L: linux-mips@linux-mips.org -W: http://www.linux-mips.org/ -T: git git://git.linux-mips.org/pub/scm/ralf/linux.git -Q: http://patchwork.linux-mips.org/project/linux-mips/list/ -S: Supported -F: Documentation/mips/ -F: arch/mips/ - -MODULE SUPPORT -M: Rusty Russell <rusty@rustcorp.com.au> -S: Maintained -F: include/linux/module.h -F: kernel/module.c - -MOTION EYE VAIO PICTUREBOOK CAMERA DRIVER -W: http://popies.net/meye/ -S: Orphan -F: Documentation/video4linux/meye.txt -F: drivers/media/video/meye.* -F: include/linux/meye.h - -MOTOROLA IMX MMC/SD HOST CONTROLLER INTERFACE DRIVER -M: Pavel Pisa <ppisa@pikron.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Maintained -F: drivers/mmc/host/imxmmc.* - -MOUSE AND MISC DEVICES [GENERAL] -M: Alessandro Rubini <rubini@ipvvis.unipv.it> -S: Maintained -F: drivers/input/mouse/ -F: include/linux/gpio_mouse.h - -MOXA SMARTIO/INDUSTIO/INTELLIO SERIAL CARD -M: Jiri Slaby <jirislaby@gmail.com> -S: Maintained -F: Documentation/serial/moxa-smartio -F: drivers/tty/mxser.* - -MSI LAPTOP SUPPORT -M: "Lee, Chun-Yi" <jlee@novell.com> -L: platform-driver-x86@vger.kernel.org -S: Maintained -F: drivers/platform/x86/msi-laptop.c - -MSI WMI SUPPORT -M: Anisse Astier <anisse@astier.eu> -L: platform-driver-x86@vger.kernel.org -S: Supported -F: drivers/platform/x86/msi-wmi.c - -MULTIFUNCTION DEVICES (MFD) -M: Samuel Ortiz <sameo@linux.intel.com> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6.git -S: Supported -F: drivers/mfd/ - -MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM -M: Chris Ball <cjb@laptop.org> -L: linux-mmc@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.git -S: Maintained -F: drivers/mmc/ -F: include/linux/mmc/ - -MULTIMEDIA CARD (MMC) ETC. OVER SPI -S: Orphan -F: drivers/mmc/host/mmc_spi.c -F: include/linux/spi/mmc_spi.h - -MULTISOUND SOUND DRIVER -M: Andrew Veliath <andrewtv@usa.net> -S: Maintained -F: Documentation/sound/oss/MultiSound -F: sound/oss/msnd* - -MULTITECH MULTIPORT CARD (ISICOM) -S: Orphan -F: drivers/tty/isicom.c -F: include/linux/isicom.h - -MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER -M: Felipe Balbi <balbi@ti.com> -L: linux-usb@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git -S: Maintained -F: drivers/usb/musb/ - -MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE) -M: Jon Mason <mason@myri.com> -M: Andrew Gallatin <gallatin@myri.com> -L: netdev@vger.kernel.org -W: http://www.myri.com/scs/download-Myri10GE.html -S: Supported -F: drivers/net/ethernet/myricom/myri10ge/ - -NATSEMI ETHERNET DRIVER (DP8381x) -S: Orphan -F: drivers/net/ethernet/natsemi/natsemi.c - -NATIVE INSTRUMENTS USB SOUND INTERFACE DRIVER -M: Daniel Mack <zonque@gmail.com> -S: Maintained -L: alsa-devel@alsa-project.org -W: http://www.native-instruments.com -F: sound/usb/caiaq/ - -NCP FILESYSTEM -M: Petr Vandrovec <petr@vandrovec.name> -S: Odd Fixes -F: fs/ncpfs/ - -NCR DUAL 700 SCSI DRIVER (MICROCHANNEL) -M: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com> -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/NCR_D700.* - -NETEFFECT IWARP RNIC DRIVER (IW_NES) -M: Faisal Latif <faisal.latif@intel.com> -L: linux-rdma@vger.kernel.org -W: http://www.intel.com/Products/Server/Adapters/Server-Cluster/Server-Cluster-overview.htm -S: Supported -F: drivers/infiniband/hw/nes/ - -NETEM NETWORK EMULATOR -M: Stephen Hemminger <shemminger@vyatta.com> -L: netem@lists.linux-foundation.org -S: Maintained -F: net/sched/sch_netem.c - -NETERION 10GbE DRIVERS (s2io/vxge) -M: Jon Mason <jdmason@kudzu.us> -L: netdev@vger.kernel.org -W: http://trac.neterion.com/cgi-bin/trac.cgi/wiki/Linux?Anonymous -W: http://trac.neterion.com/cgi-bin/trac.cgi/wiki/X3100Linux?Anonymous -S: Supported -F: Documentation/networking/s2io.txt -F: Documentation/networking/vxge.txt -F: drivers/net/ethernet/neterion/ - -NETFILTER/IPTABLES/IPCHAINS -P: Harald Welte -P: Jozsef Kadlecsik -M: Pablo Neira Ayuso <pablo@netfilter.org> -M: Patrick McHardy <kaber@trash.net> -L: netfilter-devel@vger.kernel.org -L: netfilter@vger.kernel.org -L: coreteam@netfilter.org -W: http://www.netfilter.org/ -W: http://www.iptables.org/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-2.6.git -T: git git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next-2.6.git -S: Supported -F: include/linux/netfilter* -F: include/linux/netfilter/ -F: include/net/netfilter/ -F: net/*/netfilter.c -F: net/*/netfilter/ -F: net/netfilter/ - -NETLABEL -M: Paul Moore <paul@paul-moore.com> -W: http://netlabel.sf.net -L: netdev@vger.kernel.org -S: Maintained -F: Documentation/netlabel/ -F: include/net/netlabel.h -F: net/netlabel/ - -NETROM NETWORK LAYER -M: Ralf Baechle <ralf@linux-mips.org> -L: linux-hams@vger.kernel.org -W: http://www.linux-ax25.org/ -S: Maintained -F: include/linux/netrom.h -F: include/net/netrom.h -F: net/netrom/ - -NETWORK BLOCK DEVICE (NBD) -M: Paul Clements <Paul.Clements@steeleye.com> -S: Maintained -F: Documentation/blockdev/nbd.txt -F: drivers/block/nbd.c -F: include/linux/nbd.h - -NETWORK DROP MONITOR -M: Neil Horman <nhorman@tuxdriver.com> -L: netdev@vger.kernel.org -S: Maintained -W: https://fedorahosted.org/dropwatch/ -F: net/core/drop_monitor.c - -NETWORKING [GENERAL] -M: "David S. Miller" <davem@davemloft.net> -L: netdev@vger.kernel.org -W: http://www.linuxfoundation.org/en/Net -W: http://patchwork.ozlabs.org/project/netdev/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git -S: Maintained -F: net/ -F: include/net/ -F: include/linux/in.h -F: include/linux/net.h -F: include/linux/netdevice.h - -NETWORKING [IPv4/IPv6] -M: "David S. Miller" <davem@davemloft.net> -M: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> -M: James Morris <jmorris@namei.org> -M: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> -M: Patrick McHardy <kaber@trash.net> -L: netdev@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git -S: Maintained -F: net/ipv4/ -F: net/ipv6/ -F: include/net/ip* -F: arch/x86/net/* - -NETWORKING [LABELED] (NetLabel, CIPSO, Labeled IPsec, SECMARK) -M: Paul Moore <paul@paul-moore.com> -L: netdev@vger.kernel.org -S: Maintained - -NETWORKING [WIRELESS] -M: "John W. Linville" <linville@tuxdriver.com> -L: linux-wireless@vger.kernel.org -Q: http://patchwork.kernel.org/project/linux-wireless/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git -S: Maintained -F: net/mac80211/ -F: net/rfkill/ -F: net/wireless/ -F: include/net/ieee80211* -F: include/linux/wireless.h -F: include/net/iw_handler.h -F: drivers/net/wireless/ - -NETWORKING DRIVERS -L: netdev@vger.kernel.org -W: http://www.linuxfoundation.org/en/Net -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git -S: Odd Fixes -F: drivers/net/ -F: include/linux/if_* -F: include/linux/*device.h - -NETXEN (1/10) GbE SUPPORT -M: Sony Chacko <sony.chacko@qlogic.com> -M: Rajesh Borundia <rajesh.borundia@qlogic.com> -L: netdev@vger.kernel.org -W: http://www.qlogic.com -S: Supported -F: drivers/net/ethernet/qlogic/netxen/ - -NFC SUBSYSTEM -M: Lauro Ramos Venancio <lauro.venancio@openbossa.org> -M: Aloisio Almeida Jr <aloisio.almeida@openbossa.org> -M: Samuel Ortiz <sameo@linux.intel.com> -L: linux-wireless@vger.kernel.org -S: Maintained -F: net/nfc/ -F: include/linux/nfc.h -F: include/net/nfc/ -F: drivers/nfc/ - -NFS, SUNRPC, AND LOCKD CLIENTS -M: Trond Myklebust <Trond.Myklebust@netapp.com> -L: linux-nfs@vger.kernel.org -W: http://client.linux-nfs.org -T: git git://git.linux-nfs.org/pub/linux/nfs-2.6.git -S: Maintained -F: fs/lockd/ -F: fs/nfs/ -F: fs/nfs_common/ -F: net/sunrpc/ -F: include/linux/lockd/ -F: include/linux/nfs* -F: include/linux/sunrpc/ - -NI5010 NETWORK DRIVER -M: Jan-Pascal van Best <janpascal@vanbest.org> -M: Andreas Mohr <andi@lisas.de> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/racal/ni5010.* - -NILFS2 FILESYSTEM -M: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp> -L: linux-nilfs@vger.kernel.org -W: http://www.nilfs.org/en/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2.git -S: Supported -F: Documentation/filesystems/nilfs2.txt -F: fs/nilfs2/ -F: include/linux/nilfs2_fs.h - -NINJA SCSI-3 / NINJA SCSI-32Bi (16bit/CardBus) PCMCIA SCSI HOST ADAPTER DRIVER -M: YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp> -W: http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/ninja/ -S: Maintained -F: Documentation/scsi/NinjaSCSI.txt -F: drivers/scsi/pcmcia/nsp_* - -NINJA SCSI-32Bi/UDE PCI/CARDBUS SCSI HOST ADAPTER DRIVER -M: GOTO Masanori <gotom@debian.or.jp> -M: YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp> -W: http://www.netlab.is.tsukuba.ac.jp/~yokota/izumi/ninja/ -S: Maintained -F: Documentation/scsi/NinjaSCSI.txt -F: drivers/scsi/nsp32* - -NTFS FILESYSTEM -M: Anton Altaparmakov <anton@tuxera.com> -L: linux-ntfs-dev@lists.sourceforge.net -W: http://www.tuxera.com/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs.git -S: Supported -F: Documentation/filesystems/ntfs.txt -F: fs/ntfs/ - -NVIDIA (rivafb and nvidiafb) FRAMEBUFFER DRIVER -M: Antonino Daplas <adaplas@gmail.com> -L: linux-fbdev@vger.kernel.org -S: Maintained -F: drivers/video/riva/ -F: drivers/video/nvidia/ - -OMAP SUPPORT -M: Tony Lindgren <tony@atomide.com> -L: linux-omap@vger.kernel.org -W: http://www.muru.com/linux/omap/ -W: http://linux.omap.com/ -Q: http://patchwork.kernel.org/project/linux-omap/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git -S: Maintained -F: arch/arm/*omap*/ -F: drivers/i2c/busses/i2c-omap.c -F: include/linux/i2c-omap.h - -OMAP CLOCK FRAMEWORK SUPPORT -M: Paul Walmsley <paul@pwsan.com> -L: linux-omap@vger.kernel.org -S: Maintained -F: arch/arm/*omap*/*clock* - -OMAP POWER MANAGEMENT SUPPORT -M: Kevin Hilman <khilman@ti.com> -L: linux-omap@vger.kernel.org -S: Maintained -F: arch/arm/*omap*/*pm* - -OMAP POWERDOMAIN/CLOCKDOMAIN SOC ADAPTATION LAYER SUPPORT -M: Rajendra Nayak <rnayak@ti.com> -M: Paul Walmsley <paul@pwsan.com> -L: linux-omap@vger.kernel.org -S: Maintained -F: arch/arm/mach-omap2/powerdomain2xxx_3xxx.c -F: arch/arm/mach-omap2/powerdomain44xx.c -F: arch/arm/mach-omap2/clockdomain2xxx_3xxx.c -F: arch/arm/mach-omap2/clockdomain44xx.c - -OMAP AUDIO SUPPORT -M: Peter Ujfalusi <peter.ujfalusi@ti.com> -M: Jarkko Nikula <jarkko.nikula@bitmer.com> -L: alsa-devel@alsa-project.org (subscribers-only) -L: linux-omap@vger.kernel.org -S: Maintained -F: sound/soc/omap/ - -OMAP FRAMEBUFFER SUPPORT -M: Tomi Valkeinen <tomi.valkeinen@ti.com> -L: linux-fbdev@vger.kernel.org -L: linux-omap@vger.kernel.org -S: Maintained -F: drivers/video/omap/ - -OMAP DISPLAY SUBSYSTEM and FRAMEBUFFER SUPPORT (DSS2) -M: Tomi Valkeinen <tomi.valkeinen@ti.com> -L: linux-omap@vger.kernel.org -L: linux-fbdev@vger.kernel.org -S: Maintained -F: drivers/video/omap2/ -F: Documentation/arm/OMAP/DSS - -OMAP HARDWARE SPINLOCK SUPPORT -M: Ohad Ben-Cohen <ohad@wizery.com> -L: linux-omap@vger.kernel.org -S: Maintained -F: drivers/hwspinlock/omap_hwspinlock.c -F: arch/arm/mach-omap2/hwspinlock.c - -OMAP MMC SUPPORT -M: Jarkko Lavinen <jarkko.lavinen@nokia.com> -L: linux-omap@vger.kernel.org -S: Maintained -F: drivers/mmc/host/omap.c - -OMAP HS MMC SUPPORT -L: linux-omap@vger.kernel.org -S: Orphan -F: drivers/mmc/host/omap_hsmmc.c - -OMAP RANDOM NUMBER GENERATOR SUPPORT -M: Deepak Saxena <dsaxena@plexity.net> -S: Maintained -F: drivers/char/hw_random/omap-rng.c - -OMAP HWMOD SUPPORT -M: Benoît Cousson <b-cousson@ti.com> -M: Paul Walmsley <paul@pwsan.com> -L: linux-omap@vger.kernel.org -S: Maintained -F: arch/arm/mach-omap2/omap_hwmod.c -F: arch/arm/plat-omap/include/plat/omap_hwmod.h - -OMAP HWMOD DATA FOR OMAP4-BASED DEVICES -M: Benoît Cousson <b-cousson@ti.com> -L: linux-omap@vger.kernel.org -S: Maintained -F: arch/arm/mach-omap2/omap_hwmod_44xx_data.c - -OMAP IMAGE SIGNAL PROCESSOR (ISP) -M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> -L: linux-media@vger.kernel.org -S: Maintained -F: drivers/media/video/omap3isp/* - -OMAP USB SUPPORT -M: Felipe Balbi <balbi@ti.com> -L: linux-usb@vger.kernel.org -L: linux-omap@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git -S: Maintained -F: drivers/usb/*/*omap* -F: arch/arm/*omap*/usb* - -OMFS FILESYSTEM -M: Bob Copeland <me@bobcopeland.com> -L: linux-karma-devel@lists.sourceforge.net -S: Maintained -F: Documentation/filesystems/omfs.txt -F: fs/omfs/ - -OMNIKEY CARDMAN 4000 DRIVER -M: Harald Welte <laforge@gnumonks.org> -S: Maintained -F: drivers/char/pcmcia/cm4000_cs.c -F: include/linux/cm4000_cs.h - -OMNIKEY CARDMAN 4040 DRIVER -M: Harald Welte <laforge@gnumonks.org> -S: Maintained -F: drivers/char/pcmcia/cm4040_cs.* - -OMNIVISION OV7670 SENSOR DRIVER -M: Jonathan Corbet <corbet@lwn.net> -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: drivers/media/video/ov7670.c - -ONENAND FLASH DRIVER -M: Kyungmin Park <kyungmin.park@samsung.com> -L: linux-mtd@lists.infradead.org -S: Maintained -F: drivers/mtd/onenand/ -F: include/linux/mtd/onenand*.h - -ONSTREAM SCSI TAPE DRIVER -M: Willem Riede <osst@riede.org> -L: osst-users@lists.sourceforge.net -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/osst* -F: drivers/scsi/st* - -OPENCORES I2C BUS DRIVER -M: Peter Korsgaard <jacmet@sunsite.dk> -L: linux-i2c@vger.kernel.org -S: Maintained -F: Documentation/i2c/busses/i2c-ocores -F: drivers/i2c/busses/i2c-ocores.c - -OPEN FIRMWARE AND FLATTENED DEVICE TREE -M: Grant Likely <grant.likely@secretlab.ca> -M: Rob Herring <rob.herring@calxeda.com> -L: devicetree-discuss@lists.ozlabs.org (moderated for non-subscribers) -W: http://fdt.secretlab.ca -T: git git://git.secretlab.ca/git/linux-2.6.git -S: Maintained -F: Documentation/devicetree -F: drivers/of -F: include/linux/of*.h -K: of_get_property -K: of_match_table - -OPENRISC ARCHITECTURE -M: Jonas Bonn <jonas@southpole.se> -W: http://openrisc.net -L: linux@lists.openrisc.net (moderated for non-subscribers) -S: Maintained -T: git git://openrisc.net/~jonas/linux -F: arch/openrisc - -OPENVSWITCH -M: Jesse Gross <jesse@nicira.com> -L: dev@openvswitch.org -W: http://openvswitch.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch.git -S: Maintained -F: net/openvswitch/ - -OPL4 DRIVER -M: Clemens Ladisch <clemens@ladisch.de> -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -T: git git://git.alsa-project.org/alsa-kernel.git -S: Maintained -F: sound/drivers/opl4/ - -OPROFILE -M: Robert Richter <robert.richter@amd.com> -L: oprofile-list@lists.sf.net -S: Maintained -F: arch/*/include/asm/oprofile*.h -F: arch/*/oprofile/ -F: drivers/oprofile/ -F: include/linux/oprofile.h - -ORACLE CLUSTER FILESYSTEM 2 (OCFS2) -M: Mark Fasheh <mfasheh@suse.com> -M: Joel Becker <jlbec@evilplan.org> -L: ocfs2-devel@oss.oracle.com (moderated for non-subscribers) -W: http://oss.oracle.com/projects/ocfs2/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2.git -S: Supported -F: Documentation/filesystems/ocfs2.txt -F: Documentation/filesystems/dlmfs.txt -F: fs/ocfs2/ - -ORINOCO DRIVER -L: linux-wireless@vger.kernel.org -W: http://linuxwireless.org/en/users/Drivers/orinoco -W: http://www.nongnu.org/orinoco/ -S: Orphan -F: drivers/net/wireless/orinoco/ - -OSD LIBRARY and FILESYSTEM -M: Boaz Harrosh <bharrosh@panasas.com> -M: Benny Halevy <bhalevy@tonian.com> -L: osd-dev@open-osd.org -W: http://open-osd.org -T: git git://git.open-osd.org/open-osd.git -S: Maintained -F: drivers/scsi/osd/ -F: include/scsi/osd_* -F: fs/exofs/ - -P54 WIRELESS DRIVER -M: Christian Lamparter <chunkeey@googlemail.com> -L: linux-wireless@vger.kernel.org -W: http://wireless.kernel.org/en/users/Drivers/p54 -S: Maintained -F: drivers/net/wireless/p54/ - -PA SEMI ETHERNET DRIVER -M: Olof Johansson <olof@lixom.net> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/pasemi/* - -PA SEMI SMBUS DRIVER -M: Olof Johansson <olof@lixom.net> -L: linux-i2c@vger.kernel.org -S: Maintained -F: drivers/i2c/busses/i2c-pasemi.c - -PADATA PARALLEL EXECUTION MECHANISM -M: Steffen Klassert <steffen.klassert@secunet.com> -L: linux-crypto@vger.kernel.org -S: Maintained -F: kernel/padata.c -F: include/linux/padata.h -F: Documentation/padata.txt - -PANASONIC LAPTOP ACPI EXTRAS DRIVER -M: Harald Welte <laforge@gnumonks.org> -L: platform-driver-x86@vger.kernel.org -S: Maintained -F: drivers/platform/x86/panasonic-laptop.c - -PANASONIC MN10300/AM33/AM34 PORT -M: David Howells <dhowells@redhat.com> -M: Koichi Yasutake <yasutake.koichi@jp.panasonic.com> -L: linux-am33-list@redhat.com (moderated for non-subscribers) -W: ftp://ftp.redhat.com/pub/redhat/gnupro/AM33/ -S: Maintained -F: Documentation/mn10300/ -F: arch/mn10300/ - -PARALLEL PORT SUPPORT -L: linux-parport@lists.infradead.org (subscribers-only) -S: Orphan -F: drivers/parport/ -F: include/linux/parport*.h -F: drivers/char/ppdev.c -F: include/linux/ppdev.h - -PARAVIRT_OPS INTERFACE -M: Jeremy Fitzhardinge <jeremy@goop.org> -M: Chris Wright <chrisw@sous-sol.org> -M: Alok Kataria <akataria@vmware.com> -M: Rusty Russell <rusty@rustcorp.com.au> -L: virtualization@lists.linux-foundation.org -S: Supported -F: Documentation/ia64/paravirt_ops.txt -F: arch/*/kernel/paravirt* -F: arch/*/include/asm/paravirt.h - -PARIDE DRIVERS FOR PARALLEL PORT IDE DEVICES -M: Tim Waugh <tim@cyberelk.net> -L: linux-parport@lists.infradead.org (subscribers-only) -W: http://www.torque.net/linux-pp.html -S: Maintained -F: Documentation/blockdev/paride.txt -F: drivers/block/paride/ - -PARISC ARCHITECTURE -M: "James E.J. Bottomley" <jejb@parisc-linux.org> -M: Helge Deller <deller@gmx.de> -L: linux-parisc@vger.kernel.org -W: http://www.parisc-linux.org/ -Q: http://patchwork.kernel.org/project/linux-parisc/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/parisc-2.6.git -S: Maintained -F: arch/parisc/ -F: drivers/parisc/ - -PC87360 HARDWARE MONITORING DRIVER -M: Jim Cromie <jim.cromie@gmail.com> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/pc87360 -F: drivers/hwmon/pc87360.c - -PC8736x GPIO DRIVER -M: Jim Cromie <jim.cromie@gmail.com> -S: Maintained -F: drivers/char/pc8736x_gpio.c - -PC87427 HARDWARE MONITORING DRIVER -M: Jean Delvare <khali@linux-fr.org> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/pc87427 -F: drivers/hwmon/pc87427.c - -PCA9532 LED DRIVER -M: Riku Voipio <riku.voipio@iki.fi> -S: Maintained -F: drivers/leds/leds-pca9532.c -F: include/linux/leds-pca9532.h - -PCA9541 I2C BUS MASTER SELECTOR DRIVER -M: Guenter Roeck <guenter.roeck@ericsson.com> -L: linux-i2c@vger.kernel.org -S: Maintained -F: drivers/i2c/muxes/pca9541.c - -PCA9564/PCA9665 I2C BUS DRIVER -M: Wolfram Sang <w.sang@pengutronix.de> -L: linux-i2c@vger.kernel.org -S: Maintained -F: drivers/i2c/algos/i2c-algo-pca.c -F: drivers/i2c/busses/i2c-pca-* -F: include/linux/i2c-algo-pca.h -F: include/linux/i2c-pca-platform.h - -PCDP - PRIMARY CONSOLE AND DEBUG PORT -M: Khalid Aziz <khalid.aziz@hp.com> -S: Maintained -F: drivers/firmware/pcdp.* - -PCI ERROR RECOVERY -M: Linas Vepstas <linasvepstas@gmail.com> -L: linux-pci@vger.kernel.org -S: Supported -F: Documentation/PCI/pci-error-recovery.txt -F: Documentation/powerpc/eeh-pci-error-recovery.txt - -PCI SUBSYSTEM -M: Bjorn Helgaas <bhelgaas@google.com> -L: linux-pci@vger.kernel.org -Q: http://patchwork.kernel.org/project/linux-pci/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci.git -S: Supported -F: Documentation/PCI/ -F: drivers/pci/ -F: include/linux/pci* - -PCI HOTPLUG -M: Bjorn Helgaas <bhelgaas@google.com> -L: linux-pci@vger.kernel.org -S: Supported -F: drivers/pci/hotplug - -PCMCIA SUBSYSTEM -P: Linux PCMCIA Team -L: linux-pcmcia@lists.infradead.org -W: http://lists.infradead.org/mailman/listinfo/linux-pcmcia -T: git git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git -S: Maintained -F: Documentation/pcmcia/ -F: drivers/pcmcia/ -F: include/pcmcia/ - -PCNET32 NETWORK DRIVER -M: Don Fry <pcnet32@frontier.com> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/amd/pcnet32.c - -PCRYPT PARALLEL CRYPTO ENGINE -M: Steffen Klassert <steffen.klassert@secunet.com> -L: linux-crypto@vger.kernel.org -S: Maintained -F: crypto/pcrypt.c -F: include/crypto/pcrypt.h - -PER-CPU MEMORY ALLOCATOR -M: Tejun Heo <tj@kernel.org> -M: Christoph Lameter <cl@linux-foundation.org> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu.git -S: Maintained -F: include/linux/percpu*.h -F: mm/percpu*.c -F: arch/*/include/asm/percpu.h - -PER-TASK DELAY ACCOUNTING -M: Balbir Singh <bsingharora@gmail.com> -S: Maintained -F: include/linux/delayacct.h -F: kernel/delayacct.c - -PERFORMANCE EVENTS SUBSYSTEM -M: Peter Zijlstra <a.p.zijlstra@chello.nl> -M: Paul Mackerras <paulus@samba.org> -M: Ingo Molnar <mingo@redhat.com> -M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core -S: Supported -F: kernel/events/* -F: include/linux/perf_event.h -F: arch/*/kernel/perf_event*.c -F: arch/*/kernel/*/perf_event*.c -F: arch/*/kernel/*/*/perf_event*.c -F: arch/*/include/asm/perf_event.h -F: arch/*/lib/perf_event*.c -F: arch/*/kernel/perf_callchain.c -F: tools/perf/ - -PERSONALITY HANDLING -M: Christoph Hellwig <hch@infradead.org> -L: linux-abi-devel@lists.sourceforge.net -S: Maintained -F: include/linux/personality.h - -PHONET PROTOCOL -M: Remi Denis-Courmont <remi.denis-courmont@nokia.com> -S: Supported -F: Documentation/networking/phonet.txt -F: include/linux/phonet.h -F: include/net/phonet/ -F: net/phonet/ - -PHRAM MTD DRIVER -M: Joern Engel <joern@lazybastard.org> -L: linux-mtd@lists.infradead.org -S: Maintained -F: drivers/mtd/devices/phram.c - -PICOXCELL SUPPORT -M: Jamie Iles <jamie@jamieiles.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -T: git git://github.com/jamieiles/linux-2.6-ji.git -S: Supported -F: arch/arm/mach-picoxcell -F: drivers/*/picoxcell* -F: drivers/*/*/picoxcell* - -PIN CONTROL SUBSYSTEM -M: Linus Walleij <linus.walleij@linaro.org> -S: Maintained -F: drivers/pinctrl/ - -PKTCDVD DRIVER -M: Peter Osterlund <petero2@telia.com> -S: Maintained -F: drivers/block/pktcdvd.c -F: include/linux/pktcdvd.h - -PKUNITY SOC DRIVERS -M: Guan Xuetao <gxt@mprc.pku.edu.cn> -W: http://mprc.pku.edu.cn/~guanxuetao/linux -S: Maintained -T: git git://git.kernel.org/pub/scm/linux/kernel/git/epip/linux-2.6-unicore32.git -F: drivers/input/serio/i8042-unicore32io.h -F: drivers/i2c/busses/i2c-puv3.c -F: drivers/video/fb-puv3.c -F: drivers/rtc/rtc-puv3.c - -PMBUS HARDWARE MONITORING DRIVERS -M: Guenter Roeck <guenter.roeck@ericsson.com> -L: lm-sensors@lm-sensors.org -W: http://www.lm-sensors.org/ -W: http://www.roeck-us.net/linux/drivers/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git -S: Maintained -F: Documentation/hwmon/pmbus -F: drivers/hwmon/pmbus/ -F: include/linux/i2c/pmbus.h - -PMC SIERRA MaxRAID DRIVER -M: Anil Ravindranath <anil_ravindranath@pmc-sierra.com> -L: linux-scsi@vger.kernel.org -W: http://www.pmc-sierra.com/ -S: Supported -F: drivers/scsi/pmcraid.* - -PMC SIERRA PM8001 DRIVER -M: jack_wang@usish.com -M: lindar_liu@usish.com -L: linux-scsi@vger.kernel.org -S: Supported -F: drivers/scsi/pm8001/ - -POSIX CLOCKS and TIMERS -M: Thomas Gleixner <tglx@linutronix.de> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core -S: Supported -F: fs/timerfd.c -F: include/linux/timer* -F: kernel/*timer* - -POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS -M: Anton Vorontsov <cbou@mail.ru> -M: David Woodhouse <dwmw2@infradead.org> -T: git git://git.infradead.org/battery-2.6.git -S: Maintained -F: include/linux/power_supply.h -F: drivers/power/power_supply* - -PNP SUPPORT -M: Adam Belay <abelay@mit.edu> -M: Bjorn Helgaas <bhelgaas@google.com> -S: Maintained -F: drivers/pnp/ - -PNXxxxx I2C DRIVER -M: Vitaly Wool <vitalywool@gmail.com> -L: linux-i2c@vger.kernel.org -S: Maintained -F: drivers/i2c/busses/i2c-pnx.c - -PPP PROTOCOL DRIVERS AND COMPRESSORS -M: Paul Mackerras <paulus@samba.org> -L: linux-ppp@vger.kernel.org -S: Maintained -F: drivers/net/ppp/ppp_* - -PPP OVER ATM (RFC 2364) -M: Mitchell Blank Jr <mitch@sfgoth.com> -S: Maintained -F: net/atm/pppoatm.c -F: include/linux/atmppp.h - -PPP OVER ETHERNET -M: Michal Ostrowski <mostrows@earthlink.net> -S: Maintained -F: drivers/net/ppp/pppoe.c -F: drivers/net/ppp/pppox.c - -PPP OVER L2TP -M: James Chapman <jchapman@katalix.com> -S: Maintained -F: net/l2tp/l2tp_ppp.c -F: include/linux/if_pppol2tp.h - -PPS SUPPORT -M: Rodolfo Giometti <giometti@enneenne.com> -W: http://wiki.enneenne.com/index.php/LinuxPPS_support -L: linuxpps@ml.enneenne.com (subscribers-only) -S: Maintained -F: Documentation/pps/ -F: drivers/pps/ -F: include/linux/pps*.h - -PPTP DRIVER -M: Dmitry Kozlov <xeb@mail.ru> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ppp/pptp.c -W: http://sourceforge.net/projects/accel-pptp - -PREEMPTIBLE KERNEL -M: Robert Love <rml@tech9.net> -L: kpreempt-tech@lists.sourceforge.net -W: ftp://ftp.kernel.org/pub/linux/kernel/people/rml/preempt-kernel -S: Supported -F: Documentation/preempt-locking.txt -F: include/linux/preempt.h - -PRISM54 WIRELESS DRIVER -M: "Luis R. Rodriguez" <mcgrof@gmail.com> -L: linux-wireless@vger.kernel.org -W: http://wireless.kernel.org/en/users/Drivers/p54 -S: Obsolete -F: drivers/net/wireless/prism54/ - -PROMISE SATA TX2/TX4 CONTROLLER LIBATA DRIVER -M: Mikael Pettersson <mikpe@it.uu.se> -L: linux-ide@vger.kernel.org -S: Maintained -F: drivers/ata/sata_promise.* - -PS3 NETWORK SUPPORT -M: Geoff Levand <geoff@infradead.org> -L: netdev@vger.kernel.org -L: cbe-oss-dev@lists.ozlabs.org -S: Maintained -F: drivers/net/ethernet/toshiba/ps3_gelic_net.* - -PS3 PLATFORM SUPPORT -M: Geoff Levand <geoff@infradead.org> -L: linuxppc-dev@lists.ozlabs.org -L: cbe-oss-dev@lists.ozlabs.org -S: Maintained -F: arch/powerpc/boot/ps3* -F: arch/powerpc/include/asm/lv1call.h -F: arch/powerpc/include/asm/ps3*.h -F: arch/powerpc/platforms/ps3/ -F: drivers/*/ps3* -F: drivers/ps3/ -F: drivers/rtc/rtc-ps3.c -F: drivers/usb/host/*ps3.c -F: sound/ppc/snd_ps3* - -PS3VRAM DRIVER -M: Jim Paris <jim@jtan.com> -L: cbe-oss-dev@lists.ozlabs.org -S: Maintained -F: drivers/block/ps3vram.c - -PTP HARDWARE CLOCK SUPPORT -M: Richard Cochran <richardcochran@gmail.com> -S: Maintained -W: http://linuxptp.sourceforge.net/ -F: Documentation/ABI/testing/sysfs-ptp -F: Documentation/ptp/* -F: drivers/net/gianfar_ptp.c -F: drivers/net/phy/dp83640* -F: drivers/ptp/* -F: include/linux/ptp_cl* - -PTRACE SUPPORT -M: Roland McGrath <roland@redhat.com> -M: Oleg Nesterov <oleg@redhat.com> -S: Maintained -F: include/asm-generic/syscall.h -F: include/linux/ptrace.h -F: include/linux/regset.h -F: include/linux/tracehook.h -F: kernel/ptrace.c - -PVRUSB2 VIDEO4LINUX DRIVER -M: Mike Isely <isely@pobox.com> -L: pvrusb2@isely.net (subscribers-only) -L: linux-media@vger.kernel.org -W: http://www.isely.net/pvrusb2/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: Documentation/video4linux/README.pvrusb2 -F: drivers/media/video/pvrusb2/ - -PXA2xx/PXA3xx SUPPORT -M: Eric Miao <eric.y.miao@gmail.com> -M: Russell King <linux@arm.linux.org.uk> -M: Haojian Zhuang <haojian.zhuang@gmail.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -T: git git://github.com/hzhuang1/linux.git -T: git git://git.linaro.org/people/ycmiao/pxa-linux.git -S: Maintained -F: arch/arm/mach-pxa/ -F: drivers/pcmcia/pxa2xx* -F: drivers/spi/spi-pxa2xx* -F: drivers/usb/gadget/pxa2* -F: include/sound/pxa2xx-lib.h -F: sound/arm/pxa* -F: sound/soc/pxa - -MMP SUPPORT -M: Eric Miao <eric.y.miao@gmail.com> -M: Haojian Zhuang <haojian.zhuang@gmail.com> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -T: git git://github.com/hzhuang1/linux.git -T: git git://git.linaro.org/people/ycmiao/pxa-linux.git -S: Maintained -F: arch/arm/mach-mmp/ - -PXA MMCI DRIVER -S: Orphan - -PXA RTC DRIVER -M: Robert Jarzmik <robert.jarzmik@free.fr> -L: rtc-linux@googlegroups.com -S: Maintained - -QIB DRIVER -M: Mike Marciniszyn <infinipath@qlogic.com> -L: linux-rdma@vger.kernel.org -S: Supported -F: drivers/infiniband/hw/qib/ - -QLOGIC QLA1280 SCSI DRIVER -M: Michael Reed <mdr@sgi.com> -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/qla1280.[ch] - -QLOGIC QLA2XXX FC-SCSI DRIVER -M: Andrew Vasquez <andrew.vasquez@qlogic.com> -M: linux-driver@qlogic.com -L: linux-scsi@vger.kernel.org -S: Supported -F: Documentation/scsi/LICENSE.qla2xxx -F: drivers/scsi/qla2xxx/ - -QLOGIC QLA4XXX iSCSI DRIVER -M: Ravi Anand <ravi.anand@qlogic.com> -M: Vikas Chaudhary <vikas.chaudhary@qlogic.com> -M: iscsi-driver@qlogic.com -L: linux-scsi@vger.kernel.org -S: Supported -F: drivers/scsi/qla4xxx/ - -QLOGIC QLA3XXX NETWORK DRIVER -M: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> -M: Ron Mercer <ron.mercer@qlogic.com> -M: linux-driver@qlogic.com -L: netdev@vger.kernel.org -S: Supported -F: Documentation/networking/LICENSE.qla3xxx -F: drivers/net/ethernet/qlogic/qla3xxx.* - -QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER -M: Anirban Chakraborty <anirban.chakraborty@qlogic.com> -M: Sony Chacko <sony.chacko@qlogic.com> -M: linux-driver@qlogic.com -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/ethernet/qlogic/qlcnic/ - -QLOGIC QLGE 10Gb ETHERNET DRIVER -M: Anirban Chakraborty <anirban.chakraborty@qlogic.com> -M: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> -M: Ron Mercer <ron.mercer@qlogic.com> -M: linux-driver@qlogic.com -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/ethernet/qlogic/qlge/ - -QNX4 FILESYSTEM -M: Anders Larsen <al@alarsen.net> -W: http://www.alarsen.net/linux/qnx4fs/ -S: Maintained -F: fs/qnx4/ -F: include/linux/qnx4_fs.h -F: include/linux/qnxtypes.h - -QUALCOMM HEXAGON ARCHITECTURE -M: Richard Kuo <rkuo@codeaurora.org> -L: linux-hexagon@vger.kernel.org -S: Supported -F: arch/hexagon/ - -RADOS BLOCK DEVICE (RBD) -F: include/linux/qnxtypes.h -M: Yehuda Sadeh <yehuda@hq.newdream.net> -M: Sage Weil <sage@newdream.net> -M: ceph-devel@vger.kernel.org -S: Supported -F: drivers/block/rbd.c -F: drivers/block/rbd_types.h - -RADEON FRAMEBUFFER DISPLAY DRIVER -M: Benjamin Herrenschmidt <benh@kernel.crashing.org> -L: linux-fbdev@vger.kernel.org -S: Maintained -F: drivers/video/aty/radeon* -F: include/linux/radeonfb.h - -RAGE128 FRAMEBUFFER DISPLAY DRIVER -M: Paul Mackerras <paulus@samba.org> -L: linux-fbdev@vger.kernel.org -S: Maintained -F: drivers/video/aty/aty128fb.c - -RALINK RT2X00 WIRELESS LAN DRIVER -P: rt2x00 project -M: Ivo van Doorn <IvDoorn@gmail.com> -M: Gertjan van Wingerde <gwingerde@gmail.com> -M: Helmut Schaa <helmut.schaa@googlemail.com> -L: linux-wireless@vger.kernel.org -L: users@rt2x00.serialmonkey.com (moderated for non-subscribers) -W: http://rt2x00.serialmonkey.com/ -S: Maintained -T: git git://git.kernel.org/pub/scm/linux/kernel/git/ivd/rt2x00.git -F: drivers/net/wireless/rt2x00/ - -RAMDISK RAM BLOCK DEVICE DRIVER -M: Nick Piggin <npiggin@kernel.dk> -S: Maintained -F: Documentation/blockdev/ramdisk.txt -F: drivers/block/brd.c - -RANDOM NUMBER DRIVER -M: Matt Mackall <mpm@selenic.com> -S: Maintained -F: drivers/char/random.c - -RAPIDIO SUBSYSTEM -M: Matt Porter <mporter@kernel.crashing.org> -M: Alexandre Bounine <alexandre.bounine@idt.com> -S: Maintained -F: drivers/rapidio/ - -RAYLINK/WEBGEAR 802.11 WIRELESS LAN DRIVER -L: linux-wireless@vger.kernel.org -S: Orphan -F: drivers/net/wireless/ray* - -RCUTORTURE MODULE -M: Josh Triplett <josh@freedesktop.org> -M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> -S: Supported -T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git -F: Documentation/RCU/torture.txt -F: kernel/rcutorture.c - -RDC R-321X SoC -M: Florian Fainelli <florian@openwrt.org> -S: Maintained - -RDC R6040 FAST ETHERNET DRIVER -M: Florian Fainelli <florian@openwrt.org> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/rdc/r6040.c - -RDS - RELIABLE DATAGRAM SOCKETS -M: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com> -L: rds-devel@oss.oracle.com (moderated for non-subscribers) -S: Supported -F: net/rds/ - -READ-COPY UPDATE (RCU) -M: Dipankar Sarma <dipankar@in.ibm.com> -M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> -W: http://www.rdrop.com/users/paulmck/rclock/ -S: Supported -T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git -F: Documentation/RCU/ -F: include/linux/rcu* -F: include/linux/srcu* -F: kernel/rcu* -F: kernel/srcu* -X: kernel/rcutorture.c - -REAL TIME CLOCK (RTC) SUBSYSTEM -M: Alessandro Zummo <a.zummo@towertech.it> -L: rtc-linux@googlegroups.com -Q: http://patchwork.ozlabs.org/project/rtc-linux/list/ -S: Maintained -F: Documentation/rtc.txt -F: drivers/rtc/ -F: include/linux/rtc.h - -REISERFS FILE SYSTEM -L: reiserfs-devel@vger.kernel.org -S: Supported -F: fs/reiserfs/ - -REGISTER MAP ABSTRACTION -M: Mark Brown <broonie@opensource.wolfsonmicro.com> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git -S: Supported -F: drivers/base/regmap/ -F: include/linux/regmap.h - -REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM -M: Ohad Ben-Cohen <ohad@wizery.com> -S: Maintained -F: drivers/remoteproc/ -F: Documentation/remoteproc.txt -F: include/linux/remoteproc.h - -RFKILL -M: Johannes Berg <johannes@sipsolutions.net> -L: linux-wireless@vger.kernel.org -S: Maintained -F: Documentation/rfkill.txt -F: net/rfkill/ - -RICOH SMARTMEDIA/XD DRIVER -M: Maxim Levitsky <maximlevitsky@gmail.com> -S: Maintained -F: drivers/mtd/nand/r852.c -F: drivers/mtd/nand/r852.h - -RICOH R5C592 MEMORYSTICK DRIVER -M: Maxim Levitsky <maximlevitsky@gmail.com> -S: Maintained -F: drivers/memstick/host/r592.* - -ROCKETPORT DRIVER -P: Comtrol Corp. -W: http://www.comtrol.com -S: Maintained -F: Documentation/serial/rocket.txt -F: drivers/tty/rocket* - -ROSE NETWORK LAYER -M: Ralf Baechle <ralf@linux-mips.org> -L: linux-hams@vger.kernel.org -W: http://www.linux-ax25.org/ -S: Maintained -F: include/linux/rose.h -F: include/net/rose.h -F: net/rose/ - -RTL8180 WIRELESS DRIVER -M: "John W. Linville" <linville@tuxdriver.com> -L: linux-wireless@vger.kernel.org -W: http://linuxwireless.org/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git -S: Maintained -F: drivers/net/wireless/rtl818x/rtl8180/ - -RTL8187 WIRELESS DRIVER -M: Herton Ronaldo Krzesinski <herton@canonical.com> -M: Hin-Tak Leung <htl10@users.sourceforge.net> -M: Larry Finger <Larry.Finger@lwfinger.net> -L: linux-wireless@vger.kernel.org -W: http://linuxwireless.org/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git -S: Maintained -F: drivers/net/wireless/rtl818x/rtl8187/ - -RTL8192CE WIRELESS DRIVER -M: Larry Finger <Larry.Finger@lwfinger.net> -M: Chaoming Li <chaoming_li@realsil.com.cn> -L: linux-wireless@vger.kernel.org -W: http://linuxwireless.org/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git -S: Maintained -F: drivers/net/wireless/rtlwifi/ -F: drivers/net/wireless/rtlwifi/rtl8192ce/ - -S3 SAVAGE FRAMEBUFFER DRIVER -M: Antonino Daplas <adaplas@gmail.com> -L: linux-fbdev@vger.kernel.org -S: Maintained -F: drivers/video/savage/ - -S390 -M: Martin Schwidefsky <schwidefsky@de.ibm.com> -M: Heiko Carstens <heiko.carstens@de.ibm.com> -M: linux390@de.ibm.com -L: linux-s390@vger.kernel.org -W: http://www.ibm.com/developerworks/linux/linux390/ -S: Supported -F: arch/s390/ -F: drivers/s390/ -F: block/partitions/ibm.c -F: Documentation/s390/ -F: Documentation/DocBook/s390* - -S390 NETWORK DRIVERS -M: Ursula Braun <ursula.braun@de.ibm.com> -M: Frank Blaschka <blaschka@linux.vnet.ibm.com> -M: linux390@de.ibm.com -L: linux-s390@vger.kernel.org -W: http://www.ibm.com/developerworks/linux/linux390/ -S: Supported -F: drivers/s390/net/ - -S390 ZCRYPT DRIVER -M: Holger Dengler <hd@linux.vnet.ibm.com> -M: linux390@de.ibm.com -L: linux-s390@vger.kernel.org -W: http://www.ibm.com/developerworks/linux/linux390/ -S: Supported -F: drivers/s390/crypto/ - -S390 ZFCP DRIVER -M: Steffen Maier <maier@linux.vnet.ibm.com> -M: linux390@de.ibm.com -L: linux-s390@vger.kernel.org -W: http://www.ibm.com/developerworks/linux/linux390/ -S: Supported -F: drivers/s390/scsi/zfcp_* - -S390 IUCV NETWORK LAYER -M: Ursula Braun <ursula.braun@de.ibm.com> -M: linux390@de.ibm.com -L: linux-s390@vger.kernel.org -W: http://www.ibm.com/developerworks/linux/linux390/ -S: Supported -F: drivers/s390/net/*iucv* -F: include/net/iucv/ -F: net/iucv/ - -S3C24XX SD/MMC Driver -M: Ben Dooks <ben-linux@fluff.org> -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -S: Supported -F: drivers/mmc/host/s3cmci.* - -SAA7146 VIDEO4LINUX-2 DRIVER -M: Michael Hunold <michael@mihu.de> -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -W: http://www.mihu.de/linux/saa7146 -S: Maintained -F: drivers/media/common/saa7146* -F: drivers/media/video/*7146* -F: include/media/*7146* - -SAMSUNG LAPTOP DRIVER -M: Corentin Chary <corentincj@iksaif.net> -L: platform-driver-x86@vger.kernel.org -S: Maintained -F: drivers/platform/x86/samsung-laptop.c - -SAMSUNG AUDIO (ASoC) DRIVERS -M: Sangbeom Kim <sbkim73@samsung.com> -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -S: Supported -F: sound/soc/samsung - -SAMSUNG FRAMEBUFFER DRIVER -M: Jingoo Han <jg1.han@samsung.com> -L: linux-fbdev@vger.kernel.org -S: Maintained -F: drivers/video/s3c-fb.c - -SERIAL DRIVERS -M: Alan Cox <alan@linux.intel.com> -L: linux-serial@vger.kernel.org -S: Maintained -F: drivers/tty/serial - -SYNOPSYS DESIGNWARE DMAC DRIVER -M: Viresh Kumar <viresh.kumar@st.com> -S: Maintained -F: include/linux/dw_dmac.h -F: drivers/dma/dw_dmac_regs.h -F: drivers/dma/dw_dmac.c - -TIMEKEEPING, NTP -M: John Stultz <johnstul@us.ibm.com> -M: Thomas Gleixner <tglx@linutronix.de> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core -S: Supported -F: include/linux/clocksource.h -F: include/linux/time.h -F: include/linux/timex.h -F: kernel/time/clocksource.c -F: kernel/time/time*.c -F: kernel/time/ntp.c -F: drivers/clocksource - -TLG2300 VIDEO4LINUX-2 DRIVER -M: Huang Shijie <shijie8@gmail.com> -M: Kang Yong <kangyong@telegent.com> -M: Zhang Xiaobing <xbzhang@telegent.com> -S: Supported -F: drivers/media/video/tlg2300 - -SC1200 WDT DRIVER -M: Zwane Mwaikambo <zwane@arm.linux.org.uk> -S: Maintained -F: drivers/watchdog/sc1200wdt.c - -SCHEDULER -M: Ingo Molnar <mingo@redhat.com> -M: Peter Zijlstra <peterz@infradead.org> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core -S: Maintained -F: kernel/sched* -F: include/linux/sched.h - -SCORE ARCHITECTURE -M: Chen Liqin <liqin.chen@sunplusct.com> -M: Lennox Wu <lennox.wu@gmail.com> -W: http://www.sunplusct.com -S: Supported -F: arch/score/ - -SCSI CDROM DRIVER -M: Jens Axboe <axboe@kernel.dk> -L: linux-scsi@vger.kernel.org -W: http://www.kernel.dk -S: Maintained -F: drivers/scsi/sr* - -SCSI RDMA PROTOCOL (SRP) INITIATOR -M: David Dillow <dillowda@ornl.gov> -L: linux-rdma@vger.kernel.org -S: Supported -W: http://www.openfabrics.org -Q: http://patchwork.kernel.org/project/linux-rdma/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/dad/srp-initiator.git -F: drivers/infiniband/ulp/srp/ -F: include/scsi/srp.h - -SCSI SG DRIVER -M: Doug Gilbert <dgilbert@interlog.com> -L: linux-scsi@vger.kernel.org -W: http://www.torque.net/sg -S: Maintained -F: drivers/scsi/sg.c -F: include/scsi/sg.h - -SCSI SUBSYSTEM -M: "James E.J. Bottomley" <JBottomley@parallels.com> -L: linux-scsi@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6.git -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-pending-2.6.git -S: Maintained -F: drivers/scsi/ -F: include/scsi/ - -SCSI TAPE DRIVER -M: Kai Mäkisara <Kai.Makisara@kolumbus.fi> -L: linux-scsi@vger.kernel.org -S: Maintained -F: Documentation/scsi/st.txt -F: drivers/scsi/st* - -SCTP PROTOCOL -M: Vlad Yasevich <vladislav.yasevich@hp.com> -M: Sridhar Samudrala <sri@us.ibm.com> -L: linux-sctp@vger.kernel.org -W: http://lksctp.sourceforge.net -S: Supported -F: Documentation/networking/sctp.txt -F: include/linux/sctp.h -F: include/net/sctp/ -F: net/sctp/ - -SCx200 CPU SUPPORT -M: Jim Cromie <jim.cromie@gmail.com> -S: Odd Fixes -F: Documentation/i2c/busses/scx200_acb -F: arch/x86/platform/scx200/ -F: drivers/watchdog/scx200_wdt.c -F: drivers/i2c/busses/scx200* -F: drivers/mtd/maps/scx200_docflash.c -F: include/linux/scx200.h - -SCx200 GPIO DRIVER -M: Jim Cromie <jim.cromie@gmail.com> -S: Maintained -F: drivers/char/scx200_gpio.c -F: include/linux/scx200_gpio.h - -SCx200 HRT CLOCKSOURCE DRIVER -M: Jim Cromie <jim.cromie@gmail.com> -S: Maintained -F: drivers/clocksource/scx200_hrt.c - -SDRICOH_CS MMC/SD HOST CONTROLLER INTERFACE DRIVER -M: Sascha Sommer <saschasommer@freenet.de> -L: sdricohcs-devel@lists.sourceforge.net (subscribers-only) -S: Maintained -F: drivers/mmc/host/sdricoh_cs.c - -SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) DRIVER -M: Chris Ball <cjb@laptop.org> -L: linux-mmc@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc.git -S: Maintained -F: drivers/mmc/host/sdhci.* -F: drivers/mmc/host/sdhci-pltfm.[ch] - -SECURE DIGITAL HOST CONTROLLER INTERFACE, OPEN FIRMWARE BINDINGS (SDHCI-OF) -M: Anton Vorontsov <avorontsov@ru.mvista.com> -L: linuxppc-dev@lists.ozlabs.org -L: linux-mmc@vger.kernel.org -S: Maintained -F: drivers/mmc/host/sdhci-pltfm.[ch] - -SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) SAMSUNG DRIVER -M: Ben Dooks <ben-linux@fluff.org> -L: linux-mmc@vger.kernel.org -S: Maintained -F: drivers/mmc/host/sdhci-s3c.c - -SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) ST SPEAR DRIVER -M: Viresh Kumar <viresh.kumar@st.com> -L: spear-devel@list.st.com -L: linux-mmc@vger.kernel.org -S: Maintained -F: drivers/mmc/host/sdhci-spear.c - -SECURITY SUBSYSTEM -M: James Morris <james.l.morris@oracle.com> -L: linux-security-module@vger.kernel.org (suggested Cc:) -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git -W: http://security.wiki.kernel.org/ -S: Supported -F: security/ - -SECURITY CONTACT -M: Security Officers <security@kernel.org> -S: Supported - -SELINUX SECURITY MODULE -M: Stephen Smalley <sds@tycho.nsa.gov> -M: James Morris <james.l.morris@oracle.com> -M: Eric Paris <eparis@parisplace.org> -L: selinux@tycho.nsa.gov (subscribers-only, general discussion) -W: http://selinuxproject.org -T: git git://git.infradead.org/users/eparis/selinux.git -S: Supported -F: include/linux/selinux* -F: security/selinux/ -F: scripts/selinux/ - -APPARMOR SECURITY MODULE -M: John Johansen <john.johansen@canonical.com> -L: apparmor@lists.ubuntu.com (subscribers-only, general discussion) -W: apparmor.wiki.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jj/apparmor-dev.git -S: Supported -F: security/apparmor/ - -SENSABLE PHANTOM -M: Jiri Slaby <jirislaby@gmail.com> -S: Maintained -F: drivers/misc/phantom.c -F: include/linux/phantom.h - -SERIAL ATA (SATA) SUBSYSTEM -M: Jeff Garzik <jgarzik@pobox.com> -L: linux-ide@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev.git -S: Supported -F: drivers/ata/ -F: include/linux/ata.h -F: include/linux/libata.h - -SERVER ENGINES 10Gbps iSCSI - BladeEngine 2 DRIVER -M: Jayamohan Kallickal <jayamohan.kallickal@emulex.com> -L: linux-scsi@vger.kernel.org -W: http://www.emulex.com -S: Supported -F: drivers/scsi/be2iscsi/ - -SERVER ENGINES 10Gbps NIC - BladeEngine 2 DRIVER -M: Sathya Perla <sathya.perla@emulex.com> -M: Subbu Seetharaman <subbu.seetharaman@emulex.com> -M: Ajit Khaparde <ajit.khaparde@emulex.com> -L: netdev@vger.kernel.org -W: http://www.emulex.com -S: Supported -F: drivers/net/ethernet/emulex/benet/ - -SFC NETWORK DRIVER -M: Solarflare linux maintainers <linux-net-drivers@solarflare.com> -M: Ben Hutchings <bhutchings@solarflare.com> -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/ethernet/sfc/ - -SGI GRU DRIVER -M: Jack Steiner <steiner@sgi.com> -S: Maintained -F: drivers/misc/sgi-gru/ - -SGI SN-IA64 (Altix) SERIAL CONSOLE DRIVER -M: Pat Gefre <pfg@sgi.com> -L: linux-ia64@vger.kernel.org -S: Supported -F: Documentation/ia64/serial.txt -F: drivers/tty/serial/ioc?_serial.c -F: include/linux/ioc?.h - -SGI VISUAL WORKSTATION 320 AND 540 -M: Andrey Panin <pazke@donpac.ru> -L: linux-visws-devel@lists.sf.net -W: http://linux-visws.sf.net -S: Maintained for 2.6. -F: Documentation/sgi-visws.txt - -SGI XP/XPC/XPNET DRIVER -M: Robin Holt <holt@sgi.com> -S: Maintained -F: drivers/misc/sgi-xp/ - -SIMPLE FIRMWARE INTERFACE (SFI) -M: Len Brown <lenb@kernel.org> -L: sfi-devel@simplefirmware.org -W: http://simplefirmware.org/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-sfi-2.6.git -S: Supported -F: arch/x86/platform/sfi/ -F: drivers/sfi/ -F: include/linux/sfi*.h - -SIMTEC EB110ATX (Chalice CATS) -P: Ben Dooks -P: Vincent Sanders <vince@simtec.co.uk> -M: Simtec Linux Team <linux@simtec.co.uk> -W: http://www.simtec.co.uk/products/EB110ATX/ -S: Supported - -SIMTEC EB2410ITX (BAST) -P: Ben Dooks -P: Vincent Sanders <vince@simtec.co.uk> -M: Simtec Linux Team <linux@simtec.co.uk> -W: http://www.simtec.co.uk/products/EB2410ITX/ -S: Supported -F: arch/arm/mach-s3c2410/mach-bast.c -F: arch/arm/mach-s3c2410/bast-ide.c -F: arch/arm/mach-s3c2410/bast-irq.c - -TI DAVINCI MACHINE SUPPORT -M: Sekhar Nori <nsekhar@ti.com> -M: Kevin Hilman <khilman@ti.com> -L: davinci-linux-open-source@linux.davincidsp.com (moderated for non-subscribers) -T: git git://gitorious.org/linux-davinci/linux-davinci.git -Q: http://patchwork.kernel.org/project/linux-davinci/list/ -S: Supported -F: arch/arm/mach-davinci -F: drivers/i2c/busses/i2c-davinci.c - -SIS 190 ETHERNET DRIVER -M: Francois Romieu <romieu@fr.zoreil.com> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/sis/sis190.c - -SIS 900/7016 FAST ETHERNET DRIVER -M: Daniele Venzano <venza@brownhat.org> -W: http://www.brownhat.org/sis900.html -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/sis/sis900.* - -SIS 96X I2C/SMBUS DRIVER -M: "Mark M. Hoffman" <mhoffman@lightlink.com> -L: linux-i2c@vger.kernel.org -S: Maintained -F: Documentation/i2c/busses/i2c-sis96x -F: drivers/i2c/busses/i2c-sis96x.c - -SIS FRAMEBUFFER DRIVER -M: Thomas Winischhofer <thomas@winischhofer.net> -W: http://www.winischhofer.net/linuxsisvga.shtml -S: Maintained -F: Documentation/fb/sisfb.txt -F: drivers/video/sis/ -F: include/video/sisfb.h - -SIS USB2VGA DRIVER -M: Thomas Winischhofer <thomas@winischhofer.net> -W: http://www.winischhofer.at/linuxsisusbvga.shtml -S: Maintained -F: drivers/usb/misc/sisusbvga/ - -SLAB ALLOCATOR -M: Christoph Lameter <cl@linux-foundation.org> -M: Pekka Enberg <penberg@kernel.org> -M: Matt Mackall <mpm@selenic.com> -L: linux-mm@kvack.org -S: Maintained -F: include/linux/sl?b*.h -F: mm/sl?b.c - -SMC91x ETHERNET DRIVER -M: Nicolas Pitre <nico@fluxnic.net> -S: Odd Fixes -F: drivers/net/ethernet/smsc/smc91x.* - -SMM665 HARDWARE MONITOR DRIVER -M: Guenter Roeck <linux@roeck-us.net> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/smm665 -F: drivers/hwmon/smm665.c - -SMSC EMC2103 HARDWARE MONITOR DRIVER -M: Steve Glendinning <steve.glendinning@smsc.com> -L: lm-sensors@lm-sensors.org -S: Supported -F: Documentation/hwmon/emc2103 -F: drivers/hwmon/emc2103.c - -SMSC SCH5627 HARDWARE MONITOR DRIVER -M: Hans de Goede <hdegoede@redhat.com> -L: lm-sensors@lm-sensors.org -S: Supported -F: Documentation/hwmon/sch5627 -F: drivers/hwmon/sch5627.c - -SMSC47B397 HARDWARE MONITOR DRIVER -M: "Mark M. Hoffman" <mhoffman@lightlink.com> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/smsc47b397 -F: drivers/hwmon/smsc47b397.c - -SMSC911x ETHERNET DRIVER -M: Steve Glendinning <steve.glendinning@smsc.com> -L: netdev@vger.kernel.org -S: Supported -F: include/linux/smsc911x.h -F: drivers/net/ethernet/smsc/smsc911x.* - -SMSC9420 PCI ETHERNET DRIVER -M: Steve Glendinning <steve.glendinning@smsc.com> -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/ethernet/smsc/smsc9420.* - -SMSC UFX6000 and UFX7000 USB to VGA DRIVER -M: Steve Glendinning <steve.glendinning@smsc.com> -L: linux-fbdev@vger.kernel.org -S: Supported -F: drivers/video/smscufx.c - -SN-IA64 (Itanium) SUB-PLATFORM -M: Jes Sorensen <jes@sgi.com> -L: linux-altix@sgi.com -L: linux-ia64@vger.kernel.org -W: http://www.sgi.com/altix -S: Maintained -F: arch/ia64/sn/ - -SOC-CAMERA V4L2 SUBSYSTEM -M: Guennadi Liakhovetski <g.liakhovetski@gmx.de> -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -S: Maintained -F: include/media/v4l2* -F: drivers/media/video/v4l2* - -SOEKRIS NET48XX LED SUPPORT -M: Chris Boot <bootc@bootc.net> -S: Maintained -F: drivers/leds/leds-net48xx.c - -SOFTWARE RAID (Multiple Disks) SUPPORT -M: Neil Brown <neilb@suse.de> -L: linux-raid@vger.kernel.org -S: Supported -F: drivers/md/ -F: include/linux/raid/ - -SONIC NETWORK DRIVER -M: Thomas Bogendoerfer <tsbogend@alpha.franken.de> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/natsemi/sonic.* - -SONICS SILICON BACKPLANE DRIVER (SSB) -M: Michael Buesch <m@bues.ch> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/ssb/ -F: include/linux/ssb/ - -SONY VAIO CONTROL DEVICE DRIVER -M: Mattia Dongili <malattia@linux.it> -L: platform-driver-x86@vger.kernel.org -W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers -S: Maintained -F: Documentation/laptops/sony-laptop.txt -F: drivers/char/sonypi.c -F: drivers/platform/x86/sony-laptop.c -F: include/linux/sony-laptop.h - -SONY MEMORYSTICK CARD SUPPORT -M: Alex Dubov <oakad@yahoo.com> -W: http://tifmxx.berlios.de/ -S: Maintained -F: drivers/memstick/host/tifm_ms.c - -SOUND -M: Jaroslav Kysela <perex@perex.cz> -M: Takashi Iwai <tiwai@suse.de> -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -W: http://www.alsa-project.org/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git -T: git git://git.alsa-project.org/alsa-kernel.git -S: Maintained -F: Documentation/sound/ -F: include/sound/ -F: sound/ - -SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT (ASoC) -M: Liam Girdwood <lrg@ti.com> -M: Mark Brown <broonie@opensource.wolfsonmicro.com> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -W: http://alsa-project.org/main/index.php/ASoC -S: Supported -F: sound/soc/ -F: include/sound/soc* - -SPARC + UltraSPARC (sparc/sparc64) -M: "David S. Miller" <davem@davemloft.net> -L: sparclinux@vger.kernel.org -Q: http://patchwork.ozlabs.org/project/sparclinux/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next.git -S: Maintained -F: arch/sparc/ -F: drivers/sbus/ - -SPARC SERIAL DRIVERS -M: "David S. Miller" <davem@davemloft.net> -L: sparclinux@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git -T: git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next.git -S: Maintained -F: include/linux/sunserialcore.h -F: drivers/tty/serial/suncore.c -F: drivers/tty/serial/sunhv.c -F: drivers/tty/serial/sunsab.c -F: drivers/tty/serial/sunsab.h -F: drivers/tty/serial/sunsu.c -F: drivers/tty/serial/sunzilog.c -F: drivers/tty/serial/sunzilog.h - -SPARSE CHECKER -M: "Christopher Li" <sparse@chrisli.org> -L: linux-sparse@vger.kernel.org -W: https://sparse.wiki.kernel.org/ -T: git git://git.kernel.org/pub/scm/devel/sparse/sparse.git -T: git git://git.kernel.org/pub/scm/devel/sparse/chrisl/sparse.git -S: Maintained -F: include/linux/compiler.h - -SPEAR PLATFORM SUPPORT -M: Viresh Kumar <viresh.kumar@st.com> -L: spear-devel@list.st.com -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.st.com/spear -S: Maintained -F: arch/arm/plat-spear/ - -SPEAR3XX MACHINE SUPPORT -M: Viresh Kumar <viresh.kumar@st.com> -L: spear-devel@list.st.com -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.st.com/spear -S: Maintained -F: arch/arm/mach-spear3xx/ - -SPEAR6XX MACHINE SUPPORT -M: Rajeev Kumar <rajeev-dlh.kumar@st.com> -L: spear-devel@list.st.com -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.st.com/spear -S: Maintained -F: arch/arm/mach-spear6xx/ - -SPEAR CLOCK FRAMEWORK SUPPORT -M: Viresh Kumar <viresh.kumar@st.com> -L: spear-devel@list.st.com -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.st.com/spear -S: Maintained -F: arch/arm/mach-spear*/clock.c -F: arch/arm/plat-spear/clock.c -F: arch/arm/plat-spear/include/plat/clock.h - -SPEAR PAD MULTIPLEXING SUPPORT -M: Viresh Kumar <viresh.kumar@st.com> -L: spear-devel@list.st.com -L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) -W: http://www.st.com/spear -S: Maintained -F: arch/arm/plat-spear/include/plat/padmux.h -F: arch/arm/plat-spear/padmux.c -F: arch/arm/mach-spear*/spear*xx.c -F: arch/arm/mach-spear*/include/mach/generic.h -F: arch/arm/mach-spear3xx/spear3*0.c -F: arch/arm/mach-spear3xx/spear3*0_evb.c -F: arch/arm/mach-spear6xx/spear600.c -F: arch/arm/mach-spear6xx/spear600_evb.c - -SPI SUBSYSTEM -M: Grant Likely <grant.likely@secretlab.ca> -L: spi-devel-general@lists.sourceforge.net -Q: http://patchwork.kernel.org/project/spi-devel-general/list/ -T: git git://git.secretlab.ca/git/linux-2.6.git -S: Maintained -F: Documentation/spi/ -F: drivers/spi/ -F: include/linux/spi/ - -SPIDERNET NETWORK DRIVER for CELL -M: Ishizaki Kou <kou.ishizaki@toshiba.co.jp> -M: Jens Osterkamp <jens@de.ibm.com> -L: netdev@vger.kernel.org -S: Supported -F: Documentation/networking/spider_net.txt -F: drivers/net/ethernet/toshiba/spider_net* - -SPU FILE SYSTEM -M: Jeremy Kerr <jk@ozlabs.org> -L: linuxppc-dev@lists.ozlabs.org -L: cbe-oss-dev@lists.ozlabs.org -W: http://www.ibm.com/developerworks/power/cell/ -S: Supported -F: Documentation/filesystems/spufs.txt -F: arch/powerpc/platforms/cell/spufs/ - -SQUASHFS FILE SYSTEM -M: Phillip Lougher <phillip@squashfs.org.uk> -L: squashfs-devel@lists.sourceforge.net (subscribers-only) -W: http://squashfs.org.uk -S: Maintained -F: Documentation/filesystems/squashfs.txt -F: fs/squashfs/ - -SRM (Alpha) environment access -M: Jan-Benedict Glaw <jbglaw@lug-owl.de> -S: Maintained -F: arch/alpha/kernel/srm_env.c - -STABLE BRANCH -M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -L: stable@vger.kernel.org -S: Supported - -STAGING SUBSYSTEM -M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git -L: devel@driverdev.osuosl.org -S: Supported -F: drivers/staging/ - -STAGING - AGERE HERMES II and II.5 WIRELESS DRIVERS -M: Henk de Groot <pe1dnn@amsat.org> -S: Odd Fixes -F: drivers/staging/wlags49_h2/ -F: drivers/staging/wlags49_h25/ - -STAGING - ASUS OLED -M: Jakub Schmidtke <sjakub@gmail.com> -S: Odd Fixes -F: drivers/staging/asus_oled/ - -STAGING - COMEDI -M: Ian Abbott <abbotti@mev.co.uk> -M: Mori Hess <fmhess@users.sourceforge.net> -S: Odd Fixes -F: drivers/staging/comedi/ - -STAGING - CRYSTAL HD VIDEO DECODER -M: Naren Sankar <nsankar@broadcom.com> -M: Jarod Wilson <jarod@wilsonet.com> -M: Scott Davilla <davilla@4pi.com> -M: Manu Abraham <abraham.manu@gmail.com> -S: Odd Fixes -F: drivers/staging/crystalhd/ - -STAGING - ECHO CANCELLER -M: Steve Underwood <steveu@coppice.org> -M: David Rowe <david@rowetel.com> -S: Odd Fixes -F: drivers/staging/echo/ - -STAGING - ET131X NETWORK DRIVER -M: Mark Einon <mark.einon@gmail.com> -S: Odd Fixes -F: drivers/staging/et131x/ - -STAGING - FLARION FT1000 DRIVERS -M: Marek Belisko <marek.belisko@gmail.com> -S: Odd Fixes -F: drivers/staging/ft1000/ - -STAGING - FRONTIER TRANZPORT AND ALPHATRACK -M: David Täht <d@teklibre.com> -S: Odd Fixes -F: drivers/staging/frontier/ - -STAGING - INDUSTRIAL IO -M: Jonathan Cameron <jic23@cam.ac.uk> -L: linux-iio@vger.kernel.org -S: Odd Fixes -F: drivers/staging/iio/ - -STAGING - LIRC (LINUX INFRARED REMOTE CONTROL) DRIVERS -M: Jarod Wilson <jarod@wilsonet.com> -W: http://www.lirc.org/ -S: Odd Fixes -F: drivers/staging/media/lirc/ - -STAGING - NVIDIA COMPLIANT EMBEDDED CONTROLLER INTERFACE (nvec) -M: Julian Andres Klode <jak@jak-linux.org> -M: Marc Dietrich <marvin24@gmx.de> -L: ac100@lists.launchpad.net (moderated for non-subscribers) -S: Maintained -F: drivers/staging/nvec/ - -STAGING - OLPC SECONDARY DISPLAY CONTROLLER (DCON) -M: Andres Salomon <dilinger@queued.net> -M: Chris Ball <cjb@laptop.org> -M: Jon Nettleton <jon.nettleton@gmail.com> -W: http://wiki.laptop.org/go/DCON -S: Odd Fixes -F: drivers/staging/olpc_dcon/ - -STAGING - OZMO DEVICES USB OVER WIFI DRIVER -M: Rupesh Gujare <rgujare@ozmodevices.com> -M: Chris Kelly <ckelly@ozmodevices.com> -S: Maintained -F: drivers/staging/ozwpan/ - -STAGING - PARALLEL LCD/KEYPAD PANEL DRIVER -M: Willy Tarreau <willy@meta-x.org> -S: Odd Fixes -F: drivers/staging/panel/ - -STAGING - REALTEK RTL8712U DRIVERS -M: Larry Finger <Larry.Finger@lwfinger.net> -M: Florian Schilhabel <florian.c.schilhabel@googlemail.com>. -S: Odd Fixes -F: drivers/staging/rtl8712/ - -STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER -M: Teddy Wang <teddy.wang@siliconmotion.com.cn> -S: Odd Fixes -F: drivers/staging/sm7xx/ - -STAGING - SOFTLOGIC 6x10 MPEG CODEC -M: Ben Collins <bcollins@bluecherry.net> -S: Odd Fixes -F: drivers/staging/media/solo6x10/ - -STAGING - SPEAKUP CONSOLE SPEECH DRIVER -M: William Hubbs <w.d.hubbs@gmail.com> -M: Chris Brannon <chris@the-brannons.com> -M: Kirk Reiser <kirk@braille.uwo.ca> -M: Samuel Thibault <samuel.thibault@ens-lyon.org> -L: speakup@braille.uwo.ca -W: http://www.linux-speakup.org/ -S: Odd Fixes -F: drivers/staging/speakup/ - -STAGING - TI DSP BRIDGE DRIVERS -M: Omar Ramirez Luna <omar.ramirez@ti.com> -S: Odd Fixes -F: drivers/staging/tidspbridge/ - -STAGING - USB ENE SM/MS CARD READER DRIVER -M: Al Cho <acho@novell.com> -S: Odd Fixes -F: drivers/staging/keucr/ - -STAGING - VIA VT665X DRIVERS -M: Forest Bond <forest@alittletooquiet.net> -S: Odd Fixes -F: drivers/staging/vt665?/ - -STAGING - WINBOND IS89C35 WLAN USB DRIVER -M: Pavel Machek <pavel@ucw.cz> -S: Odd Fixes -F: drivers/staging/winbond/ - -STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER -M: Arnaud Patard <arnaud.patard@rtp-net.org> -S: Odd Fixes -F: drivers/staging/xgifb/ - -STARFIRE/DURALAN NETWORK DRIVER -M: Ion Badulescu <ionut@badula.org> -S: Odd Fixes -F: drivers/net/ethernet/adaptec/starfire* - -SUN3/3X -M: Sam Creasey <sammy@sammy.net> -W: http://sammy.net/sun3/ -S: Maintained -F: arch/m68k/kernel/*sun3* -F: arch/m68k/sun3*/ -F: arch/m68k/include/asm/sun3* -F: drivers/net/ethernet/i825xx/sun3* - -SUPERH -M: Paul Mundt <lethal@linux-sh.org> -L: linux-sh@vger.kernel.org -W: http://www.linux-sh.org -Q: http://patchwork.kernel.org/project/linux-sh/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6.git sh-latest -S: Supported -F: Documentation/sh/ -F: arch/sh/ -F: drivers/sh/ - -SUSPEND TO RAM -M: Len Brown <len.brown@intel.com> -M: Pavel Machek <pavel@ucw.cz> -M: "Rafael J. Wysocki" <rjw@sisk.pl> -L: linux-pm@vger.kernel.org -S: Supported -F: Documentation/power/ -F: arch/x86/kernel/acpi/ -F: drivers/base/power/ -F: kernel/power/ -F: include/linux/suspend.h -F: include/linux/freezer.h -F: include/linux/pm.h - -SVGA HANDLING -M: Martin Mares <mj@ucw.cz> -L: linux-video@atrey.karlin.mff.cuni.cz -S: Maintained -F: Documentation/svga.txt -F: arch/x86/boot/video* - -SYSV FILESYSTEM -M: Christoph Hellwig <hch@infradead.org> -S: Maintained -F: Documentation/filesystems/sysv-fs.txt -F: fs/sysv/ -F: include/linux/sysv_fs.h - -TARGET SUBSYSTEM -M: Nicholas A. Bellinger <nab@linux-iscsi.org> -L: linux-scsi@vger.kernel.org -L: target-devel@vger.kernel.org -L: http://groups.google.com/group/linux-iscsi-target-dev -W: http://www.linux-iscsi.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/nab/lio-core.git master -S: Supported -F: drivers/target/ -F: include/target/ -F: Documentation/target/ - -TASKSTATS STATISTICS INTERFACE -M: Balbir Singh <bsingharora@gmail.com> -S: Maintained -F: Documentation/accounting/taskstats* -F: include/linux/taskstats* -F: kernel/taskstats.c - -TC CLASSIFIER -M: Jamal Hadi Salim <hadi@cyberus.ca> -L: netdev@vger.kernel.org -S: Maintained -F: include/linux/pkt_cls.h -F: include/net/pkt_cls.h -F: net/sched/ - -TCP LOW PRIORITY MODULE -M: "Wong Hoi Sing, Edison" <hswong3i@gmail.com> -M: "Hung Hing Lun, Mike" <hlhung3i@gmail.com> -W: http://tcp-lp-mod.sourceforge.net/ -S: Maintained -F: net/ipv4/tcp_lp.c - -TEAM DRIVER -M: Jiri Pirko <jpirko@redhat.com> -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/team/ -F: include/linux/if_team.h - -TEGRA SUPPORT -M: Colin Cross <ccross@android.com> -M: Olof Johansson <olof@lixom.net> -M: Stephen Warren <swarren@wwwdotorg.org> -L: linux-tegra@vger.kernel.org -Q: http://patchwork.ozlabs.org/project/linux-tegra/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra.git -S: Supported -F: arch/arm/mach-tegra - -TEHUTI ETHERNET DRIVER -M: Andy Gospodarek <andy@greyhouse.net> -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/ethernet/tehuti/* - -Telecom Clock Driver for MCPL0010 -M: Mark Gross <mark.gross@intel.com> -S: Supported -F: drivers/char/tlclk.c - -TENSILICA XTENSA PORT (xtensa) -M: Chris Zankel <chris@zankel.net> -S: Maintained -F: arch/xtensa/ - -THINKPAD ACPI EXTRAS DRIVER -M: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br> -L: ibm-acpi-devel@lists.sourceforge.net -L: platform-driver-x86@vger.kernel.org -W: http://ibm-acpi.sourceforge.net -W: http://thinkwiki.org/wiki/Ibm-acpi -T: git git://repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git -S: Maintained -F: drivers/platform/x86/thinkpad_acpi.c - -TI FLASH MEDIA INTERFACE DRIVER -M: Alex Dubov <oakad@yahoo.com> -S: Maintained -F: drivers/misc/tifm* -F: drivers/mmc/host/tifm_sd.c -F: include/linux/tifm.h - -TI TWL4030 SERIES SOC CODEC DRIVER -M: Peter Ujfalusi <peter.ujfalusi@ti.com> -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -S: Maintained -F: sound/soc/codecs/twl4030* - -TIPC NETWORK LAYER -M: Jon Maloy <jon.maloy@ericsson.com> -M: Allan Stephens <allan.stephens@windriver.com> -L: netdev@vger.kernel.org (core kernel code) -L: tipc-discussion@lists.sourceforge.net (user apps, general discussion) -W: http://tipc.sourceforge.net/ -S: Maintained -F: include/linux/tipc*.h -F: net/tipc/ - -TILE ARCHITECTURE -M: Chris Metcalf <cmetcalf@tilera.com> -W: http://www.tilera.com/scm/ -S: Supported -F: arch/tile/ -F: drivers/tty/hvc/hvc_tile.c -F: drivers/net/ethernet/tile/ -F: drivers/edac/tile_edac.c - -TLAN NETWORK DRIVER -M: Samuel Chessman <chessman@tux.org> -L: tlan-devel@lists.sourceforge.net (subscribers-only) -W: http://sourceforge.net/projects/tlan/ -S: Maintained -F: Documentation/networking/tlan.txt -F: drivers/net/ethernet/ti/tlan.* - -TOMOYO SECURITY MODULE -M: Kentaro Takeda <takedakn@nttdata.co.jp> -M: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> -L: tomoyo-dev-en@lists.sourceforge.jp (subscribers-only, for developers in English) -L: tomoyo-users-en@lists.sourceforge.jp (subscribers-only, for users in English) -L: tomoyo-dev@lists.sourceforge.jp (subscribers-only, for developers in Japanese) -L: tomoyo-users@lists.sourceforge.jp (subscribers-only, for users in Japanese) -W: http://tomoyo.sourceforge.jp/ -T: quilt http://svn.sourceforge.jp/svnroot/tomoyo/trunk/2.5.x/tomoyo-lsm/patches/ -S: Maintained -F: security/tomoyo/ - -TOPSTAR LAPTOP EXTRAS DRIVER -M: Herton Ronaldo Krzesinski <herton@canonical.com> -L: platform-driver-x86@vger.kernel.org -S: Maintained -F: drivers/platform/x86/topstar-laptop.c - -TOSHIBA ACPI EXTRAS DRIVER -L: platform-driver-x86@vger.kernel.org -S: Orphan -F: drivers/platform/x86/toshiba_acpi.c - -TOSHIBA SMM DRIVER -M: Jonathan Buzzard <jonathan@buzzard.org.uk> -L: tlinux-users@tce.toshiba-dme.co.jp -W: http://www.buzzard.org.uk/toshiba/ -S: Maintained -F: drivers/char/toshiba.c -F: include/linux/toshiba.h - -TMIO MMC DRIVER -M: Guennadi Liakhovetski <g.liakhovetski@gmx.de> -M: Ian Molton <ian@mnementh.co.uk> -L: linux-mmc@vger.kernel.org -S: Maintained -F: drivers/mmc/host/tmio_mmc* -F: drivers/mmc/host/sh_mobile_sdhi.c -F: include/linux/mmc/tmio.h -F: include/linux/mmc/sh_mobile_sdhi.h - -TMPFS (SHMEM FILESYSTEM) -M: Hugh Dickins <hughd@google.com> -L: linux-mm@kvack.org -S: Maintained -F: include/linux/shmem_fs.h -F: mm/shmem.c - -TPM DEVICE DRIVER -M: Debora Velarde <debora@linux.vnet.ibm.com> -M: Rajiv Andrade <srajiv@linux.vnet.ibm.com> -W: http://tpmdd.sourceforge.net -M: Marcel Selhorst <m.selhorst@sirrix.com> -W: http://www.sirrix.com -L: tpmdd-devel@lists.sourceforge.net (moderated for non-subscribers) -S: Maintained -F: drivers/char/tpm/ - -TRACING -M: Steven Rostedt <rostedt@goodmis.org> -M: Frederic Weisbecker <fweisbec@gmail.com> -M: Ingo Molnar <mingo@redhat.com> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core -S: Maintained -F: Documentation/trace/ftrace.txt -F: arch/*/*/*/ftrace.h -F: arch/*/kernel/ftrace.c -F: include/*/ftrace.h -F: include/linux/trace*.h -F: include/trace/ -F: kernel/trace/ - -TRIVIAL PATCHES -M: Jiri Kosina <trivial@kernel.org> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial.git -S: Maintained -K: ^Subject:.*(?i)trivial - -TTY LAYER -M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -S: Supported -T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git -F: drivers/tty/ -F: drivers/tty/serial/serial_core.c -F: include/linux/serial_core.h -F: include/linux/serial.h -F: include/linux/tty.h - -TULIP NETWORK DRIVERS -M: Grant Grundler <grundler@parisc-linux.org> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/dec/tulip/ - -TUN/TAP driver -M: Maxim Krasnyansky <maxk@qualcomm.com> -L: vtun@office.satix.net -W: http://vtun.sourceforge.net/tun -S: Maintained -F: Documentation/networking/tuntap.txt -F: arch/um/os-Linux/drivers/ - -TURBOCHANNEL SUBSYSTEM -M: "Maciej W. Rozycki" <macro@linux-mips.org> -S: Maintained -F: drivers/tc/ -F: include/linux/tc.h - -U14-34F SCSI DRIVER -M: Dario Ballabio <ballabio_dario@emc.com> -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/u14-34f.c - -UBI FILE SYSTEM (UBIFS) -M: Artem Bityutskiy <dedekind1@gmail.com> -M: Adrian Hunter <adrian.hunter@intel.com> -L: linux-mtd@lists.infradead.org -T: git git://git.infradead.org/ubifs-2.6.git -W: http://www.linux-mtd.infradead.org/doc/ubifs.html -S: Maintained -F: Documentation/filesystems/ubifs.txt -F: fs/ubifs/ - -UCLINUX (AND M68KNOMMU) -M: Greg Ungerer <gerg@uclinux.org> -W: http://www.uclinux.org/ -L: uclinux-dev@uclinux.org (subscribers-only) -S: Maintained -F: arch/m68k/*/*_no.* -F: arch/m68k/include/asm/*_no.* - -UCLINUX FOR RENESAS H8/300 (H8300) -M: Yoshinori Sato <ysato@users.sourceforge.jp> -W: http://uclinux-h8.sourceforge.jp/ -S: Supported -F: arch/h8300/ -F: drivers/ide/ide-h8300.c -F: drivers/net/ethernet/8390/ne-h8300.c - -UDF FILESYSTEM -M: Jan Kara <jack@suse.cz> -S: Maintained -F: Documentation/filesystems/udf.txt -F: fs/udf/ - -UFS FILESYSTEM -M: Evgeniy Dushistov <dushistov@mail.ru> -S: Maintained -F: Documentation/filesystems/ufs.txt -F: fs/ufs/ - -ULTRA-WIDEBAND (UWB) SUBSYSTEM: -L: linux-usb@vger.kernel.org -S: Orphan -F: drivers/uwb/ -F: include/linux/uwb.h -F: include/linux/uwb/ - -UNICORE32 ARCHITECTURE: -M: Guan Xuetao <gxt@mprc.pku.edu.cn> -W: http://mprc.pku.edu.cn/~guanxuetao/linux -S: Maintained -T: git git://git.kernel.org/pub/scm/linux/kernel/git/epip/linux-2.6-unicore32.git -F: arch/unicore32/ - -UNIFDEF -M: Tony Finch <dot@dotat.at> -W: http://dotat.at/prog/unifdef -S: Maintained -F: scripts/unifdef.c - -UNIFORM CDROM DRIVER -M: Jens Axboe <axboe@kernel.dk> -W: http://www.kernel.dk -S: Maintained -F: Documentation/cdrom/ -F: drivers/cdrom/cdrom.c -F: include/linux/cdrom.h - -UNSORTED BLOCK IMAGES (UBI) -M: Artem Bityutskiy <dedekind1@gmail.com> -W: http://www.linux-mtd.infradead.org/ -L: linux-mtd@lists.infradead.org -T: git git://git.infradead.org/ubi-2.6.git -S: Maintained -F: drivers/mtd/ubi/ -F: include/linux/mtd/ubi.h -F: include/mtd/ubi-user.h - -USB ACM DRIVER -M: Oliver Neukum <oliver@neukum.name> -L: linux-usb@vger.kernel.org -S: Maintained -F: Documentation/usb/acm.txt -F: drivers/usb/class/cdc-acm.* - -USB ATTACHED SCSI -M: Matthew Wilcox <willy@linux.intel.com> -M: Sarah Sharp <sarah.a.sharp@linux.intel.com> -L: linux-usb@vger.kernel.org -L: linux-scsi@vger.kernel.org -S: Supported -F: drivers/usb/storage/uas.c - -USB BLOCK DRIVER (UB ub) -M: Pete Zaitcev <zaitcev@redhat.com> -L: linux-usb@vger.kernel.org -S: Supported -F: drivers/block/ub.c - -USB CDC ETHERNET DRIVER -M: Oliver Neukum <oliver@neukum.name> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/net/usb/cdc_*.c -F: include/linux/usb/cdc.h - -USB CYPRESS C67X00 DRIVER -M: Peter Korsgaard <jacmet@sunsite.dk> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/usb/c67x00/ - -USB DAVICOM DM9601 DRIVER -M: Peter Korsgaard <jacmet@sunsite.dk> -L: netdev@vger.kernel.org -W: http://www.linux-usb.org/usbnet -S: Maintained -F: drivers/net/usb/dm9601.c - -USB DIAMOND RIO500 DRIVER -M: Cesar Miquel <miquel@df.uba.ar> -L: rio500-users@lists.sourceforge.net -W: http://rio500.sourceforge.net -S: Maintained -F: drivers/usb/misc/rio500* - -USB EHCI DRIVER -M: Alan Stern <stern@rowland.harvard.edu> -L: linux-usb@vger.kernel.org -S: Maintained -F: Documentation/usb/ehci.txt -F: drivers/usb/host/ehci* - -USB ET61X[12]51 DRIVER -M: Luca Risolia <luca.risolia@studio.unibo.it> -L: linux-usb@vger.kernel.org -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -W: http://www.linux-projects.org -S: Maintained -F: drivers/media/video/et61x251/ - -USB GADGET/PERIPHERAL SUBSYSTEM -M: Felipe Balbi <balbi@ti.com> -L: linux-usb@vger.kernel.org -W: http://www.linux-usb.org/gadget -T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git -S: Maintained -F: drivers/usb/gadget/ -F: include/linux/usb/gadget* - -USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...) -M: Jiri Kosina <jkosina@suse.cz> -L: linux-usb@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git -S: Maintained -F: Documentation/hid/hiddev.txt -F: drivers/hid/usbhid/ - -USB/IP DRIVERS -M: Matt Mooney <mfm@muteddisk.com> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/staging/usbip/ - -USB ISP116X DRIVER -M: Olav Kongas <ok@artecdesign.ee> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/usb/host/isp116x* -F: include/linux/usb/isp116x.h - -USB KAWASAKI LSI DRIVER -M: Oliver Neukum <oliver@neukum.name> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/usb/serial/kl5kusb105.* - -USB MASS STORAGE DRIVER -M: Matthew Dharm <mdharm-usb@one-eyed-alien.net> -L: linux-usb@vger.kernel.org -L: usb-storage@lists.one-eyed-alien.net -S: Maintained -W: http://www.one-eyed-alien.net/~mdharm/linux-usb/ -F: drivers/usb/storage/ - -USB MIDI DRIVER -M: Clemens Ladisch <clemens@ladisch.de> -L: alsa-devel@alsa-project.org (moderated for non-subscribers) -T: git git://git.alsa-project.org/alsa-kernel.git -S: Maintained -F: sound/usb/midi.* - -USB OHCI DRIVER -M: Alan Stern <stern@rowland.harvard.edu> -L: linux-usb@vger.kernel.org -S: Maintained -F: Documentation/usb/ohci.txt -F: drivers/usb/host/ohci* - -USB OPTION-CARD DRIVER -M: Matthias Urlichs <smurf@smurf.noris.de> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/usb/serial/option.c - -USB PEGASUS DRIVER -M: Petko Manolov <petkan@users.sourceforge.net> -L: linux-usb@vger.kernel.org -L: netdev@vger.kernel.org -W: http://pegasus2.sourceforge.net/ -S: Maintained -F: drivers/net/usb/pegasus.* - -USB PRINTER DRIVER (usblp) -M: Pete Zaitcev <zaitcev@redhat.com> -L: linux-usb@vger.kernel.org -S: Supported -F: drivers/usb/class/usblp.c - -USB RTL8150 DRIVER -M: Petko Manolov <petkan@users.sourceforge.net> -L: linux-usb@vger.kernel.org -L: netdev@vger.kernel.org -W: http://pegasus2.sourceforge.net/ -S: Maintained -F: drivers/net/usb/rtl8150.c - -USB SERIAL BELKIN F5U103 DRIVER -M: William Greathouse <wgreathouse@smva.com> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/usb/serial/belkin_sa.* - -USB SERIAL CYPRESS M8 DRIVER -M: Lonnie Mendez <dignome@gmail.com> -L: linux-usb@vger.kernel.org -S: Maintained -W: http://geocities.com/i0xox0i -W: http://firstlight.net/cvs -F: drivers/usb/serial/cypress_m8.* - -USB SERIAL CYBERJACK DRIVER -M: Matthias Bruestle and Harald Welte <support@reiner-sct.com> -W: http://www.reiner-sct.de/support/treiber_cyberjack.php -S: Maintained -F: drivers/usb/serial/cyberjack.c - -USB SERIAL DIGI ACCELEPORT DRIVER -M: Peter Berger <pberger@brimson.com> -M: Al Borchers <alborchers@steinerpoint.com> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/usb/serial/digi_acceleport.c - -USB SERIAL DRIVER -M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -L: linux-usb@vger.kernel.org -S: Supported -F: Documentation/usb/usb-serial.txt -F: drivers/usb/serial/generic.c -F: drivers/usb/serial/usb-serial.c -F: include/linux/usb/serial.h - -USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER -M: Gary Brubaker <xavyer@ix.netcom.com> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/usb/serial/empeg.c - -USB SERIAL KEYSPAN DRIVER -M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/usb/serial/*keyspan* - -USB SERIAL WHITEHEAT DRIVER -M: Support Department <support@connecttech.com> -L: linux-usb@vger.kernel.org -W: http://www.connecttech.com -S: Supported -F: drivers/usb/serial/whiteheat* - -USB SMSC95XX ETHERNET DRIVER -M: Steve Glendinning <steve.glendinning@smsc.com> -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/usb/smsc95xx.* - -USB SN9C1xx DRIVER -M: Luca Risolia <luca.risolia@studio.unibo.it> -L: linux-usb@vger.kernel.org -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -W: http://www.linux-projects.org -S: Maintained -F: Documentation/video4linux/sn9c102.txt -F: drivers/media/video/sn9c102/ - -USB SUBSYSTEM -M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -L: linux-usb@vger.kernel.org -W: http://www.linux-usb.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git -S: Supported -F: Documentation/usb/ -F: drivers/net/usb/ -F: drivers/usb/ -F: include/linux/usb.h -F: include/linux/usb/ - -USB UHCI DRIVER -M: Alan Stern <stern@rowland.harvard.edu> -L: linux-usb@vger.kernel.org -S: Maintained -F: drivers/usb/host/uhci* - -USB "USBNET" DRIVER FRAMEWORK -M: Oliver Neukum <oneukum@suse.de> -L: netdev@vger.kernel.org -W: http://www.linux-usb.org/usbnet -S: Maintained -F: drivers/net/usb/usbnet.c -F: include/linux/usb/usbnet.h - -USB VIDEO CLASS -M: Laurent Pinchart <laurent.pinchart@ideasonboard.com> -L: linux-uvc-devel@lists.berlios.de (subscribers-only) -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -W: http://www.ideasonboard.org/uvc/ -S: Maintained -F: drivers/media/video/uvc/ - -USB W996[87]CF DRIVER -M: Luca Risolia <luca.risolia@studio.unibo.it> -L: linux-usb@vger.kernel.org -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -W: http://www.linux-projects.org -S: Maintained -F: Documentation/video4linux/w9968cf.txt -F: drivers/media/video/w996* - -USB WIRELESS RNDIS DRIVER (rndis_wlan) -M: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> -L: linux-wireless@vger.kernel.org -S: Maintained -F: drivers/net/wireless/rndis_wlan.c - -USB XHCI DRIVER -M: Sarah Sharp <sarah.a.sharp@linux.intel.com> -L: linux-usb@vger.kernel.org -S: Supported -F: drivers/usb/host/xhci* -F: drivers/usb/host/pci-quirks* - -USB ZD1201 DRIVER -L: linux-wireless@vger.kernel.org -W: http://linux-lc100020.sourceforge.net -S: Orphan -F: drivers/net/wireless/zd1201.* - -USB ZR364XX DRIVER -M: Antoine Jacquet <royale@zerezo.com> -L: linux-usb@vger.kernel.org -L: linux-media@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git -W: http://royale.zerezo.com/zr364xx/ -S: Maintained -F: Documentation/video4linux/zr364xx.txt -F: drivers/media/video/zr364xx.c - -USER-MODE LINUX (UML) -M: Jeff Dike <jdike@addtoit.com> -M: Richard Weinberger <richard@nod.at> -L: user-mode-linux-devel@lists.sourceforge.net -L: user-mode-linux-user@lists.sourceforge.net -W: http://user-mode-linux.sourceforge.net -S: Maintained -F: Documentation/virtual/uml/ -F: arch/um/ -F: fs/hostfs/ -F: fs/hppfs/ - -USERSPACE I/O (UIO) -M: "Hans J. Koch" <hjk@hansjkoch.de> -M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -S: Maintained -F: Documentation/DocBook/uio-howto.tmpl -F: drivers/uio/ -F: include/linux/uio*.h - -UTIL-LINUX-NG PACKAGE -M: Karel Zak <kzak@redhat.com> -L: util-linux-ng@vger.kernel.org -W: http://kernel.org/~kzak/util-linux-ng/ -T: git git://git.kernel.org/pub/scm/utils/util-linux-ng/util-linux-ng.git -S: Maintained - -UVESAFB DRIVER -M: Michal Januszewski <spock@gentoo.org> -L: linux-fbdev@vger.kernel.org -W: http://dev.gentoo.org/~spock/projects/uvesafb/ -S: Maintained -F: Documentation/fb/uvesafb.txt -F: drivers/video/uvesafb.* - -VFAT/FAT/MSDOS FILESYSTEM -M: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> -S: Maintained -F: Documentation/filesystems/vfat.txt -F: fs/fat/ - -VIDEOBUF2 FRAMEWORK -M: Pawel Osciak <pawel@osciak.com> -M: Marek Szyprowski <m.szyprowski@samsung.com> -M: Kyungmin Park <kyungmin.park@samsung.com> -L: linux-media@vger.kernel.org -S: Maintained -F: drivers/media/video/videobuf2-* -F: include/media/videobuf2-* - -VIRTIO CONSOLE DRIVER -M: Amit Shah <amit.shah@redhat.com> -L: virtualization@lists.linux-foundation.org -S: Maintained -F: drivers/char/virtio_console.c -F: include/linux/virtio_console.h - -VIRTIO CORE, NET AND BLOCK DRIVERS -M: Rusty Russell <rusty@rustcorp.com.au> -M: "Michael S. Tsirkin" <mst@redhat.com> -L: virtualization@lists.linux-foundation.org -S: Maintained -F: drivers/virtio/ -F: drivers/net/virtio_net.c -F: drivers/block/virtio_blk.c -F: include/linux/virtio_*.h - -VIRTIO HOST (VHOST) -M: "Michael S. Tsirkin" <mst@redhat.com> -L: kvm@vger.kernel.org -L: virtualization@lists.linux-foundation.org -L: netdev@vger.kernel.org -S: Maintained -F: drivers/vhost/ -F: include/linux/vhost.h - -VIA RHINE NETWORK DRIVER -M: Roger Luethi <rl@hellgate.ch> -S: Maintained -F: drivers/net/ethernet/via/via-rhine.c - -VIAPRO SMBUS DRIVER -M: Jean Delvare <khali@linux-fr.org> -L: linux-i2c@vger.kernel.org -S: Maintained -F: Documentation/i2c/busses/i2c-viapro -F: drivers/i2c/busses/i2c-viapro.c - -VIA SD/MMC CARD CONTROLLER DRIVER -M: Bruce Chang <brucechang@via.com.tw> -M: Harald Welte <HaraldWelte@viatech.com> -S: Maintained -F: drivers/mmc/host/via-sdmmc.c - -VIA UNICHROME(PRO)/CHROME9 FRAMEBUFFER DRIVER -M: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> -L: linux-fbdev@vger.kernel.org -S: Maintained -F: include/linux/via-core.h -F: include/linux/via-gpio.h -F: include/linux/via_i2c.h -F: drivers/video/via/ - -VIA VELOCITY NETWORK DRIVER -M: Francois Romieu <romieu@fr.zoreil.com> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/ethernet/via/via-velocity.* - -VLAN (802.1Q) -M: Patrick McHardy <kaber@trash.net> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/macvlan.c -F: include/linux/if_*vlan.h -F: net/8021q/ - -VLYNQ BUS -M: Florian Fainelli <florian@openwrt.org> -L: openwrt-devel@lists.openwrt.org (subscribers-only) -S: Maintained -F: drivers/vlynq/vlynq.c -F: include/linux/vlynq.h - -VMWARE VMXNET3 ETHERNET DRIVER -M: Shreyas Bhatewara <sbhatewara@vmware.com> -M: "VMware, Inc." <pv-drivers@vmware.com> -L: netdev@vger.kernel.org -S: Maintained -F: drivers/net/vmxnet3/ - -VMware PVSCSI driver -M: Arvind Kumar <arvindkumar@vmware.com> -M: VMware PV-Drivers <pv-drivers@vmware.com> -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/vmw_pvscsi.c -F: drivers/scsi/vmw_pvscsi.h - -VOLTAGE AND CURRENT REGULATOR FRAMEWORK -M: Liam Girdwood <lrg@ti.com> -M: Mark Brown <broonie@opensource.wolfsonmicro.com> -W: http://opensource.wolfsonmicro.com/node/15 -W: http://www.slimlogic.co.uk/?p=48 -T: git git://git.kernel.org/pub/scm/linux/kernel/git/lrg/regulator.git -S: Supported -F: drivers/regulator/ -F: include/linux/regulator/ - -VT1211 HARDWARE MONITOR DRIVER -M: Juerg Haefliger <juergh@gmail.com> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/vt1211 -F: drivers/hwmon/vt1211.c - -VT8231 HARDWARE MONITOR DRIVER -M: Roger Lucas <vt8231@hiddenengine.co.uk> -L: lm-sensors@lm-sensors.org -S: Maintained -F: drivers/hwmon/vt8231.c - -VUB300 USB to SDIO/SD/MMC bridge chip -M: Tony Olech <tony.olech@elandigitalsystems.com> -L: linux-mmc@vger.kernel.org -L: linux-usb@vger.kernel.org -S: Supported -F: drivers/mmc/host/vub300.c - -W1 DALLAS'S 1-WIRE BUS -M: Evgeniy Polyakov <zbr@ioremap.net> -S: Maintained -F: Documentation/w1/ -F: drivers/w1/ - -W83791D HARDWARE MONITORING DRIVER -M: Marc Hulsman <m.hulsman@tudelft.nl> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/w83791d -F: drivers/hwmon/w83791d.c - -W83793 HARDWARE MONITORING DRIVER -M: Rudolf Marek <r.marek@assembler.cz> -L: lm-sensors@lm-sensors.org -S: Maintained -F: Documentation/hwmon/w83793 -F: drivers/hwmon/w83793.c - -W83795 HARDWARE MONITORING DRIVER -M: Jean Delvare <khali@linux-fr.org> -L: lm-sensors@lm-sensors.org -S: Maintained -F: drivers/hwmon/w83795.c - -W83L51xD SD/MMC CARD INTERFACE DRIVER -M: Pierre Ossman <pierre@ossman.eu> -S: Maintained -F: drivers/mmc/host/wbsd.* - -WATCHDOG DEVICE DRIVERS -M: Wim Van Sebroeck <wim@iguana.be> -L: linux-watchdog@vger.kernel.org -W: http://www.linux-watchdog.org/ -T: git git://www.linux-watchdog.org/linux-watchdog.git -S: Maintained -F: Documentation/watchdog/ -F: drivers/watchdog/ -F: include/linux/watchdog.h - -WD7000 SCSI DRIVER -M: Miroslav Zagorac <zaga@fly.cc.fer.hr> -L: linux-scsi@vger.kernel.org -S: Maintained -F: drivers/scsi/wd7000.c - -WIIMOTE HID DRIVER -M: David Herrmann <dh.herrmann@googlemail.com> -L: linux-input@vger.kernel.org -S: Maintained -F: drivers/hid/hid-wiimote* - -WINBOND CIR DRIVER -M: David Härdeman <david@hardeman.nu> -S: Maintained -F: drivers/media/rc/winbond-cir.c - -WIMAX STACK -M: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> -M: linux-wimax@intel.com -L: wimax@linuxwimax.org -S: Supported -W: http://linuxwimax.org -F: Documentation/wimax/README.wimax -F: include/linux/wimax.h -F: include/linux/wimax/debug.h -F: include/net/wimax.h -F: net/wimax/ - -WISTRON LAPTOP BUTTON DRIVER -M: Miloslav Trmac <mitr@volny.cz> -S: Maintained -F: drivers/input/misc/wistron_btns.c - -WL1251 WIRELESS DRIVER -M: Luciano Coelho <coelho@ti.com> -L: linux-wireless@vger.kernel.org -W: http://wireless.kernel.org/en/users/Drivers/wl1251 -T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git -S: Maintained -F: drivers/net/wireless/wl1251/* - -WL1271 WIRELESS DRIVER -M: Luciano Coelho <coelho@ti.com> -L: linux-wireless@vger.kernel.org -W: http://wireless.kernel.org/en/users/Drivers/wl12xx -T: git git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx.git -S: Maintained -F: drivers/net/wireless/wl12xx/ -F: include/linux/wl12xx.h - -WL3501 WIRELESS PCMCIA CARD DRIVER -M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> -L: linux-wireless@vger.kernel.org -W: http://oops.ghostprotocols.net:81/blog -S: Maintained -F: drivers/net/wireless/wl3501* - -WM97XX TOUCHSCREEN DRIVERS -M: Mark Brown <broonie@opensource.wolfsonmicro.com> -M: Liam Girdwood <lrg@slimlogic.co.uk> -L: linux-input@vger.kernel.org -T: git git://opensource.wolfsonmicro.com/linux-2.6-touch -W: http://opensource.wolfsonmicro.com/node/7 -S: Supported -F: drivers/input/touchscreen/*wm97* -F: include/linux/wm97xx.h - -WOLFSON MICROELECTRONICS DRIVERS -M: Mark Brown <broonie@opensource.wolfsonmicro.com> -L: patches@opensource.wolfsonmicro.com -T: git git://opensource.wolfsonmicro.com/linux-2.6-asoc -T: git git://opensource.wolfsonmicro.com/linux-2.6-audioplus -W: http://opensource.wolfsonmicro.com/content/linux-drivers-wolfson-devices -S: Supported -F: Documentation/hwmon/wm83?? -F: arch/arm/mach-s3c64xx/mach-crag6410* -F: drivers/leds/leds-wm83*.c -F: drivers/hwmon/wm83??-hwmon.c -F: drivers/input/misc/wm831x-on.c -F: drivers/input/touchscreen/wm831x-ts.c -F: drivers/input/touchscreen/wm97*.c -F: drivers/mfd/wm8*.c -F: drivers/power/wm83*.c -F: drivers/rtc/rtc-wm83*.c -F: drivers/regulator/wm8*.c -F: drivers/video/backlight/wm83*_bl.c -F: drivers/watchdog/wm83*_wdt.c -F: include/linux/mfd/wm831x/ -F: include/linux/mfd/wm8350/ -F: include/linux/mfd/wm8400* -F: include/linux/wm97xx.h -F: include/sound/wm????.h -F: sound/soc/codecs/wm* - -WORKQUEUE -M: Tejun Heo <tj@kernel.org> -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git -S: Maintained -F: include/linux/workqueue.h -F: kernel/workqueue.c -F: Documentation/workqueue.txt - -X.25 NETWORK LAYER -M: Andrew Hendry <andrew.hendry@gmail.com> -L: linux-x25@vger.kernel.org -S: Odd Fixes -F: Documentation/networking/x25* -F: include/net/x25* -F: net/x25/ - -X86 ARCHITECTURE (32-BIT AND 64-BIT) -M: Thomas Gleixner <tglx@linutronix.de> -M: Ingo Molnar <mingo@redhat.com> -M: "H. Peter Anvin" <hpa@zytor.com> -M: x86@kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core -S: Maintained -F: Documentation/x86/ -F: arch/x86/ - -X86 PLATFORM DRIVERS -M: Matthew Garrett <mjg@redhat.com> -L: platform-driver-x86@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86.git -S: Maintained -F: drivers/platform/x86 - -X86 MCE INFRASTRUCTURE -M: Tony Luck <tony.luck@intel.com> -M: Borislav Petkov <bp@amd64.org> -L: linux-edac@vger.kernel.org -S: Maintained -F: arch/x86/kernel/cpu/mcheck/* - -XEN HYPERVISOR INTERFACE -M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> -M: Jeremy Fitzhardinge <jeremy@goop.org> -L: xen-devel@lists.xensource.com (moderated for non-subscribers) -L: virtualization@lists.linux-foundation.org -S: Supported -F: arch/x86/xen/ -F: drivers/*/xen-*front.c -F: drivers/xen/ -F: arch/x86/include/asm/xen/ -F: include/xen/ - -XEN NETWORK BACKEND DRIVER -M: Ian Campbell <ian.campbell@citrix.com> -L: xen-devel@lists.xensource.com (moderated for non-subscribers) -L: netdev@vger.kernel.org -S: Supported -F: drivers/net/xen-netback/* - -XEN PCI SUBSYSTEM -M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> -L: xen-devel@lists.xensource.com (moderated for non-subscribers) -S: Supported -F: arch/x86/pci/*xen* -F: drivers/pci/*xen* - -XEN SWIOTLB SUBSYSTEM -M: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> -L: xen-devel@lists.xensource.com (moderated for non-subscribers) -S: Supported -F: arch/x86/xen/*swiotlb* -F: drivers/xen/*swiotlb* - -XFS FILESYSTEM -P: Silicon Graphics Inc -M: Ben Myers <bpm@sgi.com> -M: Alex Elder <elder@kernel.org> -M: xfs-masters@oss.sgi.com -L: xfs@oss.sgi.com -W: http://oss.sgi.com/projects/xfs -T: git git://oss.sgi.com/xfs/xfs.git -S: Supported -F: Documentation/filesystems/xfs.txt -F: fs/xfs/ - -XILINX AXI ETHERNET DRIVER -M: Ariane Keller <ariane.keller@tik.ee.ethz.ch> -M: Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch> -S: Maintained -F: drivers/net/ethernet/xilinx/xilinx_axienet* - -XILINX SYSTEMACE DRIVER -M: Grant Likely <grant.likely@secretlab.ca> -W: http://www.secretlab.ca/ -S: Maintained -F: drivers/block/xsysace.c - -XILINX UARTLITE SERIAL DRIVER -M: Peter Korsgaard <jacmet@sunsite.dk> -L: linux-serial@vger.kernel.org -S: Maintained -F: drivers/tty/serial/uartlite.c - -YAM DRIVER FOR AX.25 -M: Jean-Paul Roubelat <jpr@f6fbb.org> -L: linux-hams@vger.kernel.org -S: Maintained -F: drivers/net/hamradio/yam* -F: include/linux/yam.h - -YEALINK PHONE DRIVER -M: Henk Vergonet <Henk.Vergonet@gmail.com> -L: usbb2k-api-dev@nongnu.org -S: Maintained -F: Documentation/input/yealink.txt -F: drivers/input/misc/yealink.* - -Z8530 DRIVER FOR AX.25 -M: Joerg Reuter <jreuter@yaina.de> -W: http://yaina.de/jreuter/ -W: http://www.qsl.net/dl1bke/ -L: linux-hams@vger.kernel.org -S: Maintained -F: Documentation/networking/z8530drv.txt -F: drivers/net/hamradio/*scc.c -F: drivers/net/hamradio/z8530.h - -ZD1211RW WIRELESS DRIVER -M: Daniel Drake <dsd@gentoo.org> -M: Ulrich Kunitz <kune@deine-taler.de> -W: http://zd1211.ath.cx/wiki/DriverRewrite -L: linux-wireless@vger.kernel.org -L: zd1211-devs@lists.sourceforge.net (subscribers-only) -S: Maintained -F: drivers/net/wireless/zd1211rw/ - -ZR36067 VIDEO FOR LINUX DRIVER -L: mjpeg-users@lists.sourceforge.net -L: linux-media@vger.kernel.org -W: http://mjpeg.sourceforge.net/driver-zoran/ -T: Mercurial http://linuxtv.org/hg/v4l-dvb -S: Odd Fixes -F: drivers/media/video/zoran/ - -ZS DECSTATION Z85C30 SERIAL DRIVER -M: "Maciej W. Rozycki" <macro@linux-mips.org> -S: Maintained -F: drivers/tty/serial/zs.* - -THE REST -M: Linus Torvalds <torvalds@linux-foundation.org> -L: linux-kernel@vger.kernel.org -Q: http://patchwork.kernel.org/project/LKML/list/ -T: git git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git -S: Buried alive in reporters -F: * -F: */ diff --git a/openairITS/mac/DOT11/Makefile b/openairITS/mac/DOT11/Makefile deleted file mode 100644 index 647d32b819e..00000000000 --- a/openairITS/mac/DOT11/Makefile +++ /dev/null @@ -1,248 +0,0 @@ -export KMODDIR?= updates -KMODDIR_ARG:= "INSTALL_MOD_DIR=$(KMODDIR)" -ifneq ($(origin KLIB), undefined) -KMODPATH_ARG:= "INSTALL_MOD_PATH=$(KLIB)" -else -export KLIB:= /lib/modules/$(shell uname -r) -endif -export KLIB_BUILD ?= $(KLIB)/build -export MAKE - -DESTDIR?= - -ifneq ($(KERNELRELEASE),) - --include $(COMPAT_CONFIG) -include $(COMPAT_CONFIG_CW) - -NOSTDINC_FLAGS := -I$(M)/include/ \ - -include $(M)/include/linux/compat-2.6.h \ - $(CFLAGS) - -obj-y := compat/ - -#obj-$(CONFIG_COMPAT_RFKILL) += net/rfkill/ - -ifeq ($(BT),) -obj-$(CONFIG_COMPAT_WIRELESS) += net/wireless/ net/mac80211/ -#obj-$(CONFIG_COMPAT_WIRELESS_MODULES) += drivers/net/wireless/ - -#obj-$(CONFIG_COMPAT_NET_USB_MODULES) += drivers/net/usb/ - -#obj-$(CONFIG_COMPAT_NETWORK_MODULES) += drivers/net/ethernet/atheros/ -#obj-$(CONFIG_COMPAT_NETWORK_MODULES) += drivers/net/ethernet/broadcom/ - -#obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/ssb/ -#obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/bcma/ -#obj-$(CONFIG_COMPAT_VAR_MODULES) += drivers/misc/eeprom/ - -ifeq ($(CONFIG_STAGING_EXCLUDE_BUILD),) -endif - -endif - -#obj-$(CONFIG_COMPAT_BLUETOOTH) += net/bluetooth/ -#obj-$(CONFIG_COMPAT_BLUETOOTH_MODULES) += drivers/bluetooth/ - -else - -export PWD := $(shell pwd) - -# The build will fail if there is any space in PWD. -ifneq (,$(findstring $() ,$(PWD))) -$(error "The path to this compat-wireless directory has spaces in it." \ - "Please put it somewhere where there is no space") -endif - -export CFLAGS += \ - -DCOMPAT_BASE_TREE="\"$(shell cat $(PWD)/compat_base_tree)\"" \ - -DCOMPAT_BASE_TREE_VERSION="\"$(shell cat $(PWD)/compat_base_tree_version)\"" \ - -DCOMPAT_PROJECT="\"Compat-wireless\"" \ - -DCOMPAT_VERSION="\"$(shell cat $(PWD)/compat_version)\"" - -# These exported as they are used by the scripts -# to check config and compat autoconf -export COMPAT_CONFIG_CW=$(PWD)/config.mk -export COMPAT_CONFIG=$(PWD)/.config -export CONFIG_CHECK=$(PWD)/.config.mk_md5sum.txt -export COMPAT_AUTOCONF=include/linux/compat_autoconf.h -export CREL=$(shell cat $(PWD)/compat_version) -export CREL_PRE:=.compat_autoconf_ -export CREL_CHECK:=$(PWD)/$(CREL_PRE)$(CREL) - -all: modules - -$(COMPAT_CONFIG): ; - -modules: $(CREL_CHECK) - $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules - @touch $@ - -bt: $(CREL_CHECK) - +@./scripts/check_config.sh - $(MAKE) -C $(KLIB_BUILD) M=$(PWD) BT=TRUE modules - @touch $@ - -# We use a CREL_CHECK variable which will depend on the environment used to -# build. If the environment requirements change it forces a reconfiguration -# check. This means we force a new reconfiguration check if a the user gets a -# new updates of compat-wireless or when the user updates the $(COMPAT_CONFIG) -# file. -# XXX: add kernel target to the CREL_CHECK mix, this would ensure we also -# reconfigure and build again fresh if we detect a new target kernel is -# being used. -$(CREL_CHECK): - @# Force to regenerate compat autoconf - +@./compat/scripts/gen-compat-config.sh > $(COMPAT_CONFIG) - @rm -f $(CONFIG_CHECK) - +@./scripts/check_config.sh - @md5sum $(COMPAT_CONFIG_CW) > $(CONFIG_CHECK) - @touch $@ - -btinstall: btuninstall bt-install-modules - -bt-install-modules: bt - $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) BT=TRUE \ - modules_install - @/sbin/depmod -ae - @echo - @echo Now run: - @echo - @echo sudo make btunload: - @echo - @echo And then load the needed bluetooth modules. If unsure reboot. - @echo - -btuninstall: - @# New location, matches upstream - @rm -rf $(KLIB)/$(KMODDIR)/net/bluetooth/ - @rm -rf $(KLIB)/$(KMODDIR)/drivers/bluetooth/ - @# Lets only remove the stuff we are sure we are providing - @# on the misc directory. - @/sbin/depmod -ae - @echo - -btclean: - $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) BT=TRUE clean - @rm -f $(CREL_PRE)* - -install: uninstall install-modules install-scripts - -install-modules: modules - $(MAKE) -C $(KLIB_BUILD) M=$(PWD) $(KMODDIR_ARG) $(KMODPATH_ARG) \ - modules_install - @./scripts/update-initramfs - -install-scripts: - @# All the scripts we can use - @mkdir -p $(DESTDIR)/usr/lib/compat-wireless/ - @install scripts/modlib.sh $(DESTDIR)/usr/lib/compat-wireless/ - @install scripts/madwifi-unload $(DESTDIR)/usr/sbin/ - @# This is to allow switching between drivers without blacklisting - @install scripts/athenable $(DESTDIR)/usr/sbin/ - @install scripts/b43enable $(DESTDIR)/usr/sbin/ - @install scripts/iwl-enable $(DESTDIR)/usr/sbin/ - @install scripts/alx-enable $(DESTDIR)/usr/sbin/ - @install scripts/athload $(DESTDIR)/usr/sbin/ - @install scripts/b43load $(DESTDIR)/usr/sbin/ - @install scripts/iwl-load $(DESTDIR)/usr/sbin/ - @if [ $(shell modinfo ath_pci > /dev/null 2>&1 && echo 1) ]; then \ - echo -n "Note: madwifi detected, we're going to disable it. " ;\ - echo "If you would like to enable it later you can run:" ;\ - echo " sudo athenable madwifi" ;\ - echo ;\ - echo Running athenable ath5k...;\ - $(DESTDIR)/usr/sbin/athenable ath5k ;\ - fi - @if [ $(shell modinfo iwl4965 > /dev/null 2>&1 && echo 1) ]; then \ - echo ;\ - echo -n "Note: iwl4965 detected, we're going to disable it. " ;\ - echo "If you would like to enable it later you can run:" ;\ - echo " sudo iwl-load iwl4965" ;\ - echo ;\ - echo Running iwl-enable iwlagn...;\ - $(DESTDIR)/usr/sbin/iwl-enable iwlagn ;\ - fi - @if [ $(shell modinfo iwlagn > /dev/null 2>&1 && echo 1) ] \ - && [ $(shell modinfo iwlwifi > /dev/null 2>&1 && echo 1) ]; then \ - echo ;\ - echo -n "Note: iwlagn detected, we're going to disable it. " ;\ - echo "If you would like to enable it later you can run:" ;\ - echo " sudo iwl-load iwlagn" ;\ - echo ;\ - echo Running iwl-enable iwlwifi...;\ - $(DESTDIR)/usr/sbin/iwl-enable iwlwifi ;\ - fi - @if [ $(shell modinfo atl1c > /dev/null 2>&1 && echo 1) ]; then \ - echo ;\ - echo -n "Note: atl1c detected, we're going to disable it. " ;\ - echo "If you would like to enable it later you can run:" ;\ - echo " sudo alx-load atl1c" ;\ - echo ;\ - echo Running alx-enable alx...;\ - $(DESTDIR)/usr/sbin/alx-enable alx;\ - fi - @# If on distributions like Mandriva which like to - @# compress their modules this will find out and do - @# it for you. Reason is some old version of modutils - @# won't know mac80211.ko should be used instead of - @# mac80211.ko.gz - @./scripts/compress_modules - @# Mandrake doesn't have a depmod.d/ conf file to prefer - @# the updates/ dir which is what we use so we add one for it - @# (or any other distribution that doens't have this). - @./scripts/check_depmod - @# Udev stuff needed for the new compat_firmware_class. - @./compat/scripts/compat_firmware_install - @/sbin/depmod -a - @echo - @echo Now run: - @echo - @echo sudo make unload to unload all: wireless, bluetooth and ethernet modules - @echo sudo make wlunload to unload wireless modules - @echo sudo make btunload to unload bluetooth modules - @echo - @echo Run sudo modprobe 'driver-name' to load your desired driver. - @echo If unsure reboot. - @echo - -uninstall: - @# New location, matches upstream - @rm -rf $(KLIB)/$(KMODDIR)/compat/ - @rm -rf $(KLIB)/$(KMODDIR)/net/mac80211/ - @rm -rf $(KLIB)/$(KMODDIR)/net/rfkill/ - @rm -rf $(KLIB)/$(KMODDIR)/net/wireless/ - @rm -rf $(KLIB)/$(KMODDIR)/drivers/ssb/ - @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/usb/ - @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/wireless/ - @rm -rf $(KLIB)/$(KMODDIR)/drivers/staging/ - @rm -rf $(KLIB)/$(KMODDIR)/drivers/net/atl* - @# Lets only remove the stuff we are sure we are providing - @# on the misc directory. - @rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom/eeprom_93cx6.ko* - @rm -f $(KLIB)/$(KMODDIR)/drivers/misc/eeprom_93cx6.ko* - @rm -f $(KLIB)/$(KMODDIR)/drivers/net/b44.ko* - @/sbin/depmod -a - @echo - -clean: - @if [ -d net -a -d $(KLIB_BUILD) ]; then \ - $(MAKE) -C $(KLIB_BUILD) M=$(PWD) clean ;\ - fi - @rm -f $(CREL_PRE)* -unload: - @./scripts/unload.sh - -btunload: - @./scripts/btunload.sh - -wlunload: - @./scripts/wlunload.sh - - -.PHONY: all clean install uninstall unload btunload wlunload modules bt Makefile - -endif - -clean-files += Module.symvers Module.markers modules modules.order -clean-files += $(CREL_CHECK) $(CONFIG_CHECK) $(COMPAT_CONFIG) diff --git a/openairITS/mac/DOT11/README b/openairITS/mac/DOT11/README deleted file mode 100644 index 09d86125691..00000000000 --- a/openairITS/mac/DOT11/README +++ /dev/null @@ -1,417 +0,0 @@ - -Linux Wireless compatibility package -===================================== - -This is a Linux wireless compatibility package which provides the latest -Linux wireless subsystem enhancements for kernels 2.6.24 and above. -It is technically possible to support kernels < 2.6.24 but more -work is required for that. -It also provides Linux bluetooth subsystem enhancements for kernels 2.6.27 and above. - -With a local git repository you can update the compatibility package yourself. -For more information on how to do this please refer the Developers section below. - -Documentation ------------- - -This package is also documented online and has more-up-to date -information online than on this README file. You should read the wiki page -and not rely on this README: - -http://wireless.kernel.org/en/users/Download - -Subscribe to the wiki page to get updates on the documentation. - -Where to get the latest ------------------------ - -This package lets you build your own 'latest', all you need is a local git -repository. The process is documented in the Developers section of this document. -However since not many users are expected to keep a local git repository we -provide daily snapshots of this package + the wireless and bluetooth subsystem -code. You can find the latest snapshot at: - -linux-next.git version: -http://wireless.kernel.org/en/users/Download - -stable version: -http://wireless.kernel.org/en/users/Download/stable/ - -Versions --------- - -There are two different versions of this package available. - * Version based on latest linux-next.git tree named compat-wireless-YYYY-MM-DD.tar.bz2 - * Version based on linux-2.6-stable.git tree named compat-wireless-2.6.CC.DD.tar.bz2 - -Both versions should work for every kernel > 2.6.24. The differences are the -code they are containing. The version based on linux-next.git contains the -wireless and bluetooth subsystem out of linux-next.git and the stable version -the wireless subsystem out of the corresponding linux stable version. - -Selecting your driver ---------------------- - -If you know the driver you want you can select it with our -helper script: - -./scripts/driver-select - -Run that script to see more information. -Not all drivers are currently enabled via driver-select. - -Building, and installing ------------------------- - -Build: compile the latest linux wireless subsystem - - make - -Install: - -We use the updates/ directory so your distribution's drivers are left intact. - - sudo make install - -Uninstall: - -This nukes our changes to updates/ so you can go back to using your -distribution's supported drivers. - - sudo make uninstall - -Load: - -Reboot unless you know what you are doing. -(Usually modprobe 'driver-name' is the way to go) - - -Bluetooth modules can be separately compiled and installed using below commands -Bluetooth drivers are also available via ./scripts/driver-select - -Build: - make bt - -Install: - sudo make btinstall - -Uninstall: - sudo make btuninstall - -Unload: - sudo make btunload - -Load: - modprobe driver-name. If unsure, reboot. - -Drivers -------- - -This is the list of drivers the package currently provides. It adds -all new drivers or drivers which keep being updated which you might -be interested in. - -Drivers list: - -adm8211 -ar9170usb -at76c50x-usb -ath5k -ath6kl -ath9k -ath9k_htc -b43 -b43legacy -b44 -carl9170 -brcm80211 -ipw2100 -ipw2200 -iwl3945 -iwlagn -iwlcore -iwmc3200wifi -libertas -libertas_cs -libertas_sdio -libertas_spi -libertas_tf -libertas_tf_usb -libipw -mwl8k -orinoco_cs -orinoco_nortel -orinoco_pci -orinoco_plx -orinoco_tld -orinoco_usb -orinoco -p54common -p54pci -p54spi -p54usb -rt2400pci -rt2500pci -rt2500usb -rt2800pci -rt2800usb -rt61pci -rt73usb -rtl8180 -rtl8187 -rtlwifi -rtl8192ce -spectrum_cs -ssb -wl1251 -wl12xx -zd1211rw - -This package also provides more drivers which may be documented here - -For a complete list see: - -http://wireless.kernel.org/en/users/Download - -Non-wireless drivers --------------------- - -Atheros Ethernet drivers: - -atl1 -atl1c -atl1e -atl2 - -To support b43 ssb is also provided, and since ssb is also provided -we provide b44 (the ethernet driver). - -The new rfkill drivers also provided and backported. - -Bluetooth drivers: - -ath3k -bcm203x -bluecard_cs -bluetooth -bnep -bpa10x -bt3c_cs -btmrvl -btmrvl_sdio -btsdio -btusb -btuart_cs -cmtp -dtl1_cs -hidp -hci_vhci -hci_uart -l2cap -rfcomm -sco - -Firmware: ---------- - -If your driver needs firmware please be sure to check the driver page -for that driver here: - -http://wireless.kernel.org/en/users/Drivers - -Why? ----- - -For users or developers stuck on older kernels that want to help test or -patch wireless work. Additionally if you're on a recent kernel this lets -you get the latest and greatest linux-next git work without much effort. -This may mean new drivers for some users. Last but not least we hope this -will encourage vendors and developers to post patches upstream first -rather than forking or maintaining their own mac80211 releases with -their own patches for their own drivers. - -Building for external kernels ----------------------------------- - -If you have a kernel you do not have installed but yet want to build the -compat-wireless-2.6 drivers for it you can use this syntax: - -make KLIB=/home/mcgrof/kernels/linux-2.6.23.9 KLIB_BUILD=/home/mcgrof/kernels/linux-2.6.23.9 - -If you have a kernel installed, which is not your currently running kernel (e.g. via -distro updates; plus its corresponding kernel-dev package), you can use this syntax: - -make KLIB=/lib/modules/2.6.30.6-53.fc11.x86_64 - - and to install to your system's root path for the non-running kernel: - -make KLIB=/lib/modules/2.6.30.6-53.fc11.x86_64 KMODPATH_ARG='INSTALL_MOD_PATH=' install - -Bugs ------ - -If you've found a bug please report it to our linux-wireless mailing list: - -linux-wireless@vger.kernel.org - -Report the bug if you are working with the latest and greatest. -If your bug is compatibility-related then we should still try to fix -it within the compat.[ch] work. - -ChangeLog ---------- - -Here you see the list of changes to all wireless drivers, the wireless core and mac80211. - -http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=log; - -This views all the changes on wireless-testing.git. - -License -------- - -This work is a subset of the Linux kernel as such we keep the kernel's -Copyright practice. Some files have their own copyright and in those -cases the license is mentioned in the file. All additional work made -to building this package is licensed under the GPLv2. - -Developers ----------- - -Compatibility work goes into compat/compat.[ch]. If using those files do -not suffice additional actual code changes can go into patches/*.patch. - -An extended and more up to date version can be found at: - -http://wireless.kernel.org/en/users/Download/hacking - -This section deals with development details of compat-wireless and the other -trees it uses. If you want to make your own compat-wireless tarballs, or if you -see something busted with compat-wireless or just want to add something new or -an enhancement this is the guide for you. - -Git trees you will need ------------------------ - -compat-wireless backports both the bluetooth and 802.11 subsystems down to older -kernels. To be able to synchronize backporting the latest and greatest the -linux-next.git tree is used as its main source for kernel updates. General Linux -kernel compatibility is addressed through a general kernel compatibility tree, -compat.git. compat-wireless then has its own tree for specific wireless -compatibility. You will then need to checkout three trees to start hacking on -compat-wireless: - -git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git -git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/compat.git -git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/compat-wireless-2.6.git - -Linux next ----------- - -The linux-next.git tree brings all subsystems being worked on for the next -kernel release into one tree. So if the current rc kernel is 2.6.33-rc5, this -means linux-next will have what people today are working on for the 2.6.34 -kernel release. - -compat.git ----------- - -The compat git tree is a general kernel compatibility layer which can be shared -amongst different compatibility projects, or drivers. compat-wireless is just -one of the kernel compatibility projects using compat.git. compat.git builds a -general compatibility module, compat, and any additional modules to let you get -new general kernel updates from future kernels on your old kernels. - -compat.git modules ------------------- - -compat.git provides a few modules and headers to help with general kernel -compatibility. - -compat ------- - -Provides all exported symbols implemented in each respective kernel -compat-2.6.xy.c files. Upon module load it just initializes the Linux kernel's -''power management Quality Of Service'' (aka '''pm-qos''') Interface interface -added as of the 2.6.24 kernel. No other things are initialized, the rest of the -compat module just acts as a library of exported symbols. - -compat_firmware_class ---------------------- - -Another module which compat.git provides is a backport of the firmware_class -module which got updated recently newer with a new request_firmware_nowait() -to allow better asynchronous firmware uploading. This was added as of the 2.6.33 -kernel. The firmware_class module has been backported into a new module called -compat_firmware_class. A separate module has been defined instead of a direct -replacement for firmware_class since your system may have old drivers which use -the old request_firmware_nowait() and would bust if they used the new -request_firmware_nowait(). The compat_firmware_class module registers its own -sysfs subsystem and as such also gets udev events sent through a separate -subsystem. Because of this a new udev rules file is required and provided. - -compat-wireless.git -------------------- - -Anything that is not general kernel compatibility but instead specific to 802.11 -or bluetooth goes into compat-wireless.git. After you've cloned all three trees, -linux-next.git, compat.git and compat-wireless.git you need to change into the -compat-wireless directory and tell compat-wireless where you linux-next and -compat.git trees are. You do this with environment variables GIT_TREE and -GIT_COMPAT_TREE. You can do for example: - -export GIT_TREE=/home/user/wireless-testing/ -export GIT_COMPAT_TREE=/home/users/compat.git/ - -Then you can update your local sources based on these linux-next.git and -compat.git trees: - -scripts/admin-clean.sh - Cleans the compat-wireless-2.6 tree -scripts/admin-update.sh - Updates compat-wireless-2.6 with your git tree -scripts/admin-refresh.sh - Does the above two - -Adding new drivers ------------------- - -Most new drivers are enabled for compilation. If see a driver you would like -enabled try it into the mix, test them and if they work enable them and send -the respective patches. - -Sending patches ---------------- - -Remember there are three trees. linux-next itself is a conglomeration of kernel -git trees itself, so patches for linux-next.git should be sent to each -respective subsystem for which the patches are targeted for. So for example for -802.11 you will want to send them to John Linville and cc linux-wireless, for -further guidelines on this see the Submitting Patches guidelines for 802.11. -http://wireless.kernel.org/en/developers/Documentation/SubmittingPatches -As another example, for bluetooth you will want to send them to Marcel -Holtmann and cc the linux-bluetooth mailing list. If your patch touches on -others areas of the kernel refer to the MAINTAINERS file on the kernel. - -For compat.git and compat-wireless.git please send patches against to: - -To: Luis R. Rodriguez <mcgrof@kernel.org> -CC: linux-wireless@vger.kernel.org, linux-bluetooth@vger.kernel.org -Subject: [PATCH] compat-2.6: fix foo - -For patches for compat.git please use a subject like the following: - -Subject: [PATCH] compat: fix foo - -For compat-wireless.git please use a subject like the following: - -Subject: [PATCH] compat-wireless: fix foo - -Patches are preferred sent with a clear commit log entry, if unfamiliar with -how to send patches please refer to -http://wireless.kernel.org/en/developers/Documentation/git-guide. - - -TODO ------ - * Dialog (make menuconfig) option for this package - * Compatibility work for 2.6.18 --> 2.6.24 - diff --git a/openairITS/mac/DOT11/code-metrics.txt b/openairITS/mac/DOT11/code-metrics.txt deleted file mode 100644 index ddb9ec8f02e..00000000000 --- a/openairITS/mac/DOT11/code-metrics.txt +++ /dev/null @@ -1,14 +0,0 @@ - -[36mcompat-wireless code metrics[00m - -[35m 829063[00m - Total upstream lines of code being pulled -[01;32m 2748[00m - backport code changes -[01;32m 2333[00m - backport code additions -[01;32m 415[00m - backport code deletions -[01;32m 9575[00m - backport from compat module -[01;32m 12323[00m - total backport code -[31m 1.4864[00m - % of code consists of backport work - -Base tree: [01;32mlinux-stable.git[00m -Base tree version: [35mv3.4-rc3[00m -compat-wireless release: [01;33mcompat-wireless-v3.4-rc3-1[00m diff --git a/openairITS/mac/DOT11/compat/Makefile b/openairITS/mac/DOT11/compat/Makefile deleted file mode 100644 index 26b709072cc..00000000000 --- a/openairITS/mac/DOT11/compat/Makefile +++ /dev/null @@ -1,102 +0,0 @@ -ifdef MAC -obj-m += compat.o -#compat-objs := - -#obj-$(CONFIG_COMPAT_FIRMWARE_CLASS) += compat_firmware_class.o - -compat-y += main.o - -# Compat kernel compatibility code -compat-$(CONFIG_COMPAT_KERNEL_2_6_14) += compat-2.6.14.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_18) += compat-2.6.18.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_19) += compat-2.6.19.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_21) += compat-2.6.21.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_22) += compat-2.6.22.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_23) += compat-2.6.23.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_24) += compat-2.6.24.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_25) += \ - compat-2.6.25.o \ - pm_qos_params.o - -compat-$(CONFIG_COMPAT_KERNEL_2_6_26) += compat-2.6.26.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_27) += compat-2.6.27.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_28) += compat-2.6.28.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_29) += compat-2.6.29.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_32) += compat-2.6.32.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_33) += compat-2.6.33.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_35) += compat-2.6.35.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_36) += compat-2.6.36.o - -compat-$(CONFIG_COMPAT_KFIFO) += kfifo.o - -compat-$(CONFIG_COMPAT_KERNEL_2_6_37) += compat-2.6.37.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_38) += compat-2.6.38.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_39) += \ - compat-2.6.39.o \ - kstrtox.o -compat-$(CONFIG_COMPAT_KERNEL_3_0) += compat-3.0.o -compat-$(CONFIG_COMPAT_KERNEL_3_2) += compat-3.2.o -compat-$(CONFIG_COMPAT_KERNEL_3_3) += compat-3.3.o -compat-$(CONFIG_COMPAT_KERNEL_3_5) += compat-3.5.o - -compat-$(CONFIG_COMPAT_CORDIC) += cordic.o -compat-$(CONFIG_COMPAT_CRC8) += crc8.o - -ifndef CONFIG_64BIT -ifndef CONFIG_GENERIC_ATOMIC64 - compat-y += compat_atomic.o -endif -endif -endif - -ifdef ALL -obj-m += compat.o -#compat-objs := - -obj-$(CONFIG_COMPAT_FIRMWARE_CLASS) += compat_firmware_class.o - -compat-y += main.o - -# Compat kernel compatibility code -compat-$(CONFIG_COMPAT_KERNEL_2_6_14) += compat-2.6.14.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_18) += compat-2.6.18.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_19) += compat-2.6.19.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_21) += compat-2.6.21.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_22) += compat-2.6.22.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_23) += compat-2.6.23.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_24) += compat-2.6.24.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_25) += \ - compat-2.6.25.o \ - pm_qos_params.o - -compat-$(CONFIG_COMPAT_KERNEL_2_6_26) += compat-2.6.26.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_27) += compat-2.6.27.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_28) += compat-2.6.28.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_29) += compat-2.6.29.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_32) += compat-2.6.32.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_33) += compat-2.6.33.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_35) += compat-2.6.35.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_36) += compat-2.6.36.o - -compat-$(CONFIG_COMPAT_KFIFO) += kfifo.o - -compat-$(CONFIG_COMPAT_KERNEL_2_6_37) += compat-2.6.37.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_38) += compat-2.6.38.o -compat-$(CONFIG_COMPAT_KERNEL_2_6_39) += \ - compat-2.6.39.o \ - kstrtox.o -compat-$(CONFIG_COMPAT_KERNEL_3_0) += compat-3.0.o -compat-$(CONFIG_COMPAT_KERNEL_3_2) += compat-3.2.o -compat-$(CONFIG_COMPAT_KERNEL_3_3) += compat-3.3.o -compat-$(CONFIG_COMPAT_KERNEL_3_5) += compat-3.5.o - -compat-$(CONFIG_COMPAT_CORDIC) += cordic.o -compat-$(CONFIG_COMPAT_CRC8) += crc8.o - -ifndef CONFIG_64BIT -ifndef CONFIG_GENERIC_ATOMIC64 - compat-y += compat_atomic.o -endif -endif - -endif diff --git a/openairITS/mac/DOT11/compat/compat-2.6.14.c b/openairITS/mac/DOT11/compat/compat-2.6.14.c deleted file mode 100644 index 3de847d9d05..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.14.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.14. - */ - -#include <net/compat.h> - -/* 2.6.14 compat code goes here */ - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.18.c b/openairITS/mac/DOT11/compat/compat-2.6.18.c deleted file mode 100644 index c7961eeba92..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.18.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.18. - */ - -#include <net/compat.h> - -/* 2.6.18 compat code goes here */ - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.19.c b/openairITS/mac/DOT11/compat/compat-2.6.19.c deleted file mode 100644 index 60c34045809..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.19.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.19. - */ - -#include <net/compat.h> - -/* 2.6.19 compat code goes here */ - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.21.c b/openairITS/mac/DOT11/compat/compat-2.6.21.c deleted file mode 100644 index 7cf886194bd..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.21.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.21. - */ - -#include <net/compat.h> - -/* 2.6.21 compat code goes here */ - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.22.c b/openairITS/mac/DOT11/compat/compat-2.6.22.c deleted file mode 100644 index d4df7b7d8d5..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.22.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.22. - */ - -#include <net/compat.h> - -/* 2.6.22 compat code goes here */ - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.23.c b/openairITS/mac/DOT11/compat/compat-2.6.23.c deleted file mode 100644 index bc49e982663..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.23.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.23. - */ - -#include <net/compat.h> - -/* On net/core/dev.c as of 2.6.24 */ -int __dev_addr_delete(struct dev_addr_list **list, int *count, - void *addr, int alen, int glbl) -{ - struct dev_addr_list *da; - - for (; (da = *list) != NULL; list = &da->next) { - if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 && - alen == da->da_addrlen) { - if (glbl) { - int old_glbl = da->da_gusers; - da->da_gusers = 0; - if (old_glbl == 0) - break; - } - if (--da->da_users) - return 0; - - *list = da->next; - kfree(da); - (*count)--; - return 0; - } - } - return -ENOENT; -} -EXPORT_SYMBOL_GPL(__dev_addr_delete); - -/* On net/core/dev.c as of 2.6.24. This is not yet used by mac80211 but - * might as well add it */ -int __dev_addr_add(struct dev_addr_list **list, int *count, - void *addr, int alen, int glbl) -{ - struct dev_addr_list *da; - - for (da = *list; da != NULL; da = da->next) { - if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 && - da->da_addrlen == alen) { - if (glbl) { - int old_glbl = da->da_gusers; - da->da_gusers = 1; - if (old_glbl) - return 0; - } - da->da_users++; - return 0; - } - } - - da = kmalloc(sizeof(*da), GFP_ATOMIC); - if (da == NULL) - return -ENOMEM; - memcpy(da->da_addr, addr, alen); - da->da_addrlen = alen; - da->da_users = 1; - da->da_gusers = glbl ? 1 : 0; - da->next = *list; - *list = da; - (*count)++; - return 0; -} -EXPORT_SYMBOL_GPL(__dev_addr_add); - - -/* Part of net/core/dev_mcast.c as of 2.6.23. This is a slightly different version. - * Since da->da_synced is not part of 2.6.22 we need to take longer route when - * syncing */ - -/** - * dev_mc_sync - Synchronize device's multicast list to another device - * @to: destination device - * @from: source device - * - * Add newly added addresses to the destination device and release - * addresses that have no users left. The source device must be - * locked by netif_tx_lock_bh. - * - * This function is intended to be called from the dev->set_multicast_list - * function of layered software devices. - */ -int dev_mc_sync(struct net_device *to, struct net_device *from) -{ - struct dev_addr_list *da, *next, *da_to; - int err = 0; - - netif_tx_lock_bh(to); - da = from->mc_list; - while (da != NULL) { - int synced = 0; - next = da->next; - da_to = to->mc_list; - /* 2.6.22 does not have da->da_synced so lets take the long route */ - while (da_to != NULL) { - if (memcmp(da_to->da_addr, da->da_addr, da_to->da_addrlen) == 0 && - da->da_addrlen == da_to->da_addrlen) - synced = 1; - break; - } - if (!synced) { - err = __dev_addr_add(&to->mc_list, &to->mc_count, - da->da_addr, da->da_addrlen, 0); - if (err < 0) - break; - da->da_users++; - } else if (da->da_users == 1) { - __dev_addr_delete(&to->mc_list, &to->mc_count, - da->da_addr, da->da_addrlen, 0); - __dev_addr_delete(&from->mc_list, &from->mc_count, - da->da_addr, da->da_addrlen, 0); - } - da = next; - } - if (!err) - __dev_set_rx_mode(to); - netif_tx_unlock_bh(to); - - return err; -} -EXPORT_SYMBOL_GPL(dev_mc_sync); - - -/* Part of net/core/dev_mcast.c as of 2.6.23. This is a slighty different version. - * Since da->da_synced is not part of 2.6.22 we need to take longer route when - * unsyncing */ - -/** - * dev_mc_unsync - Remove synchronized addresses from the destination - * device - * @to: destination device - * @from: source device - * - * Remove all addresses that were added to the destination device by - * dev_mc_sync(). This function is intended to be called from the - * dev->stop function of layered software devices. - */ -void dev_mc_unsync(struct net_device *to, struct net_device *from) -{ - struct dev_addr_list *da, *next, *da_to; - - netif_tx_lock_bh(from); - netif_tx_lock_bh(to); - - da = from->mc_list; - while (da != NULL) { - bool synced = false; - next = da->next; - da_to = to->mc_list; - /* 2.6.22 does not have da->da_synced so lets take the long route */ - while (da_to != NULL) { - if (memcmp(da_to->da_addr, da->da_addr, da_to->da_addrlen) == 0 && - da->da_addrlen == da_to->da_addrlen) - synced = true; - break; - } - if (!synced) { - da = next; - continue; - } - __dev_addr_delete(&to->mc_list, &to->mc_count, - da->da_addr, da->da_addrlen, 0); - __dev_addr_delete(&from->mc_list, &from->mc_count, - da->da_addr, da->da_addrlen, 0); - da = next; - } - __dev_set_rx_mode(to); - - netif_tx_unlock_bh(to); - netif_tx_unlock_bh(from); -} -EXPORT_SYMBOL_GPL(dev_mc_unsync); - -/* Added as of 2.6.23 on net/core/dev.c. Slightly modifed, no dev->set_rx_mode on - * 2.6.22 so ignore that. */ - -/* - * Upload unicast and multicast address lists to device and - * configure RX filtering. When the device doesn't support unicast - * filtering it is put in promiscous mode while unicast addresses - * are present. - */ -void __dev_set_rx_mode(struct net_device *dev) -{ - /* dev_open will call this function so the list will stay sane. */ - if (!(dev->flags&IFF_UP)) - return; - - if (!netif_device_present(dev)) - return; - -/* This needs to be ported to 2.6.22 framework */ -#if 0 - /* Unicast addresses changes may only happen under the rtnl, - * therefore calling __dev_set_promiscuity here is safe. - */ - if (dev->uc_count > 0 && !dev->uc_promisc) { - __dev_set_promiscuity(dev, 1); - dev->uc_promisc = 1; - } else if (dev->uc_count == 0 && dev->uc_promisc) { - __dev_set_promiscuity(dev, -1); - dev->uc_promisc = 0; - } -#endif - - if (dev->set_multicast_list) - dev->set_multicast_list(dev); -} - -/** - * pci_try_set_mwi - enables memory-write-invalidate PCI transaction - * @dev: the PCI device for which MWI is enabled - * - * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND. - * Callers are not required to check the return value. - * - * RETURNS: An appropriate -ERRNO error value on error, or zero for success. - */ -int pci_try_set_mwi(struct pci_dev *dev) -{ - int rc = 0; -#ifdef HAVE_PCI_SET_MWI - rc = pci_set_mwi(dev); -#endif - return rc; -} -EXPORT_SYMBOL_GPL(pci_try_set_mwi); -#endif - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.24.c b/openairITS/mac/DOT11/compat/compat-2.6.24.c deleted file mode 100644 index 977db0ca170..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.24.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.24. - */ - -#include <net/compat.h> -#include <net/arp.h> - -/* - * We simply won't use it though, just declare it for our wrappers and - * for usage with tons of code that makes mention to it. - */ -struct net init_net; -EXPORT_SYMBOL_GPL(init_net); - -/* 2.6.22 and 2.6.23 have eth_header_cache_update defined as extern in include/linux/etherdevice.h - * and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */ - -/** - * eth_header_cache_update - update cache entry - * @hh: destination cache entry - * @dev: network device - * @haddr: new hardware address - * - * Called by Address Resolution module to notify changes in address. - */ -void eth_header_cache_update(struct hh_cache *hh, - struct net_device *dev, - unsigned char *haddr) -{ - memcpy(((u8 *) hh->hh_data) + HH_DATA_OFF(sizeof(struct ethhdr)), - haddr, ETH_ALEN); -} -EXPORT_SYMBOL_GPL(eth_header_cache_update); - -/* 2.6.22 and 2.6.23 have eth_header_cache defined as extern in include/linux/etherdevice.h - * and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */ - -/** - * eth_header_cache - fill cache entry from neighbour - * @neigh: source neighbour - * @hh: destination cache entry - * Create an Ethernet header template from the neighbour. - */ -int eth_header_cache(struct neighbour *neigh, struct hh_cache *hh) -{ - __be16 type = hh->hh_type; - struct ethhdr *eth; - const struct net_device *dev = neigh->dev; - - eth = (struct ethhdr *) - (((u8 *) hh->hh_data) + (HH_DATA_OFF(sizeof(*eth)))); - - if (type == htons(ETH_P_802_3)) - return -1; - - eth->h_proto = type; - memcpy(eth->h_source, dev->dev_addr, ETH_ALEN); - memcpy(eth->h_dest, neigh->ha, ETH_ALEN); - hh->hh_len = ETH_HLEN; - return 0; -} -EXPORT_SYMBOL_GPL(eth_header_cache); - -/* 2.6.22 and 2.6.23 have eth_header() defined as extern in include/linux/etherdevice.h - * and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */ - -/** - * eth_header - create the Ethernet header - * @skb: buffer to alter - * @dev: source device - * @type: Ethernet type field - * @daddr: destination address (NULL leave destination address) - * @saddr: source address (NULL use device source address) - * @len: packet length (<= skb->len) - * - * - * Set the protocol type. For a packet of type ETH_P_802_3 we put the length - * in here instead. It is up to the 802.2 layer to carry protocol information. - */ -int eth_header(struct sk_buff *skb, struct net_device *dev, unsigned short type, - void *daddr, void *saddr, unsigned len) -{ - struct ethhdr *eth = (struct ethhdr *)skb_push(skb, ETH_HLEN); - - if (type != ETH_P_802_3) - eth->h_proto = htons(type); - else - eth->h_proto = htons(len); - - /* - * Set the source hardware address. - */ - - if (!saddr) - saddr = dev->dev_addr; - memcpy(eth->h_source, saddr, dev->addr_len); - - if (daddr) { - memcpy(eth->h_dest, daddr, dev->addr_len); - return ETH_HLEN; - } - - /* - * Anyway, the loopback-device should never use this function... - */ - - if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) { - memset(eth->h_dest, 0, dev->addr_len); - return ETH_HLEN; - } - - return -ETH_HLEN; -} - -EXPORT_SYMBOL_GPL(eth_header); - -/* 2.6.22 and 2.6.23 have eth_rebuild_header defined as extern in include/linux/etherdevice.h - * and actually defined in net/ethernet/eth.c but 2.6.24 exports it. Lets export it here */ - -/** - * eth_rebuild_header- rebuild the Ethernet MAC header. - * @skb: socket buffer to update - * - * This is called after an ARP or IPV6 ndisc it's resolution on this - * sk_buff. We now let protocol (ARP) fill in the other fields. - * - * This routine CANNOT use cached dst->neigh! - * Really, it is used only when dst->neigh is wrong. - */ -int eth_rebuild_header(struct sk_buff *skb) -{ - struct ethhdr *eth = (struct ethhdr *)skb->data; - struct net_device *dev = skb->dev; - - switch (eth->h_proto) { -#ifdef CONFIG_INET - case __constant_htons(ETH_P_IP): - return arp_find(eth->h_dest, skb); -#endif - default: - printk(KERN_DEBUG - "%s: unable to resolve type %X addresses.\n", - dev->name, (int)eth->h_proto); - - memcpy(eth->h_source, dev->dev_addr, ETH_ALEN); - break; - } - - return 0; -} -EXPORT_SYMBOL_GPL(eth_rebuild_header); - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.25.c b/openairITS/mac/DOT11/compat/compat-2.6.25.c deleted file mode 100644 index 2e9c3a88100..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.25.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2007-2010 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.25. - */ - -#include <linux/miscdevice.h> - -/** - * The following things are out of ./lib/vsprintf.c - * The new iwlwifi driver is using them. - */ - -/** - * strict_strtoul - convert a string to an unsigned long strictly - * @cp: The string to be converted - * @base: The number base to use - * @res: The converted result value - * - * strict_strtoul converts a string to an unsigned long only if the - * string is really an unsigned long string, any string containing - * any invalid char at the tail will be rejected and -EINVAL is returned, - * only a newline char at the tail is acceptible because people generally - * change a module parameter in the following way: - * - * echo 1024 > /sys/module/e1000/parameters/copybreak - * - * echo will append a newline to the tail. - * - * It returns 0 if conversion is successful and *res is set to the converted - * value, otherwise it returns -EINVAL and *res is set to 0. - * - * simple_strtoul just ignores the successive invalid characters and - * return the converted value of prefix part of the string. - */ -int strict_strtoul(const char *cp, unsigned int base, unsigned long *res); - -/** - * strict_strtol - convert a string to a long strictly - * @cp: The string to be converted - * @base: The number base to use - * @res: The converted result value - * - * strict_strtol is similiar to strict_strtoul, but it allows the first - * character of a string is '-'. - * - * It returns 0 if conversion is successful and *res is set to the converted - * value, otherwise it returns -EINVAL and *res is set to 0. - */ -int strict_strtol(const char *cp, unsigned int base, long *res); - -#define define_strict_strtoux(type, valtype) \ -int strict_strtou##type(const char *cp, unsigned int base, valtype *res)\ -{ \ - char *tail; \ - valtype val; \ - size_t len; \ - \ - *res = 0; \ - len = strlen(cp); \ - if (len == 0) \ - return -EINVAL; \ - \ - val = simple_strtou##type(cp, &tail, base); \ - if ((*tail == '\0') || \ - ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) {\ - *res = val; \ - return 0; \ - } \ - \ - return -EINVAL; \ -} \ - -#define define_strict_strtox(type, valtype) \ -int strict_strto##type(const char *cp, unsigned int base, valtype *res) \ -{ \ - int ret; \ - if (*cp == '-') { \ - ret = strict_strtou##type(cp+1, base, res); \ - if (!ret) \ - *res = -(*res); \ - } else \ - ret = strict_strtou##type(cp, base, res); \ - \ - return ret; \ -} \ - -define_strict_strtoux(l, unsigned long) -define_strict_strtox(l, long) - -EXPORT_SYMBOL_GPL(strict_strtoul); -EXPORT_SYMBOL_GPL(strict_strtol); - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.26.c b/openairITS/mac/DOT11/compat/compat-2.6.26.c deleted file mode 100644 index f4715067511..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.26.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2007-2010 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.26. - * - * Copyright holders from ported work: - * - * Copyright (c) 2002-2003 Patrick Mochel <mochel@osdl.org> - * Copyright (c) 2006-2007 Greg Kroah-Hartman <greg@kroah.com> - * Copyright (c) 2006-2007 Novell Inc. - */ - -#include <net/compat.h> - -/* 2.6.24 does not have the struct kobject with a name */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) - -/** - * kobject_set_name_vargs - Set the name of an kobject - * @kobj: struct kobject to set the name of - * @fmt: format string used to build the name - * @vargs: vargs to format the string. - */ -static -int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, - va_list vargs) -{ - const char *old_name = kobj->name; - char *s; - - if (kobj->name && !fmt) - return 0; - - kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs); - if (!kobj->name) - return -ENOMEM; - - /* ewww... some of these buggers have '/' in the name ... */ - while ((s = strchr(kobj->name, '/'))) - s[0] = '!'; - - kfree(old_name); - return 0; -} -#else -static -int kobject_set_name_vargs(struct kobject *kobj, const char *fmt, - va_list vargs) -{ - struct device *dev; - unsigned int len; - va_list aq; - - dev = container_of(kobj, struct device, kobj); - - va_copy(aq, vargs); - len = vsnprintf(NULL, 0, fmt, aq); - va_end(aq); - - len = len < BUS_ID_SIZE ? (len + 1) : BUS_ID_SIZE; - - vsnprintf(dev->bus_id, len, fmt, vargs); - return 0; -} -#endif - -/** - * dev_set_name - set a device name - * @dev: device - * @fmt: format string for the device's name - */ -int dev_set_name(struct device *dev, const char *fmt, ...) -{ - va_list vargs; - int err; - - va_start(vargs, fmt); - err = kobject_set_name_vargs(&dev->kobj, fmt, vargs); - va_end(vargs); - return err; -} -EXPORT_SYMBOL_GPL(dev_set_name); - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.27.c b/openairITS/mac/DOT11/compat/compat-2.6.27.c deleted file mode 100644 index 762f0ca1deb..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.27.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.27 - */ - -#include <linux/compat.h> -#include <linux/pci.h> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) -#include <linux/mmc/sdio.h> -#include <linux/mmc/sdio_func.h> -#include <linux/mmc/card.h> -#include <linux/mmc/host.h> -#endif - -/* rfkill notification chain */ -#define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill - switch has changed */ - -/* - * e5899e1b7d73e67de758a32174a859cc2586c0b9 made pci_pme_capable() external, - * it was defined internally, some drivers want access to this information. - * - * Unfortunately the old kernels do not have ->pm_cap or ->pme_support so - * we have to call the PCI routines directly. - */ - -/** - * pci_pme_capable - check the capability of PCI device to generate PME# - * @dev: PCI device to handle. - * @state: PCI state from which device will issue PME#. - * - * This is the backport code for older kernels for compat-wireless, we read stuff - * from the initialization stuff from pci_pm_init(). - */ -bool pci_pme_capable(struct pci_dev *dev, pci_power_t state) -{ - int pm; - u16 pmc = 0; - u16 pme_support; /* as from the pci dev */ - /* find PCI PM capability in list */ - pm = pci_find_capability(dev, PCI_CAP_ID_PM); - if (!pm) - return false; - - if ((pmc & PCI_PM_CAP_VER_MASK) > 3) { - dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n", - pmc & PCI_PM_CAP_VER_MASK); - return false; - } - - pmc &= PCI_PM_CAP_PME_MASK; - - if (!pmc) - return false; - - pme_support = pmc >> PCI_PM_CAP_PME_SHIFT; - - /* Check device's ability to generate PME# */ - - return !!(pme_support & (1 << state)); -} -EXPORT_SYMBOL_GPL(pci_pme_capable); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) -/** - * mmc_align_data_size - pads a transfer size to a more optimal value - * @card: the MMC card associated with the data transfer - * @sz: original transfer size - * - * Pads the original data size with a number of extra bytes in - * order to avoid controller bugs and/or performance hits - * (e.g. some controllers revert to PIO for certain sizes). - * - * Returns the improved size, which might be unmodified. - * - * Note that this function is only relevant when issuing a - * single scatter gather entry. - */ -unsigned int mmc_align_data_size(struct mmc_card *card, unsigned int sz) -{ - /* - * FIXME: We don't have a system for the controller to tell - * the core about its problems yet, so for now we just 32-bit - * align the size. - */ - sz = ((sz + 3) / 4) * 4; - - return sz; -} -EXPORT_SYMBOL_GPL(mmc_align_data_size); - -/* - * Calculate the maximum byte mode transfer size - */ -static inline unsigned int sdio_max_byte_size(struct sdio_func *func) -{ - unsigned int mval = (unsigned int) min(func->card->host->max_seg_size, - func->card->host->max_blk_size); - mval = min(mval, func->max_blksize); - return min(mval, 512u); /* maximum size for byte mode */ -} - -/** - * sdio_align_size - pads a transfer size to a more optimal value - * @func: SDIO function - * @sz: original transfer size - * - * Pads the original data size with a number of extra bytes in - * order to avoid controller bugs and/or performance hits - * (e.g. some controllers revert to PIO for certain sizes). - * - * If possible, it will also adjust the size so that it can be - * handled in just a single request. - * - * Returns the improved size, which might be unmodified. - */ -unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz) -{ - unsigned int orig_sz; - unsigned int blk_sz, byte_sz; - unsigned chunk_sz; - - orig_sz = sz; - - /* - * Do a first check with the controller, in case it - * wants to increase the size up to a point where it - * might need more than one block. - */ - sz = mmc_align_data_size(func->card, sz); - - /* - * If we can still do this with just a byte transfer, then - * we're done. - */ - if (sz <= sdio_max_byte_size(func)) - return sz; - - if (func->card->cccr.multi_block) { - /* - * Check if the transfer is already block aligned - */ - if ((sz % func->cur_blksize) == 0) - return sz; - - /* - * Realign it so that it can be done with one request, - * and recheck if the controller still likes it. - */ - blk_sz = ((sz + func->cur_blksize - 1) / - func->cur_blksize) * func->cur_blksize; - blk_sz = mmc_align_data_size(func->card, blk_sz); - - /* - * This value is only good if it is still just - * one request. - */ - if ((blk_sz % func->cur_blksize) == 0) - return blk_sz; - - /* - * We failed to do one request, but at least try to - * pad the remainder properly. - */ - byte_sz = mmc_align_data_size(func->card, - sz % func->cur_blksize); - if (byte_sz <= sdio_max_byte_size(func)) { - blk_sz = sz / func->cur_blksize; - return blk_sz * func->cur_blksize + byte_sz; - } - } else { - /* - * We need multiple requests, so first check that the - * controller can handle the chunk size; - */ - chunk_sz = mmc_align_data_size(func->card, - sdio_max_byte_size(func)); - if (chunk_sz == sdio_max_byte_size(func)) { - /* - * Fix up the size of the remainder (if any) - */ - byte_sz = orig_sz % chunk_sz; - if (byte_sz) { - byte_sz = mmc_align_data_size(func->card, - byte_sz); - } - - return (orig_sz / chunk_sz) * chunk_sz + byte_sz; - } - } - - /* - * The controller is simply incapable of transferring the size - * we want in decent manner, so just return the original size. - */ - return orig_sz; -} -EXPORT_SYMBOL_GPL(sdio_align_size); -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) */ - -#ifdef CONFIG_DEBUG_FS -/* - * Backport of debugfs_remove_recursive() without using the internals globals - * which are used by the kernel's version with: - * simple_release_fs(&debugfs_mount, &debugfs_mount_count); - */ -void debugfs_remove_recursive(struct dentry *dentry) -{ - struct dentry *last = NULL; - - /* Sanity checks */ - if (!dentry || !dentry->d_parent || !dentry->d_parent->d_inode) - return; - - while (dentry != last) { - struct dentry *child = dentry; - - /* Find a child without children */ - while (!list_empty(&child->d_subdirs)) - child = list_entry(child->d_subdirs.next, - struct dentry, - d_u.d_child); - - /* Bail out if we already tried to remove that entry */ - if (child == last) - return; - - last = child; - debugfs_remove(child); - } -} -EXPORT_SYMBOL_GPL(debugfs_remove_recursive); -#endif /* CONFIG_DEBUG_FS */ - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.28.c b/openairITS/mac/DOT11/compat/compat-2.6.28.c deleted file mode 100644 index 0ae8f465dbb..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.28.c +++ /dev/null @@ -1,463 +0,0 @@ -/* - * Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.28. - */ - -#include <linux/compat.h> -#include <linux/usb.h> -#include <linux/tty.h> -#include <asm/poll.h> - -/* 2.6.28 compat code goes here */ - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)) -#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE) -/* - * Compat-wireless notes for USB backport stuff: - * - * urb->reject exists on 2.6.27, the poison/unpoison helpers - * did not though. The anchor poison does not exist so we cannot use them. - * - * USB anchor poising seems to exist to prevent future driver sumbissions - * of usb_anchor_urb() to an anchor marked as poisoned. For older kernels - * we cannot use that, so new usb_anchor_urb()s will be anchored. The down - * side to this should be submission of URBs will continue being anchored - * on an anchor instead of having them being rejected immediately when the - * driver realized we needed to stop. For ar9170 we poison URBs upon the - * ar9170 mac80211 stop callback(), don't think this should be so bad. - * It mean there is period of time in older kernels for which we continue - * to anchor new URBs to a known stopped anchor. We have two anchors - * (TX, and RX) - */ - -#if 0 -/** - * usb_poison_urb - reliably kill a transfer and prevent further use of an URB - * @urb: pointer to URB describing a previously submitted request, - * may be NULL - * - * This routine cancels an in-progress request. It is guaranteed that - * upon return all completion handlers will have finished and the URB - * will be totally idle and cannot be reused. These features make - * this an ideal way to stop I/O in a disconnect() callback. - * If the request has not already finished or been unlinked - * the completion handler will see urb->status == -ENOENT. - * - * After and while the routine runs, attempts to resubmit the URB will fail - * with error -EPERM. Thus even if the URB's completion handler always - * tries to resubmit, it will not succeed and the URB will become idle. - * - * This routine may not be used in an interrupt context (such as a bottom - * half or a completion handler), or when holding a spinlock, or in other - * situations where the caller can't schedule(). - * - * This routine should not be called by a driver after its disconnect - * method has returned. - */ -void usb_poison_urb(struct urb *urb) -{ - might_sleep(); - if (!(urb && urb->dev && urb->ep)) - return; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) - spin_lock_irq(&usb_reject_lock); -#endif - ++urb->reject; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) - spin_unlock_irq(&usb_reject_lock); -#endif - /* - * XXX: usb_hcd_unlink_urb() needs backporting... this is defined - * on usb hcd.c but urb.c gets access to it. That is, older kernels - * have usb_hcd_unlink_urb() but its not exported, nor can we - * re-implement it exactly. This essentially dequeues the urb from - * hw, we need to figure out a way to backport this. - */ - //usb_hcd_unlink_urb(urb, -ENOENT); - - wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0); -} -EXPORT_SYMBOL_GPL(usb_poison_urb); -#endif -#endif /* CONFIG_USB */ - -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) - -#include <pcmcia/ds.h> -struct pcmcia_cfg_mem { - tuple_t tuple; - cisparse_t parse; - u8 buf[256]; - cistpl_cftable_entry_t dflt; -}; -/** - * pcmcia_loop_config() - loop over configuration options - * @p_dev: the struct pcmcia_device which we need to loop for. - * @conf_check: function to call for each configuration option. - * It gets passed the struct pcmcia_device, the CIS data - * describing the configuration option, and private data - * being passed to pcmcia_loop_config() - * @priv_data: private data to be passed to the conf_check function. - * - * pcmcia_loop_config() loops over all configuration options, and calls - * the driver-specific conf_check() for each one, checking whether - * it is a valid one. Returns 0 on success or errorcode otherwise. - */ -int pcmcia_loop_config(struct pcmcia_device *p_dev, - int (*conf_check) (struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - unsigned int vcc, - void *priv_data), - void *priv_data) -{ - struct pcmcia_cfg_mem *cfg_mem; - - tuple_t *tuple; - int ret; - unsigned int vcc; - - cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL); - if (cfg_mem == NULL) - return -ENOMEM; - - /* get the current Vcc setting */ - vcc = p_dev->socket->socket.Vcc; - - tuple = &cfg_mem->tuple; - tuple->TupleData = cfg_mem->buf; - tuple->TupleDataMax = 255; - tuple->TupleOffset = 0; - tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; - tuple->Attributes = 0; - - ret = pcmcia_get_first_tuple(p_dev, tuple); - while (!ret) { - cistpl_cftable_entry_t *cfg = &cfg_mem->parse.cftable_entry; - - if (pcmcia_get_tuple_data(p_dev, tuple)) - goto next_entry; - - if (pcmcia_parse_tuple(tuple, &cfg_mem->parse)) - goto next_entry; - - /* default values */ - p_dev->conf.ConfigIndex = cfg->index; - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - cfg_mem->dflt = *cfg; - - ret = conf_check(p_dev, cfg, &cfg_mem->dflt, vcc, priv_data); - if (!ret) - break; - -next_entry: - ret = pcmcia_get_next_tuple(p_dev, tuple); - } - - return ret; -} -EXPORT_SYMBOL_GPL(pcmcia_loop_config); - -#endif /* CONFIG_PCMCIA */ - -#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE) - -void usb_unpoison_urb(struct urb *urb) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) - unsigned long flags; -#endif - - if (!urb) - return; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) - spin_lock_irqsave(&usb_reject_lock, flags); -#endif - --urb->reject; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) - spin_unlock_irqrestore(&usb_reject_lock, flags); -#endif -} -EXPORT_SYMBOL_GPL(usb_unpoison_urb); - - -#if 0 -/** - * usb_poison_anchored_urbs - cease all traffic from an anchor - * @anchor: anchor the requests are bound to - * - * this allows all outstanding URBs to be poisoned starting - * from the back of the queue. Newly added URBs will also be - * poisoned - * - * This routine should not be called by a driver after its disconnect - * method has returned. - */ -void usb_poison_anchored_urbs(struct usb_anchor *anchor) -{ - struct urb *victim; - - spin_lock_irq(&anchor->lock); - // anchor->poisoned = 1; /* XXX: Cannot backport */ - while (!list_empty(&anchor->urb_list)) { - victim = list_entry(anchor->urb_list.prev, struct urb, - anchor_list); - /* we must make sure the URB isn't freed before we kill it*/ - usb_get_urb(victim); - spin_unlock_irq(&anchor->lock); - /* this will unanchor the URB */ - usb_poison_urb(victim); - usb_put_urb(victim); - spin_lock_irq(&anchor->lock); - } - spin_unlock_irq(&anchor->lock); -} -EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs); -#endif - -/** - * usb_anchor_empty - is an anchor empty - * @anchor: the anchor you want to query - * - * returns 1 if the anchor has no urbs associated with it - */ -int usb_anchor_empty(struct usb_anchor *anchor) -{ - return list_empty(&anchor->urb_list); -} - -EXPORT_SYMBOL_GPL(usb_anchor_empty); -#endif /* CONFIG_USB */ -#endif - -void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar) -{ - /* - * Make sure the BAR is actually a memory resource, not an IO resource - */ - if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) { - WARN_ON(1); - return NULL; - } - return ioremap_nocache(pci_resource_start(pdev, bar), - pci_resource_len(pdev, bar)); -} -EXPORT_SYMBOL_GPL(pci_ioremap_bar); - -static unsigned long round_jiffies_common(unsigned long j, int cpu, - bool force_up) -{ - int rem; - unsigned long original = j; - - /* - * We don't want all cpus firing their timers at once hitting the - * same lock or cachelines, so we skew each extra cpu with an extra - * 3 jiffies. This 3 jiffies came originally from the mm/ code which - * already did this. - * The skew is done by adding 3*cpunr, then round, then subtract this - * extra offset again. - */ - j += cpu * 3; - - rem = j % HZ; - - /* - * If the target jiffie is just after a whole second (which can happen - * due to delays of the timer irq, long irq off times etc etc) then - * we should round down to the whole second, not up. Use 1/4th second - * as cutoff for this rounding as an extreme upper bound for this. - * But never round down if @force_up is set. - */ - if (rem < HZ/4 && !force_up) /* round down */ - j = j - rem; - else /* round up */ - j = j - rem + HZ; - - /* now that we have rounded, subtract the extra skew again */ - j -= cpu * 3; - - if (j <= jiffies) /* rounding ate our timeout entirely; */ - return original; - return j; -} - -/** - * round_jiffies_up - function to round jiffies up to a full second - * @j: the time in (absolute) jiffies that should be rounded - * - * This is the same as round_jiffies() except that it will never - * round down. This is useful for timeouts for which the exact time - * of firing does not matter too much, as long as they don't fire too - * early. - */ -unsigned long round_jiffies_up(unsigned long j) -{ - return round_jiffies_common(j, raw_smp_processor_id(), true); -} -EXPORT_SYMBOL_GPL(round_jiffies_up); - -void v2_6_28_skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, int off, - int size) -{ - skb_fill_page_desc(skb, i, page, off, size); - skb->len += size; - skb->data_len += size; - skb->truesize += size; -} -EXPORT_SYMBOL_GPL(v2_6_28_skb_add_rx_frag); - -void tty_write_unlock(struct tty_struct *tty) -{ - mutex_unlock(&tty->atomic_write_lock); - wake_up_interruptible_poll(&tty->write_wait, POLLOUT); -} - -int tty_write_lock(struct tty_struct *tty, int ndelay) -{ - if (!mutex_trylock(&tty->atomic_write_lock)) { - if (ndelay) - return -EAGAIN; - if (mutex_lock_interruptible(&tty->atomic_write_lock)) - return -ERESTARTSYS; - } - return 0; -} - -/** - * send_prio_char - send priority character - * - * Send a high priority character to the tty even if stopped - * - * Locking: none for xchar method, write ordering for write method. - */ - -static int send_prio_char(struct tty_struct *tty, char ch) -{ - int was_stopped = tty->stopped; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)) - if (tty->ops->send_xchar) { - tty->ops->send_xchar(tty, ch); -#else - if (tty->driver->send_xchar) { - tty->driver->send_xchar(tty, ch); -#endif - return 0; - } - - if (tty_write_lock(tty, 0) < 0) - return -ERESTARTSYS; - - if (was_stopped) - start_tty(tty); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)) - tty->ops->write(tty, &ch, 1); -#else - tty->driver->write(tty, &ch, 1); -#endif - if (was_stopped) - stop_tty(tty); - tty_write_unlock(tty); - return 0; -} - -int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, - unsigned int cmd, unsigned long arg) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)) - unsigned long flags; -#endif - int retval; - - switch (cmd) { - case TCXONC: - retval = tty_check_change(tty); - if (retval) - return retval; - switch (arg) { - case TCOOFF: - if (!tty->flow_stopped) { - tty->flow_stopped = 1; - stop_tty(tty); - } - break; - case TCOON: - if (tty->flow_stopped) { - tty->flow_stopped = 0; - start_tty(tty); - } - break; - case TCIOFF: - if (STOP_CHAR(tty) != __DISABLED_CHAR) - return send_prio_char(tty, STOP_CHAR(tty)); - break; - case TCION: - if (START_CHAR(tty) != __DISABLED_CHAR) - return send_prio_char(tty, START_CHAR(tty)); - break; - default: - return -EINVAL; - } - return 0; - case TCFLSH: - return tty_perform_flush(tty, arg); - case TIOCPKT: - { - int pktmode; - - if (tty->driver->type != TTY_DRIVER_TYPE_PTY || - tty->driver->subtype != PTY_TYPE_MASTER) - return -ENOTTY; - if (get_user(pktmode, (int __user *) arg)) - return -EFAULT; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)) - spin_lock_irqsave(&tty->ctrl_lock, flags); -#endif - if (pktmode) { - if (!tty->packet) { - tty->packet = 1; - tty->link->ctrl_status = 0; - } - } else - tty->packet = 0; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)) - spin_unlock_irqrestore(&tty->ctrl_lock, flags); -#endif - return 0; - } - default: - /* Try the mode commands */ - return tty_mode_ioctl(tty, file, cmd, arg); - } -} -EXPORT_SYMBOL_GPL(n_tty_ioctl_helper); - -/** - * pci_wake_from_d3 - enable/disable device to wake up from D3_hot or D3_cold - * @dev: PCI device to prepare - * @enable: True to enable wake-up event generation; false to disable - * - * Many drivers want the device to wake up the system from D3_hot or D3_cold - * and this function allows them to set that up cleanly - pci_enable_wake() - * should not be called twice in a row to enable wake-up due to PCI PM vs ACPI - * ordering constraints. - * - * This function only returns error code if the device is not capable of - * generating PME# from both D3_hot and D3_cold, and the platform is unable to - * enable wake-up power for it. - */ -int pci_wake_from_d3(struct pci_dev *dev, bool enable) -{ - return pci_pme_capable(dev, PCI_D3cold) ? - pci_enable_wake(dev, PCI_D3cold, enable) : - pci_enable_wake(dev, PCI_D3hot, enable); -} -EXPORT_SYMBOL_GPL(pci_wake_from_d3); - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.29.c b/openairITS/mac/DOT11/compat/compat-2.6.29.c deleted file mode 100644 index 1beb718dc79..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.29.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2007-2010 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.29. - */ - -#include <linux/compat.h> -#include <linux/usb.h> -#include <linux/etherdevice.h> - -/* - * If you don't see your net_device_ops implemented on - * netdev_attach_ops() then you are shit out of luck and - * you must do the nasty ifdef magic, unless you figure - * out a way to squeze your hacks into this routine :) - */ -void netdev_attach_ops(struct net_device *dev, - const struct net_device_ops *ops) -{ - dev->open = ops->ndo_open; - dev->init = ops->ndo_init; - dev->stop = ops->ndo_stop; - dev->hard_start_xmit = ops->ndo_start_xmit; - dev->change_rx_flags = ops->ndo_change_rx_flags; - dev->set_multicast_list = ops->ndo_set_multicast_list; - dev->validate_addr = ops->ndo_validate_addr; - dev->do_ioctl = ops->ndo_do_ioctl; - dev->set_config = ops->ndo_set_config; - dev->change_mtu = ops->ndo_change_mtu; - dev->set_mac_address = ops->ndo_set_mac_address; - dev->tx_timeout = ops->ndo_tx_timeout; - if (ops->ndo_get_stats) - dev->get_stats = ops->ndo_get_stats; - dev->vlan_rx_register = ops->ndo_vlan_rx_register; - dev->vlan_rx_add_vid = ops->ndo_vlan_rx_add_vid; - dev->vlan_rx_kill_vid = ops->ndo_vlan_rx_kill_vid; -#ifdef CONFIG_NET_POLL_CONTROLLER - dev->poll_controller = ops->ndo_poll_controller; -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) - dev->select_queue = ops->ndo_select_queue; -#endif -} -EXPORT_SYMBOL_GPL(netdev_attach_ops); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)) -#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE) -/** - * usb_unpoison_anchored_urbs - let an anchor be used successfully again - * @anchor: anchor the requests are bound to - * - * Reverses the effect of usb_poison_anchored_urbs - * the anchor can be used normally after it returns - */ -void usb_unpoison_anchored_urbs(struct usb_anchor *anchor) -{ - unsigned long flags; - struct urb *lazarus; - - spin_lock_irqsave(&anchor->lock, flags); - list_for_each_entry(lazarus, &anchor->urb_list, anchor_list) { - usb_unpoison_urb(lazarus); - } - //anchor->poisoned = 0; /* XXX: cannot backport */ - spin_unlock_irqrestore(&anchor->lock, flags); -} -EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs); -#endif /* CONFIG_USB */ -#endif - -/** - * eth_mac_addr - set new Ethernet hardware address - * @dev: network device - * @p: socket address - * Change hardware address of device. - * - * This doesn't change hardware matching, so needs to be overridden - * for most real devices. - */ -int eth_mac_addr(struct net_device *dev, void *p) -{ - struct sockaddr *addr = p; - - if (netif_running(dev)) - return -EBUSY; - if (!is_valid_ether_addr(addr->sa_data)) - return -EADDRNOTAVAIL; - memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); - return 0; -} -EXPORT_SYMBOL_GPL(eth_mac_addr); - -/** - * eth_change_mtu - set new MTU size - * @dev: network device - * @new_mtu: new Maximum Transfer Unit - * - * Allow changing MTU size. Needs to be overridden for devices - * supporting jumbo frames. - */ -int eth_change_mtu(struct net_device *dev, int new_mtu) -{ - if (new_mtu < 68 || new_mtu > ETH_DATA_LEN) - return -EINVAL; - dev->mtu = new_mtu; - return 0; -} -EXPORT_SYMBOL_GPL(eth_change_mtu); - -int eth_validate_addr(struct net_device *dev) -{ - if (!is_valid_ether_addr(dev->dev_addr)) - return -EADDRNOTAVAIL; - - return 0; -} -EXPORT_SYMBOL_GPL(eth_validate_addr); -/* Source: net/ethernet/eth.c */ - -#define NETREG_DUMMY 5 -/** - * init_dummy_netdev - init a dummy network device for NAPI - * @dev: device to init - * - * This takes a network device structure and initialize the minimum - * amount of fields so it can be used to schedule NAPI polls without - * registering a full blown interface. This is to be used by drivers - * that need to tie several hardware interfaces to a single NAPI - * poll scheduler due to HW limitations. - */ -int init_dummy_netdev(struct net_device *dev) -{ - /* Clear everything. Note we don't initialize spinlocks - * are they aren't supposed to be taken by any of the - * NAPI code and this dummy netdev is supposed to be - * only ever used for NAPI polls - */ - memset(dev, 0, sizeof(struct net_device)); - - /* make sure we BUG if trying to hit standard - * register/unregister code path - */ - dev->reg_state = NETREG_DUMMY; - - /* initialize the ref count */ - atomic_set(&dev->refcnt, 1); - -#ifdef CONFIG_NETPOLL - /* NAPI wants this */ - INIT_LIST_HEAD(&dev->napi_list); -#endif - - /* a dummy interface is started by default */ - set_bit(__LINK_STATE_PRESENT, &dev->state); - set_bit(__LINK_STATE_START, &dev->state); - - return 0; -} -EXPORT_SYMBOL_GPL(init_dummy_netdev); -/* Source: net/core/dev.c */ - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.32.c b/openairITS/mac/DOT11/compat/compat-2.6.32.c deleted file mode 100644 index b5a66a869e8..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.32.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.32. - */ - -#include <linux/compat.h> -#include <linux/netdevice.h> - -int __dev_addr_add(struct dev_addr_list **list, int *count, - void *addr, int alen, int glbl) -{ - struct dev_addr_list *da; - - for (da = *list; da != NULL; da = da->next) { - if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 && - da->da_addrlen == alen) { - if (glbl) { - int old_glbl = da->da_gusers; - da->da_gusers = 1; - if (old_glbl) - return 0; - } - da->da_users++; - return 0; - } - } - - da = kzalloc(sizeof(*da), GFP_ATOMIC); - if (da == NULL) - return -ENOMEM; - memcpy(da->da_addr, addr, alen); - da->da_addrlen = alen; - da->da_users = 1; - da->da_gusers = glbl ? 1 : 0; - da->next = *list; - *list = da; - (*count)++; - return 0; -} - -int __dev_addr_delete(struct dev_addr_list **list, int *count, - void *addr, int alen, int glbl) -{ - struct dev_addr_list *da; - - for (; (da = *list) != NULL; list = &da->next) { - if (memcmp(da->da_addr, addr, da->da_addrlen) == 0 && - alen == da->da_addrlen) { - if (glbl) { - int old_glbl = da->da_gusers; - da->da_gusers = 0; - if (old_glbl == 0) - break; - } - if (--da->da_users) - return 0; - - *list = da->next; - kfree(da); - (*count)--; - return 0; - } - } - return -ENOENT; -} - -int __dev_addr_sync(struct dev_addr_list **to, int *to_count, - struct dev_addr_list **from, int *from_count) -{ - struct dev_addr_list *da, *next; - int err = 0; - - da = *from; - while (da != NULL) { - next = da->next; - if (!da->da_synced) { - err = __dev_addr_add(to, to_count, - da->da_addr, da->da_addrlen, 0); - if (err < 0) - break; - da->da_synced = 1; - da->da_users++; - } else if (da->da_users == 1) { - __dev_addr_delete(to, to_count, - da->da_addr, da->da_addrlen, 0); - __dev_addr_delete(from, from_count, - da->da_addr, da->da_addrlen, 0); - } - da = next; - } - return err; -} -EXPORT_SYMBOL_GPL(__dev_addr_sync); - -void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, - struct dev_addr_list **from, int *from_count) -{ - struct dev_addr_list *da, *next; - - da = *from; - while (da != NULL) { - next = da->next; - if (da->da_synced) { - __dev_addr_delete(to, to_count, - da->da_addr, da->da_addrlen, 0); - da->da_synced = 0; - __dev_addr_delete(from, from_count, - da->da_addr, da->da_addrlen, 0); - } - da = next; - } -} -EXPORT_SYMBOL_GPL(__dev_addr_unsync); - -/* - * Nonzero if YEAR is a leap year (every 4 years, - * except every 100th isn't, and every 400th is). - */ -static int __isleap(long year) -{ - return (year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0); -} - -/* do a mathdiv for long type */ -static long math_div(long a, long b) -{ - return a / b - (a % b < 0); -} - -/* How many leap years between y1 and y2, y1 must less or equal to y2 */ -static long leaps_between(long y1, long y2) -{ - long leaps1 = math_div(y1 - 1, 4) - math_div(y1 - 1, 100) - + math_div(y1 - 1, 400); - long leaps2 = math_div(y2 - 1, 4) - math_div(y2 - 1, 100) - + math_div(y2 - 1, 400); - return leaps2 - leaps1; -} - -/* How many days come before each month (0-12). */ -static const unsigned short __mon_yday[2][13] = { - /* Normal years. */ - {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}, - /* Leap years. */ - {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} -}; - -#define SECS_PER_HOUR (60 * 60) -#define SECS_PER_DAY (SECS_PER_HOUR * 24) - -/** - * time_to_tm - converts the calendar time to local broken-down time - * - * @totalsecs the number of seconds elapsed since 00:00:00 on January 1, 1970, - * Coordinated Universal Time (UTC). - * @offset offset seconds adding to totalsecs. - * @result pointer to struct tm variable to receive broken-down time - */ -void time_to_tm(time_t totalsecs, int offset, struct tm *result) -{ - long days, rem, y; - const unsigned short *ip; - - days = totalsecs / SECS_PER_DAY; - rem = totalsecs % SECS_PER_DAY; - rem += offset; - while (rem < 0) { - rem += SECS_PER_DAY; - --days; - } - while (rem >= SECS_PER_DAY) { - rem -= SECS_PER_DAY; - ++days; - } - - result->tm_hour = rem / SECS_PER_HOUR; - rem %= SECS_PER_HOUR; - result->tm_min = rem / 60; - result->tm_sec = rem % 60; - - /* January 1, 1970 was a Thursday. */ - result->tm_wday = (4 + days) % 7; - if (result->tm_wday < 0) - result->tm_wday += 7; - - y = 1970; - - while (days < 0 || days >= (__isleap(y) ? 366 : 365)) { - /* Guess a corrected year, assuming 365 days per year. */ - long yg = y + math_div(days, 365); - - /* Adjust DAYS and Y to match the guessed year. */ - days -= (yg - y) * 365 + leaps_between(y, yg); - y = yg; - } - - result->tm_year = y - 1900; - - result->tm_yday = days; - - ip = __mon_yday[__isleap(y)]; - for (y = 11; days < ip[y]; y--) - continue; - days -= ip[y]; - - result->tm_mon = y; - result->tm_mday = days + 1; -} -EXPORT_SYMBOL_GPL(time_to_tm); -/* source: kernel/time/timeconv.c*/ - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.33.c b/openairITS/mac/DOT11/compat/compat-2.6.33.c deleted file mode 100644 index 04e2fd09f71..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.33.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2009 Hauke Mehrtens <hauke@hauke-m.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.33. - */ - -#include <linux/compat.h> -#include <linux/autoconf.h> - -#if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE) - -/** - * pccard_loop_tuple() - loop over tuples in the CIS - * @s: the struct pcmcia_socket where the card is inserted - * @function: the device function we loop for - * @code: which CIS code shall we look for? - * @parse: buffer where the tuple shall be parsed (or NULL, if no parse) - * @priv_data: private data to be passed to the loop_tuple function. - * @loop_tuple: function to call for each CIS entry of type @function. IT - * gets passed the raw tuple, the paresed tuple (if @parse is - * set) and @priv_data. - * - * pccard_loop_tuple() loops over all CIS entries of type @function, and - * calls the @loop_tuple function for each entry. If the call to @loop_tuple - * returns 0, the loop exits. Returns 0 on success or errorcode otherwise. - */ -int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, - cisdata_t code, cisparse_t *parse, void *priv_data, - int (*loop_tuple) (tuple_t *tuple, - cisparse_t *parse, - void *priv_data)) -{ - tuple_t tuple; - cisdata_t *buf; - int ret; - - buf = kzalloc(256, GFP_KERNEL); - if (buf == NULL) { - dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n"); - return -ENOMEM; - } - - tuple.TupleData = buf; - tuple.TupleDataMax = 255; - tuple.TupleOffset = 0; - tuple.DesiredTuple = code; - tuple.Attributes = 0; - - ret = pccard_get_first_tuple(s, function, &tuple); - while (!ret) { - if (pccard_get_tuple_data(s, &tuple)) - goto next_entry; - - if (parse) - if (pcmcia_parse_tuple(&tuple, parse)) - goto next_entry; - - ret = loop_tuple(&tuple, parse, priv_data); - if (!ret) - break; - -next_entry: - ret = pccard_get_next_tuple(s, function, &tuple); - } - - kfree(buf); - return ret; -} -EXPORT_SYMBOL_GPL(pccard_loop_tuple); -/* Source: drivers/pcmcia/cistpl.c */ - -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) - -struct pcmcia_loop_mem { - struct pcmcia_device *p_dev; - void *priv_data; - int (*loop_tuple) (struct pcmcia_device *p_dev, - tuple_t *tuple, - void *priv_data); -}; - -/** - * pcmcia_do_loop_tuple() - internal helper for pcmcia_loop_config() - * - * pcmcia_do_loop_tuple() is the internal callback for the call from - * pcmcia_loop_tuple() to pccard_loop_tuple(). Data is transferred - * by a struct pcmcia_cfg_mem. - */ -static int pcmcia_do_loop_tuple(tuple_t *tuple, cisparse_t *parse, void *priv) -{ - struct pcmcia_loop_mem *loop = priv; - - return loop->loop_tuple(loop->p_dev, tuple, loop->priv_data); -}; - -/** - * pcmcia_loop_tuple() - loop over tuples in the CIS - * @p_dev: the struct pcmcia_device which we need to loop for. - * @code: which CIS code shall we look for? - * @priv_data: private data to be passed to the loop_tuple function. - * @loop_tuple: function to call for each CIS entry of type @function. IT - * gets passed the raw tuple and @priv_data. - * - * pcmcia_loop_tuple() loops over all CIS entries of type @function, and - * calls the @loop_tuple function for each entry. If the call to @loop_tuple - * returns 0, the loop exits. Returns 0 on success or errorcode otherwise. - */ -int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code, - int (*loop_tuple) (struct pcmcia_device *p_dev, - tuple_t *tuple, - void *priv_data), - void *priv_data) -{ - struct pcmcia_loop_mem loop = { - .p_dev = p_dev, - .loop_tuple = loop_tuple, - .priv_data = priv_data}; - - return pccard_loop_tuple(p_dev->socket, p_dev->func, code, NULL, - &loop, pcmcia_do_loop_tuple); -} -EXPORT_SYMBOL_GPL(pcmcia_loop_tuple); -/* Source: drivers/pcmcia/pcmcia_resource.c */ - -#endif /* CONFIG_PCMCIA */ - -#endif /* CONFIG_PCCARD */ - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.35.c b/openairITS/mac/DOT11/compat/compat-2.6.35.c deleted file mode 100644 index 24551722274..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.35.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2010 Kshitij Kulshreshtha <kkhere.geo@gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.35. - */ - -#include <linux/compat.h> -#include <linux/ctype.h> - -/** - * hex_to_bin - convert a hex digit to its real value - * @ch: ascii character represents hex digit - * - * hex_to_bin() converts one hex digit to its actual value or -1 in case of bad - * input. - */ -int compat_hex_to_bin(char ch) -{ - if ((ch >= '0') && (ch <= '9')) - return ch - '0'; - ch = tolower(ch); - if ((ch >= 'a') && (ch <= 'f')) - return ch - 'a' + 10; - return -1; -} -EXPORT_SYMBOL_GPL(compat_hex_to_bin); - -/** - * noop_llseek - No Operation Performed llseek implementation - * @file: file structure to seek on - * @offset: file offset to seek to - * @origin: type of seek - * - * This is an implementation of ->llseek useable for the rare special case when - * userspace expects the seek to succeed but the (device) file is actually not - * able to perform the seek. In this case you use noop_llseek() instead of - * falling back to the default implementation of ->llseek. - */ -loff_t noop_llseek(struct file *file, loff_t offset, int origin) -{ - return file->f_pos; -} -EXPORT_SYMBOL_GPL(noop_llseek); - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.36.c b/openairITS/mac/DOT11/compat/compat-2.6.36.c deleted file mode 100644 index 9190ecd8b0a..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.36.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2010 Hauke Mehrtens <hauke@hauke-m.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.36. - */ - -#include <linux/compat.h> -#include <linux/usb.h> - -#ifdef CONFIG_COMPAT_USB_URB_THREAD_FIX -/* Callers must hold anchor->lock */ -static void __usb_unanchor_urb(struct urb *urb, struct usb_anchor *anchor) -{ - urb->anchor = NULL; - list_del(&urb->anchor_list); - usb_put_urb(urb); - if (list_empty(&anchor->urb_list)) - wake_up(&anchor->wait); -} - -/** - * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse - * @anchor: anchor the requests are bound to - * - * this allows all outstanding URBs to be unlinked starting - * from the back of the queue. This function is asynchronous. - * The unlinking is just tiggered. It may happen after this - * function has returned. - * - * This routine should not be called by a driver after its disconnect - * method has returned. - */ -void compat_usb_unlink_anchored_urbs(struct usb_anchor *anchor) -{ - struct urb *victim; - - while ((victim = usb_get_from_anchor(anchor)) != NULL) { - usb_unlink_urb(victim); - usb_put_urb(victim); - } -} -EXPORT_SYMBOL_GPL(compat_usb_unlink_anchored_urbs); - -/** - * usb_get_from_anchor - get an anchor's oldest urb - * @anchor: the anchor whose urb you want - * - * this will take the oldest urb from an anchor, - * unanchor and return it - */ -struct urb *compat_usb_get_from_anchor(struct usb_anchor *anchor) -{ - struct urb *victim; - unsigned long flags; - - spin_lock_irqsave(&anchor->lock, flags); - if (!list_empty(&anchor->urb_list)) { - victim = list_entry(anchor->urb_list.next, struct urb, - anchor_list); - usb_get_urb(victim); - __usb_unanchor_urb(victim, anchor); - } else { - victim = NULL; - } - spin_unlock_irqrestore(&anchor->lock, flags); - - return victim; -} -EXPORT_SYMBOL_GPL(compat_usb_get_from_anchor); - -/** - * usb_scuttle_anchored_urbs - unanchor all an anchor's urbs - * @anchor: the anchor whose urbs you want to unanchor - * - * use this to get rid of all an anchor's urbs - */ -void compat_usb_scuttle_anchored_urbs(struct usb_anchor *anchor) -{ - struct urb *victim; - unsigned long flags; - - spin_lock_irqsave(&anchor->lock, flags); - while (!list_empty(&anchor->urb_list)) { - victim = list_entry(anchor->urb_list.prev, struct urb, - anchor_list); - __usb_unanchor_urb(victim, anchor); - } - spin_unlock_irqrestore(&anchor->lock, flags); -} -EXPORT_SYMBOL_GPL(compat_usb_scuttle_anchored_urbs); - -#endif /* CONFIG_COMPAT_USB_URB_THREAD_FIX */ - -struct workqueue_struct *system_wq __read_mostly; -struct workqueue_struct *system_long_wq __read_mostly; -struct workqueue_struct *system_nrt_wq __read_mostly; -EXPORT_SYMBOL_GPL(system_wq); -EXPORT_SYMBOL_GPL(system_long_wq); -EXPORT_SYMBOL_GPL(system_nrt_wq); - -int compat_schedule_work(struct work_struct *work) -{ - return queue_work(system_wq, work); -} -EXPORT_SYMBOL_GPL(compat_schedule_work); - -int compat_schedule_work_on(int cpu, struct work_struct *work) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) - return queue_work_on(cpu, system_wq, work); -#else - return queue_work(system_wq, work); -#endif -} -EXPORT_SYMBOL_GPL(compat_schedule_work_on); - -int compat_schedule_delayed_work(struct delayed_work *dwork, - unsigned long delay) -{ - return queue_delayed_work(system_wq, dwork, delay); -} -EXPORT_SYMBOL_GPL(compat_schedule_delayed_work); - -int compat_schedule_delayed_work_on(int cpu, - struct delayed_work *dwork, - unsigned long delay) -{ - return queue_delayed_work_on(cpu, system_wq, dwork, delay); -} -EXPORT_SYMBOL_GPL(compat_schedule_delayed_work_on); - -void compat_flush_scheduled_work(void) -{ - /* - * It is debatable which one we should prioritize first, lets - * go with the old kernel's one first for now (keventd_wq) and - * if think its reasonable later we can flip this around. - */ - flush_workqueue(system_wq); - flush_scheduled_work(); -} -EXPORT_SYMBOL_GPL(compat_flush_scheduled_work); - -/** - * work_busy - test whether a work is currently pending or running - * @work: the work to be tested - * - * Test whether @work is currently pending or running. There is no - * synchronization around this function and the test result is - * unreliable and only useful as advisory hints or for debugging. - * Especially for reentrant wqs, the pending state might hide the - * running state. - * - * RETURNS: - * OR'd bitmask of WORK_BUSY_* bits. - */ -unsigned int work_busy(struct work_struct *work) -{ - unsigned int ret = 0; - - if (work_pending(work)) - ret |= WORK_BUSY_PENDING; - - return ret; -} -EXPORT_SYMBOL_GPL(work_busy); - -void compat_system_workqueue_create() -{ - system_wq = alloc_workqueue("events", 0, 0); - system_long_wq = alloc_workqueue("events_long", 0, 0); - system_nrt_wq = create_singlethread_workqueue("events_nrt"); - BUG_ON(!system_wq || !system_long_wq || !system_nrt_wq); -} - -void compat_system_workqueue_destroy() -{ - destroy_workqueue(system_wq); - destroy_workqueue(system_long_wq); - destroy_workqueue(system_nrt_wq); -} diff --git a/openairITS/mac/DOT11/compat/compat-2.6.37.c b/openairITS/mac/DOT11/compat/compat-2.6.37.c deleted file mode 100644 index 24b267a5be5..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.37.c +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright 2010 Hauke Mehrtens <hauke@hauke-m.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.37. - */ - -#include <linux/compat.h> -#include <linux/netdevice.h> -#include <net/sock.h> -#include <linux/nsproxy.h> -#include <linux/vmalloc.h> - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35) -static const void *net_current_ns(void) -{ - return current->nsproxy->net_ns; -} - -static const void *net_initial_ns(void) -{ - return &init_net; -} - -static const void *net_netlink_ns(struct sock *sk) -{ - return sock_net(sk); -} - -struct kobj_ns_type_operations net_ns_type_operations = { - .type = KOBJ_NS_TYPE_NET, - .current_ns = net_current_ns, - .netlink_ns = net_netlink_ns, - .initial_ns = net_initial_ns, -}; -EXPORT_SYMBOL_GPL(net_ns_type_operations); - -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)*/ - -#undef genl_info -#undef genl_unregister_family - -static LIST_HEAD(compat_nl_fam); - -static struct genl_ops *genl_get_cmd(u8 cmd, struct genl_family *family) -{ - struct genl_ops *ops; - - list_for_each_entry(ops, &family->family.ops_list, ops.ops_list) - if (ops->cmd == cmd) - return ops; - - return NULL; -} - - -static int nl_doit_wrapper(struct sk_buff *skb, struct genl_info *info) -{ - struct compat_genl_info compat_info; - struct genl_family *family; - struct genl_ops *ops; - int err; - - list_for_each_entry(family, &compat_nl_fam, list) { - if (family->id == info->nlhdr->nlmsg_type) - goto found; - } - return -ENOENT; - -found: - ops = genl_get_cmd(info->genlhdr->cmd, family); - if (!ops) - return -ENOENT; - - memset(&compat_info.user_ptr, 0, sizeof(compat_info.user_ptr)); - compat_info.info = info; -#define __copy(_field) compat_info._field = info->_field - __copy(snd_seq); - __copy(snd_pid); - __copy(genlhdr); - __copy(attrs); -#undef __copy - if (family->pre_doit) { - err = family->pre_doit(ops, skb, &compat_info); - if (err) - return err; - } - - err = ops->doit(skb, &compat_info); - - if (family->post_doit) - family->post_doit(ops, skb, &compat_info); - - return err; -} - -int compat_genl_register_family_with_ops(struct genl_family *family, - struct genl_ops *ops, size_t n_ops) -{ - int i, ret; - -#define __copy(_field) family->family._field = family->_field - __copy(id); - __copy(hdrsize); - __copy(version); - __copy(maxattr); - strncpy(family->family.name, family->name, sizeof(family->family.name)); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) - __copy(netnsok); -#endif -#undef __copy - - ret = genl_register_family(&family->family); - if (ret < 0) - return ret; - - family->attrbuf = family->family.attrbuf; - family->id = family->family.id; - - for (i = 0; i < n_ops; i++) { -#define __copy(_field) ops[i].ops._field = ops[i]._field - __copy(cmd); - __copy(flags); - __copy(policy); - __copy(dumpit); - __copy(done); -#undef __copy - if (ops[i].doit) - ops[i].ops.doit = nl_doit_wrapper; - ret = genl_register_ops(&family->family, &ops[i].ops); - if (ret < 0) - goto error_ops; - } - list_add(&family->list, &compat_nl_fam); - - return ret; - -error_ops: - compat_genl_unregister_family(family); - return ret; -} -EXPORT_SYMBOL_GPL(compat_genl_register_family_with_ops); - -int compat_genl_unregister_family(struct genl_family *family) -{ - int err; - err = genl_unregister_family(&family->family); - list_del(&family->list); - return err; -} -EXPORT_SYMBOL_GPL(compat_genl_unregister_family); - -#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) - -#undef led_brightness_set -#undef led_classdev_unregister - -static DEFINE_SPINLOCK(led_lock); -static LIST_HEAD(led_timers); - -struct led_timer { - struct list_head list; - struct led_classdev *cdev; - struct timer_list blink_timer; - unsigned long blink_delay_on; - unsigned long blink_delay_off; - int blink_brightness; -}; - -static void led_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - led_cdev->brightness = brightness; - led_cdev->brightness_set(led_cdev, brightness); -} - -static struct led_timer *led_get_timer(struct led_classdev *led_cdev) -{ - struct led_timer *p; - unsigned long flags; - - spin_lock_irqsave(&led_lock, flags); - list_for_each_entry(p, &led_timers, list) { - if (p->cdev == led_cdev) - goto found; - } - p = NULL; -found: - spin_unlock_irqrestore(&led_lock, flags); - return p; -} - -static void led_stop_software_blink(struct led_timer *led) -{ - del_timer_sync(&led->blink_timer); - led->blink_delay_on = 0; - led->blink_delay_off = 0; -} - -static void led_timer_function(unsigned long data) -{ - struct led_timer *led = (struct led_timer *)data; - unsigned long brightness; - unsigned long delay; - - if (!led->blink_delay_on || !led->blink_delay_off) { - led->cdev->brightness_set(led->cdev, LED_OFF); - return; - } - - brightness = led->cdev->brightness; - if (!brightness) { - /* Time to switch the LED on. */ - brightness = led->blink_brightness; - delay = led->blink_delay_on; - } else { - /* Store the current brightness value to be able - * to restore it when the delay_off period is over. - */ - led->blink_brightness = brightness; - brightness = LED_OFF; - delay = led->blink_delay_off; - } - - led_brightness_set(led->cdev, brightness); - mod_timer(&led->blink_timer, jiffies + msecs_to_jiffies(delay)); -} - -static struct led_timer *led_new_timer(struct led_classdev *led_cdev) -{ - struct led_timer *led; - unsigned long flags; - - led = kzalloc(sizeof(struct led_timer), GFP_ATOMIC); - if (!led) - return NULL; - - led->cdev = led_cdev; - init_timer(&led->blink_timer); - led->blink_timer.function = led_timer_function; - led->blink_timer.data = (unsigned long) led; - - spin_lock_irqsave(&led_lock, flags); - list_add(&led->list, &led_timers); - spin_unlock_irqrestore(&led_lock, flags); - - return led; -} - -void led_blink_set(struct led_classdev *led_cdev, - unsigned long *delay_on, - unsigned long *delay_off) -{ - struct led_timer *led; - int current_brightness; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) - if (led_cdev->blink_set && - !led_cdev->blink_set(led_cdev, delay_on, delay_off)) - return; -#endif - - led = led_get_timer(led_cdev); - if (!led) { - led = led_new_timer(led_cdev); - if (!led) - return; - } - - /* blink with 1 Hz as default if nothing specified */ - if (!*delay_on && !*delay_off) - *delay_on = *delay_off = 500; - - if (led->blink_delay_on == *delay_on && - led->blink_delay_off == *delay_off) - return; - - current_brightness = led_cdev->brightness; - if (current_brightness) - led->blink_brightness = current_brightness; - if (!led->blink_brightness) -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) - led->blink_brightness = led_cdev->max_brightness; -#else - led->blink_brightness = LED_FULL; -#endif - - led_stop_software_blink(led); - led->blink_delay_on = *delay_on; - led->blink_delay_off = *delay_off; - - /* never on - don't blink */ - if (!*delay_on) - return; - - /* never off - just set to brightness */ - if (!*delay_off) { - led_brightness_set(led_cdev, led->blink_brightness); - return; - } - - mod_timer(&led->blink_timer, jiffies + 1); -} -EXPORT_SYMBOL_GPL(led_blink_set); - -void compat_led_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness) -{ - struct led_timer *led = led_get_timer(led_cdev); - - if (led) - led_stop_software_blink(led); - - return led_cdev->brightness_set(led_cdev, brightness); -} -EXPORT_SYMBOL_GPL(compat_led_brightness_set); - -void compat_led_classdev_unregister(struct led_classdev *led_cdev) -{ - struct led_timer *led = led_get_timer(led_cdev); - unsigned long flags; - - if (led) { - del_timer_sync(&led->blink_timer); - spin_lock_irqsave(&led_lock, flags); - list_del(&led->list); - spin_unlock_irqrestore(&led_lock, flags); - kfree(led); - } - - led_classdev_unregister(led_cdev); -} -EXPORT_SYMBOL_GPL(compat_led_classdev_unregister); - -/** - * vzalloc - allocate virtually contiguous memory with zero fill - * @size: allocation size - * Allocate enough pages to cover @size from the page level - * allocator and map them into contiguous kernel virtual space. - * The memory allocated is set to zero. - * - * For tight control over page level allocator and protection flags - * use __vmalloc() instead. - */ -void *compat_vzalloc(unsigned long size) -{ - void *buf; - buf = vmalloc(size); - if (buf) - memset(buf, 0, size); - return buf; -} -EXPORT_SYMBOL_GPL(compat_vzalloc); - -#endif diff --git a/openairITS/mac/DOT11/compat/compat-2.6.38.c b/openairITS/mac/DOT11/compat/compat-2.6.38.c deleted file mode 100644 index 0074ac62522..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.38.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2010 Hauke Mehrtens <hauke@hauke-m.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.38. - */ - -#include <linux/compat.h> -#include <linux/module.h> -#include <linux/bug.h> - -/** - * ewma_init() - Initialize EWMA parameters - * @avg: Average structure - * @factor: Factor to use for the scaled up internal value. The maximum value - * of averages can be ULONG_MAX/(factor*weight). - * @weight: Exponential weight, or decay rate. This defines how fast the - * influence of older values decreases. Has to be bigger than 1. - * - * Initialize the EWMA parameters for a given struct ewma @avg. - */ -void ewma_init(struct ewma *avg, unsigned long factor, unsigned long weight) -{ - WARN_ON(weight <= 1 || factor == 0); - avg->internal = 0; - avg->weight = weight; - avg->factor = factor; -} -EXPORT_SYMBOL_GPL(ewma_init); - -/** - * ewma_add() - Exponentially weighted moving average (EWMA) - * @avg: Average structure - * @val: Current value - * - * Add a sample to the average. - */ -struct ewma *ewma_add(struct ewma *avg, unsigned long val) -{ - avg->internal = avg->internal ? - (((avg->internal * (avg->weight - 1)) + - (val * avg->factor)) / avg->weight) : - (val * avg->factor); - return avg; -} -EXPORT_SYMBOL_GPL(ewma_add); - diff --git a/openairITS/mac/DOT11/compat/compat-2.6.39.c b/openairITS/mac/DOT11/compat/compat-2.6.39.c deleted file mode 100644 index 5bb932218d1..00000000000 --- a/openairITS/mac/DOT11/compat/compat-2.6.39.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2011 Hauke Mehrtens <hauke@hauke-m.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 2.6.39. - */ - -#include <linux/compat.h> -#include <linux/tty.h> -#include <linux/sched.h> - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) -/* - * Termios Helper Methods - */ -static void unset_locked_termios(struct ktermios *termios, - struct ktermios *old, - struct ktermios *locked) -{ - int i; - -#define NOSET_MASK(x, y, z) (x = ((x) & ~(z)) | ((y) & (z))) - - if (!locked) { - printk(KERN_WARNING "Warning?!? termios_locked is NULL.\n"); - return; - } - - NOSET_MASK(termios->c_iflag, old->c_iflag, locked->c_iflag); - NOSET_MASK(termios->c_oflag, old->c_oflag, locked->c_oflag); - NOSET_MASK(termios->c_cflag, old->c_cflag, locked->c_cflag); - NOSET_MASK(termios->c_lflag, old->c_lflag, locked->c_lflag); - termios->c_line = locked->c_line ? old->c_line : termios->c_line; - for (i = 0; i < NCCS; i++) - termios->c_cc[i] = locked->c_cc[i] ? - old->c_cc[i] : termios->c_cc[i]; - /* FIXME: What should we do for i/ospeed */ -} - -/** - * tty_set_termios - update termios values - * @tty: tty to update - * @new_termios: desired new value - * - * Perform updates to the termios values set on this terminal. There - * is a bit of layering violation here with n_tty in terms of the - * internal knowledge of this function. - * - * Locking: termios_mutex - */ -int tty_set_termios(struct tty_struct *tty, struct ktermios *new_termios) -{ - struct ktermios old_termios; - struct tty_ldisc *ld; - unsigned long flags; - - /* - * Perform the actual termios internal changes under lock. - */ - - - /* FIXME: we need to decide on some locking/ordering semantics - for the set_termios notification eventually */ - mutex_lock(&tty->termios_mutex); - old_termios = *tty->termios; - *tty->termios = *new_termios; - unset_locked_termios(tty->termios, &old_termios, tty->termios_locked); - - /* See if packet mode change of state. */ - if (tty->link && tty->link->packet) { - int extproc = (old_termios.c_lflag & EXTPROC) | - (tty->termios->c_lflag & EXTPROC); - int old_flow = ((old_termios.c_iflag & IXON) && - (old_termios.c_cc[VSTOP] == '\023') && - (old_termios.c_cc[VSTART] == '\021')); - int new_flow = (I_IXON(tty) && - STOP_CHAR(tty) == '\023' && - START_CHAR(tty) == '\021'); - if ((old_flow != new_flow) || extproc) { - spin_lock_irqsave(&tty->ctrl_lock, flags); - if (old_flow != new_flow) { - tty->ctrl_status &= ~(TIOCPKT_DOSTOP | TIOCPKT_NOSTOP); - if (new_flow) - tty->ctrl_status |= TIOCPKT_DOSTOP; - else - tty->ctrl_status |= TIOCPKT_NOSTOP; - } - if (extproc) - tty->ctrl_status |= TIOCPKT_IOCTL; - spin_unlock_irqrestore(&tty->ctrl_lock, flags); - wake_up_interruptible(&tty->link->read_wait); - } - } - - if (tty->ops->set_termios) - (*tty->ops->set_termios)(tty, &old_termios); - else - tty_termios_copy_hw(tty->termios, &old_termios); - - ld = tty_ldisc_ref(tty); - if (ld != NULL) { - if (ld->ops->set_termios) - (ld->ops->set_termios)(tty, &old_termios); - tty_ldisc_deref(ld); - } - mutex_unlock(&tty->termios_mutex); - return 0; -} -EXPORT_SYMBOL_GPL(tty_set_termios); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) */ - diff --git a/openairITS/mac/DOT11/compat/compat-3.0.c b/openairITS/mac/DOT11/compat/compat-3.0.c deleted file mode 100644 index 1da45ac12b9..00000000000 --- a/openairITS/mac/DOT11/compat/compat-3.0.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2011 Hauke Mehrtens <hauke@hauke-m.de> - * Copyright 2011 Alexey Dobriyan <adobriyan@gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 3.0. - */ - -#include <linux/compat.h> -#include <linux/if_ether.h> - -int mac_pton(const char *s, u8 *mac) -{ - int i; - - /* XX:XX:XX:XX:XX:XX */ - if (strlen(s) < 3 * ETH_ALEN - 1) - return 0; - - /* Don't dirty result unless string is valid MAC. */ - for (i = 0; i < ETH_ALEN; i++) { - if (!strchr("0123456789abcdefABCDEF", s[i * 3])) - return 0; - if (!strchr("0123456789abcdefABCDEF", s[i * 3 + 1])) - return 0; - if (i != ETH_ALEN - 1 && s[i * 3 + 2] != ':') - return 0; - } - for (i = 0; i < ETH_ALEN; i++) { - mac[i] = (hex_to_bin(s[i * 3]) << 4) | hex_to_bin(s[i * 3 + 1]); - } - return 1; -} -EXPORT_SYMBOL_GPL(mac_pton); - -#define kstrto_from_user(f, g, type) \ -int f(const char __user *s, size_t count, unsigned int base, type *res) \ -{ \ - /* sign, base 2 representation, newline, terminator */ \ - char buf[1 + sizeof(type) * 8 + 1 + 1]; \ - \ - count = min(count, sizeof(buf) - 1); \ - if (copy_from_user(buf, s, count)) \ - return -EFAULT; \ - buf[count] = '\0'; \ - return g(buf, base, res); \ -} \ -EXPORT_SYMBOL_GPL(f) - -kstrto_from_user(kstrtoull_from_user, kstrtoull, unsigned long long); -kstrto_from_user(kstrtoll_from_user, kstrtoll, long long); -kstrto_from_user(kstrtoul_from_user, kstrtoul, unsigned long); -kstrto_from_user(kstrtol_from_user, kstrtol, long); -kstrto_from_user(kstrtouint_from_user, kstrtouint, unsigned int); -kstrto_from_user(kstrtoint_from_user, kstrtoint, int); -kstrto_from_user(kstrtou16_from_user, kstrtou16, u16); -kstrto_from_user(kstrtos16_from_user, kstrtos16, s16); -kstrto_from_user(kstrtou8_from_user, kstrtou8, u8); -kstrto_from_user(kstrtos8_from_user, kstrtos8, s8); diff --git a/openairITS/mac/DOT11/compat/compat-3.2.c b/openairITS/mac/DOT11/compat/compat-3.2.c deleted file mode 100644 index 55ae6af0f93..00000000000 --- a/openairITS/mac/DOT11/compat/compat-3.2.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 3.2. - */ - -#include <linux/kernel.h> -#include <linux/device.h> - -int __netdev_printk(const char *level, const struct net_device *dev, - struct va_format *vaf) -{ - int r; - - if (dev && dev->dev.parent) -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35)) - r = dev_printk(level, dev->dev.parent, "%s: %pV", - netdev_name(dev), vaf); -#else - /* XXX: this could likely be done better but I'm lazy */ - r = printk("%s%s: %pV", level, netdev_name(dev), vaf); -#endif - else if (dev) - r = printk("%s%s: %pV", level, netdev_name(dev), vaf); - else - r = printk("%s(NULL net_device): %pV", level, vaf); - - return r; -} -EXPORT_SYMBOL_GPL(__netdev_printk); diff --git a/openairITS/mac/DOT11/compat/compat-3.3.c b/openairITS/mac/DOT11/compat/compat-3.3.c deleted file mode 100644 index 8489344614a..00000000000 --- a/openairITS/mac/DOT11/compat/compat-3.3.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 3.3. - */ - -#include <linux/kernel.h> -#include <linux/version.h> -#include <linux/skbuff.h> -#include <linux/module.h> -#include <net/dst.h> -#include <net/xfrm.h> - -static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) -{ - new->tstamp = old->tstamp; - new->dev = old->dev; - new->transport_header = old->transport_header; - new->network_header = old->network_header; - new->mac_header = old->mac_header; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - skb_dst_copy(new, old); - new->rxhash = old->rxhash; -#else - skb_dst_set(new, dst_clone(skb_dst(old))); -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) - new->ooo_okay = old->ooo_okay; -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - new->l4_rxhash = old->l4_rxhash; -#endif -#ifdef CONFIG_XFRM - new->sp = secpath_get(old->sp); -#endif - memcpy(new->cb, old->cb, sizeof(old->cb)); - new->csum = old->csum; - new->local_df = old->local_df; - new->pkt_type = old->pkt_type; - new->ip_summed = old->ip_summed; - skb_copy_queue_mapping(new, old); - new->priority = old->priority; -#if IS_ENABLED(CONFIG_IP_VS) - new->ipvs_property = old->ipvs_property; -#endif - new->protocol = old->protocol; - new->mark = old->mark; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) - new->skb_iif = old->skb_iif; -#endif - __nf_copy(new, old); -#if IS_ENABLED(CONFIG_NETFILTER_XT_TARGET_TRACE) - new->nf_trace = old->nf_trace; -#endif -#ifdef CONFIG_NET_SCHED - new->tc_index = old->tc_index; -#ifdef CONFIG_NET_CLS_ACT - new->tc_verd = old->tc_verd; -#endif -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) - new->vlan_tci = old->vlan_tci; -#endif - - skb_copy_secmark(new, old); -} - -static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) -{ -#ifndef NET_SKBUFF_DATA_USES_OFFSET - /* - * Shift between the two data areas in bytes - */ - unsigned long offset = new->data - old->data; -#endif - - __copy_skb_header(new, old); - -#ifndef NET_SKBUFF_DATA_USES_OFFSET - /* {transport,network,mac}_header are relative to skb->head */ - new->transport_header += offset; - new->network_header += offset; - if (skb_mac_header_was_set(new)) - new->mac_header += offset; -#endif - skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size; - skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs; - skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type; -} - -static void skb_clone_fraglist(struct sk_buff *skb) -{ - struct sk_buff *list; - - skb_walk_frags(skb, list) - skb_get(list); -} - - -/** - * __pskb_copy - create copy of an sk_buff with private head. - * @skb: buffer to copy - * @headroom: headroom of new skb - * @gfp_mask: allocation priority - * - * Make a copy of both an &sk_buff and part of its data, located - * in header. Fragmented data remain shared. This is used when - * the caller wishes to modify only header of &sk_buff and needs - * private copy of the header to alter. Returns %NULL on failure - * or the pointer to the buffer on success. - * The returned buffer has a reference count of 1. - */ - -struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask) -{ - unsigned int size = skb_headlen(skb) + headroom; - struct sk_buff *n = alloc_skb(size, gfp_mask); - - if (!n) - goto out; - - /* Set the data pointer */ - skb_reserve(n, headroom); - /* Set the tail pointer and length */ - skb_put(n, skb_headlen(skb)); - /* Copy the bytes */ - skb_copy_from_linear_data(skb, n->data, n->len); - - n->truesize += skb->data_len; - n->data_len = skb->data_len; - n->len = skb->len; - - if (skb_shinfo(skb)->nr_frags) { - int i; - -/* - * SKBTX_DEV_ZEROCOPY was added on 3.1 as well but requires ubuf - * stuff added to the skb which we do not have - */ -#if 0 - if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY) { - if (skb_copy_ubufs(skb, gfp_mask)) { - kfree_skb(n); - n = NULL; - goto out; - } - } -#endif - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { - skb_shinfo(n)->frags[i] = skb_shinfo(skb)->frags[i]; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) - skb_frag_ref(skb, i); -#else - get_page(skb_shinfo(skb)->frags[i].page); -#endif - } - skb_shinfo(n)->nr_frags = i; - } - - if (skb_has_frag_list(skb)) { - skb_shinfo(n)->frag_list = skb_shinfo(skb)->frag_list; - skb_clone_fraglist(n); - } - - copy_skb_header(n, skb); -out: - return n; -} -EXPORT_SYMBOL_GPL(__pskb_copy); diff --git a/openairITS/mac/DOT11/compat/compat-3.5.c b/openairITS/mac/DOT11/compat/compat-3.5.c deleted file mode 100644 index 5d516f0ebf5..00000000000 --- a/openairITS/mac/DOT11/compat/compat-3.5.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Compatibility file for Linux wireless for kernels 3.5. - */ - -#include <linux/fs.h> -#include <linux/module.h> - -int simple_open(struct inode *inode, struct file *file) -{ - if (inode->i_private) - file->private_data = inode->i_private; - return 0; -} -EXPORT_SYMBOL_GPL(simple_open); diff --git a/openairITS/mac/DOT11/compat/compat_atomic.c b/openairITS/mac/DOT11/compat/compat_atomic.c deleted file mode 100644 index b8565aa5b2b..00000000000 --- a/openairITS/mac/DOT11/compat/compat_atomic.c +++ /dev/null @@ -1,33 +0,0 @@ -#include <linux/spinlock.h> -#include <linux/module.h> - -#if !((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) && (defined(CONFIG_UML) || defined(CONFIG_X86))) && !((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) && defined(CONFIG_ARM) && !defined(CONFIG_GENERIC_ATOMIC64)) - -static DEFINE_SPINLOCK(lock); - -long long atomic64_read(const atomic64_t *v) -{ - unsigned long flags; - long long val; - - spin_lock_irqsave(&lock, flags); - val = v->counter; - spin_unlock_irqrestore(&lock, flags); - return val; -} -EXPORT_SYMBOL_GPL(atomic64_read); - -long long atomic64_add_return(long long a, atomic64_t *v) -{ - unsigned long flags; - long long val; - - spin_lock_irqsave(&lock, flags); - val = v->counter += a; - spin_unlock_irqrestore(&lock, flags); - return val; -} -EXPORT_SYMBOL_GPL(atomic64_add_return); - -#endif - diff --git a/openairITS/mac/DOT11/compat/compat_firmware_class.c b/openairITS/mac/DOT11/compat/compat_firmware_class.c deleted file mode 100644 index 69b442b7d20..00000000000 --- a/openairITS/mac/DOT11/compat/compat_firmware_class.c +++ /dev/null @@ -1,759 +0,0 @@ -/* - * firmware_class.c - Multi purpose firmware loading support - * - * Copyright (c) 2003 Manuel Estrada Sainz - * - * Please see Documentation/firmware_class/ for more information. - * - */ - -#include <linux/capability.h> -#include <linux/device.h> -#include <linux/module.h> -#include <linux/init.h> -#include <linux/timer.h> -#include <linux/vmalloc.h> -#include <linux/interrupt.h> -#include <linux/bitops.h> -#include <linux/mutex.h> -#include <linux/kthread.h> -#include <linux/highmem.h> -#include <linux/firmware.h> -#include <linux/slab.h> - -#define compat_firmware_to_dev(obj) container_of(obj, struct device, kobj) - -MODULE_AUTHOR("Manuel Estrada Sainz"); -MODULE_DESCRIPTION("Multi purpose firmware loading support"); -MODULE_LICENSE("GPL"); - -/* Builtin firmware support */ - -//#ifdef CONFIG_FW_LOADER -#if 0 - -extern struct builtin_fw __start_builtin_fw[]; -extern struct builtin_fw __end_builtin_fw[]; - -static bool fw_get_builtin_firmware(struct firmware *fw, const char *name) -{ - struct builtin_fw *b_fw; - - for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) { - if (strcmp(name, b_fw->name) == 0) { - fw->size = b_fw->size; - fw->data = b_fw->data; - return true; - } - } - - return false; -} - -static bool fw_is_builtin_firmware(const struct firmware *fw) -{ - struct builtin_fw *b_fw; - - for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) - if (fw->data == b_fw->data) - return true; - - return false; -} - -#else /* Module case - no builtin firmware support */ - -static inline bool fw_get_builtin_firmware(struct firmware *fw, const char *name) -{ - return false; -} - -static inline bool fw_is_builtin_firmware(const struct firmware *fw) -{ - return false; -} -#endif - -enum { - FW_STATUS_LOADING, - FW_STATUS_DONE, - FW_STATUS_ABORT, -}; - -static int loading_timeout = 60; /* In seconds */ - -/* fw_lock could be moved to 'struct firmware_priv' but since it is just - * guarding for corner cases a global lock should be OK */ -static DEFINE_MUTEX(fw_lock); - -struct firmware_priv { - struct completion completion; - struct firmware *fw; - unsigned long status; - struct page **pages; - int nr_pages; - int page_array_size; - struct timer_list timeout; - struct device dev; - bool nowait; - char fw_id[]; -}; - -static struct firmware_priv *to_firmware_priv(struct device *dev) -{ - return container_of(dev, struct firmware_priv, dev); -} - -static void fw_load_abort(struct firmware_priv *fw_priv) -{ - set_bit(FW_STATUS_ABORT, &fw_priv->status); - wmb(); - complete(&fw_priv->completion); -} - -static ssize_t firmware_timeout_show(struct class *class, - char *buf) -{ - return sprintf(buf, "%d\n", loading_timeout); -} - -/** - * firmware_timeout_store - set number of seconds to wait for firmware - * @class: device class pointer - * @buf: buffer to scan for timeout value - * @count: number of bytes in @buf - * - * Sets the number of seconds to wait for the firmware. Once - * this expires an error will be returned to the driver and no - * firmware will be provided. - * - * Note: zero means 'wait forever'. - **/ -static ssize_t firmware_timeout_store(struct class *class, - const char *buf, size_t count) -{ - loading_timeout = simple_strtol(buf, NULL, 10); - if (loading_timeout < 0) - loading_timeout = 0; - - return count; -} - -static struct class_attribute firmware_class_attrs[] = { - __ATTR(timeout, S_IWUSR | S_IRUGO, - firmware_timeout_show, firmware_timeout_store), - __ATTR_NULL -}; - -static void fw_dev_release(struct device *dev) -{ - struct firmware_priv *fw_priv = to_firmware_priv(dev); - int i; - - for (i = 0; i < fw_priv->nr_pages; i++) - __free_page(fw_priv->pages[i]); - kfree(fw_priv->pages); - kfree(fw_priv); - - module_put(THIS_MODULE); -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) -static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) -{ - struct firmware_priv *fw_priv = to_firmware_priv(dev); - - if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->fw_id)) - return -ENOMEM; - if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout)) - return -ENOMEM; - if (add_uevent_var(env, "ASYNC=%d", fw_priv->nowait)) - return -ENOMEM; - - return 0; -} -#else -static int firmware_uevent(struct device *dev, char **envp, - int num_envp, char *buf, int size) -{ - struct firmware_priv *fw_priv = to_firmware_priv(dev); - int error, len = 0, i = 0; - - error = add_uevent_var(envp, num_envp, &i, - buf, size, &len, - "FIRMWARE=%s", fw_priv->fw_id); - if (error) - goto exit; - - error = add_uevent_var(envp, num_envp, &i, - buf, size, &len, - "TIMEOUT=%i", loading_timeout); - if (error) - goto exit; - error = add_uevent_var(envp, num_envp, &i, - buf, size, &len, - "ASYNC=%i", fw_priv->nowait); - if (error) - goto exit; - - return 0; -exit: - envp[i] = NULL; - return error; -} -#endif - -static struct class firmware_class = { - .name = "compat_firmware", - .class_attrs = firmware_class_attrs, - .dev_uevent = firmware_uevent, - .dev_release = fw_dev_release, -}; - -static ssize_t firmware_loading_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - struct firmware_priv *fw_priv = to_firmware_priv(dev); - int loading = test_bit(FW_STATUS_LOADING, &fw_priv->status); - - return sprintf(buf, "%d\n", loading); -} - -static void firmware_free_data(const struct firmware *fw) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - int i; - vunmap(fw->data); - if (fw->pages) { - for (i = 0; i < PFN_UP(fw->size); i++) - __free_page(fw->pages[i]); - kfree(fw->pages); - } -#else - vunmap(fw->data); -#endif -} - -/* Some architectures don't have PAGE_KERNEL_RO */ -#ifndef PAGE_KERNEL_RO -#define PAGE_KERNEL_RO PAGE_KERNEL -#endif -/** - * firmware_loading_store - set value in the 'loading' control file - * @dev: device pointer - * @buf: buffer to scan for loading control value - * @count: number of bytes in @buf - * - * The relevant values are: - * - * 1: Start a load, discarding any previous partial load. - * 0: Conclude the load and hand the data to the driver code. - * -1: Conclude the load with an error and discard any written data. - **/ -static ssize_t firmware_loading_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct firmware_priv *fw_priv = to_firmware_priv(dev); - int loading = simple_strtol(buf, NULL, 10); - int i; - - switch (loading) { - case 1: - mutex_lock(&fw_lock); - if (!fw_priv->fw) { - mutex_unlock(&fw_lock); - break; - } - firmware_free_data(fw_priv->fw); - memset(fw_priv->fw, 0, sizeof(struct firmware)); - /* If the pages are not owned by 'struct firmware' */ - for (i = 0; i < fw_priv->nr_pages; i++) - __free_page(fw_priv->pages[i]); - kfree(fw_priv->pages); - fw_priv->pages = NULL; - fw_priv->page_array_size = 0; - fw_priv->nr_pages = 0; - set_bit(FW_STATUS_LOADING, &fw_priv->status); - mutex_unlock(&fw_lock); - break; - case 0: - if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) { - vunmap(fw_priv->fw->data); - fw_priv->fw->data = vmap(fw_priv->pages, - fw_priv->nr_pages, - 0, PAGE_KERNEL_RO); - if (!fw_priv->fw->data) { - dev_err(dev, "%s: vmap() failed\n", __func__); - goto err; - } - /* Pages are now owned by 'struct firmware' */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - fw_priv->fw->pages = fw_priv->pages; - fw_priv->pages = NULL; -#endif - - fw_priv->page_array_size = 0; - fw_priv->nr_pages = 0; - complete(&fw_priv->completion); - clear_bit(FW_STATUS_LOADING, &fw_priv->status); - break; - } - /* fallthrough */ - default: - dev_err(dev, "%s: unexpected value (%d)\n", __func__, loading); - /* fallthrough */ - case -1: - err: - fw_load_abort(fw_priv); - break; - } - - return count; -} - -static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store); - -#if defined(CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP) -static ssize_t firmware_data_read(struct file *filp, struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buffer, loff_t offset, size_t count) -#else -static ssize_t firmware_data_read(struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buffer, loff_t offset, size_t count) -#endif -{ - struct device *dev = compat_firmware_to_dev(kobj); - struct firmware_priv *fw_priv = to_firmware_priv(dev); - struct firmware *fw; - ssize_t ret_count; - - mutex_lock(&fw_lock); - fw = fw_priv->fw; - if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) { - ret_count = -ENODEV; - goto out; - } - if (offset > fw->size) { - ret_count = 0; - goto out; - } - if (count > fw->size - offset) - count = fw->size - offset; - - ret_count = count; - - while (count) { - void *page_data; - int page_nr = offset >> PAGE_SHIFT; - int page_ofs = offset & (PAGE_SIZE-1); - int page_cnt = min_t(size_t, PAGE_SIZE - page_ofs, count); - - page_data = kmap(fw_priv->pages[page_nr]); - - memcpy(buffer, page_data + page_ofs, page_cnt); - - kunmap(fw_priv->pages[page_nr]); - buffer += page_cnt; - offset += page_cnt; - count -= page_cnt; - } -out: - mutex_unlock(&fw_lock); - return ret_count; -} - -static int fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size) -{ - int pages_needed = ALIGN(min_size, PAGE_SIZE) >> PAGE_SHIFT; - - /* If the array of pages is too small, grow it... */ - if (fw_priv->page_array_size < pages_needed) { - int new_array_size = max(pages_needed, - fw_priv->page_array_size * 2); - struct page **new_pages; - - new_pages = kmalloc(new_array_size * sizeof(void *), - GFP_KERNEL); - if (!new_pages) { - fw_load_abort(fw_priv); - return -ENOMEM; - } - memcpy(new_pages, fw_priv->pages, - fw_priv->page_array_size * sizeof(void *)); - memset(&new_pages[fw_priv->page_array_size], 0, sizeof(void *) * - (new_array_size - fw_priv->page_array_size)); - kfree(fw_priv->pages); - fw_priv->pages = new_pages; - fw_priv->page_array_size = new_array_size; - } - - while (fw_priv->nr_pages < pages_needed) { - fw_priv->pages[fw_priv->nr_pages] = - alloc_page(GFP_KERNEL | __GFP_HIGHMEM); - - if (!fw_priv->pages[fw_priv->nr_pages]) { - fw_load_abort(fw_priv); - return -ENOMEM; - } - fw_priv->nr_pages++; - } - return 0; -} - -/** - * firmware_data_write - write method for firmware - * @kobj: kobject for the device - * @bin_attr: bin_attr structure - * @buffer: buffer being written - * @offset: buffer offset for write in total data store area - * @count: buffer size - * - * Data written to the 'data' attribute will be later handed to - * the driver as a firmware image. - **/ -#if defined(CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP) -static ssize_t firmware_data_write(struct file *filp, struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buffer, loff_t offset, size_t count) -#else -static ssize_t firmware_data_write(struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buffer, loff_t offset, size_t count) -#endif -{ - struct device *dev = compat_firmware_to_dev(kobj); - struct firmware_priv *fw_priv = to_firmware_priv(dev); - struct firmware *fw; - ssize_t retval; - - if (!capable(CAP_SYS_RAWIO)) - return -EPERM; - - mutex_lock(&fw_lock); - fw = fw_priv->fw; - if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) { - retval = -ENODEV; - goto out; - } - retval = fw_realloc_buffer(fw_priv, offset + count); - if (retval) - goto out; - - retval = count; - - while (count) { - void *page_data; - int page_nr = offset >> PAGE_SHIFT; - int page_ofs = offset & (PAGE_SIZE - 1); - int page_cnt = min_t(size_t, PAGE_SIZE - page_ofs, count); - - page_data = kmap(fw_priv->pages[page_nr]); - - memcpy(page_data + page_ofs, buffer, page_cnt); - - kunmap(fw_priv->pages[page_nr]); - buffer += page_cnt; - offset += page_cnt; - count -= page_cnt; - } - - fw->size = max_t(size_t, offset, fw->size); -out: - mutex_unlock(&fw_lock); - return retval; -} - -static struct bin_attribute firmware_attr_data = { - .attr = { .name = "data", .mode = 0644 }, - .size = 0, - .read = firmware_data_read, - .write = firmware_data_write, -}; - -static void firmware_class_timeout(u_long data) -{ - struct firmware_priv *fw_priv = (struct firmware_priv *) data; - - fw_load_abort(fw_priv); -} - -static struct firmware_priv * -fw_create_instance(struct firmware *firmware, const char *fw_name, - struct device *device, bool uevent, bool nowait) -{ - struct firmware_priv *fw_priv; - struct device *f_dev; - int error; - - fw_priv = kzalloc(sizeof(*fw_priv) + strlen(fw_name) + 1 , GFP_KERNEL); - if (!fw_priv) { - dev_err(device, "%s: kmalloc failed\n", __func__); - error = -ENOMEM; - goto err_out; - } - - fw_priv->fw = firmware; - fw_priv->nowait = nowait; - strcpy(fw_priv->fw_id, fw_name); - init_completion(&fw_priv->completion); - setup_timer(&fw_priv->timeout, - firmware_class_timeout, (u_long) fw_priv); - - f_dev = &fw_priv->dev; - - device_initialize(f_dev); - dev_set_name(f_dev, "%s", dev_name(device)); - f_dev->parent = device; - f_dev->class = &firmware_class; - - dev_set_uevent_suppress(f_dev, true); - - /* Need to pin this module until class device is destroyed */ - __module_get(THIS_MODULE); - - error = device_add(f_dev); - if (error) { - dev_err(device, "%s: device_register failed\n", __func__); - goto err_put_dev; - } - - error = device_create_bin_file(f_dev, &firmware_attr_data); - if (error) { - dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__); - goto err_del_dev; - } - - error = device_create_file(f_dev, &dev_attr_loading); - if (error) { - dev_err(device, "%s: device_create_file failed\n", __func__); - goto err_del_bin_attr; - } - - if (uevent) - dev_set_uevent_suppress(f_dev, false); - - return fw_priv; - -err_del_bin_attr: - device_remove_bin_file(f_dev, &firmware_attr_data); -err_del_dev: - device_del(f_dev); -err_put_dev: - put_device(f_dev); -err_out: - return ERR_PTR(error); -} - -static void fw_destroy_instance(struct firmware_priv *fw_priv) -{ - struct device *f_dev = &fw_priv->dev; - - device_remove_file(f_dev, &dev_attr_loading); - device_remove_bin_file(f_dev, &firmware_attr_data); - device_unregister(f_dev); -} - -static int _request_firmware(const struct firmware **firmware_p, - const char *name, struct device *device, - bool uevent, bool nowait) -{ - struct firmware_priv *fw_priv; - struct firmware *firmware; - int retval = 0; - - if (!firmware_p) - return -EINVAL; - - *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); - if (!firmware) { - dev_err(device, "%s: kmalloc(struct firmware) failed\n", - __func__); - retval = -ENOMEM; - goto out; - } - - if (fw_get_builtin_firmware(firmware, name)) { - dev_dbg(device, "firmware: using built-in firmware %s\n", name); - return 0; - } - - if (uevent) - dev_dbg(device, "firmware: requesting %s\n", name); - - fw_priv = fw_create_instance(firmware, name, device, uevent, nowait); - if (IS_ERR(fw_priv)) { - retval = PTR_ERR(fw_priv); - goto out; - } - - if (uevent) { - if (loading_timeout > 0) - mod_timer(&fw_priv->timeout, - round_jiffies_up(jiffies + - loading_timeout * HZ)); - - kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); - } - - wait_for_completion(&fw_priv->completion); - - set_bit(FW_STATUS_DONE, &fw_priv->status); - del_timer_sync(&fw_priv->timeout); - - mutex_lock(&fw_lock); - if (!fw_priv->fw->size || test_bit(FW_STATUS_ABORT, &fw_priv->status)) - retval = -ENOENT; - fw_priv->fw = NULL; - mutex_unlock(&fw_lock); - - fw_destroy_instance(fw_priv); - -out: - if (retval) { - release_firmware(firmware); - *firmware_p = NULL; - } - - return retval; -} - -/** - * request_firmware: - send firmware request and wait for it - * @firmware_p: pointer to firmware image - * @name: name of firmware file - * @device: device for which firmware is being loaded - * - * @firmware_p will be used to return a firmware image by the name - * of @name for device @device. - * - * Should be called from user context where sleeping is allowed. - * - * @name will be used as $FIRMWARE in the uevent environment and - * should be distinctive enough not to be confused with any other - * firmware image for this or any other device. - **/ -int -compat_request_firmware(const struct firmware **firmware_p, const char *name, - struct device *device) -{ - int uevent = 1; - return _request_firmware(firmware_p, name, device, uevent, false); -} - -/** - * release_firmware: - release the resource associated with a firmware image - * @fw: firmware resource to release - **/ -void compat_release_firmware(const struct firmware *fw) -{ - if (fw) { - if (!fw_is_builtin_firmware(fw)) - firmware_free_data(fw); - kfree(fw); - } -} - -/* Async support */ -struct firmware_work { - struct work_struct work; - struct module *module; - const char *name; - struct device *device; - void *context; - void (*cont)(const struct firmware *fw, void *context); - int uevent; -}; - -static int request_firmware_work_func(void *arg) -{ - struct firmware_work *fw_work = arg; - const struct firmware *fw; - int ret; - - if (!arg) { - WARN_ON(1); - return 0; - } - - ret = _request_firmware(&fw, fw_work->name, fw_work->device, - fw_work->uevent, true); - fw_work->cont(fw, fw_work->context); - - module_put(fw_work->module); - kfree(fw_work); - - return ret; -} - -/** - * request_firmware_nowait - asynchronous version of request_firmware - * @module: module requesting the firmware - * @uevent: sends uevent to copy the firmware image if this flag - * is non-zero else the firmware copy must be done manually. - * @name: name of firmware file - * @device: device for which firmware is being loaded - * @gfp: allocation flags - * @context: will be passed over to @cont, and - * @fw may be %NULL if firmware request fails. - * @cont: function will be called asynchronously when the firmware - * request is over. - * - * Asynchronous variant of request_firmware() for user contexts where - * it is not possible to sleep for long time. It can't be called - * in atomic contexts. - **/ -int -compat_request_firmware_nowait( - struct module *module, int uevent, - const char *name, struct device *device, gfp_t gfp, void *context, - void (*cont)(const struct firmware *fw, void *context)) -{ - struct task_struct *task; - struct firmware_work *fw_work; - - fw_work = kzalloc(sizeof (struct firmware_work), gfp); - if (!fw_work) - return -ENOMEM; - - fw_work->module = module; - fw_work->name = name; - fw_work->device = device; - fw_work->context = context; - fw_work->cont = cont; - fw_work->uevent = uevent; - - if (!try_module_get(module)) { - kfree(fw_work); - return -EFAULT; - } - - task = kthread_run(request_firmware_work_func, fw_work, - "firmware/%s", name); - if (IS_ERR(task)) { - fw_work->cont(NULL, fw_work->context); - module_put(fw_work->module); - kfree(fw_work); - return PTR_ERR(task); - } - - return 0; -} - -static int __init firmware_class_init(void) -{ - return class_register(&firmware_class); -} - -static void __exit firmware_class_exit(void) -{ - class_unregister(&firmware_class); -} - -fs_initcall(firmware_class_init); -module_exit(firmware_class_exit); - -EXPORT_SYMBOL_GPL(release_firmware); -EXPORT_SYMBOL_GPL(request_firmware); -EXPORT_SYMBOL_GPL(request_firmware_nowait); diff --git a/openairITS/mac/DOT11/compat/cordic.c b/openairITS/mac/DOT11/compat/cordic.c deleted file mode 100644 index a6340b6a093..00000000000 --- a/openairITS/mac/DOT11/compat/cordic.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include <linux/module.h> -#include <linux/cordic.h> - -#define CORDIC_ANGLE_GEN 39797 -#define CORDIC_PRECISION_SHIFT 16 -#define CORDIC_NUM_ITER (CORDIC_PRECISION_SHIFT + 2) - -#define FIXED(X) ((s32)((X) << CORDIC_PRECISION_SHIFT)) -#define FLOAT(X) (((X) >= 0) \ - ? ((((X) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1) \ - : -((((-(X)) >> (CORDIC_PRECISION_SHIFT - 1)) + 1) >> 1)) - -static const s32 arctan_table[] = { - 2949120, - 1740967, - 919879, - 466945, - 234379, - 117304, - 58666, - 29335, - 14668, - 7334, - 3667, - 1833, - 917, - 458, - 229, - 115, - 57, - 29 -}; - -/* - * cordic_calc_iq() - calculates the i/q coordinate for given angle - * - * theta: angle in degrees for which i/q coordinate is to be calculated - * coord: function output parameter holding the i/q coordinate - */ -struct cordic_iq cordic_calc_iq(s32 theta) -{ - struct cordic_iq coord; - s32 angle, valtmp; - unsigned iter; - int signx = 1; - int signtheta; - - coord.i = CORDIC_ANGLE_GEN; - coord.q = 0; - angle = 0; - - theta = FIXED(theta); - signtheta = (theta < 0) ? -1 : 1; - theta = ((theta + FIXED(180) * signtheta) % FIXED(360)) - - FIXED(180) * signtheta; - - if (FLOAT(theta) > 90) { - theta -= FIXED(180); - signx = -1; - } else if (FLOAT(theta) < -90) { - theta += FIXED(180); - signx = -1; - } - - for (iter = 0; iter < CORDIC_NUM_ITER; iter++) { - if (theta > angle) { - valtmp = coord.i - (coord.q >> iter); - coord.q += (coord.i >> iter); - angle += arctan_table[iter]; - } else { - valtmp = coord.i + (coord.q >> iter); - coord.q -= (coord.i >> iter); - angle -= arctan_table[iter]; - } - coord.i = valtmp; - } - - coord.i *= signx; - coord.q *= signx; - return coord; -} -EXPORT_SYMBOL_GPL(cordic_calc_iq); - -MODULE_DESCRIPTION("Cordic functions"); -MODULE_AUTHOR("Broadcom Corporation"); -MODULE_LICENSE("Dual BSD/GPL"); diff --git a/openairITS/mac/DOT11/compat/crc8.c b/openairITS/mac/DOT11/compat/crc8.c deleted file mode 100644 index 5878171c5bd..00000000000 --- a/openairITS/mac/DOT11/compat/crc8.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#undef pr_fmt -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include <linux/module.h> -#include <linux/crc8.h> -#include <linux/printk.h> - -/* - * crc8_populate_msb - fill crc table for given polynomial in reverse bit order. - * - * table: table to be filled. - * polynomial: polynomial for which table is to be filled. - */ -void crc8_populate_msb(u8 table[CRC8_TABLE_SIZE], u8 polynomial) -{ - int i, j; - const u8 msbit = 0x80; - u8 t = msbit; - - table[0] = 0; - - for (i = 1; i < CRC8_TABLE_SIZE; i *= 2) { - t = (t << 1) ^ (t & msbit ? polynomial : 0); - for (j = 0; j < i; j++) - table[i+j] = table[j] ^ t; - } -} -EXPORT_SYMBOL_GPL(crc8_populate_msb); - -/* - * crc8_populate_lsb - fill crc table for given polynomial in regular bit order. - * - * table: table to be filled. - * polynomial: polynomial for which table is to be filled. - */ -void crc8_populate_lsb(u8 table[CRC8_TABLE_SIZE], u8 polynomial) -{ - int i, j; - u8 t = 1; - - table[0] = 0; - - for (i = (CRC8_TABLE_SIZE >> 1); i; i >>= 1) { - t = (t >> 1) ^ (t & 1 ? polynomial : 0); - for (j = 0; j < CRC8_TABLE_SIZE; j += 2*i) - table[i+j] = table[j] ^ t; - } -} -EXPORT_SYMBOL_GPL(crc8_populate_lsb); - -/* - * crc8 - calculate a crc8 over the given input data. - * - * table: crc table used for calculation. - * pdata: pointer to data buffer. - * nbytes: number of bytes in data buffer. - * crc: previous returned crc8 value. - */ -u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc) -{ - /* loop over the buffer data */ - while (nbytes-- > 0) - crc = table[(crc ^ *pdata++) & 0xff]; - - return crc; -} -EXPORT_SYMBOL_GPL(crc8); - -MODULE_DESCRIPTION("CRC8 (by Williams, Ross N.) function"); -MODULE_AUTHOR("Broadcom Corporation"); -MODULE_LICENSE("Dual BSD/GPL"); diff --git a/openairITS/mac/DOT11/compat/kfifo.c b/openairITS/mac/DOT11/compat/kfifo.c deleted file mode 100644 index 96e1bdfd0e9..00000000000 --- a/openairITS/mac/DOT11/compat/kfifo.c +++ /dev/null @@ -1,608 +0,0 @@ -/* - * A generic kernel FIFO implementation - * - * Copyright (C) 2009/2010 Stefani Seibold <stefani@seibold.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/slab.h> -#include <linux/err.h> -#include <linux/log2.h> -#include <linux/uaccess.h> -#include <linux/kfifo.h> - -/* - * internal helper to calculate the unused elements in a fifo - */ -static inline unsigned int kfifo_unused(struct __kfifo *fifo) -{ - return (fifo->mask + 1) - (fifo->in - fifo->out); -} - -int __kfifo_alloc(struct __kfifo *fifo, unsigned int size, - size_t esize, gfp_t gfp_mask) -{ - /* - * round down to the next power of 2, since our 'let the indices - * wrap' technique works only in this case. - */ - if (!is_power_of_2(size)) - size = rounddown_pow_of_two(size); - - fifo->in = 0; - fifo->out = 0; - fifo->esize = esize; - - if (size < 2) { - fifo->data = NULL; - fifo->mask = 0; - return -EINVAL; - } - - fifo->data = kmalloc(size * esize, gfp_mask); - - if (!fifo->data) { - fifo->mask = 0; - return -ENOMEM; - } - fifo->mask = size - 1; - - return 0; -} -EXPORT_SYMBOL_GPL(__kfifo_alloc); - -void __kfifo_free(struct __kfifo *fifo) -{ - kfree(fifo->data); - fifo->in = 0; - fifo->out = 0; - fifo->esize = 0; - fifo->data = NULL; - fifo->mask = 0; -} -EXPORT_SYMBOL_GPL(__kfifo_free); - -int __kfifo_init(struct __kfifo *fifo, void *buffer, - unsigned int size, size_t esize) -{ - size /= esize; - - if (!is_power_of_2(size)) - size = rounddown_pow_of_two(size); - - fifo->in = 0; - fifo->out = 0; - fifo->esize = esize; - fifo->data = buffer; - - if (size < 2) { - fifo->mask = 0; - return -EINVAL; - } - fifo->mask = size - 1; - - return 0; -} -EXPORT_SYMBOL_GPL(__kfifo_init); - -static void kfifo_copy_in(struct __kfifo *fifo, const void *src, - unsigned int len, unsigned int off) -{ - unsigned int size = fifo->mask + 1; - unsigned int esize = fifo->esize; - unsigned int l; - - off &= fifo->mask; - if (esize != 1) { - off *= esize; - size *= esize; - len *= esize; - } - l = min(len, size - off); - - memcpy(fifo->data + off, src, l); - memcpy(fifo->data, src + l, len - l); - /* - * make sure that the data in the fifo is up to date before - * incrementing the fifo->in index counter - */ - smp_wmb(); -} - -unsigned int __kfifo_in(struct __kfifo *fifo, - const void *buf, unsigned int len) -{ - unsigned int l; - - l = kfifo_unused(fifo); - if (len > l) - len = l; - - kfifo_copy_in(fifo, buf, len, fifo->in); - fifo->in += len; - return len; -} -EXPORT_SYMBOL_GPL(__kfifo_in); - -static void kfifo_copy_out(struct __kfifo *fifo, void *dst, - unsigned int len, unsigned int off) -{ - unsigned int size = fifo->mask + 1; - unsigned int esize = fifo->esize; - unsigned int l; - - off &= fifo->mask; - if (esize != 1) { - off *= esize; - size *= esize; - len *= esize; - } - l = min(len, size - off); - - memcpy(dst, fifo->data + off, l); - memcpy(dst + l, fifo->data, len - l); - /* - * make sure that the data is copied before - * incrementing the fifo->out index counter - */ - smp_wmb(); -} - -unsigned int __kfifo_out_peek(struct __kfifo *fifo, - void *buf, unsigned int len) -{ - unsigned int l; - - l = fifo->in - fifo->out; - if (len > l) - len = l; - - kfifo_copy_out(fifo, buf, len, fifo->out); - return len; -} -EXPORT_SYMBOL_GPL(__kfifo_out_peek); - -unsigned int __kfifo_out(struct __kfifo *fifo, - void *buf, unsigned int len) -{ - len = __kfifo_out_peek(fifo, buf, len); - fifo->out += len; - return len; -} -EXPORT_SYMBOL_GPL(__kfifo_out); - -static unsigned long kfifo_copy_from_user(struct __kfifo *fifo, - const void __user *from, unsigned int len, unsigned int off, - unsigned int *copied) -{ - unsigned int size = fifo->mask + 1; - unsigned int esize = fifo->esize; - unsigned int l; - unsigned long ret; - - off &= fifo->mask; - if (esize != 1) { - off *= esize; - size *= esize; - len *= esize; - } - l = min(len, size - off); - - ret = copy_from_user(fifo->data + off, from, l); - if (unlikely(ret)) - ret = DIV_ROUND_UP(ret + len - l, esize); - else { - ret = copy_from_user(fifo->data, from + l, len - l); - if (unlikely(ret)) - ret = DIV_ROUND_UP(ret, esize); - } - /* - * make sure that the data in the fifo is up to date before - * incrementing the fifo->in index counter - */ - smp_wmb(); - *copied = len - ret; - /* return the number of elements which are not copied */ - return ret; -} - -int __kfifo_from_user(struct __kfifo *fifo, const void __user *from, - unsigned long len, unsigned int *copied) -{ - unsigned int l; - unsigned long ret; - unsigned int esize = fifo->esize; - int err; - - if (esize != 1) - len /= esize; - - l = kfifo_unused(fifo); - if (len > l) - len = l; - - ret = kfifo_copy_from_user(fifo, from, len, fifo->in, copied); - if (unlikely(ret)) { - len -= ret; - err = -EFAULT; - } else - err = 0; - fifo->in += len; - return err; -} -EXPORT_SYMBOL_GPL(__kfifo_from_user); - -static unsigned long kfifo_copy_to_user(struct __kfifo *fifo, void __user *to, - unsigned int len, unsigned int off, unsigned int *copied) -{ - unsigned int l; - unsigned long ret; - unsigned int size = fifo->mask + 1; - unsigned int esize = fifo->esize; - - off &= fifo->mask; - if (esize != 1) { - off *= esize; - size *= esize; - len *= esize; - } - l = min(len, size - off); - - ret = copy_to_user(to, fifo->data + off, l); - if (unlikely(ret)) - ret = DIV_ROUND_UP(ret + len - l, esize); - else { - ret = copy_to_user(to + l, fifo->data, len - l); - if (unlikely(ret)) - ret = DIV_ROUND_UP(ret, esize); - } - /* - * make sure that the data is copied before - * incrementing the fifo->out index counter - */ - smp_wmb(); - *copied = len - ret; - /* return the number of elements which are not copied */ - return ret; -} - -int __kfifo_to_user(struct __kfifo *fifo, void __user *to, - unsigned long len, unsigned int *copied) -{ - unsigned int l; - unsigned long ret; - unsigned int esize = fifo->esize; - int err; - - if (esize != 1) - len /= esize; - - l = fifo->in - fifo->out; - if (len > l) - len = l; - ret = kfifo_copy_to_user(fifo, to, len, fifo->out, copied); - if (unlikely(ret)) { - len -= ret; - err = -EFAULT; - } else - err = 0; - fifo->out += len; - return err; -} -EXPORT_SYMBOL_GPL(__kfifo_to_user); - -static int setup_sgl_buf(struct scatterlist *sgl, void *buf, - int nents, unsigned int len) -{ - int n; - unsigned int l; - unsigned int off; - struct page *page; - - if (!nents) - return 0; - - if (!len) - return 0; - - n = 0; - page = virt_to_page(buf); - off = offset_in_page(buf); - l = 0; - - while (len >= l + PAGE_SIZE - off) { - struct page *npage; - - l += PAGE_SIZE; - buf += PAGE_SIZE; - npage = virt_to_page(buf); - if (page_to_phys(page) != page_to_phys(npage) - l) { - sg_set_page(sgl, page, l - off, off); - sgl = sg_next(sgl); - if (++n == nents || sgl == NULL) - return n; - page = npage; - len -= l - off; - l = off = 0; - } - } - sg_set_page(sgl, page, len, off); - return n + 1; -} - -static unsigned int setup_sgl(struct __kfifo *fifo, struct scatterlist *sgl, - int nents, unsigned int len, unsigned int off) -{ - unsigned int size = fifo->mask + 1; - unsigned int esize = fifo->esize; - unsigned int l; - unsigned int n; - - off &= fifo->mask; - if (esize != 1) { - off *= esize; - size *= esize; - len *= esize; - } - l = min(len, size - off); - - n = setup_sgl_buf(sgl, fifo->data + off, nents, l); - n += setup_sgl_buf(sgl + n, fifo->data, nents - n, len - l); - - return n; -} - -unsigned int __kfifo_dma_in_prepare(struct __kfifo *fifo, - struct scatterlist *sgl, int nents, unsigned int len) -{ - unsigned int l; - - l = kfifo_unused(fifo); - if (len > l) - len = l; - - return setup_sgl(fifo, sgl, nents, len, fifo->in); -} -EXPORT_SYMBOL_GPL(__kfifo_dma_in_prepare); - -unsigned int __kfifo_dma_out_prepare(struct __kfifo *fifo, - struct scatterlist *sgl, int nents, unsigned int len) -{ - unsigned int l; - - l = fifo->in - fifo->out; - if (len > l) - len = l; - - return setup_sgl(fifo, sgl, nents, len, fifo->out); -} -EXPORT_SYMBOL_GPL(__kfifo_dma_out_prepare); - -unsigned int __kfifo_max_r(unsigned int len, size_t recsize) -{ - unsigned int max = (1 << (recsize << 3)) - 1; - - if (len > max) - return max; - return len; -} - -#define __KFIFO_PEEK(data, out, mask) \ - ((data)[(out) & (mask)]) -/* - * __kfifo_peek_n internal helper function for determinate the length of - * the next record in the fifo - */ -static unsigned int __kfifo_peek_n(struct __kfifo *fifo, size_t recsize) -{ - unsigned int l; - unsigned int mask = fifo->mask; - unsigned char *data = fifo->data; - - l = __KFIFO_PEEK(data, fifo->out, mask); - - if (--recsize) - l |= __KFIFO_PEEK(data, fifo->out + 1, mask) << 8; - - return l; -} - -#define __KFIFO_POKE(data, in, mask, val) \ - ( \ - (data)[(in) & (mask)] = (unsigned char)(val) \ - ) - -/* - * __kfifo_poke_n internal helper function for storeing the length of - * the record into the fifo - */ -static void __kfifo_poke_n(struct __kfifo *fifo, unsigned int n, size_t recsize) -{ - unsigned int mask = fifo->mask; - unsigned char *data = fifo->data; - - __KFIFO_POKE(data, fifo->in, mask, n); - - if (recsize > 1) - __KFIFO_POKE(data, fifo->in + 1, mask, n >> 8); -} - -unsigned int __kfifo_len_r(struct __kfifo *fifo, size_t recsize) -{ - return __kfifo_peek_n(fifo, recsize); -} -EXPORT_SYMBOL_GPL(__kfifo_len_r); - -unsigned int __kfifo_in_r(struct __kfifo *fifo, const void *buf, - unsigned int len, size_t recsize) -{ - if (len + recsize > kfifo_unused(fifo)) - return 0; - - __kfifo_poke_n(fifo, len, recsize); - - kfifo_copy_in(fifo, buf, len, fifo->in + recsize); - fifo->in += len + recsize; - return len; -} -EXPORT_SYMBOL_GPL(__kfifo_in_r); - -static unsigned int kfifo_out_copy_r(struct __kfifo *fifo, - void *buf, unsigned int len, size_t recsize, unsigned int *n) -{ - *n = __kfifo_peek_n(fifo, recsize); - - if (len > *n) - len = *n; - - kfifo_copy_out(fifo, buf, len, fifo->out + recsize); - return len; -} - -unsigned int __kfifo_out_peek_r(struct __kfifo *fifo, void *buf, - unsigned int len, size_t recsize) -{ - unsigned int n; - - if (fifo->in == fifo->out) - return 0; - - return kfifo_out_copy_r(fifo, buf, len, recsize, &n); -} -EXPORT_SYMBOL_GPL(__kfifo_out_peek_r); - -unsigned int __kfifo_out_r(struct __kfifo *fifo, void *buf, - unsigned int len, size_t recsize) -{ - unsigned int n; - - if (fifo->in == fifo->out) - return 0; - - len = kfifo_out_copy_r(fifo, buf, len, recsize, &n); - fifo->out += n + recsize; - return len; -} -EXPORT_SYMBOL_GPL(__kfifo_out_r); - -void __kfifo_skip_r(struct __kfifo *fifo, size_t recsize) -{ - unsigned int n; - - n = __kfifo_peek_n(fifo, recsize); - fifo->out += n + recsize; -} -EXPORT_SYMBOL_GPL(__kfifo_skip_r); - -int __kfifo_from_user_r(struct __kfifo *fifo, const void __user *from, - unsigned long len, unsigned int *copied, size_t recsize) -{ - unsigned long ret; - - len = __kfifo_max_r(len, recsize); - - if (len + recsize > kfifo_unused(fifo)) { - *copied = 0; - return 0; - } - - __kfifo_poke_n(fifo, len, recsize); - - ret = kfifo_copy_from_user(fifo, from, len, fifo->in + recsize, copied); - if (unlikely(ret)) { - *copied = 0; - return -EFAULT; - } - fifo->in += len + recsize; - return 0; -} -EXPORT_SYMBOL_GPL(__kfifo_from_user_r); - -int __kfifo_to_user_r(struct __kfifo *fifo, void __user *to, - unsigned long len, unsigned int *copied, size_t recsize) -{ - unsigned long ret; - unsigned int n; - - if (fifo->in == fifo->out) { - *copied = 0; - return 0; - } - - n = __kfifo_peek_n(fifo, recsize); - if (len > n) - len = n; - - ret = kfifo_copy_to_user(fifo, to, len, fifo->out + recsize, copied); - if (unlikely(ret)) { - *copied = 0; - return -EFAULT; - } - fifo->out += n + recsize; - return 0; -} -EXPORT_SYMBOL_GPL(__kfifo_to_user_r); - -unsigned int __kfifo_dma_in_prepare_r(struct __kfifo *fifo, - struct scatterlist *sgl, int nents, unsigned int len, size_t recsize) -{ - if (!nents) - BUG(); - - len = __kfifo_max_r(len, recsize); - - if (len + recsize > kfifo_unused(fifo)) - return 0; - - return setup_sgl(fifo, sgl, nents, len, fifo->in + recsize); -} -EXPORT_SYMBOL_GPL(__kfifo_dma_in_prepare_r); - -void __kfifo_dma_in_finish_r(struct __kfifo *fifo, - unsigned int len, size_t recsize) -{ - len = __kfifo_max_r(len, recsize); - __kfifo_poke_n(fifo, len, recsize); - fifo->in += len + recsize; -} -EXPORT_SYMBOL_GPL(__kfifo_dma_in_finish_r); - -unsigned int __kfifo_dma_out_prepare_r(struct __kfifo *fifo, - struct scatterlist *sgl, int nents, unsigned int len, size_t recsize) -{ - if (!nents) - BUG(); - - len = __kfifo_max_r(len, recsize); - - if (len + recsize > fifo->in - fifo->out) - return 0; - - return setup_sgl(fifo, sgl, nents, len, fifo->out + recsize); -} -EXPORT_SYMBOL_GPL(__kfifo_dma_out_prepare_r); - -void __kfifo_dma_out_finish_r(struct __kfifo *fifo, size_t recsize) -{ - unsigned int len; - - len = __kfifo_peek_n(fifo, recsize); - fifo->out += len + recsize; -} -EXPORT_SYMBOL_GPL(__kfifo_dma_out_finish_r); diff --git a/openairITS/mac/DOT11/compat/kstrtox.c b/openairITS/mac/DOT11/compat/kstrtox.c deleted file mode 100644 index 44859d19a5b..00000000000 --- a/openairITS/mac/DOT11/compat/kstrtox.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Convert integer string representation to an integer. - * If an integer doesn't fit into specified type, -E is returned. - * - * Integer starts with optional sign. - * kstrtou*() functions do not accept sign "-". - * - * Radix 0 means autodetection: leading "0x" implies radix 16, - * leading "0" implies radix 8, otherwise radix is 10. - * Autodetection hints work after optional sign, but not before. - * - * If -E is returned, result is not touched. - */ -#include <linux/kernel.h> -/* - * kstrto* was included in kernel 2.6.38.4 and causes conflicts with the - * version included in compat-wireless. We use strict_strtol to check if - * kstrto* is already available. - */ -#ifndef strict_strtol - -#include <linux/ctype.h> -#include <linux/errno.h> -#include <linux/kernel.h> -#include <linux/math64.h> -#include <linux/module.h> -#include <linux/types.h> - -static inline char _tolower(const char c) -{ - return c | 0x20; -} - -static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res) -{ - unsigned long long acc; - int ok; - - if (base == 0) { - if (s[0] == '0') { - if (_tolower(s[1]) == 'x' && isxdigit(s[2])) - base = 16; - else - base = 8; - } else - base = 10; - } - if (base == 16 && s[0] == '0' && _tolower(s[1]) == 'x') - s += 2; - - acc = 0; - ok = 0; - while (*s) { - unsigned int val; - - if ('0' <= *s && *s <= '9') - val = *s - '0'; - else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f') - val = _tolower(*s) - 'a' + 10; - else if (*s == '\n') { - if (*(s + 1) == '\0') - break; - else - return -EINVAL; - } else - return -EINVAL; - - if (val >= base) - return -EINVAL; - if (acc > div_u64(ULLONG_MAX - val, base)) - return -ERANGE; - acc = acc * base + val; - ok = 1; - - s++; - } - if (!ok) - return -EINVAL; - *res = acc; - return 0; -} - -int kstrtoull(const char *s, unsigned int base, unsigned long long *res) -{ - if (s[0] == '+') - s++; - return _kstrtoull(s, base, res); -} -EXPORT_SYMBOL_GPL(kstrtoull); - -int kstrtoll(const char *s, unsigned int base, long long *res) -{ - unsigned long long tmp; - int rv; - - if (s[0] == '-') { - rv = _kstrtoull(s + 1, base, &tmp); - if (rv < 0) - return rv; - if ((long long)(-tmp) >= 0) - return -ERANGE; - *res = -tmp; - } else { - rv = kstrtoull(s, base, &tmp); - if (rv < 0) - return rv; - if ((long long)tmp < 0) - return -ERANGE; - *res = tmp; - } - return 0; -} -EXPORT_SYMBOL_GPL(kstrtoll); - -/* Internal, do not use. */ -int _kstrtoul(const char *s, unsigned int base, unsigned long *res) -{ - unsigned long long tmp; - int rv; - - rv = kstrtoull(s, base, &tmp); - if (rv < 0) - return rv; - if (tmp != (unsigned long long)(unsigned long)tmp) - return -ERANGE; - *res = tmp; - return 0; -} -EXPORT_SYMBOL_GPL(_kstrtoul); - -/* Internal, do not use. */ -int _kstrtol(const char *s, unsigned int base, long *res) -{ - long long tmp; - int rv; - - rv = kstrtoll(s, base, &tmp); - if (rv < 0) - return rv; - if (tmp != (long long)(long)tmp) - return -ERANGE; - *res = tmp; - return 0; -} -EXPORT_SYMBOL_GPL(_kstrtol); - -int kstrtouint(const char *s, unsigned int base, unsigned int *res) -{ - unsigned long long tmp; - int rv; - - rv = kstrtoull(s, base, &tmp); - if (rv < 0) - return rv; - if (tmp != (unsigned long long)(unsigned int)tmp) - return -ERANGE; - *res = tmp; - return 0; -} -EXPORT_SYMBOL_GPL(kstrtouint); - -int kstrtoint(const char *s, unsigned int base, int *res) -{ - long long tmp; - int rv; - - rv = kstrtoll(s, base, &tmp); - if (rv < 0) - return rv; - if (tmp != (long long)(int)tmp) - return -ERANGE; - *res = tmp; - return 0; -} -EXPORT_SYMBOL_GPL(kstrtoint); - -int kstrtou16(const char *s, unsigned int base, u16 *res) -{ - unsigned long long tmp; - int rv; - - rv = kstrtoull(s, base, &tmp); - if (rv < 0) - return rv; - if (tmp != (unsigned long long)(u16)tmp) - return -ERANGE; - *res = tmp; - return 0; -} -EXPORT_SYMBOL_GPL(kstrtou16); - -int kstrtos16(const char *s, unsigned int base, s16 *res) -{ - long long tmp; - int rv; - - rv = kstrtoll(s, base, &tmp); - if (rv < 0) - return rv; - if (tmp != (long long)(s16)tmp) - return -ERANGE; - *res = tmp; - return 0; -} -EXPORT_SYMBOL_GPL(kstrtos16); - -int kstrtou8(const char *s, unsigned int base, u8 *res) -{ - unsigned long long tmp; - int rv; - - rv = kstrtoull(s, base, &tmp); - if (rv < 0) - return rv; - if (tmp != (unsigned long long)(u8)tmp) - return -ERANGE; - *res = tmp; - return 0; -} -EXPORT_SYMBOL_GPL(kstrtou8); - -int kstrtos8(const char *s, unsigned int base, s8 *res) -{ - long long tmp; - int rv; - - rv = kstrtoll(s, base, &tmp); - if (rv < 0) - return rv; - if (tmp != (long long)(s8)tmp) - return -ERANGE; - *res = tmp; - return 0; -} -EXPORT_SYMBOL_GPL(kstrtos8); -#endif /* #ifndef strict_strtol */ diff --git a/openairITS/mac/DOT11/compat/main.c b/openairITS/mac/DOT11/compat/main.c deleted file mode 100644 index 30a4a1ee6e0..00000000000 --- a/openairITS/mac/DOT11/compat/main.c +++ /dev/null @@ -1,66 +0,0 @@ -#include <linux/module.h> - -MODULE_AUTHOR("Luis R. Rodriguez"); -MODULE_DESCRIPTION("Kernel compatibility module"); -MODULE_LICENSE("GPL"); - -#ifndef COMPAT_BASE_TREE -#error "You need a COMPAT_BASE_TREE" -#endif - -#ifndef COMPAT_BASE_TREE_VERSION -#error "You need a COMPAT_BASE_TREE_VERSION" -#endif - -#ifndef COMPAT_VERSION -#error "You need a COMPAT_VERSION" -#endif - -static char *compat_base_tree = COMPAT_BASE_TREE; -static char *compat_base_tree_version = COMPAT_BASE_TREE_VERSION; -static char *compat_version = COMPAT_VERSION; - -module_param(compat_base_tree, charp, 0400); -MODULE_PARM_DESC(compat_base_tree, - "The upstream tree used as base for this backport"); - -module_param(compat_base_tree_version, charp, 0400); -MODULE_PARM_DESC(compat_base_tree_version, - "The git-describe of the upstream base tree"); - -module_param(compat_version, charp, 0400); -MODULE_PARM_DESC(compat_version, - "Version of the kernel compat backport work"); - -void compat_dependency_symbol(void) -{ -} -EXPORT_SYMBOL_GPL(compat_dependency_symbol); - -static int __init compat_init(void) -{ - /* pm-qos for kernels <= 2.6.24, this is a no-op on newer kernels */ - compat_pm_qos_power_init(); - compat_system_workqueue_create(); - - printk(KERN_INFO - COMPAT_PROJECT " backport release: " - COMPAT_VERSION - "\n"); - printk(KERN_INFO "Backport based on " - COMPAT_BASE_TREE " " COMPAT_BASE_TREE_VERSION - "\n"); - - return 0; -} -module_init(compat_init); - -static void __exit compat_exit(void) -{ - compat_pm_qos_power_deinit(); - compat_system_workqueue_destroy(); - - return; -} -module_exit(compat_exit); - diff --git a/openairITS/mac/DOT11/compat/modules.order b/openairITS/mac/DOT11/compat/modules.order deleted file mode 100644 index b251c8f0e87..00000000000 --- a/openairITS/mac/DOT11/compat/modules.order +++ /dev/null @@ -1 +0,0 @@ -kernel//home/thales/openair4G/openairITS/mac/DOT11/compat/compat.ko diff --git a/openairITS/mac/DOT11/compat/pm_qos_params.c b/openairITS/mac/DOT11/compat/pm_qos_params.c deleted file mode 100644 index 833d98c5ddd..00000000000 --- a/openairITS/mac/DOT11/compat/pm_qos_params.c +++ /dev/null @@ -1,477 +0,0 @@ -#include <net/compat.h> - -/* This is the backport of pm-qos params for kernels <= 2.6.25 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) - -/* - * This module exposes the interface to kernel space for specifying - * QoS dependencies. It provides infrastructure for registration of: - * - * Dependents on a QoS value : register requirements - * Watchers of QoS value : get notified when target QoS value changes - * - * This QoS design is best effort based. Dependents register their QoS needs. - * Watchers register to keep track of the current QoS needs of the system. - * - * There are 3 basic classes of QoS parameter: latency, timeout, throughput - * each have defined units: - * latency: usec - * timeout: usec <-- currently not used. - * throughput: kbs (kilo byte / sec) - * - * There are lists of pm_qos_objects each one wrapping requirements, notifiers - * - * User mode requirements on a QOS parameter register themselves to the - * subsystem by opening the device node /dev/... and writing there request to - * the node. As long as the process holds a file handle open to the node the - * client continues to be accounted for. Upon file release the usermode - * requirement is removed and a new qos target is computed. This way when the - * requirement that the application has is cleaned up when closes the file - * pointer or exits the pm_qos_object will get an opportunity to clean up. - * - * Mark Gross <mgross@linux.intel.com> - */ - -#include <linux/pm_qos_params.h> -#include <linux/sched.h> -#include <linux/spinlock.h> -#include <linux/slab.h> -#include <linux/time.h> -#include <linux/fs.h> -#include <linux/device.h> -#include <linux/miscdevice.h> -#include <linux/string.h> -#include <linux/platform_device.h> -#include <linux/init.h> - -#include <linux/uaccess.h> - -/* - * locking rule: all changes to requirements or notifiers lists - * or pm_qos_object list and pm_qos_objects need to happen with pm_qos_lock - * held, taken with _irqsave. One lock to rule them all - */ -struct requirement_list { - struct list_head list; - union { - s32 value; - s32 usec; - s32 kbps; - }; - char *name; -}; - -static s32 max_compare(s32 v1, s32 v2); -static s32 min_compare(s32 v1, s32 v2); - -struct pm_qos_object { - struct requirement_list requirements; - struct blocking_notifier_head *notifiers; - struct miscdevice pm_qos_power_miscdev; - char *name; - s32 default_value; - atomic_t target_value; - s32 (*comparitor)(s32, s32); -}; - -static struct pm_qos_object null_pm_qos; -static BLOCKING_NOTIFIER_HEAD(cpu_dma_lat_notifier); -static struct pm_qos_object cpu_dma_pm_qos = { - .requirements = {LIST_HEAD_INIT(cpu_dma_pm_qos.requirements.list)}, - .notifiers = &cpu_dma_lat_notifier, - .name = "cpu_dma_latency", - .default_value = 2000 * USEC_PER_SEC, - .target_value = ATOMIC_INIT(2000 * USEC_PER_SEC), - .comparitor = min_compare -}; - -static BLOCKING_NOTIFIER_HEAD(network_lat_notifier); -static struct pm_qos_object network_lat_pm_qos = { - .requirements = {LIST_HEAD_INIT(network_lat_pm_qos.requirements.list)}, - .notifiers = &network_lat_notifier, - .name = "network_latency", - .default_value = 2000 * USEC_PER_SEC, - .target_value = ATOMIC_INIT(2000 * USEC_PER_SEC), - .comparitor = min_compare -}; - - -static BLOCKING_NOTIFIER_HEAD(network_throughput_notifier); -static struct pm_qos_object network_throughput_pm_qos = { - .requirements = - {LIST_HEAD_INIT(network_throughput_pm_qos.requirements.list)}, - .notifiers = &network_throughput_notifier, - .name = "network_throughput", - .default_value = 0, - .target_value = ATOMIC_INIT(0), - .comparitor = max_compare -}; - -static BLOCKING_NOTIFIER_HEAD(system_bus_freq_notifier); -static struct pm_qos_object system_bus_freq_pm_qos = { - .requirements = - {LIST_HEAD_INIT(system_bus_freq_pm_qos.requirements.list)}, - .notifiers = &system_bus_freq_notifier, - .name = "system_bus_freq", - .default_value = 0, - .target_value = ATOMIC_INIT(0), - .comparitor = max_compare -}; - - -static struct pm_qos_object *pm_qos_array[PM_QOS_NUM_CLASSES] = { - [PM_QOS_RESERVED] = &null_pm_qos, - [PM_QOS_CPU_DMA_LATENCY] = &cpu_dma_pm_qos, - [PM_QOS_NETWORK_LATENCY] = &network_lat_pm_qos, - [PM_QOS_NETWORK_THROUGHPUT] = &network_throughput_pm_qos, - [PM_QOS_SYSTEM_BUS_FREQ] = &system_bus_freq_pm_qos, -}; - -static DEFINE_SPINLOCK(pm_qos_lock); - -static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, - size_t count, loff_t *f_pos); -static int pm_qos_power_open(struct inode *inode, struct file *filp); -static int pm_qos_power_release(struct inode *inode, struct file *filp); - -static const struct file_operations pm_qos_power_fops = { - .write = pm_qos_power_write, - .open = pm_qos_power_open, - .release = pm_qos_power_release, -}; - -/* static helper functions */ -static s32 max_compare(s32 v1, s32 v2) -{ - return max(v1, v2); -} - -static s32 min_compare(s32 v1, s32 v2) -{ - return min(v1, v2); -} - - -static void update_target(int target) -{ - s32 extreme_value; - struct requirement_list *node; - unsigned long flags; - int call_notifier = 0; - - spin_lock_irqsave(&pm_qos_lock, flags); - extreme_value = pm_qos_array[target]->default_value; - list_for_each_entry(node, - &pm_qos_array[target]->requirements.list, list) { - extreme_value = pm_qos_array[target]->comparitor( - extreme_value, node->value); - } - if (atomic_read(&pm_qos_array[target]->target_value) != extreme_value) { - call_notifier = 1; - atomic_set(&pm_qos_array[target]->target_value, extreme_value); - pr_debug(KERN_ERR "new target for qos %d is %d\n", target, - atomic_read(&pm_qos_array[target]->target_value)); - } - spin_unlock_irqrestore(&pm_qos_lock, flags); - - if (call_notifier) - blocking_notifier_call_chain(pm_qos_array[target]->notifiers, - (unsigned long) extreme_value, NULL); -} - -static int register_pm_qos_misc(struct pm_qos_object *qos) -{ - qos->pm_qos_power_miscdev.minor = MISC_DYNAMIC_MINOR; - qos->pm_qos_power_miscdev.name = qos->name; - qos->pm_qos_power_miscdev.fops = &pm_qos_power_fops; - - return misc_register(&qos->pm_qos_power_miscdev); -} - -static int find_pm_qos_object_by_minor(int minor) -{ - int pm_qos_class; - - for (pm_qos_class = 0; - pm_qos_class < PM_QOS_NUM_CLASSES; pm_qos_class++) { - if (minor == - pm_qos_array[pm_qos_class]->pm_qos_power_miscdev.minor) - return pm_qos_class; - } - return -1; -} - -/** - * pm_qos_requirement - returns current system wide qos expectation - * @pm_qos_class: identification of which qos value is requested - * - * This function returns the current target value in an atomic manner. - */ -int pm_qos_requirement(int pm_qos_class) -{ - return atomic_read(&pm_qos_array[pm_qos_class]->target_value); -} -EXPORT_SYMBOL_GPL(pm_qos_requirement); - -/** - * pm_qos_add_requirement - inserts new qos request into the list - * @pm_qos_class: identifies which list of qos request to us - * @name: identifies the request - * @value: defines the qos request - * - * This function inserts a new entry in the pm_qos_class list of requested qos - * performance characteristics. It recomputes the aggregate QoS expectations - * for the pm_qos_class of parameters. - */ -int pm_qos_add_requirement(int pm_qos_class, char *name, s32 value) -{ - struct requirement_list *dep; - unsigned long flags; - - dep = kzalloc(sizeof(struct requirement_list), GFP_KERNEL); - if (dep) { - if (value == PM_QOS_DEFAULT_VALUE) - dep->value = pm_qos_array[pm_qos_class]->default_value; - else - dep->value = value; - dep->name = kstrdup(name, GFP_KERNEL); - if (!dep->name) - goto cleanup; - - spin_lock_irqsave(&pm_qos_lock, flags); - list_add(&dep->list, - &pm_qos_array[pm_qos_class]->requirements.list); - spin_unlock_irqrestore(&pm_qos_lock, flags); - update_target(pm_qos_class); - - return 0; - } - -cleanup: - kfree(dep); - return -ENOMEM; -} -EXPORT_SYMBOL_GPL(pm_qos_add_requirement); - -/** - * pm_qos_update_requirement - modifies an existing qos request - * @pm_qos_class: identifies which list of qos request to us - * @name: identifies the request - * @value: defines the qos request - * - * Updates an existing qos requirement for the pm_qos_class of parameters along - * with updating the target pm_qos_class value. - * - * If the named request isn't in the list then no change is made. - */ -int pm_qos_update_requirement(int pm_qos_class, char *name, s32 new_value) -{ - unsigned long flags; - struct requirement_list *node; - int pending_update = 0; - - spin_lock_irqsave(&pm_qos_lock, flags); - list_for_each_entry(node, - &pm_qos_array[pm_qos_class]->requirements.list, list) { - if (strcmp(node->name, name) == 0) { - if (new_value == PM_QOS_DEFAULT_VALUE) - node->value = - pm_qos_array[pm_qos_class]->default_value; - else - node->value = new_value; - pending_update = 1; - break; - } - } - spin_unlock_irqrestore(&pm_qos_lock, flags); - if (pending_update) - update_target(pm_qos_class); - - return 0; -} -EXPORT_SYMBOL_GPL(pm_qos_update_requirement); - -/** - * pm_qos_remove_requirement - modifies an existing qos request - * @pm_qos_class: identifies which list of qos request to us - * @name: identifies the request - * - * Will remove named qos request from pm_qos_class list of parameters and - * recompute the current target value for the pm_qos_class. - */ -void pm_qos_remove_requirement(int pm_qos_class, char *name) -{ - unsigned long flags; - struct requirement_list *node; - int pending_update = 0; - - spin_lock_irqsave(&pm_qos_lock, flags); - list_for_each_entry(node, - &pm_qos_array[pm_qos_class]->requirements.list, list) { - if (strcmp(node->name, name) == 0) { - kfree(node->name); - list_del(&node->list); - kfree(node); - pending_update = 1; - break; - } - } - spin_unlock_irqrestore(&pm_qos_lock, flags); - if (pending_update) - update_target(pm_qos_class); -} -EXPORT_SYMBOL_GPL(pm_qos_remove_requirement); - -/** - * pm_qos_add_notifier - sets notification entry for changes to target value - * @pm_qos_class: identifies which qos target changes should be notified. - * @notifier: notifier block managed by caller. - * - * will register the notifier into a notification chain that gets called - * upon changes to the pm_qos_class target value. - */ -int pm_qos_add_notifier(int pm_qos_class, struct notifier_block *notifier) -{ - int retval; - - retval = blocking_notifier_chain_register( - pm_qos_array[pm_qos_class]->notifiers, notifier); - - return retval; -} -EXPORT_SYMBOL_GPL(pm_qos_add_notifier); - -/** - * pm_qos_remove_notifier - deletes notification entry from chain. - * @pm_qos_class: identifies which qos target changes are notified. - * @notifier: notifier block to be removed. - * - * will remove the notifier from the notification chain that gets called - * upon changes to the pm_qos_class target value. - */ -int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier) -{ - int retval; - - retval = blocking_notifier_chain_unregister( - pm_qos_array[pm_qos_class]->notifiers, notifier); - - return retval; -} -EXPORT_SYMBOL_GPL(pm_qos_remove_notifier); - -#define PID_NAME_LEN 32 - -static int pm_qos_power_open(struct inode *inode, struct file *filp) -{ - int ret; - long pm_qos_class; - char name[PID_NAME_LEN]; - - pm_qos_class = find_pm_qos_object_by_minor(iminor(inode)); - if (pm_qos_class >= 0) { - filp->private_data = (void *)pm_qos_class; - snprintf(name, PID_NAME_LEN, "process_%d", current->pid); - ret = pm_qos_add_requirement(pm_qos_class, name, - PM_QOS_DEFAULT_VALUE); - if (ret >= 0) - return 0; - } - return -EPERM; -} - -static int pm_qos_power_release(struct inode *inode, struct file *filp) -{ - int pm_qos_class; - char name[PID_NAME_LEN]; - - pm_qos_class = (long)filp->private_data; - snprintf(name, PID_NAME_LEN, "process_%d", current->pid); - pm_qos_remove_requirement(pm_qos_class, name); - - return 0; -} - -static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, - size_t count, loff_t *f_pos) -{ - s32 value; - int pm_qos_class; - char name[PID_NAME_LEN]; - - pm_qos_class = (long)filp->private_data; - if (count != sizeof(s32)) - return -EINVAL; - if (copy_from_user(&value, buf, sizeof(s32))) - return -EFAULT; - snprintf(name, PID_NAME_LEN, "process_%d", current->pid); - pm_qos_update_requirement(pm_qos_class, name, value); - - return sizeof(s32); -} - - -/* - * This initializes pm-qos for older kernels. - */ -int compat_pm_qos_power_init(void) -{ - int ret = 0; - - ret = register_pm_qos_misc(&cpu_dma_pm_qos); - if (ret < 0) { - printk(KERN_ERR "pm_qos_param: cpu_dma_latency setup failed\n"); - return ret; - } - ret = register_pm_qos_misc(&network_lat_pm_qos); - if (ret < 0) { - printk(KERN_ERR "pm_qos_param: network_latency setup failed\n"); - return ret; - } - ret = register_pm_qos_misc(&network_throughput_pm_qos); - if (ret < 0) { - printk(KERN_ERR - "pm_qos_param: network_throughput setup failed\n"); - return ret; - } - ret = register_pm_qos_misc(&system_bus_freq_pm_qos); - if (ret < 0) - printk(KERN_ERR - "pm_qos_param: system_bus_freq setup failed\n"); - - return ret; -} - -int compat_pm_qos_power_deinit(void) -{ - int ret = 0; - - ret = misc_deregister(&cpu_dma_pm_qos.pm_qos_power_miscdev); - if (ret < 0) { - printk(KERN_ERR "pm_qos_param: cpu_dma_latency deinit failed\n"); - return ret; - } - - ret = misc_deregister(&network_lat_pm_qos.pm_qos_power_miscdev); - if (ret < 0) { - printk(KERN_ERR "pm_qos_param: network_latency deinit failed\n"); - return ret; - } - - ret = misc_deregister(&network_throughput_pm_qos.pm_qos_power_miscdev); - if (ret < 0) { - printk(KERN_ERR - "pm_qos_param: network_throughput deinit failed\n"); - return ret; - } - - ret = misc_deregister(&system_bus_freq_pm_qos.pm_qos_power_miscdev); - if (ret < 0) { - printk(KERN_ERR - "pm_qos_param: system_bus_freq deinit failed\n"); - return ret; - } - - return ret; -} -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) */ diff --git a/openairITS/mac/DOT11/compat/scripts/compat_firmware_install b/openairITS/mac/DOT11/compat/scripts/compat_firmware_install deleted file mode 100755 index 33e4fde8460..00000000000 --- a/openairITS/mac/DOT11/compat/scripts/compat_firmware_install +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -if [ -f /usr/bin/lsb_release ]; then - LSB_RED_ID=$(/usr/bin/lsb_release -i -s) -else - LSB_RED_ID="Unknown" -fi - -case $LSB_RED_ID in -"Ubuntu") - mkdir -p /lib/udev/ /lib/udev/rules.d/ - cp udev/ubuntu/compat_firmware.sh /lib/udev/ - cp udev/ubuntu/50-compat_firmware.rules /lib/udev/rules.d/ - ;; -*) - mkdir -p /lib/udev/ /lib/udev/rules.d/ - cp udev/compat_firmware.sh /lib/udev/ - cp udev/50-compat_firmware.rules /lib/udev/rules.d/ - ;; -esac - diff --git a/openairITS/mac/DOT11/compat/scripts/gen-compat-autoconf.sh b/openairITS/mac/DOT11/compat/scripts/gen-compat-autoconf.sh deleted file mode 100755 index e52cc5aa880..00000000000 --- a/openairITS/mac/DOT11/compat/scripts/gen-compat-autoconf.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash -# -# Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org> -# Copyright 2011 Hauke Mehrtens <hauke@hauke-m.de> -# Copyright 2011 John W. Linville <linville@tuxdriver.com> -# -# Use this to parse a small .config equivalent looking file to generate -# our own autoconf.h. This file has defines for each config option -# just like the kernels include/linux/autoconf.h -# -# XXX: consider using scripts/kconfig/confdata.c instead. -# On the downside this would require the user to have libc though. - -# This indicates which is the oldest kernel we support -# Update this if you are adding support for older kernels. -OLDEST_KERNEL_SUPPORTED="2.6.24" - -if [ $# -ne 1 ]; then - echo "Usage $0 config-file" - exit -fi - -COMPAT_CONFIG="$1" - -if [ ! -f $COMPAT_CONFIG ]; then - echo "File $1 is not a file" - exit -fi - -# Defines a CONFIG_ option if not defined yet, this helps respect -# linux/autoconf.h -function define_config { - VAR=$1 - VALUE=$2 - case $VALUE in - n) # Try to undefine it - echo "#undef $VAR" - ;; - y) - echo "#ifndef $VAR" - echo "#define $VAR 1" - echo "#endif /* $VAR */" - ;; - m) - echo "#ifndef $VAR" - echo "#define $VAR 1" - echo "#endif /* $VAR */" - ;; - *) # Assume string - # XXX: add better checks to make sure what was on - # the right was indeed a string - echo "#ifndef $VAR" - echo "#define $VAR \"$VALUE\"" - echo "#endif /* $VAR */" - ;; - esac -} - -function kernel_version_req { - VERSION=$(echo $1 | sed -e 's/\./,/g') - echo "#if (LINUX_VERSION_CODE < KERNEL_VERSION($VERSION))" - echo "#error compat requirement: Linux >= $VERSION" - echo "#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION($VERSION) */" -} - -cat <<EOF -#ifndef COMPAT_AUTOCONF_INCLUDED -#define COMPAT_AUTOCONF_INCLUDED -/* - * Automatically generated C config: don't edit - */ -EOF - -# Checks user is compiling against a kernel we support -kernel_version_req $OLDEST_KERNEL_SUPPORTED - -# For each CONFIG_FOO=x option -for i in $(egrep '^CONFIG_|^ifdef CONFIG_|^ifndef CONFIG_|^endif #CONFIG_|^else #CONFIG_' $COMPAT_CONFIG | sed 's/ /+/'); do - case $i in - 'ifdef+CONFIG_'* ) - echo "#$i" | sed -e 's/+/ /' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(3,\2,0))/' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,\2))/' -e 's/\(ifdef CONFIG_COMPAT_RHEL_\)\([0-9]*\)_\([0-9]*\)/if (defined(RHEL_MAJOR) \&\& RHEL_MAJOR == \2 \&\& RHEL_MINOR >= \3)/' -e 's/\(#ifdef \)\(CONFIG_[^:space:]*\)/#if defined(\2) || defined(\2_MODULE)/' - continue - ;; - 'ifndef+CONFIG_'* ) - echo "#$i" | sed -e 's/+/ /' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,\2,0))/' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,\2))/' -e 's/\(ifndef CONFIG_COMPAT_RHEL_\)\([0-9]*\)_\([0-9]*\)/if (!defined(RHEL_MAJOR) || RHEL_MAJOR != \2 || RHEL_MINOR < \3)/' -e 's/\(#ifndef \)\(CONFIG_[^:space:]*\)/#if !defined(\2) \&\& !defined(\2_MODULE)/' - continue - ;; - 'else+#CONFIG_'* | 'endif+#CONFIG_'* ) - echo "#$i */" |sed -e 's/+#/ \/* /g' - continue - ;; - CONFIG_* ) - # Get the element on the left of the "=" - VAR=$(echo $i | cut -d"=" -f 1) - # Get the element on the right of the "=" - VALUE=$(echo $i | cut -d"=" -f 2) - - # Any other module which can *definitely* be built as a module goes here - define_config $VAR $VALUE - continue - ;; - esac -done - -echo "#endif /* COMPAT_AUTOCONF_INCLUDED */" diff --git a/openairITS/mac/DOT11/compat/scripts/gen-compat-config.sh b/openairITS/mac/DOT11/compat/scripts/gen-compat-config.sh deleted file mode 100755 index f56cbfc8ec9..00000000000 --- a/openairITS/mac/DOT11/compat/scripts/gen-compat-config.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org> -# Copyright 2012 Hauke Mehrtens <hauke@hauke-m.de> -# -# This generates a bunch of CONFIG_COMPAT_KERNEL_2_6_22 -# CONFIG_COMPAT_KERNEL_3_0 .. etc for each kernel release you need an object -# for. -# -# Note: this is part of the compat.git project, not compat-wireless.git, -# send patches against compat.git. - -if [[ ! -f ${KLIB_BUILD}/Makefile ]]; then - exit -fi - -# Actual kernel version -KERNEL_VERSION=$(${MAKE} -C ${KLIB_BUILD} kernelversion | sed -n 's/^\([0-9]\)\..*/\1/p') - -# 3.0 kernel stuff -COMPAT_LATEST_VERSION="5" -KERNEL_SUBLEVEL="-1" - -# Note that this script will export all variables explicitly, -# trying to export all with a blanket "export" statement at -# the top of the generated file causes the build to slow down -# by an order of magnitude. - -if [[ ${KERNEL_VERSION} -eq "3" ]]; then - KERNEL_SUBLEVEL=$(${MAKE} -C ${KLIB_BUILD} kernelversion | sed -n 's/^3\.\([0-9]\+\).*/\1/p') -else - COMPAT_26LATEST_VERSION="39" - KERNEL_26SUBLEVEL=$(${MAKE} -C ${KLIB_BUILD} kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p') - let KERNEL_26SUBLEVEL=${KERNEL_26SUBLEVEL}+1 - - for i in $(seq ${KERNEL_26SUBLEVEL} ${COMPAT_26LATEST_VERSION}); do - eval CONFIG_COMPAT_KERNEL_2_6_${i}=y - echo "export CONFIG_COMPAT_KERNEL_2_6_${i}=y" - done -fi - -let KERNEL_SUBLEVEL=${KERNEL_SUBLEVEL}+1 -for i in $(seq ${KERNEL_SUBLEVEL} ${COMPAT_LATEST_VERSION}); do - eval CONFIG_COMPAT_KERNEL_3_${i}=y - echo "export CONFIG_COMPAT_KERNEL_3_${i}=y" -done - -# The purpose of these seem to be the inverse of the above other varibales. -# The RHEL checks seem to annotate the existance of RHEL minor versions. -RHEL_MAJOR=$(grep ^RHEL_MAJOR ${KLIB_BUILD}/Makefile | sed -n 's/.*= *\(.*\)/\1/p') -if [[ ! -z ${RHEL_MAJOR} ]]; then - RHEL_MINOR=$(grep ^RHEL_MINOR $(KLIB_BUILD)/Makefile | sed -n 's/.*= *\(.*\)/\1/p') - for i in $(seq 0 ${RHEL_MINOR}); do - eval CONFIG_COMPAT_${RHEL_MAJOR}_${i}=y - echo "export CONFIG_COMPAT_${RHEL_MAJOR}_${i}=y" - done -fi - -if [[ ${CONFIG_COMPAT_KERNEL_2_6_33} = "y" ]]; then - echo "export CONFIG_COMPAT_FIRMWARE_CLASS=m" -fi - -if [[ ${CONFIG_COMPAT_KERNEL_2_6_36} = "y" ]]; then - echo "export CONFIG_COMPAT_KFIFO=y" -fi diff --git a/openairITS/mac/DOT11/compat/scripts/skip-colors b/openairITS/mac/DOT11/compat/scripts/skip-colors deleted file mode 100755 index 121626fb161..00000000000 --- a/openairITS/mac/DOT11/compat/scripts/skip-colors +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -perl -pe 's|(\e)\[(\d+)(;*)(\d*)(\w)||g' diff --git a/openairITS/mac/DOT11/compat_base_tree b/openairITS/mac/DOT11/compat_base_tree deleted file mode 100644 index ab2d9258c65..00000000000 --- a/openairITS/mac/DOT11/compat_base_tree +++ /dev/null @@ -1 +0,0 @@ -linux-stable.git diff --git a/openairITS/mac/DOT11/compat_base_tree_version b/openairITS/mac/DOT11/compat_base_tree_version deleted file mode 100644 index a861ab72fd9..00000000000 --- a/openairITS/mac/DOT11/compat_base_tree_version +++ /dev/null @@ -1 +0,0 @@ -v3.4-rc3 diff --git a/openairITS/mac/DOT11/compat_version b/openairITS/mac/DOT11/compat_version deleted file mode 100644 index ac0b9a674ca..00000000000 --- a/openairITS/mac/DOT11/compat_version +++ /dev/null @@ -1 +0,0 @@ -compat-wireless-v3.4-rc3-1 diff --git a/openairITS/mac/DOT11/config.mk b/openairITS/mac/DOT11/config.mk deleted file mode 100644 index f02d52b7f27..00000000000 --- a/openairITS/mac/DOT11/config.mk +++ /dev/null @@ -1,677 +0,0 @@ -ifeq ($(wildcard $(KLIB_BUILD)/.config),) -# These will be ignored by compat autoconf - export CONFIG_PCI=y - export CONFIG_USB=y - export CONFIG_PCMCIA=y - export CONFIG_SSB=m -else -include $(KLIB_BUILD)/.config -endif - -ifneq ($(wildcard $(KLIB_BUILD)/Makefile),) - -KERNEL_VERSION := $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^\([0-9]\)\..*/\1/p') - -ifneq ($(KERNEL_VERSION),2) -else -KERNEL_26SUBLEVEL := $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p') -endif - -ifdef CONFIG_COMPAT_KERNEL_2_6_24 -$(error "ERROR: compat-wireless by default supports kernels >= 2.6.24, try enabling only one driver though") -endif #CONFIG_COMPAT_KERNEL_2_6_24 - -ifeq ($(CONFIG_CFG80211),y) -$(error "ERROR: your kernel has CONFIG_CFG80211=y, you should have it CONFIG_CFG80211=m if you want to use this thing.") -endif - - -# 2.6.27 has FTRACE_DYNAMIC borked, so we will complain if -# you have it enabled, otherwise you will very likely run into -# a kernel panic. -# XXX: move this to compat_autoconf.h script generation -ifeq ($(KERNEL_VERSION),2) -ifeq ($(shell test $(KERNEL_VERSION) -eq 2 -a $(KERNEL_26SUBLEVEL) -eq 27 && echo yes),yes) -ifeq ($(CONFIG_DYNAMIC_FTRACE),y) -$(error "ERROR: Your 2.6.27 kernel has CONFIG_DYNAMIC_FTRACE, please upgrade your distribution kernel as newer ones should not have this enabled (and if so report a bug) or remove this warning if you know what you are doing") -endif -endif -endif - -# This is because with CONFIG_MAC80211 include/linux/skbuff.h will -# enable on 2.6.27 a new attribute: -# -# skb->do_not_encrypt -# -# and on 2.6.28 another new attribute: -# -# skb->requeue -# -# In kernel 2.6.32 both attributes were removed. -# -# XXX: move this to compat_autoconf.h script generation -ifeq ($(KERNEL_VERSION),2) -ifeq ($(shell test $(KERNEL_VERSION) -eq 2 -a $(KERNEL_26SUBLEVEL) -ge 27 -a $(KERNEL_26SUBLEVEL) -le 31 && echo yes),yes) -ifeq ($(CONFIG_MAC80211),) -$(error "ERROR: Your >=2.6.27 and <= 2.6.31 kernel has CONFIG_MAC80211 disabled, you should have it CONFIG_MAC80211=m if you want to use this thing.") -endif -endif -endif - -ifneq ($(KERNELRELEASE),) # This prevents a warning - -# We will warn when you don't have MQ support or NET_SCHED enabled. -# -# We could consider just quiting if MQ and NET_SCHED is disabled -# as I suspect all users of this package want 802.11e (WME) and -# 802.11n (HT) support. -ifeq ($(CONFIG_NET_SCHED),) - QOS_REQS_MISSING+=CONFIG_NET_SCHED -endif - -ifneq ($(QOS_REQS_MISSING),) # Complain about our missing dependencies -$(warning "WARNING: You are running a kernel >= 2.6.23, you should enable in it $(QOS_REQS_MISSING) for 802.11[ne] support") -endif - -endif # build check -endif # kernel Makefile check - -# These both are needed by compat-wireless || compat-bluetooth so enable them - export CONFIG_COMPAT_RFKILL=y - -ifeq ($(CONFIG_MAC80211),y) -$(error "ERROR: you have MAC80211 compiled into the kernel, CONFIG_MAC80211=y, as such you cannot replace its mac80211 driver. You need this set to CONFIG_MAC80211=m. If you are using Fedora upgrade your kernel as later version should this set as modular. For further information on Fedora see https://bugzilla.redhat.com/show_bug.cgi?id=470143. If you are using your own kernel recompile it and make mac80211 modular") -else - export CONFIG_COMPAT_WIRELESS=y - export CONFIG_COMPAT_WIRELESS_MODULES=m - export CONFIG_COMPAT_VAR_MODULES=m -# We could technically separate these but not yet, we only have b44 -# Note that we don't intend on backporting network drivers that -# use Multiqueue as that was a pain to backport to kernels older than -# 2.6.27. But -- we could just disable those drivers from kernels -# older than 2.6.27 - export CONFIG_COMPAT_NETWORK_MODULES=m - export CONFIG_COMPAT_NET_USB_MODULES=m -endif - -# The Bluetooth compatibility only builds on kernels >= 2.6.27 for now -ifndef CONFIG_COMPAT_KERNEL_2_6_27 -ifeq ($(CONFIG_BT),y) -# we'll ignore compiling bluetooth -else - export CONFIG_COMPAT_BLUETOOTH=y - export CONFIG_COMPAT_BLUETOOTH_MODULES=m -endif -endif #CONFIG_COMPAT_KERNEL_2_6_27 - -# -# CONFIG_COMPAT_FIRMWARE_CLASS definition has no leading whitespace, -# because it gets passed-on through compat_autoconf.h. -# -ifdef CONFIG_COMPAT_KERNEL_2_6_33 -ifndef CONFIG_COMPAT_RHEL_6_1 -ifdef CONFIG_FW_LOADER -export CONFIG_COMPAT_FIRMWARE_CLASS=m -endif #CONFIG_FW_LOADER -endif #CONFIG_COMPAT_RHEL_6_1 -endif #CONFIG_COMPAT_KERNEL_2_6_33 - -ifdef CONFIG_COMPAT_KERNEL_2_6_36 -ifndef CONFIG_COMPAT_RHEL_6_1 - export CONFIG_COMPAT_KFIFO=y -endif #CONFIG_COMPAT_RHEL_6_1 -endif #CONFIG_COMPAT_KERNEL_2_6_36 - -# -# CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN definitions have no leading -# whitespace, because they get passed-on through compat_autoconf.h. -# -ifndef CONFIG_COMPAT_KERNEL_2_6_33 -export CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN=y -endif #CONFIG_COMPAT_KERNEL_2_6_33 -ifdef CONFIG_COMPAT_RHEL_6_0 -export CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN=y -endif #CONFIG_COMPAT_RHEL_6_0 - -# -# CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP definition has no leading -# whitespace, because it gets passed-on through compat_autoconf.h. -# -ifdef CONFIG_COMPAT_RHEL_6_0 -export CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP=y -endif #CONFIG_COMPAT_RHEL_6_0 - -# Wireless subsystem stuff -export CONFIG_MAC80211=m - -ifndef CONFIG_COMPAT_KERNEL_2_6_33 -export CONFIG_COMPAT_MAC80211_DRIVER_API_TRACER=y -endif #CONFIG_COMPAT_KERNEL_2_6_33 - -# CONFIG_MAC80211_DEBUGFS=y -# CONFIG_MAC80211_NOINLINE=y -# CONFIG_MAC80211_VERBOSE_DEBUG=y -# CONFIG_MAC80211_HT_DEBUG=y -# CONFIG_MAC80211_TKIP_DEBUG=y -# CONFIG_MAC80211_IBSS_DEBUG=y -# CONFIG_MAC80211_VERBOSE_PS_DEBUG=y -# CONFIG_MAC80211_VERBOSE_MPL_DEBUG=y -# CONFIG_MAC80211_VERBOSE_MHWMP_DEBUG=y -# CONFIG_MAC80211_VERBOSE_TDLS_DEBUG -# CONFIG_MAC80211_DEBUG_COUNTERS=y - -# choose between pid and minstrel as default rate control algorithm -export CONFIG_MAC80211_RC_DEFAULT=minstrel_ht -export CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y -# CONFIG_MAC80211_RC_DEFAULT_PID=y -# This is the one used by our compat-wireless net/mac80211/rate.c -# in case you have and old kernel which is overriding this to pid. -export CONFIG_COMPAT_MAC80211_RC_DEFAULT=minstrel_ht -export CONFIG_MAC80211_RC_PID=y -export CONFIG_MAC80211_RC_MINSTREL=y -export CONFIG_MAC80211_RC_MINSTREL_HT=y -ifdef CONFIG_LEDS_TRIGGERS -export CONFIG_MAC80211_LEDS=y -endif #CONFIG_LEDS_TRIGGERS - -# enable mesh networking too -export CONFIG_MAC80211_MESH=y - -export CONFIG_CFG80211=m -export CONFIG_CFG80211_DEFAULT_PS=y -# CONFIG_CFG80211_DEBUGFS=y -# CONFIG_NL80211_TESTMODE=y -# CONFIG_CFG80211_DEVELOPER_WARNINGS=y -# CONFIG_CFG80211_REG_DEBUG=y -# CONFIG_CFG80211_INTERNAL_REGDB=y -# See below for wext stuff - -export CONFIG_LIB80211=m -export CONFIG_LIB80211_CRYPT_WEP=m -export CONFIG_LIB80211_CRYPT_CCMP=m -export CONFIG_LIB80211_CRYPT_TKIP=m -# CONFIG_LIB80211_DEBUG=y - -export CONFIG_BT=m -export CONFIG_BT_RFCOMM=m -export CONFIG_BT_RFCOMM_TTY=y -export CONFIG_BT_BNEP=m -export CONFIG_BT_BNEP_MC_FILTER=y -export CONFIG_BT_BNEP_PROTO_FILTER=y -# CONFIG_BT_CMTP depends on ISDN_CAPI -ifdef CONFIG_ISDN_CAPI -export CONFIG_BT_CMTP=m -endif #CONFIG_ISDN_CAPI -ifndef CONFIG_COMPAT_KERNEL_2_6_28 -export CONFIG_COMPAT_BT_HIDP=m -endif #CONFIG_COMPAT_KERNEL_2_6_28 - -export CONFIG_BT_HCIUART=M -export CONFIG_BT_HCIUART_H4=y -export CONFIG_BT_HCIUART_BCSP=y -export CONFIG_BT_HCIUART_ATH3K=y -export CONFIG_BT_HCIUART_LL=y - -export CONFIG_BT_HCIVHCI=m -export CONFIG_BT_MRVL=m - -ifdef CONFIG_PCMCIA -export CONFIG_BT_HCIDTL1=m -export CONFIG_BT_HCIBT3C=m -export CONFIG_BT_HCIBLUECARD=m -export CONFIG_BT_HCIBTUART=m -endif #CONFIG_PCMCIA - - -# We need CONFIG_WIRELESS_EXT for CONFIG_CFG80211_WEXT for every kernel -# version. The new way CONFIG_CFG80211_WEXT is called from the kernel -# does not work with compat-wireless because it calls some callback -# function on struct wiphy. This struct is shipped with compat-wireless -# and changes from kernel version to version. We are using the -# wireless_handlers attribute which will be activated by -# CONFIG_WIRELESS_EXT. -ifdef CONFIG_WIRELESS_EXT -export CONFIG_CFG80211_WEXT=y -else #CONFIG_CFG80211_WEXT -$(warning "WARNING: CONFIG_CFG80211_WEXT will be deactivated or not working because kernel was compiled with CONFIG_WIRELESS_EXT=n. Tools using wext interface like iwconfig will not work. To activate it build your kernel e.g. with CONFIG_LIBIPW=m.") -endif #CONFIG_WIRELESS_EXT - -ifdef CONFIG_STAGING -export CONFIG_COMPAT_STAGING=m -endif #CONFIG_STAGING - -# mac80211 test driver -export CONFIG_MAC80211_HWSIM=m - -export CONFIG_ATH5K=m -# CONFIG_ATH5K_DEBUG=y -# CONFIG_ATH5K_TRACER=y -# CONFIG_ATH5K_AHB=y - -export CONFIG_ATH9K=m -export CONFIG_ATH9K_HW=m -export CONFIG_ATH9K_COMMON=m -# CONFIG_ATH9K_DEBUGFS=y -# CONFIG_ATH9K_AHB=y -# CONFIG_ATH9K_PKTLOG=y - -# Disable this to get minstrel as default, we leave the ath9k -# rate control algorithm as the default for now as that is also -# default upstream on the kernel. We will move this to minstrel -# as default once we get minstrel properly tested and blessed by -# our systems engineering team. CCK rates also need to be used -# for long range considerations. -export CONFIG_COMPAT_ATH9K_RATE_CONTROL=y - -export CONFIG_ATH9K_BTCOEX_SUPPORT=y - -# PCI Drivers -ifdef CONFIG_PCI - -export CONFIG_ATH5K_PCI=y -export CONFIG_ATH9K_PCI=y - -export CONFIG_IWLWIFI=m -export CONFIG_IWLWIFI_P2P=y -# CONFIG_IWLWIFI_DEBUG=y -# CONFIG_IWLWIFI_DEBUGFS=y -# CONFIG_IWLWIFI_DEVICE_TRACING=y -# CONFIG_IWLWIFI_DEBUG_EXPERIMENTAL_UCODE=y - -export CONFIG_IWLEGACY=m -export CONFIG_COMPAT_IWL4965=m -export CONFIG_IWL3945=m -# CONFIG_IWLEGACY_DEBUG=y -# CONFIG_IWLEGACY_DEBUGFS=y - - -export CONFIG_B43=m -export CONFIG_B43_HWRNG=y -export CONFIG_B43_PCI_AUTOSELECT=y -ifdef CONFIG_PCMCIA -export CONFIG_B43_PCMCIA=y -endif #CONFIG_PCMCIA -ifdef CONFIG_MAC80211_LEDS -export CONFIG_B43_LEDS=y -endif #CONFIG_MAC80211_LEDS -export CONFIG_B43_PHY_LP=y -export CONFIG_B43_PHY_N=y -export CONFIG_B43_PHY_HT=y -# CONFIG_B43_PHY_LCN=y -# CONFIG_B43_DEBUG=y - -export CONFIG_B43LEGACY=m -export CONFIG_B43LEGACY_HWRNG=y -export CONFIG_B43LEGACY_PCI_AUTOSELECT=y -ifdef CONFIG_MAC80211_LEDS -export CONFIG_B43LEGACY_LEDS=y -endif #CONFIG_MAC80211_LEDS -# CONFIG_B43LEGACY_DEBUG=y -export CONFIG_B43LEGACY_DMA=y -export CONFIG_B43LEGACY_PIO=y - -ifdef CONFIG_WIRELESS_EXT -# The Intel ipws -export CONFIG_LIBIPW=m -# CONFIG_LIBIPW_DEBUG=y - -export CONFIG_IPW2100=m -export CONFIG_IPW2100_MONITOR=y -# CONFIG_IPW2100_DEBUG=y -export CONFIG_IPW2200=m -export CONFIG_IPW2200_MONITOR=y -export CONFIG_IPW2200_RADIOTAP=y -export CONFIG_IPW2200_PROMISCUOUS=y -export CONFIG_IPW2200_QOS=y -# CONFIG_IPW2200_DEBUG=y -# The above enables use a second interface prefixed 'rtap'. -# Example usage: -# -# % modprobe ipw2200 rtap_iface=1 -# % ifconfig rtap0 up -# % tethereal -i rtap0 -# -# If you do not specify 'rtap_iface=1' as a module parameter then -# the rtap interface will not be created and you will need to turn -# it on via sysfs: -# -# % echo 1 > /sys/bus/pci/drivers/ipw2200/*/rtap_iface -endif #CONFIG_WIRELESS_EXT - -ifdef CONFIG_SSB -# Sonics Silicon Backplane -export CONFIG_SSB_SPROM=y - -export CONFIG_SSB_BLOCKIO=y -export CONFIG_SSB_PCIHOST=y -export CONFIG_SSB_B43_PCI_BRIDGE=y -ifdef CONFIG_PCMCIA -export CONFIG_SSB_PCMCIAHOST=y -endif #CONFIG_PCMCIA -# CONFIG_SSB_DEBUG=y -export CONFIG_SSB_DRIVER_PCICORE=y -export CONFIG_B43_SSB=y -endif #CONFIG_SSB - -export CONFIG_BCMA=m -export CONFIG_BCMA_BLOCKIO=y -export CONFIG_BCMA_HOST_PCI=y -# CONFIG_BCMA_DEBUG=y -export CONFIG_B43_BCMA=y -export CONFIG_B43_BCMA_EXTRA=y - -export CONFIG_P54_PCI=m - -export CONFIG_B44=m -export CONFIG_B44_PCI=y - -export CONFIG_RTL8180=m - -export CONFIG_ADM8211=m - -export CONFIG_RT2X00_LIB_PCI=m -export CONFIG_RT2400PCI=m -export CONFIG_RT2500PCI=m -ifdef CONFIG_CRC_CCITT -export CONFIG_RT2800PCI=m -export CONFIG_RT2800PCI_RT33XX=y -export CONFIG_RT2800PCI_RT35XX=y -export CONFIG_RT2800PCI_RT53XX=y -endif #CONFIG_CRC_CCITT -NEED_RT2X00=y - -# Two rt2x00 drivers require firmware: rt61pci and rt73usb. They depend on -# CRC to check the firmware. We check here first for the PCI -# driver as we're in the PCI section. -ifdef CONFIG_CRC_ITU_T -export CONFIG_RT61PCI=m -endif #CONFIG_CRC_ITU_T - -export CONFIG_MWL8K=m - -# Ethernet drivers go here -export CONFIG_ATL1=m -export CONFIG_ATL2=m -export CONFIG_ATL1E=m -ifdef CONFIG_COMPAT_KERNEL_2_6_27 -export CONFIG_ATL1C=n -export CONFIG_ALX=m -else #CONFIG_COMPAT_KERNEL_2_6_27 -export CONFIG_ATL1C=n -export CONFIG_ALX=m -endif #CONFIG_COMPAT_KERNEL_2_6_27 - -ifdef CONFIG_WIRELESS_EXT -export CONFIG_HERMES=m -export CONFIG_HERMES_CACHE_FW_ON_INIT=y -ifdef CONFIG_PPC_PMAC -export CONFIG_APPLE_AIRPORT=m -endif #CONFIG_PPC_PMAC -export CONFIG_PLX_HERMES=m -export CONFIG_TMD_HERMES=m -export CONFIG_NORTEL_HERMES=m -export CONFIG_PCI_HERMES=m -ifdef CONFIG_PCMCIA -export CONFIG_PCMCIA_HERMES=m -export CONFIG_PCMCIA_SPECTRUM=m -endif #CONFIG_PCMCIA -endif #CONFIG_WIRELESS_EXT - -export CONFIG_RTL8192CE=m -export CONFIG_RTL8192SE=m -export CONFIG_RTL8192DE=m - -export CONFIG_BRCMSMAC=m - -export CONFIG_MWIFIEX_PCIE=m - -endif #CONFIG_PCI -## end of PCI - -ifdef CONFIG_PCMCIA - -ifdef CONFIG_COMPAT_KERNEL_2_6_27 -export CONFIG_LIBERTAS=n -export CONFIG_LIBERTAS_CS=n -else #CONFIG_COMPAT_KERNEL_2_6_27 -export CONFIG_LIBERTAS_CS=m -NEED_LIBERTAS=y -endif #CONFIG_COMPAT_KERNEL_2_6_27 - -endif #CONFIG_PCMCIA -## end of PCMCIA - -# This is required for some cards -export CONFIG_EEPROM_93CX6=m - -# USB Drivers -ifdef CONFIG_USB -ifndef CONFIG_COMPAT_KERNEL_2_6_29 -export CONFIG_COMPAT_ZD1211RW=m -# CONFIG_ZD1211RW_DEBUG=y -endif #CONFIG_COMPAT_KERNEL_2_6_29 - -# Sorry, rndis_wlan uses cancel_work_sync which is new and can't be done in compat... - -# Wireless RNDIS USB support (RTL8185 802.11g) A-Link WL54PC -# All of these devices are based on Broadcom 4320 chip which -# is only wireless RNDIS chip known to date. -# Note: this depends on CONFIG_USB_NET_RNDIS_HOST and CONFIG_USB_NET_CDCETHER -# it also requires new RNDIS_HOST and CDC_ETHER modules which we add -ifdef CONFIG_COMPAT_KERNEL_2_6_29 -export CONFIG_USB_COMPAT_USBNET=n -export CONFIG_USB_NET_COMPAT_RNDIS_HOST=n -export CONFIG_USB_NET_COMPAT_RNDIS_WLAN=n -export CONFIG_USB_NET_COMPAT_CDCETHER=n -else #CONFIG_COMPAT_KERNEL_2_6_29 -export CONFIG_USB_COMPAT_USBNET=m -ifdef CONFIG_USB_NET_CDCETHER -export CONFIG_USB_NET_COMPAT_RNDIS_HOST=m -export CONFIG_USB_NET_COMPAT_RNDIS_WLAN=m -endif #CONFIG_USB_NET_CDCETHER -ifdef CONFIG_USB_NET_CDCETHER_MODULE -export CONFIG_USB_NET_COMPAT_RNDIS_HOST=m -export CONFIG_USB_NET_COMPAT_RNDIS_WLAN=m -endif #CONFIG_USB_NET_CDCETHER -export CONFIG_USB_NET_COMPAT_CDCETHER=m -endif #CONFIG_COMPAT_KERNEL_2_6_29 - - -export CONFIG_P54_USB=m -export CONFIG_RTL8187=m -ifdef CONFIG_MAC80211_LEDS -export CONFIG_RTL8187_LEDS=y -endif #CONFIG_MAC80211_LEDS - -export CONFIG_AT76C50X_USB=m - -ifndef CONFIG_COMPAT_KERNEL_2_6_29 -export CONFIG_CARL9170=m -ifdef CONFIG_MAC80211_LEDS -export CONFIG_CARL9170_LEDS=y -endif #CONFIG_MAC80211_LEDS -# CONFIG_CARL9170_DEBUGFS=y -export CONFIG_CARL9170_WPC=y -endif #CONFIG_COMPAT_KERNEL_2_6_29 - -# This activates a threading fix for usb urb. -# this is mainline commit: b3e670443b7fb8a2d29831b62b44a039c283e351 -# This fix will be included in some stable releases. -export CONFIG_COMPAT_USB_URB_THREAD_FIX=y - -export CONFIG_ATH9K_HTC=m -# CONFIG_ATH9K_HTC_DEBUGFS=y - -# RT2500USB does not require firmware -export CONFIG_RT2500USB=m -ifdef CONFIG_CRC_CCITT -export CONFIG_RT2800USB=m -export CONFIG_RT2800USB_RT33XX=y -export CONFIG_RT2800USB_RT35XX=y -export CONFIG_RT2800USB_RT53XX=y -export CONFIG_RT2800USB_UNKNOWN=y -endif #CONFIG_CRC_CCITT -export CONFIG_RT2X00_LIB_USB=m -NEED_RT2X00=y -# RT73USB requires firmware -ifdef CONFIG_CRC_ITU_T -export CONFIG_RT73USB=m -endif #CONFIG_CRC_ITU_T - -ifdef CONFIG_COMPAT_KERNEL_2_6_27 -export CONFIG_LIBERTAS_THINFIRM_USB=n -export CONFIG_LIBERTAS_USB=n -NEED_LIBERTAS=n -else #CONFIG_COMPAT_KERNEL_2_6_27 -export CONFIG_LIBERTAS_THINFIRM_USB=m -export CONFIG_LIBERTAS_USB=m -NEED_LIBERTAS=y -endif #CONFIG_COMPAT_KERNEL_2_6_27 - -export CONFIG_ORINOCO_USB=m - -export CONFIG_BT_HCIBTUSB=m -export CONFIG_BT_HCIBCM203X=m -export CONFIG_BT_HCIBPA10X=m -export CONFIG_BT_HCIBFUSB=m -export CONFIG_BT_ATH3K=m - -export CONFIG_RTL8192CU=m - -endif #CONFIG_USB end of USB driver list - -ifdef CONFIG_SPI_MASTER -ifndef CONFIG_COMPAT_KERNEL_2_6_25 - -ifdef CONFIG_CRC7 -export CONFIG_WL1251_SPI=m -export CONFIG_WL12XX_SPI=m -endif #CONFIG_CRC7 -export CONFIG_P54_SPI=m - -ifdef CONFIG_COMPAT_KERNEL_2_6_27 -export CONFIG_LIBERTAS_SPI=n -NEED_LIBERTAS=n -else #CONFIG_COMPAT_KERNEL_2_6_27 -export CONFIG_LIBERTAS_SPI=m -NEED_LIBERTAS=y -endif #CONFIG_COMPAT_KERNEL_2_6_27 - -endif #CONFIG_COMPAT_KERNEL_2_6_25 -endif #CONFIG_SPI_MASTER end of SPI driver list - -ifdef CONFIG_MMC - -export CONFIG_SSB_SDIOHOST=y -export CONFIG_B43_SDIO=y - -ifdef CONFIG_CRC7 -ifdef CONFIG_WL12XX_PLATFORM_DATA -export CONFIG_COMPAT_WL1251_SDIO=m -endif #CONFIG_WL12XX_PLATFORM_DATA - -ifndef CONFIG_COMPAT_KERNEL_2_6_32 -ifdef CONFIG_WL12XX_PLATFORM_DATA -export CONFIG_COMPAT_WL12XX_SDIO=m -endif #CONFIG_WL12XX_PLATFORM_DATA -endif #CONFIG_COMPAT_KERNEL_2_6_32 - -endif #CONFIG_CRC7 - -export CONFIG_MWIFIEX_SDIO=m - -ifndef CONFIG_COMPAT_KERNEL_2_6_32 -export CONFIG_COMPAT_LIBERTAS_SDIO=m -NEED_LIBERTAS=y -endif #CONFIG_COMPAT_KERNEL_2_6_32 - -export CONFIG_IWM=m -# CONFIG_IWM_DEBUG=y -# CONFIG_IWM_TRACING=y - -export CONFIG_BT_HCIBTSDIO=m -export CONFIG_BT_MRVL_SDIO=m - -ifndef CONFIG_COMPAT_KERNEL_2_6_27 -export CONFIG_ATH6KL=m -# CONFIG_ATH6KL_DEBUG=y -endif #CONFIG_COMPAT_KERNEL_2_6_27 - -ifndef CONFIG_COMPAT_KERNEL_2_6_29 -export CONFIG_BRCMFMAC=m -export CONFIG_BRCMFMAC_SDIO=y -endif #CONFIG_COMPAT_KERNEL_2_6_29 - -endif #CONFIG_MMC - -export CONFIG_RTLWIFI=m -export CONFIG_RTL8192C_COMMON=m - -# Common rt2x00 requirements -ifeq ($(NEED_RT2X00),y) -export CONFIG_RT2X00=y -export CONFIG_RT2X00_LIB=m -export CONFIG_RT2800_LIB=m -export CONFIG_RT2X00_LIB_FIRMWARE=y -export CONFIG_RT2X00_LIB_CRYPTO=y -# CONFIG_RT2X00_LIB_SOC=y -ifdef CONFIG_COMPAT_KERNEL_2_6_25 -export CONFIG_RT2X00_LIB_LEDS=n -else #CONFIG_COMPAT_KERNEL_2_6_25 -ifdef CONFIG_LEDS_CLASS -export CONFIG_RT2X00_LIB_LEDS=y -endif #CONFIG_LEDS_CLASS -endif #CONFIG_COMPAT_KERNEL_2_6_25 -# CONFIG_RT2X00_DEBUG=y -# CONFIG_RT2X00_LIB_DEBUGFS=y -endif - -# p54 -export CONFIG_P54_COMMON=m -ifdef CONFIG_MAC80211_LEDS -export CONFIG_P54_LEDS=y -endif #CONFIG_MAC80211_LEDS - -# Atheros -export CONFIG_ATH_COMMON=m -# CONFIG_ATH_DEBUG=y - -export CONFIG_BRCMUTIL=m -# CONFIG_BRCMDBG=y - -ifdef CONFIG_CRC7 -export CONFIG_WL1251=m -export CONFIG_WL12XX=m -endif #CONFIG_CRC7 - -export CONFIG_MWIFIEX=m - -ifndef CONFIG_CORDIC -export CONFIG_COMPAT_CORDIC=y -endif #CONFIG_CORDIC - -ifndef CONFIG_CRC8 -export CONFIG_COMPAT_CRC8=y -endif #CONFIG_CRC8 - -ifdef CONFIG_COMPAT_KERNEL_2_6_27 -export CONFIG_LIBERTAS=n -else #CONFIG_COMPAT_KERNEL_2_6_27 -ifeq ($(NEED_LIBERTAS),y) -export CONFIG_LIBERTAS_THINFIRM=m -export CONFIG_LIBERTAS=m -export CONFIG_LIBERTAS_MESH=y -# CONFIG_LIBERTAS_DEBUG=y -endif -endif #CONFIG_COMPAT_KERNEL_2_6_27 - -# We need the backported rfkill module on kernel < 2.6.31. -# In more recent kernel versions use the in kernel rfkill module. -ifdef CONFIG_COMPAT_KERNEL_2_6_31 -export CONFIG_RFKILL_BACKPORT=m -ifdef CONFIG_LEDS_TRIGGERS -export CONFIG_RFKILL_BACKPORT_LEDS=y -endif #CONFIG_LEDS_TRIGGERS -export CONFIG_RFKILL_BACKPORT_INPUT=y -endif #CONFIG_COMPAT_KERNEL_2_6_31 - diff --git a/openairITS/mac/DOT11/include/N/pcmcia/cistpl.h b/openairITS/mac/DOT11/include/N/pcmcia/cistpl.h deleted file mode 100644 index 789dc59db72..00000000000 --- a/openairITS/mac/DOT11/include/N/pcmcia/cistpl.h +++ /dev/null @@ -1,10 +0,0 @@ -#include <linux/version.h> - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36) -#include <pcmcia/cs_types.h> -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37) -#include <pcmcia/cs.h> -#endif - -#include_next <pcmcia/cistpl.h> diff --git a/openairITS/mac/DOT11/include/N/trace/define_trace.h b/openairITS/mac/DOT11/include/N/trace/define_trace.h deleted file mode 100644 index 7d03ccf770e..00000000000 --- a/openairITS/mac/DOT11/include/N/trace/define_trace.h +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/version.h> - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) -#include_next <trace/define_trace.h> -#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) */ diff --git a/openairITS/mac/DOT11/include/crypto/aes.h b/openairITS/mac/DOT11/include/crypto/aes.h deleted file mode 100644 index 8031a54d4a4..00000000000 --- a/openairITS/mac/DOT11/include/crypto/aes.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _COMPAT_CRYPTO_AES_H -#define _COMPAT_CRYPTO_AES_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,24)) -#include_next <crypto/aes.h> -#else - -#define AES_MIN_KEY_SIZE 16 -#define AES_MAX_KEY_SIZE 32 -#define AES_KEYSIZE_128 16 -#define AES_KEYSIZE_192 24 -#define AES_KEYSIZE_256 32 -#define AES_BLOCK_SIZE 16 -#define AES_MAX_KEYLENGTH (15 * 16) -#define AES_MAX_KEYLENGTH_U32 (AES_MAX_KEYLENGTH / sizeof(u32)) - -#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,24)) */ - -#endif diff --git a/openairITS/mac/DOT11/include/linux/ath9k_platform.h b/openairITS/mac/DOT11/include/linux/ath9k_platform.h deleted file mode 100644 index 6e3f54f3784..00000000000 --- a/openairITS/mac/DOT11/include/linux/ath9k_platform.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2008 Atheros Communications Inc. - * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org> - * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _LINUX_ATH9K_PLATFORM_H -#define _LINUX_ATH9K_PLATFORM_H - -#define ATH9K_PLAT_EEP_MAX_WORDS 2048 - -struct ath9k_platform_data { - u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; - u8 *macaddr; - - int led_pin; - u32 gpio_mask; - u32 gpio_val; - - bool is_clk_25mhz; - int (*get_mac_revision)(void); - int (*external_reset)(void); -}; - -#endif /* _LINUX_ATH9K_PLATFORM_H */ diff --git a/openairITS/mac/DOT11/include/linux/atomic.h b/openairITS/mac/DOT11/include/linux/atomic.h deleted file mode 100644 index 378b748fb20..00000000000 --- a/openairITS/mac/DOT11/include/linux/atomic.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _COMPAT_LINUX_ATOMIC_H -#define _COMPAT_LINUX_ATOMIC_H 1 - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) -#include_next <linux/atomic.h> -#else - -#include <asm/atomic.h> - -/** - * atomic_inc_not_zero_hint - increment if not null - * @v: pointer of type atomic_t - * @hint: probable value of the atomic before the increment - * - * This version of atomic_inc_not_zero() gives a hint of probable - * value of the atomic. This helps processor to not read the memory - * before doing the atomic read/modify/write cycle, lowering - * number of bus transactions on some arches. - * - * Returns: 0 if increment was not done, 1 otherwise. - */ -#ifndef atomic_inc_not_zero_hint -static inline int atomic_inc_not_zero_hint(atomic_t *v, int hint) -{ - int val, c = hint; - - /* sanity test, should be removed by compiler if hint is a constant */ - if (!hint) - return atomic_inc_not_zero(v); - - do { - val = atomic_cmpxchg(v, c, c + 1); - if (val == c) - return 1; - c = val; - } while (c); - - return 0; -} -#endif - -#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) */ - -#endif /* _COMPAT_LINUX_ATOMIC_H */ diff --git a/openairITS/mac/DOT11/include/linux/average.h b/openairITS/mac/DOT11/include/linux/average.h deleted file mode 100644 index ece86ca3a97..00000000000 --- a/openairITS/mac/DOT11/include/linux/average.h +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/version.h> - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37)) -#include_next <linux/average.h> -#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37)) */ diff --git a/openairITS/mac/DOT11/include/linux/bcma/bcma.h b/openairITS/mac/DOT11/include/linux/bcma/bcma.h deleted file mode 100644 index 5af9a075498..00000000000 --- a/openairITS/mac/DOT11/include/linux/bcma/bcma.h +++ /dev/null @@ -1,307 +0,0 @@ -#ifndef LINUX_BCMA_H_ -#define LINUX_BCMA_H_ - -#include <linux/pci.h> -#include <linux/mod_devicetable.h> - -#include <linux/bcma/bcma_driver_chipcommon.h> -#include <linux/bcma/bcma_driver_pci.h> -#include <linux/bcma/bcma_driver_mips.h> -#include <linux/ssb/ssb.h> /* SPROM sharing */ - -#include "bcma_regs.h" - -struct bcma_device; -struct bcma_bus; - -enum bcma_hosttype { - BCMA_HOSTTYPE_PCI, - BCMA_HOSTTYPE_SDIO, - BCMA_HOSTTYPE_SOC, -}; - -struct bcma_chipinfo { - u16 id; - u8 rev; - u8 pkg; -}; - -enum bcma_clkmode { - BCMA_CLKMODE_FAST, - BCMA_CLKMODE_DYNAMIC, -}; - -struct bcma_host_ops { - u8 (*read8)(struct bcma_device *core, u16 offset); - u16 (*read16)(struct bcma_device *core, u16 offset); - u32 (*read32)(struct bcma_device *core, u16 offset); - void (*write8)(struct bcma_device *core, u16 offset, u8 value); - void (*write16)(struct bcma_device *core, u16 offset, u16 value); - void (*write32)(struct bcma_device *core, u16 offset, u32 value); -#ifdef CONFIG_BCMA_BLOCKIO - void (*block_read)(struct bcma_device *core, void *buffer, - size_t count, u16 offset, u8 reg_width); - void (*block_write)(struct bcma_device *core, const void *buffer, - size_t count, u16 offset, u8 reg_width); -#endif - /* Agent ops */ - u32 (*aread32)(struct bcma_device *core, u16 offset); - void (*awrite32)(struct bcma_device *core, u16 offset, u32 value); -}; - -/* Core manufacturers */ -#define BCMA_MANUF_ARM 0x43B -#define BCMA_MANUF_MIPS 0x4A7 -#define BCMA_MANUF_BCM 0x4BF - -/* Core class values. */ -#define BCMA_CL_SIM 0x0 -#define BCMA_CL_EROM 0x1 -#define BCMA_CL_CORESIGHT 0x9 -#define BCMA_CL_VERIF 0xB -#define BCMA_CL_OPTIMO 0xD -#define BCMA_CL_GEN 0xE -#define BCMA_CL_PRIMECELL 0xF - -/* Core-ID values. */ -#define BCMA_CORE_OOB_ROUTER 0x367 /* Out of band */ -#define BCMA_CORE_INVALID 0x700 -#define BCMA_CORE_CHIPCOMMON 0x800 -#define BCMA_CORE_ILINE20 0x801 -#define BCMA_CORE_SRAM 0x802 -#define BCMA_CORE_SDRAM 0x803 -#define BCMA_CORE_PCI 0x804 -#define BCMA_CORE_MIPS 0x805 -#define BCMA_CORE_ETHERNET 0x806 -#define BCMA_CORE_V90 0x807 -#define BCMA_CORE_USB11_HOSTDEV 0x808 -#define BCMA_CORE_ADSL 0x809 -#define BCMA_CORE_ILINE100 0x80A -#define BCMA_CORE_IPSEC 0x80B -#define BCMA_CORE_UTOPIA 0x80C -#define BCMA_CORE_PCMCIA 0x80D -#define BCMA_CORE_INTERNAL_MEM 0x80E -#define BCMA_CORE_MEMC_SDRAM 0x80F -#define BCMA_CORE_OFDM 0x810 -#define BCMA_CORE_EXTIF 0x811 -#define BCMA_CORE_80211 0x812 -#define BCMA_CORE_PHY_A 0x813 -#define BCMA_CORE_PHY_B 0x814 -#define BCMA_CORE_PHY_G 0x815 -#define BCMA_CORE_MIPS_3302 0x816 -#define BCMA_CORE_USB11_HOST 0x817 -#define BCMA_CORE_USB11_DEV 0x818 -#define BCMA_CORE_USB20_HOST 0x819 -#define BCMA_CORE_USB20_DEV 0x81A -#define BCMA_CORE_SDIO_HOST 0x81B -#define BCMA_CORE_ROBOSWITCH 0x81C -#define BCMA_CORE_PARA_ATA 0x81D -#define BCMA_CORE_SATA_XORDMA 0x81E -#define BCMA_CORE_ETHERNET_GBIT 0x81F -#define BCMA_CORE_PCIE 0x820 -#define BCMA_CORE_PHY_N 0x821 -#define BCMA_CORE_SRAM_CTL 0x822 -#define BCMA_CORE_MINI_MACPHY 0x823 -#define BCMA_CORE_ARM_1176 0x824 -#define BCMA_CORE_ARM_7TDMI 0x825 -#define BCMA_CORE_PHY_LP 0x826 -#define BCMA_CORE_PMU 0x827 -#define BCMA_CORE_PHY_SSN 0x828 -#define BCMA_CORE_SDIO_DEV 0x829 -#define BCMA_CORE_ARM_CM3 0x82A -#define BCMA_CORE_PHY_HT 0x82B -#define BCMA_CORE_MIPS_74K 0x82C -#define BCMA_CORE_MAC_GBIT 0x82D -#define BCMA_CORE_DDR12_MEM_CTL 0x82E -#define BCMA_CORE_PCIE_RC 0x82F /* PCIe Root Complex */ -#define BCMA_CORE_OCP_OCP_BRIDGE 0x830 -#define BCMA_CORE_SHARED_COMMON 0x831 -#define BCMA_CORE_OCP_AHB_BRIDGE 0x832 -#define BCMA_CORE_SPI_HOST 0x833 -#define BCMA_CORE_I2S 0x834 -#define BCMA_CORE_SDR_DDR1_MEM_CTL 0x835 /* SDR/DDR1 memory controller core */ -#define BCMA_CORE_SHIM 0x837 /* SHIM component in ubus/6362 */ -#define BCMA_CORE_DEFAULT 0xFFF - -#define BCMA_MAX_NR_CORES 16 - -struct bcma_device { - struct bcma_bus *bus; - struct bcma_device_id id; - - struct device dev; - struct device *dma_dev; - - unsigned int irq; - bool dev_registered; - - u8 core_index; - u8 core_unit; - - u32 addr; - u32 wrap; - - void __iomem *io_addr; - void __iomem *io_wrap; - - void *drvdata; - struct list_head list; -}; - -static inline void *bcma_get_drvdata(struct bcma_device *core) -{ - return core->drvdata; -} -static inline void bcma_set_drvdata(struct bcma_device *core, void *drvdata) -{ - core->drvdata = drvdata; -} - -struct bcma_driver { - const char *name; - const struct bcma_device_id *id_table; - - int (*probe)(struct bcma_device *dev); - void (*remove)(struct bcma_device *dev); - int (*suspend)(struct bcma_device *dev); - int (*resume)(struct bcma_device *dev); - void (*shutdown)(struct bcma_device *dev); - - struct device_driver drv; -}; -extern -int __bcma_driver_register(struct bcma_driver *drv, struct module *owner); -#define bcma_driver_register(drv) \ - __bcma_driver_register(drv, THIS_MODULE) - -extern void bcma_driver_unregister(struct bcma_driver *drv); - -/* Set a fallback SPROM. - * See kdoc at the function definition for complete documentation. */ -extern int bcma_arch_register_fallback_sprom( - int (*sprom_callback)(struct bcma_bus *bus, - struct ssb_sprom *out)); - -struct bcma_bus { - /* The MMIO area. */ - void __iomem *mmio; - - const struct bcma_host_ops *ops; - - enum bcma_hosttype hosttype; - union { - /* Pointer to the PCI bus (only for BCMA_HOSTTYPE_PCI) */ - struct pci_dev *host_pci; - /* Pointer to the SDIO device (only for BCMA_HOSTTYPE_SDIO) */ - struct sdio_func *host_sdio; - }; - - struct bcma_chipinfo chipinfo; - - struct bcma_device *mapped_core; - struct list_head cores; - u8 nr_cores; - u8 init_done:1; - u8 num; - - struct bcma_drv_cc drv_cc; - struct bcma_drv_pci drv_pci; - struct bcma_drv_mips drv_mips; - - /* We decided to share SPROM struct with SSB as long as we do not need - * any hacks for BCMA. This simplifies drivers code. */ - struct ssb_sprom sprom; -}; - -static inline u32 bcma_read8(struct bcma_device *core, u16 offset) -{ - return core->bus->ops->read8(core, offset); -} -static inline u32 bcma_read16(struct bcma_device *core, u16 offset) -{ - return core->bus->ops->read16(core, offset); -} -static inline u32 bcma_read32(struct bcma_device *core, u16 offset) -{ - return core->bus->ops->read32(core, offset); -} -static inline -void bcma_write8(struct bcma_device *core, u16 offset, u32 value) -{ - core->bus->ops->write8(core, offset, value); -} -static inline -void bcma_write16(struct bcma_device *core, u16 offset, u32 value) -{ - core->bus->ops->write16(core, offset, value); -} -static inline -void bcma_write32(struct bcma_device *core, u16 offset, u32 value) -{ - core->bus->ops->write32(core, offset, value); -} -#ifdef CONFIG_BCMA_BLOCKIO -static inline void bcma_block_read(struct bcma_device *core, void *buffer, - size_t count, u16 offset, u8 reg_width) -{ - core->bus->ops->block_read(core, buffer, count, offset, reg_width); -} -static inline void bcma_block_write(struct bcma_device *core, - const void *buffer, size_t count, - u16 offset, u8 reg_width) -{ - core->bus->ops->block_write(core, buffer, count, offset, reg_width); -} -#endif -static inline u32 bcma_aread32(struct bcma_device *core, u16 offset) -{ - return core->bus->ops->aread32(core, offset); -} -static inline -void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value) -{ - core->bus->ops->awrite32(core, offset, value); -} - -static inline void bcma_mask32(struct bcma_device *cc, u16 offset, u32 mask) -{ - bcma_write32(cc, offset, bcma_read32(cc, offset) & mask); -} -static inline void bcma_set32(struct bcma_device *cc, u16 offset, u32 set) -{ - bcma_write32(cc, offset, bcma_read32(cc, offset) | set); -} -static inline void bcma_maskset32(struct bcma_device *cc, - u16 offset, u32 mask, u32 set) -{ - bcma_write32(cc, offset, (bcma_read32(cc, offset) & mask) | set); -} -static inline void bcma_mask16(struct bcma_device *cc, u16 offset, u16 mask) -{ - bcma_write16(cc, offset, bcma_read16(cc, offset) & mask); -} -static inline void bcma_set16(struct bcma_device *cc, u16 offset, u16 set) -{ - bcma_write16(cc, offset, bcma_read16(cc, offset) | set); -} -static inline void bcma_maskset16(struct bcma_device *cc, - u16 offset, u16 mask, u16 set) -{ - bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set); -} - -extern struct bcma_device *bcma_find_core(struct bcma_bus *bus, u16 coreid); -extern bool bcma_core_is_enabled(struct bcma_device *core); -extern void bcma_core_disable(struct bcma_device *core, u32 flags); -extern int bcma_core_enable(struct bcma_device *core, u32 flags); -extern void bcma_core_set_clockmode(struct bcma_device *core, - enum bcma_clkmode clkmode); -extern void bcma_core_pll_ctl(struct bcma_device *core, u32 req, u32 status, - bool on); -#define BCMA_DMA_TRANSLATION_MASK 0xC0000000 -#define BCMA_DMA_TRANSLATION_NONE 0x00000000 -#define BCMA_DMA_TRANSLATION_DMA32_CMT 0x40000000 /* Client Mode Translation for 32-bit DMA */ -#define BCMA_DMA_TRANSLATION_DMA64_CMT 0x80000000 /* Client Mode Translation for 64-bit DMA */ -extern u32 bcma_core_dma_translation(struct bcma_device *core); - -#endif /* LINUX_BCMA_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/bcma/bcma_driver_chipcommon.h b/openairITS/mac/DOT11/include/linux/bcma/bcma_driver_chipcommon.h deleted file mode 100644 index 8bbfe31fbac..00000000000 --- a/openairITS/mac/DOT11/include/linux/bcma/bcma_driver_chipcommon.h +++ /dev/null @@ -1,415 +0,0 @@ -#ifndef LINUX_BCMA_DRIVER_CC_H_ -#define LINUX_BCMA_DRIVER_CC_H_ - -/** ChipCommon core registers. **/ -#define BCMA_CC_ID 0x0000 -#define BCMA_CC_ID_ID 0x0000FFFF -#define BCMA_CC_ID_ID_SHIFT 0 -#define BCMA_CC_ID_REV 0x000F0000 -#define BCMA_CC_ID_REV_SHIFT 16 -#define BCMA_CC_ID_PKG 0x00F00000 -#define BCMA_CC_ID_PKG_SHIFT 20 -#define BCMA_CC_ID_NRCORES 0x0F000000 -#define BCMA_CC_ID_NRCORES_SHIFT 24 -#define BCMA_CC_ID_TYPE 0xF0000000 -#define BCMA_CC_ID_TYPE_SHIFT 28 -#define BCMA_CC_CAP 0x0004 /* Capabilities */ -#define BCMA_CC_CAP_NRUART 0x00000003 /* # of UARTs */ -#define BCMA_CC_CAP_MIPSEB 0x00000004 /* MIPS in BigEndian Mode */ -#define BCMA_CC_CAP_UARTCLK 0x00000018 /* UART clock select */ -#define BCMA_CC_CAP_UARTCLK_INT 0x00000008 /* UARTs are driven by internal divided clock */ -#define BCMA_CC_CAP_UARTGPIO 0x00000020 /* UARTs on GPIO 15-12 */ -#define BCMA_CC_CAP_EXTBUS 0x000000C0 /* External buses present */ -#define BCMA_CC_CAP_FLASHT 0x00000700 /* Flash Type */ -#define BCMA_CC_FLASHT_NONE 0x00000000 /* No flash */ -#define BCMA_CC_FLASHT_STSER 0x00000100 /* ST serial flash */ -#define BCMA_CC_FLASHT_ATSER 0x00000200 /* Atmel serial flash */ -#define BCMA_CC_FLASHT_NFLASH 0x00000200 -#define BCMA_CC_FLASHT_PARA 0x00000700 /* Parallel flash */ -#define BCMA_CC_CAP_PLLT 0x00038000 /* PLL Type */ -#define BCMA_PLLTYPE_NONE 0x00000000 -#define BCMA_PLLTYPE_1 0x00010000 /* 48Mhz base, 3 dividers */ -#define BCMA_PLLTYPE_2 0x00020000 /* 48Mhz, 4 dividers */ -#define BCMA_PLLTYPE_3 0x00030000 /* 25Mhz, 2 dividers */ -#define BCMA_PLLTYPE_4 0x00008000 /* 48Mhz, 4 dividers */ -#define BCMA_PLLTYPE_5 0x00018000 /* 25Mhz, 4 dividers */ -#define BCMA_PLLTYPE_6 0x00028000 /* 100/200 or 120/240 only */ -#define BCMA_PLLTYPE_7 0x00038000 /* 25Mhz, 4 dividers */ -#define BCMA_CC_CAP_PCTL 0x00040000 /* Power Control */ -#define BCMA_CC_CAP_OTPS 0x00380000 /* OTP size */ -#define BCMA_CC_CAP_OTPS_SHIFT 19 -#define BCMA_CC_CAP_OTPS_BASE 5 -#define BCMA_CC_CAP_JTAGM 0x00400000 /* JTAG master present */ -#define BCMA_CC_CAP_BROM 0x00800000 /* Internal boot ROM active */ -#define BCMA_CC_CAP_64BIT 0x08000000 /* 64-bit Backplane */ -#define BCMA_CC_CAP_PMU 0x10000000 /* PMU available (rev >= 20) */ -#define BCMA_CC_CAP_ECI 0x20000000 /* ECI available (rev >= 20) */ -#define BCMA_CC_CAP_SPROM 0x40000000 /* SPROM present */ -#define BCMA_CC_CORECTL 0x0008 -#define BCMA_CC_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */ -#define BCMA_CC_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */ -#define BCMA_CC_CORECTL_UARTCLKEN 0x00000008 /* UART clock enable (rev >= 21) */ -#define BCMA_CC_BIST 0x000C -#define BCMA_CC_OTPS 0x0010 /* OTP status */ -#define BCMA_CC_OTPS_PROGFAIL 0x80000000 -#define BCMA_CC_OTPS_PROTECT 0x00000007 -#define BCMA_CC_OTPS_HW_PROTECT 0x00000001 -#define BCMA_CC_OTPS_SW_PROTECT 0x00000002 -#define BCMA_CC_OTPS_CID_PROTECT 0x00000004 -#define BCMA_CC_OTPS_GU_PROG_IND 0x00000F00 /* General Use programmed indication */ -#define BCMA_CC_OTPS_GU_PROG_IND_SHIFT 8 -#define BCMA_CC_OTPS_GU_PROG_HW 0x00000100 /* HW region programmed */ -#define BCMA_CC_OTPC 0x0014 /* OTP control */ -#define BCMA_CC_OTPC_RECWAIT 0xFF000000 -#define BCMA_CC_OTPC_PROGWAIT 0x00FFFF00 -#define BCMA_CC_OTPC_PRW_SHIFT 8 -#define BCMA_CC_OTPC_MAXFAIL 0x00000038 -#define BCMA_CC_OTPC_VSEL 0x00000006 -#define BCMA_CC_OTPC_SELVL 0x00000001 -#define BCMA_CC_OTPP 0x0018 /* OTP prog */ -#define BCMA_CC_OTPP_COL 0x000000FF -#define BCMA_CC_OTPP_ROW 0x0000FF00 -#define BCMA_CC_OTPP_ROW_SHIFT 8 -#define BCMA_CC_OTPP_READERR 0x10000000 -#define BCMA_CC_OTPP_VALUE 0x20000000 -#define BCMA_CC_OTPP_READ 0x40000000 -#define BCMA_CC_OTPP_START 0x80000000 -#define BCMA_CC_OTPP_BUSY 0x80000000 -#define BCMA_CC_OTPL 0x001C /* OTP layout */ -#define BCMA_CC_OTPL_GURGN_OFFSET 0x00000FFF /* offset of general use region */ -#define BCMA_CC_IRQSTAT 0x0020 -#define BCMA_CC_IRQMASK 0x0024 -#define BCMA_CC_IRQ_GPIO 0x00000001 /* gpio intr */ -#define BCMA_CC_IRQ_EXT 0x00000002 /* ro: ext intr pin (corerev >= 3) */ -#define BCMA_CC_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */ -#define BCMA_CC_CHIPCTL 0x0028 /* Rev >= 11 only */ -#define BCMA_CC_CHIPSTAT 0x002C /* Rev >= 11 only */ -#define BCMA_CC_CHIPST_4313_SPROM_PRESENT 1 -#define BCMA_CC_CHIPST_4313_OTP_PRESENT 2 -#define BCMA_CC_CHIPST_4331_SPROM_PRESENT 2 -#define BCMA_CC_CHIPST_4331_OTP_PRESENT 4 -#define BCMA_CC_JCMD 0x0030 /* Rev >= 10 only */ -#define BCMA_CC_JCMD_START 0x80000000 -#define BCMA_CC_JCMD_BUSY 0x80000000 -#define BCMA_CC_JCMD_PAUSE 0x40000000 -#define BCMA_CC_JCMD0_ACC_MASK 0x0000F000 -#define BCMA_CC_JCMD0_ACC_IRDR 0x00000000 -#define BCMA_CC_JCMD0_ACC_DR 0x00001000 -#define BCMA_CC_JCMD0_ACC_IR 0x00002000 -#define BCMA_CC_JCMD0_ACC_RESET 0x00003000 -#define BCMA_CC_JCMD0_ACC_IRPDR 0x00004000 -#define BCMA_CC_JCMD0_ACC_PDR 0x00005000 -#define BCMA_CC_JCMD0_IRW_MASK 0x00000F00 -#define BCMA_CC_JCMD_ACC_MASK 0x000F0000 /* Changes for corerev 11 */ -#define BCMA_CC_JCMD_ACC_IRDR 0x00000000 -#define BCMA_CC_JCMD_ACC_DR 0x00010000 -#define BCMA_CC_JCMD_ACC_IR 0x00020000 -#define BCMA_CC_JCMD_ACC_RESET 0x00030000 -#define BCMA_CC_JCMD_ACC_IRPDR 0x00040000 -#define BCMA_CC_JCMD_ACC_PDR 0x00050000 -#define BCMA_CC_JCMD_IRW_MASK 0x00001F00 -#define BCMA_CC_JCMD_IRW_SHIFT 8 -#define BCMA_CC_JCMD_DRW_MASK 0x0000003F -#define BCMA_CC_JIR 0x0034 /* Rev >= 10 only */ -#define BCMA_CC_JDR 0x0038 /* Rev >= 10 only */ -#define BCMA_CC_JCTL 0x003C /* Rev >= 10 only */ -#define BCMA_CC_JCTL_FORCE_CLK 4 /* Force clock */ -#define BCMA_CC_JCTL_EXT_EN 2 /* Enable external targets */ -#define BCMA_CC_JCTL_EN 1 /* Enable Jtag master */ -#define BCMA_CC_FLASHCTL 0x0040 -#define BCMA_CC_FLASHCTL_START 0x80000000 -#define BCMA_CC_FLASHCTL_BUSY BCMA_CC_FLASHCTL_START -#define BCMA_CC_FLASHADDR 0x0044 -#define BCMA_CC_FLASHDATA 0x0048 -#define BCMA_CC_BCAST_ADDR 0x0050 -#define BCMA_CC_BCAST_DATA 0x0054 -#define BCMA_CC_GPIOPULLUP 0x0058 /* Rev >= 20 only */ -#define BCMA_CC_GPIOPULLDOWN 0x005C /* Rev >= 20 only */ -#define BCMA_CC_GPIOIN 0x0060 -#define BCMA_CC_GPIOOUT 0x0064 -#define BCMA_CC_GPIOOUTEN 0x0068 -#define BCMA_CC_GPIOCTL 0x006C -#define BCMA_CC_GPIOPOL 0x0070 -#define BCMA_CC_GPIOIRQ 0x0074 -#define BCMA_CC_WATCHDOG 0x0080 -#define BCMA_CC_GPIOTIMER 0x0088 /* LED powersave (corerev >= 16) */ -#define BCMA_CC_GPIOTIMER_OFFTIME 0x0000FFFF -#define BCMA_CC_GPIOTIMER_OFFTIME_SHIFT 0 -#define BCMA_CC_GPIOTIMER_ONTIME 0xFFFF0000 -#define BCMA_CC_GPIOTIMER_ONTIME_SHIFT 16 -#define BCMA_CC_GPIOTOUTM 0x008C /* LED powersave (corerev >= 16) */ -#define BCMA_CC_CLOCK_N 0x0090 -#define BCMA_CC_CLOCK_SB 0x0094 -#define BCMA_CC_CLOCK_PCI 0x0098 -#define BCMA_CC_CLOCK_M2 0x009C -#define BCMA_CC_CLOCK_MIPS 0x00A0 -#define BCMA_CC_CLKDIV 0x00A4 /* Rev >= 3 only */ -#define BCMA_CC_CLKDIV_SFLASH 0x0F000000 -#define BCMA_CC_CLKDIV_SFLASH_SHIFT 24 -#define BCMA_CC_CLKDIV_OTP 0x000F0000 -#define BCMA_CC_CLKDIV_OTP_SHIFT 16 -#define BCMA_CC_CLKDIV_JTAG 0x00000F00 -#define BCMA_CC_CLKDIV_JTAG_SHIFT 8 -#define BCMA_CC_CLKDIV_UART 0x000000FF -#define BCMA_CC_CAP_EXT 0x00AC /* Capabilities */ -#define BCMA_CC_PLLONDELAY 0x00B0 /* Rev >= 4 only */ -#define BCMA_CC_FREFSELDELAY 0x00B4 /* Rev >= 4 only */ -#define BCMA_CC_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */ -#define BCMA_CC_SLOWCLKCTL_SRC 0x00000007 /* slow clock source mask */ -#define BCMA_CC_SLOWCLKCTL_SRC_LPO 0x00000000 /* source of slow clock is LPO */ -#define BCMA_CC_SLOWCLKCTL_SRC_XTAL 0x00000001 /* source of slow clock is crystal */ -#define BCMA_CC_SLOECLKCTL_SRC_PCI 0x00000002 /* source of slow clock is PCI */ -#define BCMA_CC_SLOWCLKCTL_LPOFREQ 0x00000200 /* LPOFreqSel, 1: 160Khz, 0: 32KHz */ -#define BCMA_CC_SLOWCLKCTL_LPOPD 0x00000400 /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */ -#define BCMA_CC_SLOWCLKCTL_FSLOW 0x00000800 /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */ -#define BCMA_CC_SLOWCLKCTL_IPLL 0x00001000 /* IgnorePllOffReq, 1/0: power logic ignores/honors PLL clock disable requests from core */ -#define BCMA_CC_SLOWCLKCTL_ENXTAL 0x00002000 /* XtalControlEn, 1/0: power logic does/doesn't disable crystal when appropriate */ -#define BCMA_CC_SLOWCLKCTL_XTALPU 0x00004000 /* XtalPU (RO), 1/0: crystal running/disabled */ -#define BCMA_CC_SLOWCLKCTL_CLKDIV 0xFFFF0000 /* ClockDivider (SlowClk = 1/(4+divisor)) */ -#define BCMA_CC_SLOWCLKCTL_CLKDIV_SHIFT 16 -#define BCMA_CC_SYSCLKCTL 0x00C0 /* Rev >= 3 only */ -#define BCMA_CC_SYSCLKCTL_IDLPEN 0x00000001 /* ILPen: Enable Idle Low Power */ -#define BCMA_CC_SYSCLKCTL_ALPEN 0x00000002 /* ALPen: Enable Active Low Power */ -#define BCMA_CC_SYSCLKCTL_PLLEN 0x00000004 /* ForcePLLOn */ -#define BCMA_CC_SYSCLKCTL_FORCEALP 0x00000008 /* Force ALP (or HT if ALPen is not set */ -#define BCMA_CC_SYSCLKCTL_FORCEHT 0x00000010 /* Force HT */ -#define BCMA_CC_SYSCLKCTL_CLKDIV 0xFFFF0000 /* ClkDiv (ILP = 1/(4+divisor)) */ -#define BCMA_CC_SYSCLKCTL_CLKDIV_SHIFT 16 -#define BCMA_CC_CLKSTSTR 0x00C4 /* Rev >= 3 only */ -#define BCMA_CC_EROM 0x00FC -#define BCMA_CC_PCMCIA_CFG 0x0100 -#define BCMA_CC_PCMCIA_MEMWAIT 0x0104 -#define BCMA_CC_PCMCIA_ATTRWAIT 0x0108 -#define BCMA_CC_PCMCIA_IOWAIT 0x010C -#define BCMA_CC_IDE_CFG 0x0110 -#define BCMA_CC_IDE_MEMWAIT 0x0114 -#define BCMA_CC_IDE_ATTRWAIT 0x0118 -#define BCMA_CC_IDE_IOWAIT 0x011C -#define BCMA_CC_PROG_CFG 0x0120 -#define BCMA_CC_PROG_WAITCNT 0x0124 -#define BCMA_CC_FLASH_CFG 0x0128 -#define BCMA_CC_FLASH_CFG_DS 0x0010 /* Data size, 0=8bit, 1=16bit */ -#define BCMA_CC_FLASH_WAITCNT 0x012C -#define BCMA_CC_SROM_CONTROL 0x0190 -#define BCMA_CC_SROM_CONTROL_START 0x80000000 -#define BCMA_CC_SROM_CONTROL_BUSY 0x80000000 -#define BCMA_CC_SROM_CONTROL_OPCODE 0x60000000 -#define BCMA_CC_SROM_CONTROL_OP_READ 0x00000000 -#define BCMA_CC_SROM_CONTROL_OP_WRITE 0x20000000 -#define BCMA_CC_SROM_CONTROL_OP_WRDIS 0x40000000 -#define BCMA_CC_SROM_CONTROL_OP_WREN 0x60000000 -#define BCMA_CC_SROM_CONTROL_OTPSEL 0x00000010 -#define BCMA_CC_SROM_CONTROL_LOCK 0x00000008 -#define BCMA_CC_SROM_CONTROL_SIZE_MASK 0x00000006 -#define BCMA_CC_SROM_CONTROL_SIZE_1K 0x00000000 -#define BCMA_CC_SROM_CONTROL_SIZE_4K 0x00000002 -#define BCMA_CC_SROM_CONTROL_SIZE_16K 0x00000004 -#define BCMA_CC_SROM_CONTROL_SIZE_SHIFT 1 -#define BCMA_CC_SROM_CONTROL_PRESENT 0x00000001 -/* 0x1E0 is defined as shared BCMA_CLKCTLST */ -#define BCMA_CC_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ -#define BCMA_CC_UART0_DATA 0x0300 -#define BCMA_CC_UART0_IMR 0x0304 -#define BCMA_CC_UART0_FCR 0x0308 -#define BCMA_CC_UART0_LCR 0x030C -#define BCMA_CC_UART0_MCR 0x0310 -#define BCMA_CC_UART0_LSR 0x0314 -#define BCMA_CC_UART0_MSR 0x0318 -#define BCMA_CC_UART0_SCRATCH 0x031C -#define BCMA_CC_UART1_DATA 0x0400 -#define BCMA_CC_UART1_IMR 0x0404 -#define BCMA_CC_UART1_FCR 0x0408 -#define BCMA_CC_UART1_LCR 0x040C -#define BCMA_CC_UART1_MCR 0x0410 -#define BCMA_CC_UART1_LSR 0x0414 -#define BCMA_CC_UART1_MSR 0x0418 -#define BCMA_CC_UART1_SCRATCH 0x041C -/* PMU registers (rev >= 20) */ -#define BCMA_CC_PMU_CTL 0x0600 /* PMU control */ -#define BCMA_CC_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ -#define BCMA_CC_PMU_CTL_ILP_DIV_SHIFT 16 -#define BCMA_CC_PMU_CTL_PLL_UPD 0x00000400 -#define BCMA_CC_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ -#define BCMA_CC_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ -#define BCMA_CC_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */ -#define BCMA_CC_PMU_CTL_XTALFREQ 0x0000007C /* Crystal freq */ -#define BCMA_CC_PMU_CTL_XTALFREQ_SHIFT 2 -#define BCMA_CC_PMU_CTL_ILPDIVEN 0x00000002 /* ILP div enable */ -#define BCMA_CC_PMU_CTL_LPOSEL 0x00000001 /* LPO sel */ -#define BCMA_CC_PMU_CAP 0x0604 /* PMU capabilities */ -#define BCMA_CC_PMU_CAP_REVISION 0x000000FF /* Revision mask */ -#define BCMA_CC_PMU_STAT 0x0608 /* PMU status */ -#define BCMA_CC_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */ -#define BCMA_CC_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */ -#define BCMA_CC_PMU_STAT_HAVEALP 0x00000008 /* ALP available */ -#define BCMA_CC_PMU_STAT_HAVEHT 0x00000004 /* HT available */ -#define BCMA_CC_PMU_STAT_RESINIT 0x00000003 /* Res init */ -#define BCMA_CC_PMU_RES_STAT 0x060C /* PMU res status */ -#define BCMA_CC_PMU_RES_PEND 0x0610 /* PMU res pending */ -#define BCMA_CC_PMU_TIMER 0x0614 /* PMU timer */ -#define BCMA_CC_PMU_MINRES_MSK 0x0618 /* PMU min res mask */ -#define BCMA_CC_PMU_MAXRES_MSK 0x061C /* PMU max res mask */ -#define BCMA_CC_PMU_RES_TABSEL 0x0620 /* PMU res table sel */ -#define BCMA_CC_PMU_RES_DEPMSK 0x0624 /* PMU res dep mask */ -#define BCMA_CC_PMU_RES_UPDNTM 0x0628 /* PMU res updown timer */ -#define BCMA_CC_PMU_RES_TIMER 0x062C /* PMU res timer */ -#define BCMA_CC_PMU_CLKSTRETCH 0x0630 /* PMU clockstretch */ -#define BCMA_CC_PMU_WATCHDOG 0x0634 /* PMU watchdog */ -#define BCMA_CC_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */ -#define BCMA_CC_PMU_RES_REQT 0x0644 /* PMU res req timer */ -#define BCMA_CC_PMU_RES_REQM 0x0648 /* PMU res req mask */ -#define BCMA_CC_CHIPCTL_ADDR 0x0650 -#define BCMA_CC_CHIPCTL_DATA 0x0654 -#define BCMA_CC_REGCTL_ADDR 0x0658 -#define BCMA_CC_REGCTL_DATA 0x065C -#define BCMA_CC_PLLCTL_ADDR 0x0660 -#define BCMA_CC_PLLCTL_DATA 0x0664 -#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */ - -/* Divider allocation in 4716/47162/5356 */ -#define BCMA_CC_PMU5_MAINPLL_CPU 1 -#define BCMA_CC_PMU5_MAINPLL_MEM 2 -#define BCMA_CC_PMU5_MAINPLL_SSB 3 - -/* PLL usage in 4716/47162 */ -#define BCMA_CC_PMU4716_MAINPLL_PLL0 12 - -/* PLL usage in 5356/5357 */ -#define BCMA_CC_PMU5356_MAINPLL_PLL0 0 -#define BCMA_CC_PMU5357_MAINPLL_PLL0 0 - -/* 4706 PMU */ -#define BCMA_CC_PMU4706_MAINPLL_PLL0 0 - -/* ALP clock on pre-PMU chips */ -#define BCMA_CC_PMU_ALP_CLOCK 20000000 -/* HT clock for systems with PMU-enabled chipcommon */ -#define BCMA_CC_PMU_HT_CLOCK 80000000 - -/* PMU rev 5 (& 6) */ -#define BCMA_CC_PPL_P1P2_OFF 0 -#define BCMA_CC_PPL_P1_MASK 0x0f000000 -#define BCMA_CC_PPL_P1_SHIFT 24 -#define BCMA_CC_PPL_P2_MASK 0x00f00000 -#define BCMA_CC_PPL_P2_SHIFT 20 -#define BCMA_CC_PPL_M14_OFF 1 -#define BCMA_CC_PPL_MDIV_MASK 0x000000ff -#define BCMA_CC_PPL_MDIV_WIDTH 8 -#define BCMA_CC_PPL_NM5_OFF 2 -#define BCMA_CC_PPL_NDIV_MASK 0xfff00000 -#define BCMA_CC_PPL_NDIV_SHIFT 20 -#define BCMA_CC_PPL_FMAB_OFF 3 -#define BCMA_CC_PPL_MRAT_MASK 0xf0000000 -#define BCMA_CC_PPL_MRAT_SHIFT 28 -#define BCMA_CC_PPL_ABRAT_MASK 0x08000000 -#define BCMA_CC_PPL_ABRAT_SHIFT 27 -#define BCMA_CC_PPL_FDIV_MASK 0x07ffffff -#define BCMA_CC_PPL_PLLCTL_OFF 4 -#define BCMA_CC_PPL_PCHI_OFF 5 -#define BCMA_CC_PPL_PCHI_MASK 0x0000003f - -/* BCM4331 ChipControl numbers. */ -#define BCMA_CHIPCTL_4331_BT_COEXIST BIT(0) /* 0 disable */ -#define BCMA_CHIPCTL_4331_SECI BIT(1) /* 0 SECI is disabled (JATG functional) */ -#define BCMA_CHIPCTL_4331_EXT_LNA BIT(2) /* 0 disable */ -#define BCMA_CHIPCTL_4331_SPROM_GPIO13_15 BIT(3) /* sprom/gpio13-15 mux */ -#define BCMA_CHIPCTL_4331_EXTPA_EN BIT(4) /* 0 ext pa disable, 1 ext pa enabled */ -#define BCMA_CHIPCTL_4331_GPIOCLK_ON_SPROMCS BIT(5) /* set drive out GPIO_CLK on sprom_cs pin */ -#define BCMA_CHIPCTL_4331_PCIE_MDIO_ON_SPROMCS BIT(6) /* use sprom_cs pin as PCIE mdio interface */ -#define BCMA_CHIPCTL_4331_EXTPA_ON_GPIO2_5 BIT(7) /* aband extpa will be at gpio2/5 and sprom_dout */ -#define BCMA_CHIPCTL_4331_OVR_PIPEAUXCLKEN BIT(8) /* override core control on pipe_AuxClkEnable */ -#define BCMA_CHIPCTL_4331_OVR_PIPEAUXPWRDOWN BIT(9) /* override core control on pipe_AuxPowerDown */ -#define BCMA_CHIPCTL_4331_PCIE_AUXCLKEN BIT(10) /* pcie_auxclkenable */ -#define BCMA_CHIPCTL_4331_PCIE_PIPE_PLLDOWN BIT(11) /* pcie_pipe_pllpowerdown */ -#define BCMA_CHIPCTL_4331_BT_SHD0_ON_GPIO4 BIT(16) /* enable bt_shd0 at gpio4 */ -#define BCMA_CHIPCTL_4331_BT_SHD1_ON_GPIO5 BIT(17) /* enable bt_shd1 at gpio5 */ - -/* Data for the PMU, if available. - * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) - */ -struct bcma_chipcommon_pmu { - u8 rev; /* PMU revision */ - u32 crystalfreq; /* The active crystal frequency (in kHz) */ -}; - -#ifdef CONFIG_BCMA_DRIVER_MIPS -struct bcma_pflash { - u8 buswidth; - u32 window; - u32 window_size; -}; - -struct bcma_serial_port { - void *regs; - unsigned long clockspeed; - unsigned int irq; - unsigned int baud_base; - unsigned int reg_shift; -}; -#endif /* CONFIG_BCMA_DRIVER_MIPS */ - -struct bcma_drv_cc { - struct bcma_device *core; - u32 status; - u32 capabilities; - u32 capabilities_ext; - u8 setup_done:1; - /* Fast Powerup Delay constant */ - u16 fast_pwrup_delay; - struct bcma_chipcommon_pmu pmu; -#ifdef CONFIG_BCMA_DRIVER_MIPS - struct bcma_pflash pflash; - - int nr_serial_ports; - struct bcma_serial_port serial_ports[4]; -#endif /* CONFIG_BCMA_DRIVER_MIPS */ -}; - -/* Register access */ -#define bcma_cc_read32(cc, offset) \ - bcma_read32((cc)->core, offset) -#define bcma_cc_write32(cc, offset, val) \ - bcma_write32((cc)->core, offset, val) - -#define bcma_cc_mask32(cc, offset, mask) \ - bcma_cc_write32(cc, offset, bcma_cc_read32(cc, offset) & (mask)) -#define bcma_cc_set32(cc, offset, set) \ - bcma_cc_write32(cc, offset, bcma_cc_read32(cc, offset) | (set)) -#define bcma_cc_maskset32(cc, offset, mask, set) \ - bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) - -extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); - -extern void bcma_chipco_suspend(struct bcma_drv_cc *cc); -extern void bcma_chipco_resume(struct bcma_drv_cc *cc); - -void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable); - -extern void bcma_chipco_watchdog_timer_set(struct bcma_drv_cc *cc, - u32 ticks); - -void bcma_chipco_irq_mask(struct bcma_drv_cc *cc, u32 mask, u32 value); - -u32 bcma_chipco_irq_status(struct bcma_drv_cc *cc, u32 mask); - -/* Chipcommon GPIO pin access. */ -u32 bcma_chipco_gpio_in(struct bcma_drv_cc *cc, u32 mask); -u32 bcma_chipco_gpio_out(struct bcma_drv_cc *cc, u32 mask, u32 value); -u32 bcma_chipco_gpio_outen(struct bcma_drv_cc *cc, u32 mask, u32 value); -u32 bcma_chipco_gpio_control(struct bcma_drv_cc *cc, u32 mask, u32 value); -u32 bcma_chipco_gpio_intmask(struct bcma_drv_cc *cc, u32 mask, u32 value); -u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value); - -/* PMU support */ -extern void bcma_pmu_init(struct bcma_drv_cc *cc); - -extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, - u32 value); -extern void bcma_chipco_pll_maskset(struct bcma_drv_cc *cc, u32 offset, - u32 mask, u32 set); -extern void bcma_chipco_chipctl_maskset(struct bcma_drv_cc *cc, - u32 offset, u32 mask, u32 set); -extern void bcma_chipco_regctl_maskset(struct bcma_drv_cc *cc, - u32 offset, u32 mask, u32 set); - -#endif /* LINUX_BCMA_DRIVER_CC_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/bcma/bcma_driver_mips.h b/openairITS/mac/DOT11/include/linux/bcma/bcma_driver_mips.h deleted file mode 100644 index c0043645cdc..00000000000 --- a/openairITS/mac/DOT11/include/linux/bcma/bcma_driver_mips.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef LINUX_BCMA_DRIVER_MIPS_H_ -#define LINUX_BCMA_DRIVER_MIPS_H_ - -#define BCMA_MIPS_IPSFLAG 0x0F08 -/* which sbflags get routed to mips interrupt 1 */ -#define BCMA_MIPS_IPSFLAG_IRQ1 0x0000003F -#define BCMA_MIPS_IPSFLAG_IRQ1_SHIFT 0 -/* which sbflags get routed to mips interrupt 2 */ -#define BCMA_MIPS_IPSFLAG_IRQ2 0x00003F00 -#define BCMA_MIPS_IPSFLAG_IRQ2_SHIFT 8 -/* which sbflags get routed to mips interrupt 3 */ -#define BCMA_MIPS_IPSFLAG_IRQ3 0x003F0000 -#define BCMA_MIPS_IPSFLAG_IRQ3_SHIFT 16 -/* which sbflags get routed to mips interrupt 4 */ -#define BCMA_MIPS_IPSFLAG_IRQ4 0x3F000000 -#define BCMA_MIPS_IPSFLAG_IRQ4_SHIFT 24 - -/* MIPS 74K core registers */ -#define BCMA_MIPS_MIPS74K_CORECTL 0x0000 -#define BCMA_MIPS_MIPS74K_EXCEPTBASE 0x0004 -#define BCMA_MIPS_MIPS74K_BIST 0x000C -#define BCMA_MIPS_MIPS74K_INTMASK_INT0 0x0014 -#define BCMA_MIPS_MIPS74K_INTMASK(int) \ - ((int) * 4 + BCMA_MIPS_MIPS74K_INTMASK_INT0) -#define BCMA_MIPS_MIPS74K_NMIMASK 0x002C -#define BCMA_MIPS_MIPS74K_GPIOSEL 0x0040 -#define BCMA_MIPS_MIPS74K_GPIOOUT 0x0044 -#define BCMA_MIPS_MIPS74K_GPIOEN 0x0048 -#define BCMA_MIPS_MIPS74K_CLKCTLST 0x01E0 - -#define BCMA_MIPS_OOBSELOUTA30 0x100 - -struct bcma_device; - -struct bcma_drv_mips { - struct bcma_device *core; - u8 setup_done:1; - unsigned int assigned_irqs; -}; - -#ifdef CONFIG_BCMA_DRIVER_MIPS -extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); -#else -static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } -#endif - -extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); - -extern unsigned int bcma_core_mips_irq(struct bcma_device *dev); - -#endif /* LINUX_BCMA_DRIVER_MIPS_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/bcma/bcma_driver_pci.h b/openairITS/mac/DOT11/include/linux/bcma/bcma_driver_pci.h deleted file mode 100644 index 46c71e27d31..00000000000 --- a/openairITS/mac/DOT11/include/linux/bcma/bcma_driver_pci.h +++ /dev/null @@ -1,214 +0,0 @@ -#ifndef LINUX_BCMA_DRIVER_PCI_H_ -#define LINUX_BCMA_DRIVER_PCI_H_ - -#include <linux/types.h> - -struct pci_dev; - -/** PCI core registers. **/ -#define BCMA_CORE_PCI_CTL 0x0000 /* PCI Control */ -#define BCMA_CORE_PCI_CTL_RST_OE 0x00000001 /* PCI_RESET Output Enable */ -#define BCMA_CORE_PCI_CTL_RST 0x00000002 /* PCI_RESET driven out to pin */ -#define BCMA_CORE_PCI_CTL_CLK_OE 0x00000004 /* Clock gate Output Enable */ -#define BCMA_CORE_PCI_CTL_CLK 0x00000008 /* Gate for clock driven out to pin */ -#define BCMA_CORE_PCI_ARBCTL 0x0010 /* PCI Arbiter Control */ -#define BCMA_CORE_PCI_ARBCTL_INTERN 0x00000001 /* Use internal arbiter */ -#define BCMA_CORE_PCI_ARBCTL_EXTERN 0x00000002 /* Use external arbiter */ -#define BCMA_CORE_PCI_ARBCTL_PARKID 0x00000006 /* Mask, selects which agent is parked on an idle bus */ -#define BCMA_CORE_PCI_ARBCTL_PARKID_LAST 0x00000000 /* Last requestor */ -#define BCMA_CORE_PCI_ARBCTL_PARKID_4710 0x00000002 /* 4710 */ -#define BCMA_CORE_PCI_ARBCTL_PARKID_EXT0 0x00000004 /* External requestor 0 */ -#define BCMA_CORE_PCI_ARBCTL_PARKID_EXT1 0x00000006 /* External requestor 1 */ -#define BCMA_CORE_PCI_ISTAT 0x0020 /* Interrupt status */ -#define BCMA_CORE_PCI_ISTAT_INTA 0x00000001 /* PCI INTA# */ -#define BCMA_CORE_PCI_ISTAT_INTB 0x00000002 /* PCI INTB# */ -#define BCMA_CORE_PCI_ISTAT_SERR 0x00000004 /* PCI SERR# (write to clear) */ -#define BCMA_CORE_PCI_ISTAT_PERR 0x00000008 /* PCI PERR# (write to clear) */ -#define BCMA_CORE_PCI_ISTAT_PME 0x00000010 /* PCI PME# */ -#define BCMA_CORE_PCI_IMASK 0x0024 /* Interrupt mask */ -#define BCMA_CORE_PCI_IMASK_INTA 0x00000001 /* PCI INTA# */ -#define BCMA_CORE_PCI_IMASK_INTB 0x00000002 /* PCI INTB# */ -#define BCMA_CORE_PCI_IMASK_SERR 0x00000004 /* PCI SERR# */ -#define BCMA_CORE_PCI_IMASK_PERR 0x00000008 /* PCI PERR# */ -#define BCMA_CORE_PCI_IMASK_PME 0x00000010 /* PCI PME# */ -#define BCMA_CORE_PCI_MBOX 0x0028 /* Backplane to PCI Mailbox */ -#define BCMA_CORE_PCI_MBOX_F0_0 0x00000100 /* PCI function 0, INT 0 */ -#define BCMA_CORE_PCI_MBOX_F0_1 0x00000200 /* PCI function 0, INT 1 */ -#define BCMA_CORE_PCI_MBOX_F1_0 0x00000400 /* PCI function 1, INT 0 */ -#define BCMA_CORE_PCI_MBOX_F1_1 0x00000800 /* PCI function 1, INT 1 */ -#define BCMA_CORE_PCI_MBOX_F2_0 0x00001000 /* PCI function 2, INT 0 */ -#define BCMA_CORE_PCI_MBOX_F2_1 0x00002000 /* PCI function 2, INT 1 */ -#define BCMA_CORE_PCI_MBOX_F3_0 0x00004000 /* PCI function 3, INT 0 */ -#define BCMA_CORE_PCI_MBOX_F3_1 0x00008000 /* PCI function 3, INT 1 */ -#define BCMA_CORE_PCI_BCAST_ADDR 0x0050 /* Backplane Broadcast Address */ -#define BCMA_CORE_PCI_BCAST_ADDR_MASK 0x000000FF -#define BCMA_CORE_PCI_BCAST_DATA 0x0054 /* Backplane Broadcast Data */ -#define BCMA_CORE_PCI_GPIO_IN 0x0060 /* rev >= 2 only */ -#define BCMA_CORE_PCI_GPIO_OUT 0x0064 /* rev >= 2 only */ -#define BCMA_CORE_PCI_GPIO_ENABLE 0x0068 /* rev >= 2 only */ -#define BCMA_CORE_PCI_GPIO_CTL 0x006C /* rev >= 2 only */ -#define BCMA_CORE_PCI_SBTOPCI0 0x0100 /* Backplane to PCI translation 0 (sbtopci0) */ -#define BCMA_CORE_PCI_SBTOPCI0_MASK 0xFC000000 -#define BCMA_CORE_PCI_SBTOPCI1 0x0104 /* Backplane to PCI translation 1 (sbtopci1) */ -#define BCMA_CORE_PCI_SBTOPCI1_MASK 0xFC000000 -#define BCMA_CORE_PCI_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */ -#define BCMA_CORE_PCI_SBTOPCI2_MASK 0xC0000000 -#define BCMA_CORE_PCI_CONFIG_ADDR 0x0120 /* pcie config space access */ -#define BCMA_CORE_PCI_CONFIG_DATA 0x0124 /* pcie config space access */ -#define BCMA_CORE_PCI_MDIO_CONTROL 0x0128 /* controls the mdio access */ -#define BCMA_CORE_PCI_MDIOCTL_DIVISOR_MASK 0x7f /* clock to be used on MDIO */ -#define BCMA_CORE_PCI_MDIOCTL_DIVISOR_VAL 0x2 -#define BCMA_CORE_PCI_MDIOCTL_PREAM_EN 0x80 /* Enable preamble sequnce */ -#define BCMA_CORE_PCI_MDIOCTL_ACCESS_DONE 0x100 /* Tranaction complete */ -#define BCMA_CORE_PCI_MDIO_DATA 0x012c /* Data to the mdio access */ -#define BCMA_CORE_PCI_MDIODATA_MASK 0x0000ffff /* data 2 bytes */ -#define BCMA_CORE_PCI_MDIODATA_TA 0x00020000 /* Turnaround */ -#define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF_OLD 18 /* Regaddr shift (rev < 10) */ -#define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK_OLD 0x003c0000 /* Regaddr Mask (rev < 10) */ -#define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF_OLD 22 /* Physmedia devaddr shift (rev < 10) */ -#define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK_OLD 0x0fc00000 /* Physmedia devaddr Mask (rev < 10) */ -#define BCMA_CORE_PCI_MDIODATA_REGADDR_SHF 18 /* Regaddr shift */ -#define BCMA_CORE_PCI_MDIODATA_REGADDR_MASK 0x007c0000 /* Regaddr Mask */ -#define BCMA_CORE_PCI_MDIODATA_DEVADDR_SHF 23 /* Physmedia devaddr shift */ -#define BCMA_CORE_PCI_MDIODATA_DEVADDR_MASK 0x0f800000 /* Physmedia devaddr Mask */ -#define BCMA_CORE_PCI_MDIODATA_WRITE 0x10000000 /* write Transaction */ -#define BCMA_CORE_PCI_MDIODATA_READ 0x20000000 /* Read Transaction */ -#define BCMA_CORE_PCI_MDIODATA_START 0x40000000 /* start of Transaction */ -#define BCMA_CORE_PCI_MDIODATA_DEV_ADDR 0x0 /* dev address for serdes */ -#define BCMA_CORE_PCI_MDIODATA_BLK_ADDR 0x1F /* blk address for serdes */ -#define BCMA_CORE_PCI_MDIODATA_DEV_PLL 0x1d /* SERDES PLL Dev */ -#define BCMA_CORE_PCI_MDIODATA_DEV_TX 0x1e /* SERDES TX Dev */ -#define BCMA_CORE_PCI_MDIODATA_DEV_RX 0x1f /* SERDES RX Dev */ -#define BCMA_CORE_PCI_PCIEIND_ADDR 0x0130 /* indirect access to the internal register */ -#define BCMA_CORE_PCI_PCIEIND_DATA 0x0134 /* Data to/from the internal regsiter */ -#define BCMA_CORE_PCI_CLKREQENCTRL 0x0138 /* >= rev 6, Clkreq rdma control */ -#define BCMA_CORE_PCI_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */ -#define BCMA_CORE_PCI_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */ -#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ -#define BCMA_CORE_PCI_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */ -#define BCMA_CORE_PCI_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */ - -/* SBtoPCIx */ -#define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000 -#define BCMA_CORE_PCI_SBTOPCI_IO 0x00000001 -#define BCMA_CORE_PCI_SBTOPCI_CFG0 0x00000002 -#define BCMA_CORE_PCI_SBTOPCI_CFG1 0x00000003 -#define BCMA_CORE_PCI_SBTOPCI_PREF 0x00000004 /* Prefetch enable */ -#define BCMA_CORE_PCI_SBTOPCI_BURST 0x00000008 /* Burst enable */ -#define BCMA_CORE_PCI_SBTOPCI_MRM 0x00000020 /* Memory Read Multiple */ -#define BCMA_CORE_PCI_SBTOPCI_RC 0x00000030 /* Read Command mask (rev >= 11) */ -#define BCMA_CORE_PCI_SBTOPCI_RC_READ 0x00000000 /* Memory read */ -#define BCMA_CORE_PCI_SBTOPCI_RC_READL 0x00000010 /* Memory read line */ -#define BCMA_CORE_PCI_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */ - -/* PCIE protocol PHY diagnostic registers */ -#define BCMA_CORE_PCI_PLP_MODEREG 0x200 /* Mode */ -#define BCMA_CORE_PCI_PLP_STATUSREG 0x204 /* Status */ -#define BCMA_CORE_PCI_PLP_POLARITYINV_STAT 0x10 /* Status reg PCIE_PLP_STATUSREG */ -#define BCMA_CORE_PCI_PLP_LTSSMCTRLREG 0x208 /* LTSSM control */ -#define BCMA_CORE_PCI_PLP_LTLINKNUMREG 0x20c /* Link Training Link number */ -#define BCMA_CORE_PCI_PLP_LTLANENUMREG 0x210 /* Link Training Lane number */ -#define BCMA_CORE_PCI_PLP_LTNFTSREG 0x214 /* Link Training N_FTS */ -#define BCMA_CORE_PCI_PLP_ATTNREG 0x218 /* Attention */ -#define BCMA_CORE_PCI_PLP_ATTNMASKREG 0x21C /* Attention Mask */ -#define BCMA_CORE_PCI_PLP_RXERRCTR 0x220 /* Rx Error */ -#define BCMA_CORE_PCI_PLP_RXFRMERRCTR 0x224 /* Rx Framing Error */ -#define BCMA_CORE_PCI_PLP_RXERRTHRESHREG 0x228 /* Rx Error threshold */ -#define BCMA_CORE_PCI_PLP_TESTCTRLREG 0x22C /* Test Control reg */ -#define BCMA_CORE_PCI_PLP_SERDESCTRLOVRDREG 0x230 /* SERDES Control Override */ -#define BCMA_CORE_PCI_PLP_TIMINGOVRDREG 0x234 /* Timing param override */ -#define BCMA_CORE_PCI_PLP_RXTXSMDIAGREG 0x238 /* RXTX State Machine Diag */ -#define BCMA_CORE_PCI_PLP_LTSSMDIAGREG 0x23C /* LTSSM State Machine Diag */ - -/* PCIE protocol DLLP diagnostic registers */ -#define BCMA_CORE_PCI_DLLP_LCREG 0x100 /* Link Control */ -#define BCMA_CORE_PCI_DLLP_LSREG 0x104 /* Link Status */ -#define BCMA_CORE_PCI_DLLP_LAREG 0x108 /* Link Attention */ -#define BCMA_CORE_PCI_DLLP_LSREG_LINKUP (1 << 16) -#define BCMA_CORE_PCI_DLLP_LAMASKREG 0x10C /* Link Attention Mask */ -#define BCMA_CORE_PCI_DLLP_NEXTTXSEQNUMREG 0x110 /* Next Tx Seq Num */ -#define BCMA_CORE_PCI_DLLP_ACKEDTXSEQNUMREG 0x114 /* Acked Tx Seq Num */ -#define BCMA_CORE_PCI_DLLP_PURGEDTXSEQNUMREG 0x118 /* Purged Tx Seq Num */ -#define BCMA_CORE_PCI_DLLP_RXSEQNUMREG 0x11C /* Rx Sequence Number */ -#define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */ -#define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */ -#define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */ -#define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */ -#define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */ -#define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */ -#define BCMA_CORE_PCI_DLLP_RTRRWREG 0x138 /* Retry buffer Read/Write */ -#define BCMA_CORE_PCI_DLLP_ECTHRESHREG 0x13C /* Error Count Threshold */ -#define BCMA_CORE_PCI_DLLP_TLPERRCTRREG 0x140 /* TLP Error Counter */ -#define BCMA_CORE_PCI_DLLP_ERRCTRREG 0x144 /* Error Counter */ -#define BCMA_CORE_PCI_DLLP_NAKRXCTRREG 0x148 /* NAK Received Counter */ -#define BCMA_CORE_PCI_DLLP_TESTREG 0x14C /* Test */ -#define BCMA_CORE_PCI_DLLP_PKTBIST 0x150 /* Packet BIST */ -#define BCMA_CORE_PCI_DLLP_PCIE11 0x154 /* DLLP PCIE 1.1 reg */ - -/* SERDES RX registers */ -#define BCMA_CORE_PCI_SERDES_RX_CTRL 1 /* Rx cntrl */ -#define BCMA_CORE_PCI_SERDES_RX_CTRL_FORCE 0x80 /* rxpolarity_force */ -#define BCMA_CORE_PCI_SERDES_RX_CTRL_POLARITY 0x40 /* rxpolarity_value */ -#define BCMA_CORE_PCI_SERDES_RX_TIMER1 2 /* Rx Timer1 */ -#define BCMA_CORE_PCI_SERDES_RX_CDR 6 /* CDR */ -#define BCMA_CORE_PCI_SERDES_RX_CDRBW 7 /* CDR BW */ - -/* SERDES PLL registers */ -#define BCMA_CORE_PCI_SERDES_PLL_CTRL 1 /* PLL control reg */ -#define BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN 0x4000 /* bit 14 is FREQDET on */ - -/* PCIcore specific boardflags */ -#define BCMA_CORE_PCI_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */ - -/* PCIE Config space accessing MACROS */ -#define BCMA_CORE_PCI_CFG_BUS_SHIFT 24 /* Bus shift */ -#define BCMA_CORE_PCI_CFG_SLOT_SHIFT 19 /* Slot/Device shift */ -#define BCMA_CORE_PCI_CFG_FUN_SHIFT 16 /* Function shift */ -#define BCMA_CORE_PCI_CFG_OFF_SHIFT 0 /* Register shift */ - -#define BCMA_CORE_PCI_CFG_BUS_MASK 0xff /* Bus mask */ -#define BCMA_CORE_PCI_CFG_SLOT_MASK 0x1f /* Slot/Device mask */ -#define BCMA_CORE_PCI_CFG_FUN_MASK 7 /* Function mask */ -#define BCMA_CORE_PCI_CFG_OFF_MASK 0xfff /* Register mask */ - -/* PCIE Root Capability Register bits (Host mode only) */ -#define BCMA_CORE_PCI_RC_CRS_VISIBILITY 0x0001 - -struct bcma_drv_pci; - -#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE -struct bcma_drv_pci_host { - struct bcma_drv_pci *pdev; - - u32 host_cfg_addr; - spinlock_t cfgspace_lock; - - struct pci_controller pci_controller; - struct pci_ops pci_ops; - struct resource mem_resource; - struct resource io_resource; -}; -#endif - -struct bcma_drv_pci { - struct bcma_device *core; - u8 setup_done:1; - u8 hostmode:1; - -#ifdef CONFIG_BCMA_DRIVER_PCI_HOSTMODE - struct bcma_drv_pci_host *host_controller; -#endif -}; - -/* Register access */ -#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset) -#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val) - -extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc); -extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, - struct bcma_device *core, bool enable); - -extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev); -extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev); - -#endif /* LINUX_BCMA_DRIVER_PCI_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/bcma/bcma_regs.h b/openairITS/mac/DOT11/include/linux/bcma/bcma_regs.h deleted file mode 100644 index 5a71d571964..00000000000 --- a/openairITS/mac/DOT11/include/linux/bcma/bcma_regs.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef LINUX_BCMA_REGS_H_ -#define LINUX_BCMA_REGS_H_ - -/* Some single registers are shared between many cores */ -/* BCMA_CLKCTLST: ChipCommon (rev >= 20), PCIe, 80211 */ -#define BCMA_CLKCTLST 0x01E0 /* Clock control and status */ -#define BCMA_CLKCTLST_FORCEALP 0x00000001 /* Force ALP request */ -#define BCMA_CLKCTLST_FORCEHT 0x00000002 /* Force HT request */ -#define BCMA_CLKCTLST_FORCEILP 0x00000004 /* Force ILP request */ -#define BCMA_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */ -#define BCMA_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */ -#define BCMA_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */ -#define BCMA_CLKCTLST_EXTRESREQ 0x00000700 /* Mask of external resource requests */ -#define BCMA_CLKCTLST_HAVEALP 0x00010000 /* ALP available */ -#define BCMA_CLKCTLST_HAVEHT 0x00020000 /* HT available */ -#define BCMA_CLKCTLST_BP_ON_ALP 0x00040000 /* RO: running on ALP clock */ -#define BCMA_CLKCTLST_BP_ON_HT 0x00080000 /* RO: running on HT clock */ -#define BCMA_CLKCTLST_EXTRESST 0x07000000 /* Mask of external resource status */ -/* Is there any BCM4328 on BCMA bus? */ -#define BCMA_CLKCTLST_4328A0_HAVEHT 0x00010000 /* 4328a0 has reversed bits */ -#define BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */ - -/* Agent registers (common for every core) */ -#define BCMA_IOCTL 0x0408 /* IO control */ -#define BCMA_IOCTL_CLK 0x0001 -#define BCMA_IOCTL_FGC 0x0002 -#define BCMA_IOCTL_CORE_BITS 0x3FFC -#define BCMA_IOCTL_PME_EN 0x4000 -#define BCMA_IOCTL_BIST_EN 0x8000 -#define BCMA_IOST 0x0500 /* IO status */ -#define BCMA_IOST_CORE_BITS 0x0FFF -#define BCMA_IOST_DMA64 0x1000 -#define BCMA_IOST_GATED_CLK 0x2000 -#define BCMA_IOST_BIST_ERROR 0x4000 -#define BCMA_IOST_BIST_DONE 0x8000 -#define BCMA_RESET_CTL 0x0800 -#define BCMA_RESET_CTL_RESET 0x0001 - -/* BCMA PCI config space registers. */ -#define BCMA_PCI_PMCSR 0x44 -#define BCMA_PCI_PE 0x100 -#define BCMA_PCI_BAR0_WIN 0x80 /* Backplane address space 0 */ -#define BCMA_PCI_BAR1_WIN 0x84 /* Backplane address space 1 */ -#define BCMA_PCI_SPROMCTL 0x88 /* SPROM control */ -#define BCMA_PCI_SPROMCTL_WE 0x10 /* SPROM write enable */ -#define BCMA_PCI_BAR1_CONTROL 0x8c /* Address space 1 burst control */ -#define BCMA_PCI_IRQS 0x90 /* PCI interrupts */ -#define BCMA_PCI_IRQMASK 0x94 /* PCI IRQ control and mask (pcirev >= 6 only) */ -#define BCMA_PCI_BACKPLANE_IRQS 0x98 /* Backplane Interrupts */ -#define BCMA_PCI_BAR0_WIN2 0xAC -#define BCMA_PCI_GPIO_IN 0xB0 /* GPIO Input (pcirev >= 3 only) */ -#define BCMA_PCI_GPIO_OUT 0xB4 /* GPIO Output (pcirev >= 3 only) */ -#define BCMA_PCI_GPIO_OUT_ENABLE 0xB8 /* GPIO Output Enable/Disable (pcirev >= 3 only) */ -#define BCMA_PCI_GPIO_SCS 0x10 /* PCI config space bit 4 for 4306c0 slow clock source */ -#define BCMA_PCI_GPIO_HWRAD 0x20 /* PCI config space GPIO 13 for hw radio disable */ -#define BCMA_PCI_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ -#define BCMA_PCI_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ - -/* SiliconBackplane Address Map. - * All regions may not exist on all chips. - */ -#define BCMA_SOC_SDRAM_BASE 0x00000000U /* Physical SDRAM */ -#define BCMA_SOC_PCI_MEM 0x08000000U /* Host Mode sb2pcitranslation0 (64 MB) */ -#define BCMA_SOC_PCI_MEM_SZ (64 * 1024 * 1024) -#define BCMA_SOC_PCI_CFG 0x0c000000U /* Host Mode sb2pcitranslation1 (64 MB) */ -#define BCMA_SOC_SDRAM_SWAPPED 0x10000000U /* Byteswapped Physical SDRAM */ -#define BCMA_SOC_SDRAM_R2 0x80000000U /* Region 2 for sdram (512 MB) */ - - -#define BCMA_SOC_PCI_DMA 0x40000000U /* Client Mode sb2pcitranslation2 (1 GB) */ -#define BCMA_SOC_PCI_DMA2 0x80000000U /* Client Mode sb2pcitranslation2 (1 GB) */ -#define BCMA_SOC_PCI_DMA_SZ 0x40000000U /* Client Mode sb2pcitranslation2 size in bytes */ -#define BCMA_SOC_PCIE_DMA_L32 0x00000000U /* PCIE Client Mode sb2pcitranslation2 - * (2 ZettaBytes), low 32 bits - */ -#define BCMA_SOC_PCIE_DMA_H32 0x80000000U /* PCIE Client Mode sb2pcitranslation2 - * (2 ZettaBytes), high 32 bits - */ - -#define BCMA_SOC_PCI1_MEM 0x40000000U /* Host Mode sb2pcitranslation0 (64 MB) */ -#define BCMA_SOC_PCI1_CFG 0x44000000U /* Host Mode sb2pcitranslation1 (64 MB) */ -#define BCMA_SOC_PCIE1_DMA_H32 0xc0000000U /* PCIE Client Mode sb2pcitranslation2 - * (2 ZettaBytes), high 32 bits - */ - -#endif /* LINUX_BCMA_REGS_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/bcma/bcma_soc.h b/openairITS/mac/DOT11/include/linux/bcma/bcma_soc.h deleted file mode 100644 index 4203c5593b9..00000000000 --- a/openairITS/mac/DOT11/include/linux/bcma/bcma_soc.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef LINUX_BCMA_SOC_H_ -#define LINUX_BCMA_SOC_H_ - -#include <linux/bcma/bcma.h> - -struct bcma_soc { - struct bcma_bus bus; - struct bcma_device core_cc; - struct bcma_device core_mips; -}; - -int __init bcma_host_soc_register(struct bcma_soc *soc); - -int bcma_bus_register(struct bcma_bus *bus); - -#endif /* LINUX_BCMA_SOC_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/bitops.h b/openairITS/mac/DOT11/include/linux/bitops.h deleted file mode 100644 index aa76af18434..00000000000 --- a/openairITS/mac/DOT11/include/linux/bitops.h +++ /dev/null @@ -1,211 +0,0 @@ -#ifndef _LINUX_BITOPS_H -#define _LINUX_BITOPS_H -#include <asm/types.h> - -#ifdef __KERNEL__ -#define BIT(nr) (1UL << (nr)) -#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) -#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) -#define BITS_PER_BYTE 8 -#ifndef BITS_TO_LONGS /* Older kernels define this already */ -#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) -#endif -#endif - -extern unsigned int __sw_hweight8(unsigned int w); -extern unsigned int __sw_hweight16(unsigned int w); -extern unsigned int __sw_hweight32(unsigned int w); -extern unsigned long __sw_hweight64(__u64 w); - -/* - * Include this here because some architectures need generic_ffs/fls in - * scope - */ -#include <asm/bitops.h> - -#define for_each_set_bit(bit, addr, size) \ - for ((bit) = find_first_bit((addr), (size)); \ - (bit) < (size); \ - (bit) = find_next_bit((addr), (size), (bit) + 1)) - -static __inline__ int get_bitmask_order(unsigned int count) -{ - int order; - - order = fls(count); - return order; /* We could be slightly more clever with -1 here... */ -} - -static __inline__ int get_count_order(unsigned int count) -{ - int order; - - order = fls(count) - 1; - if (count & (count - 1)) - order++; - return order; -} - -static inline unsigned long hweight_long(unsigned long w) -{ - return sizeof(w) == 4 ? hweight32(w) : hweight64(w); -} - -/** - * rol32 - rotate a 32-bit value left - * @word: value to rotate - * @shift: bits to roll - */ -static inline __u32 rol32(__u32 word, unsigned int shift) -{ - return (word << shift) | (word >> (32 - shift)); -} - -/** - * ror32 - rotate a 32-bit value right - * @word: value to rotate - * @shift: bits to roll - */ -static inline __u32 ror32(__u32 word, unsigned int shift) -{ - return (word >> shift) | (word << (32 - shift)); -} - -/** - * rol16 - rotate a 16-bit value left - * @word: value to rotate - * @shift: bits to roll - */ -static inline __u16 rol16(__u16 word, unsigned int shift) -{ - return (word << shift) | (word >> (16 - shift)); -} - -/** - * ror16 - rotate a 16-bit value right - * @word: value to rotate - * @shift: bits to roll - */ -static inline __u16 ror16(__u16 word, unsigned int shift) -{ - return (word >> shift) | (word << (16 - shift)); -} - -/** - * rol8 - rotate an 8-bit value left - * @word: value to rotate - * @shift: bits to roll - */ -static inline __u8 rol8(__u8 word, unsigned int shift) -{ - return (word << shift) | (word >> (8 - shift)); -} - -/** - * ror8 - rotate an 8-bit value right - * @word: value to rotate - * @shift: bits to roll - */ -static inline __u8 ror8(__u8 word, unsigned int shift) -{ - return (word >> shift) | (word << (8 - shift)); -} - -/** - * sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit - * @value: value to sign extend - * @index: 0 based bit index (0<=index<32) to sign bit - */ -static inline __s32 sign_extend32(__u32 value, int index) -{ - __u8 shift = 31 - index; - return (__s32)(value << shift) >> shift; -} - -static inline unsigned fls_long(unsigned long l) -{ - if (sizeof(l) == 4) - return fls(l); - return fls64(l); -} - -/** - * __ffs64 - find first set bit in a 64 bit word - * @word: The 64 bit word - * - * On 64 bit arches this is a synomyn for __ffs - * The result is not defined if no bits are set, so check that @word - * is non-zero before calling this. - */ -static inline unsigned long __ffs64(u64 word) -{ -#if BITS_PER_LONG == 32 - if (((u32)word) == 0UL) - return __ffs((u32)(word >> 32)) + 32; -#elif BITS_PER_LONG != 64 -#error BITS_PER_LONG not 32 or 64 -#endif - return __ffs((unsigned long)word); -} - -#ifdef __KERNEL__ -#ifdef CONFIG_GENERIC_FIND_FIRST_BIT - -/** - * find_first_bit - find the first set bit in a memory region - * @addr: The address to start the search at - * @size: The maximum size to search - * - * Returns the bit number of the first set bit. - */ -extern unsigned long find_first_bit(const unsigned long *addr, - unsigned long size); - -/** - * find_first_zero_bit - find the first cleared bit in a memory region - * @addr: The address to start the search at - * @size: The maximum size to search - * - * Returns the bit number of the first cleared bit. - */ -extern unsigned long find_first_zero_bit(const unsigned long *addr, - unsigned long size); -#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ - -#ifdef CONFIG_GENERIC_FIND_LAST_BIT -/** - * find_last_bit - find the last set bit in a memory region - * @addr: The address to start the search at - * @size: The maximum size to search - * - * Returns the bit number of the first set bit, or size. - */ -extern unsigned long find_last_bit(const unsigned long *addr, - unsigned long size); -#endif /* CONFIG_GENERIC_FIND_LAST_BIT */ - -#ifdef CONFIG_GENERIC_FIND_NEXT_BIT - -/** - * find_next_bit - find the next set bit in a memory region - * @addr: The address to base the search on - * @offset: The bitnumber to start searching at - * @size: The bitmap size in bits - */ -extern unsigned long find_next_bit(const unsigned long *addr, - unsigned long size, unsigned long offset); - -/** - * find_next_zero_bit - find the next cleared bit in a memory region - * @addr: The address to base the search on - * @offset: The bitnumber to start searching at - * @size: The bitmap size in bits - */ - -extern unsigned long find_next_zero_bit(const unsigned long *addr, - unsigned long size, - unsigned long offset); - -#endif /* CONFIG_GENERIC_FIND_NEXT_BIT */ -#endif /* __KERNEL__ */ -#endif diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.14.h b/openairITS/mac/DOT11/include/linux/compat-2.6.14.h deleted file mode 100644 index 1f19f7fee56..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.14.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef LINUX_26_14_COMPAT_H -#define LINUX_26_14_COMPAT_H - -#include <linux/version.h> - -/* Compat work for 2.6.14 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)) - -typedef unsigned int gfp_t; - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)) */ - -#endif /* LINUX_26_14_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.18.h b/openairITS/mac/DOT11/include/linux/compat-2.6.18.h deleted file mode 100644 index 5e0182b18a1..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.18.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef LINUX_26_18_COMPAT_H -#define LINUX_26_18_COMPAT_H - -#include <linux/version.h> - -/* Compat work for 2.6.18 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) - -#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) */ - -#endif /* LINUX_26_18_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.19.h b/openairITS/mac/DOT11/include/linux/compat-2.6.19.h deleted file mode 100644 index 1e648c0aeba..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.19.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef LINUX_26_19_COMPAT_H -#define LINUX_26_19_COMPAT_H - -#include <linux/version.h> - -/* Compat work for 2.6.19 */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) - -#include <linux/slab.h> - -static inline int -compat_kmem_cache_destroy(struct kmem_cache *cachep) -{ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) - return kmem_cache_destroy(cachep); -#else - kmem_cache_destroy(cachep); - return 0; -#endif -} - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) */ - -#endif /* LINUX_26_19_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.20.h b/openairITS/mac/DOT11/include/linux/compat-2.6.20.h deleted file mode 100644 index 14579e29cf8..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.20.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef LINUX_26_20_COMPAT_H -#define LINUX_26_20_COMPAT_H - -#include <linux/version.h> - -/* Compat work for 2.6.20 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) - -#include <linux/workqueue.h> - -typedef void (*work_func_t)(struct work_struct *work); -typedef void (*compat_work_func_t)(void *work); -static inline void (INIT_WORK)(struct work_struct *work, work_func_t func) -{ - INIT_WORK(work, (compat_work_func_t)func, work); -} -#undef INIT_WORK - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) */ - -#endif /* LINUX_26_20_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.21.h b/openairITS/mac/DOT11/include/linux/compat-2.6.21.h deleted file mode 100644 index 89ed6d9a435..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.21.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LINUX_26_21_COMPAT_H -#define LINUX_26_21_COMPAT_H - -#include <linux/version.h> - -/* Compat work for 2.6.21 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) - -#include <linux/sysctl.h> - -#define register_sysctl_table(table) \ - ({ \ - register_sysctl_table((table), 0); \ - }) - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) */ - -#endif /* LINUX_26_21_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.22.h b/openairITS/mac/DOT11/include/linux/compat-2.6.22.h deleted file mode 100644 index 7ca1b18ea0f..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.22.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef LINUX_26_22_COMPAT_H -#define LINUX_26_22_COMPAT_H - -#include <linux/version.h> - -/* Compat work for 2.6.21 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) - -#include <linux/pci.h> -#include <linux/skbuff.h> - -/* reuse ax25_ptr */ -#define ieee80211_ptr ax25_ptr - -#ifdef CONFIG_AX25 -#error Compat reuses the AX.25 pointer so that may not be enabled! -#endif - -static inline unsigned char *skb_mac_header(const struct sk_buff *skb) -{ - return skb->mac.raw; -} - -static inline void skb_set_mac_header(struct sk_buff *skb, int offset) -{ - skb->mac.raw = skb->data + offset; -} - -static inline void skb_reset_mac_header(struct sk_buff *skb) -{ - skb->mac.raw = skb->data; -} - -static inline void skb_reset_network_header(struct sk_buff *skb) -{ - skb->nh.raw = skb->data; -} - -static inline void skb_set_network_header(struct sk_buff *skb, int offset) -{ - skb->nh.raw = skb->data + offset; -} - -static inline void skb_set_transport_header(struct sk_buff *skb, int offset) -{ - skb->h.raw = skb->data + offset; -} - -static inline unsigned char *skb_transport_header(struct sk_buff *skb) -{ - return skb->h.raw; -} - -static inline unsigned char *skb_network_header(const struct sk_buff *skb) -{ - return skb->nh.raw; -} - -static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) -{ - return skb->tail; -} - -static inline struct iphdr *ip_hdr(const struct sk_buff *skb) -{ - return (struct iphdr *)skb_network_header(skb); -} - -static inline void skb_copy_from_linear_data(const struct sk_buff *skb, - void *to, - const unsigned int len) -{ - memcpy(to, skb->data, len); -} - -static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb, - const int offset, void *to, - const unsigned int len) -{ - memcpy(to, skb->data + offset, len); -} - -#define __maybe_unused __attribute__((unused)) - -#define uninitialized_var(x) x = x - -/* This will lead to very weird behaviour... */ -#define NLA_BINARY NLA_STRING - -static inline int pci_set_mwi(struct pci_dev *dev) -{ - return -ENOSYS; -} - -static inline void pci_clear_mwi(struct pci_dev *dev) -{ -} - -#define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) */ - -#endif /* LINUX_26_22_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.23.h b/openairITS/mac/DOT11/include/linux/compat-2.6.23.h deleted file mode 100644 index fbfb470d13b..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.23.h +++ /dev/null @@ -1,136 +0,0 @@ -#ifndef LINUX_26_23_COMPAT_H -#define LINUX_26_23_COMPAT_H - -#include <linux/version.h> - -/* Compat work for < 2.6.23 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) - -#include <linux/netdevice.h> -#include <linux/sched.h> -#include <linux/workqueue.h> -#include <linux/genetlink.h> -#include <net/sch_generic.h> - -/* - * Tell gcc if a function is cold. The compiler will assume any path - * directly leading to the call is unlikely. - */ - -#if !(__GNUC__ == 4 && __GNUC_MINOR__ < 3) -/* Mark functions as cold. gcc will assume any path leading to a call - * to them will be unlikely. This means a lot of manual unlikely()s - * are unnecessary now for any paths leading to the usual suspects - * like BUG(), printk(), panic() etc. [but let's keep them for now for - * older compilers] - * - * Early snapshots of gcc 4.3 don't support this and we can't detect this - * in the preprocessor, but we can live with this because they're unreleased. - * Maketime probing would be overkill here. - * - * gcc also has a __attribute__((__hot__)) to move hot functions into - * a special section, but I don't see any sense in this right now in - * the kernel context */ -#define __cold __attribute__((__cold__)) -#endif /* gcc 4.3 check */ - -#ifndef __cold -#define __cold -#endif - -/* Added as of 2.6.23 in include/linux/netdevice.h */ -#define alloc_netdev_mq(sizeof_priv, name, setup, queue) \ - alloc_netdev(sizeof_priv, name, setup) -#define NETIF_F_MULTI_QUEUE 16384 - -/* Added as of 2.6.23 on include/linux/netdevice.h */ -static inline int netif_is_multiqueue(const struct net_device *dev) -{ - return (!!(NETIF_F_MULTI_QUEUE & dev->features)); -} - -/* 2.6.23 fixed a bug in tcf_destroy_chain and the parameter changed */ -static inline void tcf_destroy_chain_compat(struct tcf_proto **fl) -{ - struct tcf_proto *tp; - - while ((tp = *fl) != NULL) { - *fl = tp->next; - tp->ops->destroy(tp); - module_put(tp->ops->owner); - kfree(tp); - } -} - -/* dev_mc_list was replaced with dev_addr_list as of 2.6.23, - * only new member added is da_synced. */ -#define dev_addr_list dev_mc_list -#define da_addr dmi_addr -#define da_addrlen dmi_addrlen -#define da_users dmi_users -#define da_gusers dmi_gusers - -/* dev_set_promiscuity() was moved to __dev_set_promiscuity() on 2.6.23 and - * dev_set_promiscuity() became a wrapper. */ -#define __dev_set_promiscuity dev_set_promiscuity - -/* Our own 2.6.22 port on compat.c */ -extern void dev_mc_unsync(struct net_device *to, struct net_device *from); -extern int dev_mc_sync(struct net_device *to, struct net_device *from); - -/* Our own 2.6.22 port on compat.c */ -extern void __dev_set_rx_mode(struct net_device *dev); - -/* Simple to add this */ -extern int cancel_delayed_work_sync(struct delayed_work *work); - -#define cancel_delayed_work_sync cancel_rearming_delayed_work - -#define debugfs_rename(a, b, c, d) 1 - -/* nl80211 requires multicast group support which is new and added on - * 2.6.23. We can't add support for it for older kernels to support it - * genl_family structure was changed. Lets just let through the - * genl_register_mc_group call. This means no multicast group suppport */ - -#define genl_register_mc_group(a, b) 0 - -/** - * struct genl_multicast_group - generic netlink multicast group - * @name: name of the multicast group, names are per-family - * @id: multicast group ID, assigned by the core, to use with - * genlmsg_multicast(). - * @list: list entry for linking - * @family: pointer to family, need not be set before registering - */ -struct genl_multicast_group -{ - struct genl_family *family; /* private */ - struct list_head list; /* private */ - char name[GENL_NAMSIZ]; - u32 id; -}; - - -/* Added as of 2.6.23 */ -int pci_try_set_mwi(struct pci_dev *dev); - -/* Added as of 2.6.23 */ -#ifdef CONFIG_PM_SLEEP -/* - * Tell the freezer that the current task should be frozen by it - */ -static inline void set_freezable(void) -{ - current->flags &= ~PF_NOFREEZE; -} - -#else -static inline void set_freezable(void) {} -#endif /* CONFIG_PM_SLEEP */ - -#else -#define tcf_destroy_chain_compat tcf_destroy_chain -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) */ - -#endif /* LINUX_26_23_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.24.h b/openairITS/mac/DOT11/include/linux/compat-2.6.24.h deleted file mode 100644 index 456dcb6c2ae..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.24.h +++ /dev/null @@ -1,247 +0,0 @@ -#ifndef LINUX_26_24_COMPAT_H -#define LINUX_26_24_COMPAT_H - -#include <linux/version.h> - -/* Compat work for 2.6.21, 2.6.22 and 2.6.23 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) - -#include <asm/atomic.h> -#include <linux/netdevice.h> -#include <linux/skbuff.h> -#include <linux/usb.h> -#include <linux/types.h> -#include <linux/list.h> -#include <linux/scatterlist.h> - -#define KEY_BLUETOOTH 237 -#define KEY_WLAN 238 -#define KEY_UWB 239 - -#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) - -struct proc_dir_entry; -struct net_device; -struct net { - atomic_t count; /* To decided when the network - * namespace should be freed. - */ - atomic_t use_count; /* To track references we - * destroy on demand - */ - struct list_head list; /* list of network namespaces */ - struct work_struct work; /* work struct for freeing */ - - struct proc_dir_entry *proc_net; - struct proc_dir_entry *proc_net_stat; - struct proc_dir_entry *proc_net_root; - - struct net_device *loopback_dev; /* The loopback */ - - struct list_head dev_base_head; - struct hlist_head *dev_name_head; - struct hlist_head *dev_index_head; -}; - -#ifdef CONFIG_NET -/* Init's network namespace */ -extern struct net init_net; -#define INIT_NET_NS(net_ns) .net_ns = &init_net, -#else -#define INIT_NET_NS(net_ns) -#endif - -/* Added on 2.6.24 in include/linux/types.h by Al viro on commit 142956af */ -typedef unsigned long uintptr_t; - -/* From include/linux/net.h */ -enum sock_shutdown_cmd { - SHUT_RD = 0, - SHUT_WR = 1, - SHUT_RDWR = 2, -}; - -#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,23)) /* Local check */ -/* Added as of 2.6.24 in include/linux/skbuff.h. - * - * Although 2.6.23 does support for CONFIG_NETDEVICES_MULTIQUEUE - * this helper was not added until 2.6.24. This implementation - * is exactly as it is on newer kernels. - * - * For older kernels we use the an internal mac80211 hack. - * For details see changes to include/net/mac80211.h through - * compat.diff and compat/mq_compat.h */ -static inline u16 skb_get_queue_mapping(struct sk_buff *skb) -{ -#ifdef CONFIG_NETDEVICES_MULTIQUEUE - return skb->queue_mapping; -#else - return 0; -#endif -} -#endif /* Local 2.6.23 check */ - -/* On older kernels we handle this a bit differently, so we yield to that - * code for its implementation in mq_compat.h as we want to make - * use of the internal mac80211 __ieee80211_queue_stopped() which itself - * uses internal mac80211 data structure hacks. */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)) /* Local check */ -/** - * netif_subqueue_stopped - test status of subqueue - * @dev: network device - * @queue_index: sub queue index - * - * Check individual transmit queue of a device with multiple transmit queues. - */ -static inline int __netif_subqueue_stopped(const struct net_device *dev, - u16 queue_index) -{ -#ifdef CONFIG_NETDEVICES_MULTIQUEUE - return test_bit(__LINK_STATE_XOFF, - &dev->egress_subqueue[queue_index].state); -#else - return 0; -#endif -} - -/* Note: although the backport implementation for netif_subqueue_stopped - * on older kernels is identical to upstream __netif_subqueue_stopped() - * (except for a const qualifier) we implement netif_subqueue_stopped() - * as part of mac80211 as it relies on internal mac80211 structures we - * use for MQ support. We this implement it in mq_compat.h */ - -#endif /* Local 2.6.23 check */ - -/* - * Force link bug if constructor is used, can't be done compatibly - * because constructor arguments were swapped since then! - */ -extern void __incompatible_kmem_cache_create(void); - -/* 2.6.21 and 2.6.22 kmem_cache_create() takes 6 arguments */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) -#define kmem_cache_create(name, objsize, align, flags, ctor) \ - ({ \ - if (ctor) __incompatible_kmem_cache_create(); \ - kmem_cache_create((name), (objsize), (align), \ - (flags), NULL, NULL); \ - }) -#endif - -/* 2.6.23 kmem_cache_create() takes 5 arguments */ -#if (LINUX_VERSION_CODE == KERNEL_VERSION(2,6,23)) -#define kmem_cache_create(name, objsize, align, flags, ctor) \ - ({ \ - if (ctor) __incompatible_kmem_cache_create(); \ - kmem_cache_create((name), (objsize), (align), \ - (flags), NULL); \ - }) -#endif - -/* From include/linux/mod_devicetable.h */ - -/* SSB core, see drivers/ssb/ */ -#ifndef SSB_DEVICE -struct ssb_device_id { - __u16 vendor; - __u16 coreid; - __u8 revision; -}; -#define SSB_DEVICE(_vendor, _coreid, _revision) \ - { .vendor = _vendor, .coreid = _coreid, .revision = _revision, } -#define SSB_DEVTABLE_END \ - { 0, }, - -#define SSB_ANY_VENDOR 0xFFFF -#define SSB_ANY_ID 0xFFFF -#define SSB_ANY_REV 0xFF -#endif - - -/* Namespace stuff, introduced on 2.6.24 */ -#define dev_get_by_index(a, b) dev_get_by_index(b) -#define __dev_get_by_index(a, b) __dev_get_by_index(b) - -extern int eth_header(struct sk_buff *skb, struct net_device *dev, - unsigned short type, void *daddr, - void *saddr, unsigned len); -extern int eth_rebuild_header(struct sk_buff *skb); -extern void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev, - unsigned char * haddr); -extern int eth_header_cache(struct neighbour *neigh, - struct hh_cache *hh); - -/* This structure is simply not present on 2.6.22 and 2.6.23 */ -struct header_ops { - int (*create) (struct sk_buff *skb, struct net_device *dev, - unsigned short type, void *daddr, - void *saddr, unsigned len); - int (*parse)(const struct sk_buff *skb, unsigned char *haddr); - int (*rebuild)(struct sk_buff *skb); - #define HAVE_HEADER_CACHE - int (*cache)(struct neighbour *neigh, struct hh_cache *hh); - void (*cache_update)(struct hh_cache *hh, - struct net_device *dev, - unsigned char *haddr); -}; - -/* net/ieee80211/ieee80211_crypt_tkip uses sg_init_table. This was added on - * 2.6.24. CONFIG_DEBUG_SG was added in 2.6.24 as well, so lets just ignore - * the debug stuff. Note that adding this required changes to the struct - * scatterlist on include/asm/scatterlist*, so the right way to port this - * is to simply ignore the new structure changes and zero the scatterlist - * array. We lave the kdoc intact for reference. - */ - -/** - * sg_mark_end - Mark the end of the scatterlist - * @sg: SG entryScatterlist - * - * Description: - * Marks the passed in sg entry as the termination point for the sg - * table. A call to sg_next() on this entry will return NULL. - * - **/ -static inline void sg_mark_end(struct scatterlist *sg) -{ -#ifdef CONFIG_DEBUG_SG - BUG_ON(sg->sg_magic != SG_MAGIC); -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) - /* - * Set termination bit, clear potential chain bit - */ - sg->page_link |= 0x02; - sg->page_link &= ~0x01; -#endif -} - -/** - * sg_init_table - Initialize SG table - * @sgl: The SG table - * @nents: Number of entries in table - * - * Notes: - * If this is part of a chained sg table, sg_mark_end() should be - * used only on the last table part. - * - **/ -static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents) -{ - memset(sgl, 0, sizeof(*sgl) * nents); -} - -/** - * usb_endpoint_num - get the endpoint's number - * @epd: endpoint to be checked - * - * Returns @epd's number: 0 to 15. - */ -static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd) -{ - return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; -} - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) */ - -#endif /* LINUX_26_24_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.25.h b/openairITS/mac/DOT11/include/linux/compat-2.6.25.h deleted file mode 100644 index d0cd50b5b46..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.25.h +++ /dev/null @@ -1,274 +0,0 @@ -#ifndef LINUX_26_25_COMPAT_H -#define LINUX_26_25_COMPAT_H - -#include <linux/version.h> - -/* Compat work for 2.6.24 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) - -#include <linux/types.h> -#include <linux/io.h> -#include <linux/hw_random.h> -#include <linux/leds.h> -#include <linux/kernel.h> -#include <linux/netdevice.h> -#include <linux/pm.h> -#include <asm-generic/bug.h> -#include <linux/pm_qos_params.h> -#include <linux/pci.h> -#include <linux/in.h> -#include <linux/errno.h> -#include <linux/init.h> - -/* - * Backports 312b1485fb509c9bc32eda28ad29537896658cb8 - * Author: Sam Ravnborg <sam@ravnborg.org> - * Date: Mon Jan 28 20:21:15 2008 +0100 - * - * Introduce new section reference annotations tags: __ref, __refdata, __refconst - */ -#define __ref __init_refok -#define __refdata __initdata_refok - -/* - * backports 2658fa803111dae1353602e7f586de8e537803e2 - * We skip proto_ports_offset() as I'm lazy. - */ - -static inline bool ipv4_is_loopback(__be32 addr) -{ - return (addr & htonl(0xff000000)) == htonl(0x7f000000); -} - -static inline bool ipv4_is_multicast(__be32 addr) -{ - return (addr & htonl(0xf0000000)) == htonl(0xe0000000); -} - -static inline bool ipv4_is_local_multicast(__be32 addr) -{ - return (addr & htonl(0xffffff00)) == htonl(0xe0000000); -} - -static inline bool ipv4_is_lbcast(__be32 addr) -{ - /* limited broadcast */ - return addr == htonl(INADDR_BROADCAST); -} - -static inline bool ipv4_is_zeronet(__be32 addr) -{ - return (addr & htonl(0xff000000)) == htonl(0x00000000); -} - -/* Special-Use IPv4 Addresses (RFC3330) */ - -static inline bool ipv4_is_private_10(__be32 addr) -{ - return (addr & htonl(0xff000000)) == htonl(0x0a000000); -} - -static inline bool ipv4_is_private_172(__be32 addr) -{ - return (addr & htonl(0xfff00000)) == htonl(0xac100000); -} - -static inline bool ipv4_is_private_192(__be32 addr) -{ - return (addr & htonl(0xffff0000)) == htonl(0xc0a80000); -} - -static inline bool ipv4_is_linklocal_169(__be32 addr) -{ - return (addr & htonl(0xffff0000)) == htonl(0xa9fe0000); -} - -static inline bool ipv4_is_anycast_6to4(__be32 addr) -{ - return (addr & htonl(0xffffff00)) == htonl(0xc0586300); -} - -static inline bool ipv4_is_test_192(__be32 addr) -{ - return (addr & htonl(0xffffff00)) == htonl(0xc0000200); -} - -static inline bool ipv4_is_test_198(__be32 addr) -{ - return (addr & htonl(0xfffe0000)) == htonl(0xc6120000); -} - -/* - * phys_addr_t was added as a generic arch typedef on 2.6.28, - * that backport is dealt with in compat-2.6.28.h - */ -#if defined(CONFIG_X86) || defined(CONFIG_X86_64) - -#if defined(CONFIG_64BIT) || defined(CONFIG_X86_PAE) || defined(CONFIG_PHYS_64BIT) -typedef u64 phys_addr_t; -#else -typedef u32 phys_addr_t; -#endif - -#endif /* x86 */ - -/* The macro below uses a const upstream, this differs */ - -/** - * DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table - * @_table: device table name - * - * This macro is used to create a struct pci_device_id array (a device table) - * in a generic manner. - */ -#define DEFINE_PCI_DEVICE_TABLE(_table) \ - const struct pci_device_id _table[] __devinitdata - -/* - * Backport work for QoS dependencies (kernel/pm_qos_params.c) - * pm-qos stuff written by mark gross mgross@linux.intel.com. - * - * ipw2100 now makes use of: - * - * pm_qos_add_requirement(), - * pm_qos_update_requirement() and - * pm_qos_remove_requirement() from it - * - * mac80211 uses the network latency to determine if to enable or not - * dynamic PS. mac80211 also and registers a notifier for when - * the latency changes. Since older kernels do no thave pm-qos stuff - * we just implement it completley here and register it upon cfg80211 - * init. I haven't tested ipw2100 on 2.6.24 though. - * - * This pm-qos implementation is copied verbatim from the kernel - * written by mark gross mgross@linux.intel.com. You don't have - * to do anythinig to use pm-qos except use the same exported - * routines as used in newer kernels. The compat_pm_qos_power_init() - * defned below is used by the compat module to initialize pm-qos. - */ -int compat_pm_qos_power_init(void); -int compat_pm_qos_power_deinit(void); - -/* - * 2.6.25 adds PM_EVENT_HIBERNATE as well here but - * we don't have this on <= 2.6.23) - */ -#ifndef PM_EVENT_SLEEP /* some distribution have mucked with their own headers to add this.. */ -#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND) -#endif - -/* Although we don't care about wimax this is needed for rfkill input stuff */ -#define KEY_WIMAX 246 - -/* Although pm_qos stuff is not implemented on <= 2.6.24 lets keep the define */ -#define PM_QOS_DEFAULT_VALUE -1 - -#define __WARN(foo) dump_stack() - -#define dev_emerg(dev, format, arg...) \ - dev_printk(KERN_EMERG , dev , format , ## arg) -#define dev_alert(dev, format, arg...) \ - dev_printk(KERN_ALERT , dev , format , ## arg) -#define dev_crit(dev, format, arg...) \ - dev_printk(KERN_CRIT , dev , format , ## arg) - -extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count); -extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count); - -#define seq_file_net &init_net; - -enum nf_inet_hooks { - NF_INET_PRE_ROUTING = 0, - NF_INET_LOCAL_IN = 1, - NF_INET_FORWARD = 2, - NF_INET_LOCAL_OUT = 3, - NF_INET_POST_ROUTING = 4, - NF_INET_NUMHOOKS = 5 -}; - -/* The patch: - * commit 8b5f6883683c91ad7e1af32b7ceeb604d68e2865 - * Author: Marcin Slusarz <marcin.slusarz@gmail.com> - * Date: Fri Feb 8 04:20:12 2008 -0800 - * - * byteorder: move le32_add_cpu & friends from OCFS2 to core - * - * moves le*_add_cpu and be*_add_cpu functions from OCFS2 to core - * header (1st) and converted some existing code to it. We port - * it here as later kernels will most likely use it. - */ -static inline void le16_add_cpu(__le16 *var, u16 val) -{ - *var = cpu_to_le16(le16_to_cpu(*var) + val); -} - -static inline void le32_add_cpu(__le32 *var, u32 val) -{ - *var = cpu_to_le32(le32_to_cpu(*var) + val); -} - -static inline void le64_add_cpu(__le64 *var, u64 val) -{ - *var = cpu_to_le64(le64_to_cpu(*var) + val); -} - -static inline void be16_add_cpu(__be16 *var, u16 val) -{ - u16 v = be16_to_cpu(*var); - *var = cpu_to_be16(v + val); -} - -static inline void be32_add_cpu(__be32 *var, u32 val) -{ - u32 v = be32_to_cpu(*var); - *var = cpu_to_be32(v + val); -} - -static inline void be64_add_cpu(__be64 *var, u64 val) -{ - u64 v = be64_to_cpu(*var); - *var = cpu_to_be64(v + val); -} - -/* 2.6.25 changes hwrng_unregister()'s behaviour by supporting - * suspend of its parent device (the misc device, which is itself the - * hardware random number generator). It does this by passing a parameter to - * unregister_miscdev() which is not supported in older kernels. The suspend - * parameter allows us to enable access to the device's hardware - * number generator during suspend. As far as wireless is concerned this means - * if a driver goes to suspend it you won't have the HNR available in - * older kernels. */ -static inline void __hwrng_unregister(struct hwrng *rng, bool suspended) -{ - hwrng_unregister(rng); -} - -static inline void led_classdev_unregister_suspended(struct led_classdev *lcd) -{ - led_classdev_unregister(lcd); -} - -/** - * The following things are out of ./include/linux/kernel.h - * The new iwlwifi driver is using them. - */ -extern int strict_strtoul(const char *, unsigned int, unsigned long *); -extern int strict_strtol(const char *, unsigned int, long *); - -#else -/* - * Kernels >= 2.6.25 have pm-qos and its initialized as part of - * the bootup process - */ -static inline int compat_pm_qos_power_init(void) -{ - return 0; -} - -static inline int compat_pm_qos_power_deinit(void) -{ - return 0; -} -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) */ - -#endif /* LINUX_26_25_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.26.h b/openairITS/mac/DOT11/include/linux/compat-2.6.26.h deleted file mode 100644 index 177792a3753..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.26.h +++ /dev/null @@ -1,455 +0,0 @@ -#ifndef LINUX_26_26_COMPAT_H -#define LINUX_26_26_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) - -#include <linux/device.h> -#include <linux/list.h> -#include <linux/kernel.h> -#include <linux/jiffies.h> -#include <net/sock.h> -#include <linux/fs.h> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) -#include <net/net_namespace.h> -#endif -#include <linux/fs.h> -#include <linux/types.h> -#include <asm/div64.h> - -/* These jiffie helpers added as of 2.6.26 */ - -/* - * These four macros compare jiffies and 'a' for convenience. - */ - -/* time_is_before_jiffies(a) return true if a is before jiffies */ -#define time_is_before_jiffies(a) time_after(jiffies, a) - -/* time_is_after_jiffies(a) return true if a is after jiffies */ -#define time_is_after_jiffies(a) time_before(jiffies, a) - -/* time_is_before_eq_jiffies(a) return true if a is before or equal to jiffies*/ -#define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a) - -/* time_is_after_eq_jiffies(a) return true if a is after or equal to jiffies*/ -#define time_is_after_eq_jiffies(a) time_before_eq(jiffies, a) - -/* This comes from include/linux/input.h */ -#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" - set = radio enabled */ - -/* From kernel.h */ -#define USHORT_MAX ((u16)(~0U)) -#define SHORT_MAX ((s16)(USHORT_MAX>>1)) -#define SHORT_MIN (-SHORT_MAX - 1) - -extern int dev_set_name(struct device *dev, const char *name, ...) - __attribute__((format(printf, 2, 3))); - -/** - * clamp - return a value clamped to a given range with strict typechecking - * @val: current value - * @min: minimum allowable value - * @max: maximum allowable value - * - * This macro does strict typechecking of min/max to make sure they are of the - * same type as val. See the unnecessary pointer comparisons. - */ -#define clamp(val, min, max) ({ \ - typeof(val) __val = (val); \ - typeof(min) __min = (min); \ - typeof(max) __max = (max); \ - (void) (&__val == &__min); \ - (void) (&__val == &__max); \ - __val = __val < __min ? __min: __val; \ - __val > __max ? __max: __val; }) - -/** - * clamp_t - return a value clamped to a given range using a given type - * @type: the type of variable to use - * @val: current value - * @min: minimum allowable value - * @max: maximum allowable value - * - * This macro does no typechecking and uses temporary variables of type - * 'type' to make all the comparisons. - */ -#define clamp_t(type, val, min, max) ({ \ - type __val = (val); \ - type __min = (min); \ - type __max = (max); \ - __val = __val < __min ? __min: __val; \ - __val > __max ? __max: __val; }) - - -/* from include/linux/device.h */ -/* device_create_drvdata() is new */ -extern struct device *device_create_drvdata(struct class *cls, - struct device *parent, - dev_t devt, - void *drvdata, - const char *fmt, ...) -__attribute__((format(printf, 5, 6))); - -/* This is from include/linux/list.h */ - -/** - * list_is_singular - tests whether a list has just one entry. - * @head: the list to test. - */ -static inline int list_is_singular(const struct list_head *head) -{ - return !list_empty(head) && (head->next == head->prev); -} - -/* This is from include/linux/device.h, which was added as of 2.6.26 */ -static inline const char *dev_name(struct device *dev) -{ - /* will be changed into kobject_name(&dev->kobj) in the near future */ - return dev->bus_id; -} - -/* This is from include/linux/kernel.h, which was added as of 2.6.26 */ - -/** - * clamp_val - return a value clamped to a given range using val's type - * @val: current value - * @min: minimum allowable value - * @max: maximum allowable value - * - * This macro does no typechecking and uses temporary variables of whatever - * type the input argument 'val' is. This is useful when val is an unsigned - * type and min and max are literals that will otherwise be assigned a signed - * integer type. - */ - -#define clamp_val(val, min, max) ({ \ - typeof(val) __val = (val); \ - typeof(val) __min = (min); \ - typeof(val) __max = (max); \ - __val = __val < __min ? __min: __val; \ - __val > __max ? __max: __val; }) - -/* This comes from include/net/net_namespace.h */ - -#ifdef CONFIG_NET_NS -static inline -int net_eq(const struct net *net1, const struct net *net2) -{ - return net1 == net2; -} -#else -static inline -int net_eq(const struct net *net1, const struct net *net2) -{ - return 1; -} -#endif - -static inline -void dev_net_set(struct net_device *dev, struct net *net) -{ -#ifdef CONFIG_NET_NS - release_net(dev->nd_net); - dev->nd_net = hold_net(net); -#endif -} - -static inline -struct net *sock_net(const struct sock *sk) -{ -#ifdef CONFIG_NET_NS - return sk->sk_net; -#else - return &init_net; -#endif -} - -/* This comes from include/linux/netdevice.h */ - -/* - * Net namespace inlines - */ -static inline -struct net *dev_net(const struct net_device *dev) -{ -#ifdef CONFIG_NET_NS - /* - * compat-wirelss backport note: - * For older kernels we may just need to always return init_net, - * not sure when we added dev->nd_net. - */ - return dev->nd_net; -#else - return &init_net; -#endif -} - - -/* - * 2.6.26 added its own unaligned API which the - * new drivers can use. Lets port it here by including it in older - * kernels and also deal with the architecture handling here. - */ - -#ifdef CONFIG_ALPHA - -#include <linux/unaligned/be_struct.h> -#include <linux/unaligned/le_byteshift.h> -#include <linux/unaligned/generic.h> - -#endif /* alpha */ -#ifdef CONFIG_ARM - -/* arm */ -#include <linux/unaligned/le_byteshift.h> -#include <linux/unaligned/be_byteshift.h> -#include <linux/unaligned/generic.h> - -#endif /* arm */ -#ifdef CONFIG_AVR32 - -/* - * AVR32 can handle some unaligned accesses, depending on the - * implementation. The AVR32 AP implementation can handle unaligned - * words, but halfwords must be halfword-aligned, and doublewords must - * be word-aligned. - * - * However, swapped word loads must be word-aligned so we can't - * optimize word loads in general. - */ - -#include <linux/unaligned/be_struct.h> -#include <linux/unaligned/le_byteshift.h> -#include <linux/unaligned/generic.h> - -#endif -#ifdef CONFIG_BLACKFIN - -#include <linux/unaligned/le_struct.h> -#include <linux/unaligned/be_byteshift.h> -#include <linux/unaligned/generic.h> - -#endif /* blackfin */ -#ifdef CONFIG_CRIS - -/* - * CRIS can do unaligned accesses itself. - */ -#include <linux/unaligned/access_ok.h> -#include <linux/unaligned/generic.h> - -#endif /* cris */ -#ifdef CONFIG_FRV - -#include <linux/unaligned/le_byteshift.h> -#include <linux/unaligned/be_byteshift.h> -#include <linux/unaligned/generic.h> - -#endif /* frv */ -#ifdef CONFIG_H8300 - -#include <linux/unaligned/be_memmove.h> -#include <linux/unaligned/le_byteshift.h> -#include <linux/unaligned/generic.h> - -#endif /* h8300 */ -#ifdef CONFIG_IA64 - -#include <linux/unaligned/le_struct.h> -#include <linux/unaligned/be_byteshift.h> -#include <linux/unaligned/generic.h> - -#endif /* ia64 */ -#ifdef CONFIG_M32R - -#if defined(__LITTLE_ENDIAN__) -# include <linux/unaligned/le_memmove.h> -# include <linux/unaligned/be_byteshift.h> -# include <linux/unaligned/generic.h> -#else -# include <linux/unaligned/be_memmove.h> -# include <linux/unaligned/le_byteshift.h> -# include <linux/unaligned/generic.h> -#endif - -#endif /* m32r */ -#ifdef CONFIG_M68K /* this handles both m68k and m68knommu */ - -#ifdef CONFIG_COLDFIRE -#include <linux/unaligned/be_struct.h> -#include <linux/unaligned/le_byteshift.h> -#include <linux/unaligned/generic.h> -#else - -/* - * The m68k can do unaligned accesses itself. - */ -#include <linux/unaligned/access_ok.h> -#include <linux/unaligned/generic.h> -#endif - -#endif /* m68k and m68knommu */ -#ifdef CONFIG_MIPS - -#if defined(__MIPSEB__) -# include <linux/unaligned/be_struct.h> -# include <linux/unaligned/le_byteshift.h> -# include <linux/unaligned/generic.h> -# define get_unaligned __get_unaligned_be -# define put_unaligned __put_unaligned_be -#elif defined(__MIPSEL__) -# include <linux/unaligned/le_struct.h> -# include <linux/unaligned/be_byteshift.h> -# include <linux/unaligned/generic.h> -#endif - -#endif /* mips */ -#ifdef CONFIG_MN10300 - -#include <linux/unaligned/access_ok.h> -#include <linux/unaligned/generic.h> - -#endif /* mn10300 */ -#ifdef CONFIG_PARISC - -#include <linux/unaligned/be_struct.h> -#include <linux/unaligned/le_byteshift.h> -#include <linux/unaligned/generic.h> - -#endif /* parisc */ -#ifdef CONFIG_PPC -/* - * The PowerPC can do unaligned accesses itself in big endian mode. - */ -#include <linux/unaligned/access_ok.h> -#include <linux/unaligned/generic.h> - -#endif /* ppc */ -#ifdef CONFIG_S390 - -/* - * The S390 can do unaligned accesses itself. - */ -#include <linux/unaligned/access_ok.h> -#include <linux/unaligned/generic.h> - -#endif /* s390 */ -#ifdef CONFIG_SUPERH - -/* SH can't handle unaligned accesses. */ -#ifdef __LITTLE_ENDIAN__ -# include <linux/unaligned/le_struct.h> -# include <linux/unaligned/be_byteshift.h> -# include <linux/unaligned/generic.h> -#else -# include <linux/unaligned/be_struct.h> -# include <linux/unaligned/le_byteshift.h> -# include <linux/unaligned/generic.h> -#endif - -#endif /* sh - SUPERH */ -#ifdef CONFIG_SPARC - -/* sparc and sparc64 */ -#include <linux/unaligned/be_struct.h> -#include <linux/unaligned/le_byteshift.h> -#include <linux/unaligned/generic.h> - -#endif /* sparc */ -#ifdef CONFIG_UML - -#include "asm/arch/unaligned.h" - -#endif /* um - uml */ -#ifdef CONFIG_V850 - -#include <linux/unaligned/be_byteshift.h> -#include <linux/unaligned/le_byteshift.h> -#include <linux/unaligned/generic.h> - -#endif /* v850 */ -#ifdef CONFIG_X86 -/* - * The x86 can do unaligned accesses itself. - */ -#include <linux/unaligned/access_ok.h> -#include <linux/unaligned/generic.h> - -#endif /* x86 */ -#ifdef CONFIG_XTENSA - -#ifdef __XTENSA_EL__ -# include <linux/unaligned/le_memmove.h> -# include <linux/unaligned/be_byteshift.h> -# include <linux/unaligned/generic.h> -#elif defined(__XTENSA_EB__) -# include <linux/unaligned/be_memmove.h> -# include <linux/unaligned/le_byteshift.h> -# include <linux/unaligned/generic.h> -#else -# error processor byte order undefined! -#endif - -#endif /* xtensa */ - -#define PCIE_LINK_STATE_L0S 1 -#define PCIE_LINK_STATE_L1 2 -#define PCIE_LINK_STATE_CLKPM 4 - -static inline void pci_disable_link_state(struct pci_dev *pdev, int state) -{ -} -/* source: include/linux/pci-aspm.h */ - - -#if BITS_PER_LONG == 64 - -/** - * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder - * - * This is commonly provided by 32bit archs to provide an optimized 64bit - * divide. - */ -static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) -{ - *remainder = dividend % divisor; - return dividend / divisor; -} - -#elif BITS_PER_LONG == 32 - -#ifndef div_u64_rem -static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) -{ - *remainder = do_div(dividend, divisor); - return dividend; -} -#endif - -#endif /* BITS_PER_LONG */ - -/** - * div_u64 - unsigned 64bit divide with 32bit divisor - * - * This is the most common 64bit divide and should be used if possible, - * as many 32bit archs can optimize this variant better than a full 64bit - * divide. - */ -#ifndef div_u64 -static inline u64 div_u64(u64 dividend, u32 divisor) -{ - u32 remainder; - return div_u64_rem(dividend, divisor, &remainder); -} -#endif -/* source: include/math64.h */ - -#define hex_asc_lo(x) hex_asc((x) & 0x0f) -#define hex_asc_hi(x) hex_asc(((x) & 0xf0) >> 4) - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) */ - -#endif /* LINUX_26_26_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.27.h b/openairITS/mac/DOT11/include/linux/compat-2.6.27.h deleted file mode 100644 index 1e2af806a44..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.27.h +++ /dev/null @@ -1,263 +0,0 @@ -#ifndef LINUX_26_27_COMPAT_H -#define LINUX_26_27_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) - -#include <linux/debugfs.h> -#include <linux/list.h> -#include <linux/pci.h> -#include <linux/dma-mapping.h> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) -#include <linux/mmc/sdio.h> -#include <linux/mmc/sdio_func.h> -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) */ -#include <linux/netdevice.h> -#include <linux/workqueue.h> -#include <net/iw_handler.h> -#include <asm-generic/bug.h> -#include <linux/wireless.h> -#include <linux/skbuff.h> -#include <net/sch_generic.h> -#include <linux/ethtool.h> - -#define PCI_PM_CAP_PME_SHIFT 11 - -/* I can't find a more suitable replacement... */ -#define flush_work(work) cancel_work_sync(work) - -struct builtin_fw { - char *name; - void *data; - unsigned long size; -}; - -/* - * On older kernels we do not have net_device Multi Queue support, but - * since we no longer use MQ on mac80211 we can simply use the 0 queue. - * Note that if other fullmac drivers make use of this they then need - * to be backported somehow or deal with just 1 queueue from MQ. - */ -static inline void netif_tx_wake_all_queues(struct net_device *dev) -{ - netif_wake_queue(dev); -} -static inline void netif_tx_start_all_queues(struct net_device *dev) -{ - netif_start_queue(dev); -} -static inline void netif_tx_stop_all_queues(struct net_device *dev) -{ - netif_stop_queue(dev); -} - -/* Are all TX queues of the device empty? */ -static inline bool qdisc_all_tx_empty(const struct net_device *dev) -{ - return skb_queue_empty(&dev->qdisc->q); -} - -bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); - -/* - * The net_device has a spin_lock on newer kernels, on older kernels we're out of luck - */ -#define netif_addr_lock_bh(dev) -#define netif_addr_unlock_bh(dev) - -/* - * To port this properly we'd have to port warn_slowpath_null(), - * which I'm lazy to do so just do a regular print for now. If you - * want to port this read kernel/panic.c - */ -#define __WARN_printf(arg...) do { printk(arg); __WARN(); } while (0) - -/* This is ported directly as-is on newer kernels */ -#ifndef WARN -#define WARN(condition, format...) ({ \ - int __ret_warn_on = !!(condition); \ - if (unlikely(__ret_warn_on)) \ - __WARN_printf(format); \ - unlikely(__ret_warn_on); \ -}) -#endif - -/* On 2.6.27 a second argument was added, on older kernels we ignore it */ -#define dma_mapping_error(pdev, dma_addr) dma_mapping_error(dma_addr) -#define pci_dma_mapping_error(pdev, dma_addr) dma_mapping_error(pdev, dma_addr) - -/* This is from include/linux/ieee80211.h */ -#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 - -/* New link list changes added as of 2.6.27, needed for ath9k */ - -static inline void __list_cut_position(struct list_head *list, - struct list_head *head, struct list_head *entry) -{ - struct list_head *new_first = entry->next; - list->next = head->next; - list->next->prev = list; - list->prev = entry; - entry->next = list; - head->next = new_first; - new_first->prev = head; -} - -/** - * list_cut_position - cut a list into two - * @list: a new list to add all removed entries - * @head: a list with entries - * @entry: an entry within head, could be the head itself - * and if so we won't cut the list - * - * This helper moves the initial part of @head, up to and - * including @entry, from @head to @list. You should - * pass on @entry an element you know is on @head. @list - * should be an empty list or a list you do not care about - * losing its data. - * - */ -static inline void list_cut_position(struct list_head *list, - struct list_head *head, struct list_head *entry) -{ - if (list_empty(head)) - return; - if (list_is_singular(head) && - (head->next != entry && head != entry)) - return; - if (entry == head) - INIT_LIST_HEAD(list); - else - __list_cut_position(list, head, entry); -} - - -/* __list_splice as re-implemented on 2.6.27, we backport it */ -static inline void __compat_list_splice_new_27(const struct list_head *list, - struct list_head *prev, - struct list_head *next) -{ - struct list_head *first = list->next; - struct list_head *last = list->prev; - - first->prev = prev; - prev->next = first; - - last->next = next; - next->prev = last; -} - -/** - * list_splice_tail - join two lists, each list being a queue - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -static inline void list_splice_tail(struct list_head *list, - struct list_head *head) -{ - if (!list_empty(list)) - __compat_list_splice_new_27(list, head->prev, head); -} - -/** - * list_splice_tail_init - join two lists and reinitialise the emptied list - * @list: the new list to add. - * @head: the place to add it in the first list. - * - * Each of the lists is a queue. - * The list at @list is reinitialised - */ -static inline void list_splice_tail_init(struct list_head *list, - struct list_head *head) -{ - if (!list_empty(list)) { - __compat_list_splice_new_27(list, head->prev, head); - INIT_LIST_HEAD(list); - } -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) -extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int); -extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz); -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) */ - -#define iwe_stream_add_value(info, event, value, ends, iwe, event_len) iwe_stream_add_value(event, value, ends, iwe, event_len) -#define iwe_stream_add_point(info, stream, ends, iwe, extra) iwe_stream_add_point(stream, ends, iwe, extra) -#define iwe_stream_add_event(info, stream, ends, iwe, event_len) iwe_stream_add_event(stream, ends, iwe, event_len) - -/* Flags available in struct iw_request_info */ -#define IW_REQUEST_FLAG_COMPAT 0x0001 /* Compat ioctl call */ - -static inline int iwe_stream_lcp_len(struct iw_request_info *info) -{ -#ifdef CONFIG_COMPAT - if (info->flags & IW_REQUEST_FLAG_COMPAT) - return IW_EV_COMPAT_LCP_LEN; -#endif - return IW_EV_LCP_LEN; -} - -#ifdef CONFIG_ARM - -/* - * The caller asks to handle a range between offset and offset + size, - * but we process a larger range from 0 to offset + size due to lack of - * offset support. - */ - -static inline void dma_sync_single_range_for_cpu(struct device *dev, - dma_addr_t handle, unsigned long offset, size_t size, - enum dma_data_direction dir) -{ - dma_sync_single_for_cpu(dev, handle, offset + size, dir); -} - -static inline void dma_sync_single_range_for_device(struct device *dev, - dma_addr_t handle, unsigned long offset, size_t size, - enum dma_data_direction dir) -{ - dma_sync_single_for_device(dev, handle, offset + size, dir); -} - -#endif /* arm */ - -#if defined(CONFIG_DEBUG_FS) -void debugfs_remove_recursive(struct dentry *dentry); -#else -static inline void debugfs_remove_recursive(struct dentry *dentry) -{ } -#endif - -#define device_create(cls, parent, devt, drvdata, fmt, ...) \ -({ \ - struct device *_dev; \ - _dev = (device_create)(cls, parent, devt, fmt, __VA_ARGS__); \ - dev_set_drvdata(_dev, drvdata); \ - _dev; \ -}) - -#define dev_name(dev) dev_name((struct device *)dev) - -static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, - __u32 speed) -{ - ep->speed = (__u16)speed; -} - -static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep) -{ - return ep->speed; -} - -/** - * lower_32_bits - return bits 0-31 of a number - * @n: the number we're accessing - */ -#define lower_32_bits(n) ((u32)(n)) - -#define netif_wake_subqueue netif_start_subqueue - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) */ - -#endif /* LINUX_26_27_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.28.h b/openairITS/mac/DOT11/include/linux/compat-2.6.28.h deleted file mode 100644 index 3980989ee36..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.28.h +++ /dev/null @@ -1,268 +0,0 @@ -#ifndef LINUX_26_28_COMPAT_H -#define LINUX_26_28_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) - -#include <linux/skbuff.h> -#include <linux/if_ether.h> -#include <linux/usb.h> -#include <linux/types.h> -#include <linux/types.h> -#include <linux/cpumask.h> - -#ifndef ETH_P_PAE -#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ -#endif - -#include <linux/pci.h> - -typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } compat_cpumask_t; - -#if defined(CONFIG_X86) || defined(CONFIG_X86_64) || defined(CONFIG_PPC) -/* - * CONFIG_PHYS_ADDR_T_64BIT was added as new to all architectures - * as of 2.6.28 but x86 and ppc had it already. x86 only got phys_addr_t - * as of 2.6.25 but then is backported in compat-2.6.25.h - */ -#else -#if defined(CONFIG_64BIT) || defined(CONFIG_X86_PAE) || defned(CONFIG_PPC64) || defined(CONFIG_PHYS_64BIT) -#define CONFIG_PHYS_ADDR_T_64BIT 1 -typedef u64 phys_addr_t; -#else -typedef u32 phys_addr_t; -#endif - -#endif /* non x86 and ppc */ - -#ifndef WARN_ONCE -#define WARN_ONCE(condition, format...) ({ \ - static int __warned; \ - int __ret_warn_once = !!(condition); \ - \ - if (unlikely(__ret_warn_once)) \ - if (WARN(!__warned, format)) \ - __warned = 1; \ - unlikely(__ret_warn_once); \ -}) -#endif /* From include/asm-generic/bug.h */ - -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) - -#include <pcmcia/cs_types.h> -#include <pcmcia/cs.h> -#include <pcmcia/cistpl.h> -#ifdef pcmcia_parse_tuple -#undef pcmcia_parse_tuple -#define pcmcia_parse_tuple(tuple, parse) pccard_parse_tuple(tuple, parse) -#endif - -/* From : include/pcmcia/ds.h */ -/* loop CIS entries for valid configuration */ -int pcmcia_loop_config(struct pcmcia_device *p_dev, - int (*conf_check) (struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - cistpl_cftable_entry_t *dflt, - unsigned int vcc, - void *priv_data), - void *priv_data); - -#endif /* CONFIG_PCMCIA */ - -/* USB anchors were added as of 2.6.23 */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)) - -#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE) -#if 0 -extern void usb_poison_urb(struct urb *urb); -#endif -extern void usb_unpoison_urb(struct urb *urb); - -#if 0 -extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); -#endif - -extern int usb_anchor_empty(struct usb_anchor *anchor); -#endif /* CONFIG_USB */ -#endif - - -void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar); - -/** - * skb_queue_is_last - check if skb is the last entry in the queue - * @list: queue head - * @skb: buffer - * - * Returns true if @skb is the last buffer on the list. - */ -static inline bool skb_queue_is_last(const struct sk_buff_head *list, - const struct sk_buff *skb) -{ - return (skb->next == (struct sk_buff *) list); -} - -/** - * skb_queue_next - return the next packet in the queue - * @list: queue head - * @skb: current buffer - * - * Return the next packet in @list after @skb. It is only valid to - * call this if skb_queue_is_last() evaluates to false. - */ -static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list, - const struct sk_buff *skb) -{ - /* This BUG_ON may seem severe, but if we just return then we - * are going to dereference garbage. - */ - BUG_ON(skb_queue_is_last(list, skb)); - return skb->next; -} - -/** - * __skb_queue_head_init - initialize non-spinlock portions of sk_buff_head - * @list: queue to initialize - * - * This initializes only the list and queue length aspects of - * an sk_buff_head object. This allows to initialize the list - * aspects of an sk_buff_head without reinitializing things like - * the spinlock. It can also be used for on-stack sk_buff_head - * objects where the spinlock is known to not be used. - */ -static inline void __skb_queue_head_init(struct sk_buff_head *list) -{ - list->prev = list->next = (struct sk_buff *)list; - list->qlen = 0; -} - -static inline void __skb_queue_splice(const struct sk_buff_head *list, - struct sk_buff *prev, - struct sk_buff *next) -{ - struct sk_buff *first = list->next; - struct sk_buff *last = list->prev; - - first->prev = prev; - prev->next = first; - - last->next = next; - next->prev = last; -} - -/** - * skb_queue_splice - join two skb lists, this is designed for stacks - * @list: the new list to add - * @head: the place to add it in the first list - */ -static inline void skb_queue_splice(const struct sk_buff_head *list, - struct sk_buff_head *head) -{ - if (!skb_queue_empty(list)) { - __skb_queue_splice(list, (struct sk_buff *) head, head->next); - head->qlen += list->qlen; - } -} - -/** - * skb_queue_splice - join two skb lists and reinitialise the emptied list - * @list: the new list to add - * @head: the place to add it in the first list - * - * The list at @list is reinitialised - */ -static inline void skb_queue_splice_init(struct sk_buff_head *list, - struct sk_buff_head *head) -{ - if (!skb_queue_empty(list)) { - __skb_queue_splice(list, (struct sk_buff *) head, head->next); - head->qlen += list->qlen; - __skb_queue_head_init(list); - } -} - -/** - * skb_queue_splice_tail - join two skb lists and reinitialise the emptied list - * @list: the new list to add - * @head: the place to add it in the first list - * - * Each of the lists is a queue. - * The list at @list is reinitialised - */ -static inline void skb_queue_splice_tail_init(struct sk_buff_head *list, - struct sk_buff_head *head) -{ - if (!skb_queue_empty(list)) { - __skb_queue_splice(list, head->prev, (struct sk_buff *) head); - head->qlen += list->qlen; - __skb_queue_head_init(list); - } -} /* From include/linux/skbuff.h */ - -/** - * skb_queue_splice_tail - join two skb lists, each list being a queue - * @list: the new list to add - * @head: the place to add it in the first list - */ -static inline void skb_queue_splice_tail(const struct sk_buff_head *list, - struct sk_buff_head *head) -{ - if (!skb_queue_empty(list)) { - __skb_queue_splice(list, head->prev, (struct sk_buff *) head); - head->qlen += list->qlen; - } -} - -#ifndef DECLARE_TRACE - -#define TP_PROTO(args...) args -#define TP_ARGS(args...) args - -#define DECLARE_TRACE(name, proto, args) \ - static inline void _do_trace_##name(struct tracepoint *tp, proto) \ - { } \ - static inline void trace_##name(proto) \ - { } \ - static inline int register_trace_##name(void (*probe)(proto)) \ - { \ - return -ENOSYS; \ - } \ - static inline int unregister_trace_##name(void (*probe)(proto)) \ - { \ - return -ENOSYS; \ - } - -#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) -#define EXPORT_TRACEPOINT_SYMBOL(name) - - -#endif - -/* openSuse includes round_jiffies_up in it's kernel 2.6.27. - * This is needed to prevent conflicts with the openSuse definition. - */ -#define round_jiffies_up backport_round_jiffies_up - -unsigned long round_jiffies_up(unsigned long j); - -extern void v2_6_28_skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page, - int off, int size); - -#define wake_up_interruptible_poll(x, m) \ - __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m)) - -extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file, - unsigned int cmd, unsigned long arg); - -int pci_wake_from_d3(struct pci_dev *dev, bool enable); - -#define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active) - -#ifndef pr_fmt -#define pr_fmt(fmt) fmt -#endif - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */ - -#endif /* LINUX_26_28_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.29.h b/openairITS/mac/DOT11/include/linux/compat-2.6.29.h deleted file mode 100644 index 48b62e8a391..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.29.h +++ /dev/null @@ -1,379 +0,0 @@ -#ifndef LINUX_26_29_COMPAT_H -#define LINUX_26_29_COMPAT_H - -#include <linux/version.h> -#include <linux/netdevice.h> -#include <linux/if_link.h> - -/* - * I kow this looks odd.. but 2.6.32 added the netdev_tx_t - * and we backport that there so inlcude that header first - * as we need it for the netdev ops. - */ -#include <linux/compat-2.6.32.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) - -#include <linux/skbuff.h> -#include <linux/usb.h> -#include <linux/types.h> - -/* backports */ -static inline void usb_autopm_put_interface_async(struct usb_interface *intf) -{ } -static inline int usb_autopm_get_interface_async(struct usb_interface *intf) -{ return 0; } - -#if \ - defined(CONFIG_ALPHA) || defined(CONFIG_AVR32) || \ - defined(CONFIG_BLACKFIN) || defined(CONFIG_CRIS) || \ - defined(CONFIG_H8300) || defined(CONFIG_IA64) || \ - defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \ - defined(CONFIG_PARISC) || defined(CONFIG_S390) || \ - defined(CONFIG_PPC64) || defined(CONFIG_PPC32) || \ - defined(CONFIG_SUPERH) || defined(CONFIG_SPARC) || \ - defined(CONFIG_FRV) || defined(CONFIG_X86) || \ - defined(CONFIG_M32R) || defined(CONFIG_M68K) || \ - defined(CONFIG_MN10300) || defined(CONFIG_XTENSA) -#include <asm/atomic.h> -#else -typedef struct { - volatile int counter; -} atomic_t; - -#ifdef CONFIG_64BIT -typedef struct { - volatile long counter; -} atomic64_t; -#endif /* CONFIG_64BIT */ - -#endif - -#define PCI_EXP_LNKCTL_ES 0x0080 /* Extended Synch */ - -/* - * Older kernels do not have struct net_device_ops but what we can - * do is just define the data structure and use a caller to let us - * set the data structure's routines onto the old netdev, essentially - * doing it the old way. This avoids huge deltas on our backports. - */ - -/* - * This structure defines the management hooks for network devices. - * The following hooks can be defined; unless noted otherwise, they are - * optional and can be filled with a null pointer. - * - * int (*ndo_init)(struct net_device *dev); - * This function is called once when network device is registered. - * The network device can use this to any late stage initializaton - * or semantic validattion. It can fail with an error code which will - * be propogated back to register_netdev - * - * void (*ndo_uninit)(struct net_device *dev); - * This function is called when device is unregistered or when registration - * fails. It is not called if init fails. - * - * int (*ndo_open)(struct net_device *dev); - * This function is called when network device transistions to the up - * state. - * - * int (*ndo_stop)(struct net_device *dev); - * This function is called when network device transistions to the down - * state. - * - * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb, - * struct net_device *dev); - * Called when a packet needs to be transmitted. - * Must return NETDEV_TX_OK , NETDEV_TX_BUSY. - * (can also return NETDEV_TX_LOCKED iff NETIF_F_LLTX) - * Required can not be NULL. - * - * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb); - * Called to decide which queue to when device supports multiple - * transmit queues. - * - * void (*ndo_change_rx_flags)(struct net_device *dev, int flags); - * This function is called to allow device receiver to make - * changes to configuration when multicast or promiscious is enabled. - * - * void (*ndo_set_rx_mode)(struct net_device *dev); - * This function is called device changes address list filtering. - * - * void (*ndo_set_multicast_list)(struct net_device *dev); - * This function is called when the multicast address list changes. - * - * int (*ndo_set_mac_address)(struct net_device *dev, void *addr); - * This function is called when the Media Access Control address - * needs to be changed. If this interface is not defined, the - * mac address can not be changed. - * - * int (*ndo_validate_addr)(struct net_device *dev); - * Test if Media Access Control address is valid for the device. - * - * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd); - * Called when a user request an ioctl which can't be handled by - * the generic interface code. If not defined ioctl's return - * not supported error code. - * - * int (*ndo_set_config)(struct net_device *dev, struct ifmap *map); - * Used to set network devices bus interface parameters. This interface - * is retained for legacy reason, new devices should use the bus - * interface (PCI) for low level management. - * - * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu); - * Called when a user wants to change the Maximum Transfer Unit - * of a device. If not defined, any request to change MTU will - * will return an error. - * - * void (*ndo_tx_timeout)(struct net_device *dev); - * Callback uses when the transmitter has not made any progress - * for dev->watchdog ticks. - * - * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); - * Called when a user wants to get the network device usage - * statistics. If not defined, the counters in dev->stats will - * be used. - * - * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp); - * If device support VLAN receive accleration - * (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called - * when vlan groups for the device changes. Note: grp is NULL - * if no vlan's groups are being used. - * - * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid); - * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) - * this function is called when a VLAN id is registered. - * - * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid); - * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER) - * this function is called when a VLAN id is unregistered. - * - * void (*ndo_poll_controller)(struct net_device *dev); - * - * SR-IOV management functions. - * int (*ndo_set_vf_mac)(struct net_device *dev, int vf, u8* mac); - * int (*ndo_set_vf_vlan)(struct net_device *dev, int vf, u16 vlan, u8 qos); - * int (*ndo_set_vf_tx_rate)(struct net_device *dev, int vf, int rate); - * int (*ndo_get_vf_config)(struct net_device *dev, - * int vf, struct ifla_vf_info *ivf); - */ -#define HAVE_NET_DEVICE_OPS -struct net_device_ops { - int (*ndo_init)(struct net_device *dev); - void (*ndo_uninit)(struct net_device *dev); - int (*ndo_open)(struct net_device *dev); - int (*ndo_stop)(struct net_device *dev); - netdev_tx_t (*ndo_start_xmit) (struct sk_buff *skb, - struct net_device *dev); - u16 (*ndo_select_queue)(struct net_device *dev, - struct sk_buff *skb); - void (*ndo_change_rx_flags)(struct net_device *dev, - int flags); - void (*ndo_set_rx_mode)(struct net_device *dev); - void (*ndo_set_multicast_list)(struct net_device *dev); - int (*ndo_set_mac_address)(struct net_device *dev, - void *addr); - int (*ndo_validate_addr)(struct net_device *dev); - int (*ndo_do_ioctl)(struct net_device *dev, - struct ifreq *ifr, int cmd); - int (*ndo_set_config)(struct net_device *dev, - struct ifmap *map); - int (*ndo_change_mtu)(struct net_device *dev, - int new_mtu); - int (*ndo_neigh_setup)(struct net_device *dev, - struct neigh_parms *); - void (*ndo_tx_timeout) (struct net_device *dev); - - struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); - - void (*ndo_vlan_rx_register)(struct net_device *dev, - struct vlan_group *grp); - void (*ndo_vlan_rx_add_vid)(struct net_device *dev, - unsigned short vid); - void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, - unsigned short vid); -#ifdef CONFIG_NET_POLL_CONTROLLER - void (*ndo_poll_controller)(struct net_device *dev); -#endif - int (*ndo_set_vf_mac)(struct net_device *dev, - int queue, u8 *mac); - int (*ndo_set_vf_vlan)(struct net_device *dev, - int queue, u16 vlan, u8 qos); - int (*ndo_set_vf_tx_rate)(struct net_device *dev, - int vf, int rate); -/* - * The struct ifla_vf_info was added via b280da8d54b8d82b52f368a8703b7ada6c1744d5 - * on the v2.6.34-rc1~233^2~338 release - */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) - int (*ndo_get_vf_config)(struct net_device *dev, - int vf, - struct ifla_vf_info *ivf); -#endif -#if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE) - int (*ndo_fcoe_enable)(struct net_device *dev); - int (*ndo_fcoe_disable)(struct net_device *dev); - int (*ndo_fcoe_ddp_setup)(struct net_device *dev, - u16 xid, - struct scatterlist *sgl, - unsigned int sgc); - int (*ndo_fcoe_ddp_done)(struct net_device *dev, - u16 xid); -#define NETDEV_FCOE_WWNN 0 -#define NETDEV_FCOE_WWPN 1 - int (*ndo_fcoe_get_wwn)(struct net_device *dev, - u64 *wwn, int type); -#endif -}; - -static inline int ndo_do_ioctl(struct net_device *dev, - struct ifreq *ifr, - int cmd) -{ - if (dev->do_ioctl) - return dev->do_ioctl(dev, ifr, cmd); - return -EOPNOTSUPP; -} - - -void netdev_attach_ops(struct net_device *dev, - const struct net_device_ops *ops); - -/** - * skb_queue_is_first - check if skb is the first entry in the queue - * @list: queue head - * @skb: buffer - * - * Returns true if @skb is the first buffer on the list. - */ -static inline bool skb_queue_is_first(const struct sk_buff_head *list, - const struct sk_buff *skb) -{ - return (skb->prev == (struct sk_buff *) list); -} - -/** - * skb_queue_prev - return the prev packet in the queue - * @list: queue head - * @skb: current buffer - * - * Return the prev packet in @list before @skb. It is only valid to - * call this if skb_queue_is_first() evaluates to false. - */ -static inline struct sk_buff *skb_queue_prev(const struct sk_buff_head *list, - const struct sk_buff *skb) -{ - /* This BUG_ON may seem severe, but if we just return then we - * are going to dereference garbage. - */ - BUG_ON(skb_queue_is_first(list, skb)); - return skb->prev; -} - - -static inline struct net_device_stats *dev_get_stats(struct net_device *dev) -{ - return dev->get_stats(dev); -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)) -#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE) -extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); -#endif /* CONFIG_USB */ -#endif - -#define DIV_ROUND_CLOSEST(x, divisor)( \ -{ \ - typeof(divisor) __divisor = divisor; \ - (((x) + ((__divisor) / 2)) / (__divisor)); \ -} \ -) - -extern int eth_mac_addr(struct net_device *dev, void *p); -extern int eth_change_mtu(struct net_device *dev, int new_mtu); -extern int eth_validate_addr(struct net_device *dev); - -#ifdef CONFIG_NET_NS - -static inline void write_pnet(struct net **pnet, struct net *net) -{ - *pnet = net; -} - -static inline struct net *read_pnet(struct net * const *pnet) -{ - return *pnet; -} - -#else - -#define write_pnet(pnet, net) do { (void)(net);} while (0) -#define read_pnet(pnet) (&init_net) - -/* - * swap - swap value of @a and @b - */ -#define swap(a, b) \ - do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) - -#endif - -extern int init_dummy_netdev(struct net_device *dev); - -#define compat_pci_suspend(fn) \ - int fn##_compat(struct pci_dev *pdev, pm_message_t state) \ - { \ - int r; \ - \ - r = fn(&pdev->dev); \ - if (r) \ - return r; \ - \ - pci_save_state(pdev); \ - pci_disable_device(pdev); \ - pci_set_power_state(pdev, PCI_D3hot); \ - \ - return 0; \ - } - -#define compat_pci_resume(fn) \ - int fn##_compat(struct pci_dev *pdev) \ - { \ - int r; \ - \ - pci_set_power_state(pdev, PCI_D0); \ - r = pci_enable_device(pdev); \ - if (r) \ - return r; \ - pci_restore_state(pdev); \ - \ - return fn(&pdev->dev); \ - } - -#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) */ - -/* Kernels >= 2.6.29 follows */ - -/* XXX: this can probably just go upstream ! */ -static inline void netdev_attach_ops(struct net_device *dev, - const struct net_device_ops *ops) -{ - dev->netdev_ops = ops; -} - -/* XXX: this can probably just go upstream! */ -static inline int ndo_do_ioctl(struct net_device *dev, - struct ifreq *ifr, - int cmd) -{ - if (dev->netdev_ops && dev->netdev_ops->ndo_do_ioctl) - return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); - return -EOPNOTSUPP; -} - -#define compat_pci_suspend(fn) -#define compat_pci_resume(fn) - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) */ - -#endif /* LINUX_26_29_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.30.h b/openairITS/mac/DOT11/include/linux/compat-2.6.30.h deleted file mode 100644 index 28f3d54a923..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.30.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef LINUX_26_30_COMPAT_H -#define LINUX_26_30_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) - -#include <linux/device.h> - -#ifndef TP_PROTO -#define TP_PROTO(args...) TPPROTO(args) -#endif -#ifndef TP_ARGS -#define TP_ARGS(args...) TPARGS(args) -#endif - -#define IRQ_WAKE_THREAD (2) - -/* From : include/linux/pm.h */ -/* How to reorder dpm_list after device_move() */ -enum dpm_order { - DPM_ORDER_NONE, - DPM_ORDER_DEV_AFTER_PARENT, - DPM_ORDER_PARENT_BEFORE_DEV, - DPM_ORDER_DEV_LAST, -}; - -static inline void dev_set_uevent_suppress(struct device *dev, int val) -{ - dev->uevent_suppress = val; -} - -/* - * Print a one-time message (analogous to WARN_ONCE() et al): - */ -#define printk_once(x...) ({ \ - static bool __print_once; \ - \ - if (!__print_once) { \ - __print_once = true; \ - printk(x); \ - } \ -}) - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) */ - -#endif /* LINUX_26_30_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.31.h b/openairITS/mac/DOT11/include/linux/compat-2.6.31.h deleted file mode 100644 index 25db973dff9..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.31.h +++ /dev/null @@ -1,221 +0,0 @@ -#ifndef LINUX_26_31_COMPAT_H -#define LINUX_26_31_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) - -#include <linux/skbuff.h> -#include <linux/workqueue.h> -#include <linux/interrupt.h> -#include <net/dst.h> -#include <net/genetlink.h> -#include <linux/ethtool.h> - -/* - * These macros allow us to backport rfkill without any - * changes on cfg80211 through compat.diff. Note that this - * file will be included by rfkill_backport.h so we must - * not conflict with things there. - */ -#define rfkill_get_led_trigger_name backport_rfkill_get_led_trigger_name -#define rfkill_set_led_trigger_name backport_rfkill_set_led_trigger_name -#define rfkill_set_hw_state backport_rfkill_set_hw_state -#define rfkill_set_sw_state backport_rfkill_set_sw_state -#define rfkill_init_sw_state backport_rfkill_init_sw_state -#define rfkill_set_states backport_rfkill_set_states -#define rfkill_pause_polling backport_rfkill_pause_polling -#define rfkill_resume_polling backport_rfkill_resume_polling -#define rfkill_blocked backport_rfkill_blocked -#define rfkill_alloc backport_rfkill_alloc -#define rfkill_register backport_rfkill_register -#define rfkill_unregister backport_rfkill_unregister -#define rfkill_destroy backport_rfkill_destroy - -#ifndef ERFKILL -#if !defined(CONFIG_ALPHA) && !defined(CONFIG_MIPS) && !defined(CONFIG_PARISC) && !defined(CONFIG_SPARC) -#define ERFKILL 132 /* Operation not possible due to RF-kill */ -#endif -#ifdef CONFIG_ALPHA -#define ERFKILL 138 /* Operation not possible due to RF-kill */ -#endif -#ifdef CONFIG_MIPS -#define ERFKILL 167 /* Operation not possible due to RF-kill */ -#endif -#ifdef CONFIG_PARISC -#define ERFKILL 256 /* Operation not possible due to RF-kill */ -#endif -#ifdef CONFIG_SPARC -#define ERFKILL 134 /* Operation not possible due to RF-kill */ -#endif -#endif - -#ifndef NETDEV_PRE_UP -#define NETDEV_PRE_UP 0x000D -#endif - -#ifndef SDIO_DEVICE_ID_MARVELL_8688WLAN -#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104 -#endif - -struct compat_threaded_irq { - unsigned int irq; - irq_handler_t handler; - irq_handler_t thread_fn; - void *dev_id; - char wq_name[64]; - struct workqueue_struct *wq; - struct work_struct work; -}; - -/* - * kmemleak was introduced on 2.6.31, since older kernels do not have - * we simply ignore its tuning. - */ -static inline void kmemleak_ignore(const void *ptr) -{ - return; -} - -static inline void kmemleak_not_leak(const void *ptr) -{ - return; -} - -static inline void kmemleak_no_scan(const void *ptr) -{ - return; -} - -/* - * Added via adf30907d63893e4208dfe3f5c88ae12bc2f25d5 - * - * There is no _sk_dst on older kernels, so just set the - * old dst to NULL and release it directly. - */ -static inline void skb_dst_drop(struct sk_buff *skb) -{ - dst_release(skb->dst); - skb->dst = NULL; -} - -static inline struct dst_entry *skb_dst(const struct sk_buff *skb) -{ - return (struct dst_entry *)skb->dst; -} - -static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst) -{ - skb->dst = dst; -} - -static inline struct rtable *skb_rtable(const struct sk_buff *skb) -{ - return (struct rtable *)skb_dst(skb); -} - -/* Backport threaded IRQ support */ - -static inline -void compat_irq_work(struct work_struct *work) -{ - struct compat_threaded_irq *comp = container_of(work, struct compat_threaded_irq, work); - comp->thread_fn(comp->irq, comp->dev_id); -} - -static inline -irqreturn_t compat_irq_dispatcher(int irq, void *dev_id) -{ - struct compat_threaded_irq *comp = dev_id; - irqreturn_t res; - - res = comp->handler(irq, comp->dev_id); - if (res == IRQ_WAKE_THREAD) { - queue_work(comp->wq, &comp->work); - res = IRQ_HANDLED; - } - - return res; -} - -static inline -int compat_request_threaded_irq(struct compat_threaded_irq *comp, - unsigned int irq, - irq_handler_t handler, - irq_handler_t thread_fn, - unsigned long flags, - const char *name, - void *dev_id) -{ - comp->irq = irq; - comp->handler = handler; - comp->thread_fn = thread_fn; - comp->dev_id = dev_id; - INIT_WORK(&comp->work, compat_irq_work); - - if (!comp->wq) { - snprintf(comp->wq_name, sizeof(comp->wq_name), - "compirq/%u-%s", irq, name); - comp->wq = create_singlethread_workqueue(comp->wq_name); - if (!comp->wq) { - printk(KERN_ERR "Failed to create compat-threaded-IRQ workqueue %s\n", - comp->wq_name); - return -ENOMEM; - } - } - return request_irq(irq, compat_irq_dispatcher, flags, name, comp); -} - -static inline -void compat_free_threaded_irq(struct compat_threaded_irq *comp) -{ - free_irq(comp->irq, comp); -} - -static inline -void compat_destroy_threaded_irq(struct compat_threaded_irq *comp) -{ - if (comp->wq) - destroy_workqueue(comp->wq); - comp->wq = NULL; -} - -static inline -void compat_synchronize_threaded_irq(struct compat_threaded_irq *comp) -{ - synchronize_irq(comp->irq); - cancel_work_sync(&comp->work); -} - -/** - * list_entry_rcu - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - * - * This primitive may safely run concurrently with the _rcu list-mutation - * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock(). - */ -#define list_entry_rcu(ptr, type, member) \ - container_of(rcu_dereference(ptr), type, member) - -#define skb_walk_frags(skb, iter) \ - for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) - -#ifndef CONFIG_64BIT - -typedef struct { - long long counter; -} atomic64_t; - -extern long long atomic64_read(const atomic64_t *v); -extern long long atomic64_add_return(long long a, atomic64_t *v); - -#define atomic64_inc_return(v) atomic64_add_return(1LL, (v)) - -#endif - - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */ - -#endif /* LINUX_26_31_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.32.h b/openairITS/mac/DOT11/include/linux/compat-2.6.32.h deleted file mode 100644 index b0c699a6d46..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.32.h +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef LINUX_26_32_COMPAT_H -#define LINUX_26_32_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) - -#include <linux/netdevice.h> -#include <linux/compat.h> -#include <net/iw_handler.h> -#include <linux/workqueue.h> -#include <net/genetlink.h> - -#define SDIO_VENDOR_ID_INTEL 0x0089 -#define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402 -#define SDIO_DEVICE_ID_INTEL_IWMC3200WIFI 0x1403 -#define SDIO_DEVICE_ID_INTEL_IWMC3200TOP 0x1404 -#define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405 -#define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406 - -/* - * Backports 5e928f77a09a07f9dd595bb8a489965d69a83458 - * run-time power management cannot really be backported - * given that the implementation added bus specific - * callbacks that we won't have on older kernels. If - * you really want run-time power management or good - * power management upgrade your kernel. We'll just - * compile this out as if run-time power management was - * disabled just as the kernel disables run-time power management - * when CONFIG_PM_RUNTIME is disabled. - */ -static inline void pm_runtime_init(struct device *dev) {} -static inline void pm_runtime_remove(struct device *dev) {} -static inline int pm_runtime_get(struct device *dev) -{ - return 0; -} - -static inline int pm_runtime_get_sync(struct device *dev) -{ - return 0; -} - -static inline int pm_runtime_put(struct device *dev) -{ - return 0; -} - -static inline int pm_runtime_put_sync(struct device *dev) -{ - return 0; -} - -static inline int pm_runtime_set_active(struct device *dev) -{ - return 0; -} - -static inline void pm_runtime_set_suspended(struct device *dev) -{ -} - -static inline void pm_runtime_disable(struct device *dev) -{ -} - -static inline void pm_runtime_put_noidle(struct device *dev) {} -static inline void pm_runtime_get_noresume(struct device *dev) {} - -static inline void flush_delayed_work(struct delayed_work *dwork) -{ - if (del_timer_sync(&dwork->timer)) { - /* - * This is what would happen on 2.6.32 but since we don't have - * access to the singlethread_cpu we can't really backport this, - * so avoid really *flush*ing the work... Oh well. Any better ideas? - - struct cpu_workqueue_struct *cwq; - cwq = wq_per_cpu(keventd_wq, get_cpu()); - __queue_work(cwq, &dwork->work); - put_cpu(); - - */ - } - flush_work(&dwork->work); -} - -/* - * struct genl_multicast_group was made netns aware through - * patch "genetlink: make netns aware" by johannes, we just - * force this to always use the default init_net - */ -#define genl_info_net(x) &init_net -/* Just use init_net for older kernels */ -#define get_net_ns_by_pid(x) &init_net - -/* net namespace is lost */ -#define genlmsg_multicast_netns(a, b, c, d, e) genlmsg_multicast(b, c, d, e) -#define genlmsg_multicast_allns(a, b, c, d) genlmsg_multicast(a, b, c, d) -#define genlmsg_unicast(net, skb, pid) genlmsg_unicast(skb, pid) - -#define dev_change_net_namespace(a, b, c) (-EOPNOTSUPP) - -#define SET_NETDEV_DEVTYPE(netdev, type) - -#ifdef __KERNEL__ -/* Driver transmit return codes */ -enum netdev_tx { - BACKPORT_NETDEV_TX_OK = NETDEV_TX_OK, /* driver took care of packet */ - BACKPORT_NETDEV_TX_BUSY = NETDEV_TX_BUSY, /* driver tx path was busy*/ - BACKPORT_NETDEV_TX_LOCKED = NETDEV_TX_LOCKED, /* driver tx lock was already taken */ -}; -typedef enum netdev_tx netdev_tx_t; -#endif /* __KERNEL__ */ - -/* - * dev_pm_ops is only available on kernels >= 2.6.29, for - * older kernels we rely on reverting the work to old - * power management style stuff. - */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) -/* - * Use this if you want to use the same suspend and resume callbacks for suspend - * to RAM and hibernation. - */ -#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ -struct dev_pm_ops name = { \ - .suspend = suspend_fn, \ - .resume = resume_fn, \ - .freeze = suspend_fn, \ - .thaw = resume_fn, \ - .poweroff = suspend_fn, \ - .restore = resume_fn, \ -} -#else -#define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) -#endif /* >= 2.6.29 */ - -#define wireless_send_event(a, b, c, d) wireless_send_event(a, b, c, (char * ) d) - -/* The export symbol in changed in compat/patches/15-symbol-export-conflicts.patch */ -#define ieee80211_rx(hw, skb) mac80211_ieee80211_rx(hw, skb) - -#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev) - -#define lockdep_assert_held(l) do { } while (0) - -/* - * Similar to the struct tm in userspace <time.h>, but it needs to be here so - * that the kernel source is self contained. - */ -struct tm { - /* - * the number of seconds after the minute, normally in the range - * 0 to 59, but can be up to 60 to allow for leap seconds - */ - int tm_sec; - /* the number of minutes after the hour, in the range 0 to 59*/ - int tm_min; - /* the number of hours past midnight, in the range 0 to 23 */ - int tm_hour; - /* the day of the month, in the range 1 to 31 */ - int tm_mday; - /* the number of months since January, in the range 0 to 11 */ - int tm_mon; - /* the number of years since 1900 */ - long tm_year; - /* the number of days since Sunday, in the range 0 to 6 */ - int tm_wday; - /* the number of days since January 1, in the range 0 to 365 */ - int tm_yday; -}; - -void time_to_tm(time_t totalsecs, int offset, struct tm *result); - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) */ - -#endif /* LINUX_26_32_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.33.h b/openairITS/mac/DOT11/include/linux/compat-2.6.33.h deleted file mode 100644 index 0c71af99938..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.33.h +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef LINUX_26_33_COMPAT_H -#define LINUX_26_33_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) - -#include <linux/skbuff.h> -#include <linux/pci.h> -#if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE) -#include <pcmcia/cs_types.h> -#include <pcmcia/cistpl.h> -#include <pcmcia/ds.h> -#endif -#include <linux/firmware.h> -#include <linux/input.h> - -#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) -#define release_firmware compat_release_firmware -#define request_firmware compat_request_firmware -#define request_firmware_nowait compat_request_firmware_nowait -#endif - -#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) -int compat_request_firmware(const struct firmware **fw, const char *name, - struct device *device); -int compat_request_firmware_nowait( - struct module *module, int uevent, - const char *name, struct device *device, gfp_t gfp, void *context, - void (*cont)(const struct firmware *fw, void *context)); - -void compat_release_firmware(const struct firmware *fw); -#else -static inline int compat_request_firmware(const struct firmware **fw, - const char *name, - struct device *device) -{ - return -EINVAL; -} -static inline int compat_request_firmware_nowait( - struct module *module, int uevent, - const char *name, struct device *device, gfp_t gfp, void *context, - void (*cont)(const struct firmware *fw, void *context)) -{ - return -EINVAL; -} - -static inline void compat_release_firmware(const struct firmware *fw) -{ -} -#endif - -/* mask KEY_RFKILL as RHEL6 backports this */ -#if !defined(KEY_RFKILL) -#define KEY_RFKILL 247 /* Key that controls all radios */ -#endif - -#define IFF_DONT_BRIDGE 0x800 /* disallow bridging this ether dev */ -/* source: include/linux/if.h */ - -/* this will never happen on older kernels */ -#define NETDEV_POST_INIT 0xffff - -/* mask netdev_alloc_skb_ip_align as debian squeeze also backports this */ -#define netdev_alloc_skb_ip_align(a, b) compat_netdev_alloc_skb_ip_align(a, b) - -static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, - unsigned int length) -{ - struct sk_buff *skb = netdev_alloc_skb(dev, length + NET_IP_ALIGN); - - if (NET_IP_ALIGN && skb) - skb_reserve(skb, NET_IP_ALIGN); - return skb; -} - -#if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE) - -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) - -#define pcmcia_request_window(a, b, c) pcmcia_request_window(&a, b, c) - -#define pcmcia_map_mem_page(a, b, c) pcmcia_map_mem_page(b, c) - -/* loop over CIS entries */ -int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code, - int (*loop_tuple) (struct pcmcia_device *p_dev, - tuple_t *tuple, - void *priv_data), - void *priv_data); - -#endif /* CONFIG_PCMCIA */ - -/* loop over CIS entries */ -int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function, - cisdata_t code, cisparse_t *parse, void *priv_data, - int (*loop_tuple) (tuple_t *tuple, - cisparse_t *parse, - void *priv_data)); - -#endif /* CONFIG_PCCARD */ - -/** - * list_for_each_entry_continue_rcu - continue iteration over list of given type - * @pos: the type * to use as a loop cursor. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * Continue to iterate over list of given type, continuing after - * the current position. - */ -#define list_for_each_entry_continue_rcu(pos, head, member) \ - for (pos = list_entry_rcu(pos->member.next, typeof(*pos), member); \ - prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry_rcu(pos->member.next, typeof(*pos), member)) - -#define sock_recv_ts_and_drops(msg, sk, skb) sock_recv_timestamp(msg, sk, skb) - -/* mask pci_pcie_cap as debian squeeze also backports this */ -#define pci_pcie_cap(a) compat_pci_pcie_cap(a) - -/** - * pci_pcie_cap - get the saved PCIe capability offset - * @dev: PCI device - * - * PCIe capability offset is calculated at PCI device initialization - * time and saved in the data structure. This function returns saved - * PCIe capability offset. Using this instead of pci_find_capability() - * reduces unnecessary search in the PCI configuration space. If you - * need to calculate PCIe capability offset from raw device for some - * reasons, please use pci_find_capability() instead. - */ -static inline int pci_pcie_cap(struct pci_dev *dev) -{ - return pci_find_capability(dev, PCI_CAP_ID_EXP); -} - -/* mask pci_is_pcie as RHEL6 backports this */ -#define pci_is_pcie(a) compat_pci_is_pcie(a) - -/** - * pci_is_pcie - check if the PCI device is PCI Express capable - * @dev: PCI device - * - * Retrun true if the PCI device is PCI Express capable, false otherwise. - */ -static inline bool pci_is_pcie(struct pci_dev *dev) -{ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) - return dev->is_pcie; -#else - return !!pci_pcie_cap(dev); -#endif -} - -#ifdef __GNUC__ -#define __always_unused __attribute__((unused)) -#else -#define __always_unused /* unimplemented */ -#endif - -/* mask IS_ERR_OR_NULL as debian squeeze also backports this */ -#define IS_ERR_OR_NULL(a) compat_IS_ERR_OR_NULL(a) - -static inline long __must_check IS_ERR_OR_NULL(const void *ptr) -{ - return !ptr || IS_ERR_VALUE((unsigned long)ptr); -} - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) */ - -#endif /* LINUX_26_33_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.34.h b/openairITS/mac/DOT11/include/linux/compat-2.6.34.h deleted file mode 100644 index da242ce0536..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.34.h +++ /dev/null @@ -1,309 +0,0 @@ -#ifndef LINUX_26_34_COMPAT_H -#define LINUX_26_34_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) - -#include <linux/netdevice.h> -#include <linux/usb.h> - -#define netdev_mc_count(dev) ((dev)->mc_count) -#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0) - -#define netdev_for_each_mc_addr(mclist, dev) \ - for (mclist = dev->mc_list; mclist; mclist = mclist->next) -/* source: include/linux/netdevice.h */ - - -/* Logging, debugging and troubleshooting/diagnostic helpers. */ - -/* netdev_printk helpers, similar to dev_printk */ - -#ifndef netdev_name -#define netdev_name(__dev) \ - ((__dev->reg_state != NETREG_REGISTERED) ? \ - "(unregistered net_device)" : __dev->name) -#endif - -#define netdev_printk(level, netdev, format, args...) \ - dev_printk(level, (netdev)->dev.parent, \ - "%s: " format, \ - netdev_name(netdev), ##args) - -#define netdev_emerg(dev, format, args...) \ - netdev_printk(KERN_EMERG, dev, format, ##args) -#define netdev_alert(dev, format, args...) \ - netdev_printk(KERN_ALERT, dev, format, ##args) -#define netdev_crit(dev, format, args...) \ - netdev_printk(KERN_CRIT, dev, format, ##args) -#define netdev_err(dev, format, args...) \ - netdev_printk(KERN_ERR, dev, format, ##args) -#define netdev_warn(dev, format, args...) \ - netdev_printk(KERN_WARNING, dev, format, ##args) -#define netdev_notice(dev, format, args...) \ - netdev_printk(KERN_NOTICE, dev, format, ##args) -#define netdev_info(dev, format, args...) \ - netdev_printk(KERN_INFO, dev, format, ##args) - -/* mask netdev_dbg as RHEL6 backports this */ -#if !defined(netdev_dbg) - -#if defined(DEBUG) -#define netdev_dbg(__dev, format, args...) \ - netdev_printk(KERN_DEBUG, __dev, format, ##args) -#elif defined(CONFIG_DYNAMIC_DEBUG) -#define netdev_dbg(__dev, format, args...) \ -do { \ - dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \ - netdev_name(__dev), ##args); \ -} while (0) -#else -#define netdev_dbg(__dev, format, args...) \ -({ \ - if (0) \ - netdev_printk(KERN_DEBUG, __dev, format, ##args); \ - 0; \ -}) -#endif - -#endif - -/* mask netdev_vdbg as RHEL6 backports this */ -#if !defined(netdev_dbg) - -#if defined(VERBOSE_DEBUG) -#define netdev_vdbg netdev_dbg -#else - -#define netdev_vdbg(dev, format, args...) \ -({ \ - if (0) \ - netdev_printk(KERN_DEBUG, dev, format, ##args); \ - 0; \ -}) -#endif - -#endif - -/* - * netdev_WARN() acts like dev_printk(), but with the key difference - * of using a WARN/WARN_ON to get the message out, including the - * file/line information and a backtrace. - */ -#define netdev_WARN(dev, format, args...) \ - WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args); - -/* netif printk helpers, similar to netdev_printk */ - -#define netif_printk(priv, type, level, dev, fmt, args...) \ -do { \ - if (netif_msg_##type(priv)) \ - netdev_printk(level, (dev), fmt, ##args); \ -} while (0) - -#define netif_emerg(priv, type, dev, fmt, args...) \ - netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args) -#define netif_alert(priv, type, dev, fmt, args...) \ - netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args) -#define netif_crit(priv, type, dev, fmt, args...) \ - netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args) -#define netif_err(priv, type, dev, fmt, args...) \ - netif_printk(priv, type, KERN_ERR, dev, fmt, ##args) -#define netif_warn(priv, type, dev, fmt, args...) \ - netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args) -#define netif_notice(priv, type, dev, fmt, args...) \ - netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args) -#define netif_info(priv, type, dev, fmt, args...) \ - netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args) - -/* mask netif_dbg as RHEL6 backports this */ -#if !defined(netif_dbg) - -#if defined(DEBUG) -#define netif_dbg(priv, type, dev, format, args...) \ - netif_printk(priv, type, KERN_DEBUG, dev, format, ##args) -#elif defined(CONFIG_DYNAMIC_DEBUG) -#define netif_dbg(priv, type, netdev, format, args...) \ -do { \ - if (netif_msg_##type(priv)) \ - dynamic_dev_dbg((netdev)->dev.parent, \ - "%s: " format, \ - netdev_name(netdev), ##args); \ -} while (0) -#else -#define netif_dbg(priv, type, dev, format, args...) \ -({ \ - if (0) \ - netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \ - 0; \ -}) -#endif - -#endif - -/* mask netif_vdbg as RHEL6 backports this */ -#if !defined(netif_vdbg) - -#if defined(VERBOSE_DEBUG) -#define netif_vdbg netdev_dbg -#else -#define netif_vdbg(priv, type, dev, format, args...) \ -({ \ - if (0) \ - netif_printk(KERN_DEBUG, dev, format, ##args); \ - 0; \ -}) -#endif -#endif -/* source: include/linux/netdevice.h */ - - -static inline void device_lock(struct device *dev) -{ -#if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP) - mutex_lock(&dev->mutex); -#else - down(&dev->sem); -#endif -} - -static inline int device_trylock(struct device *dev) -{ -#if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP) - return mutex_trylock(&dev->mutex); -#else - return down_trylock(&dev->sem); -#endif -} - -static inline void device_unlock(struct device *dev) -{ -#if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP) - mutex_unlock(&dev->mutex); -#else - up(&dev->sem); -#endif -} - -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) -#define PCMCIA_DEVICE_PROD_ID3(v3, vh3) { \ - .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID3, \ - .prod_id = { NULL, NULL, (v3), NULL }, \ - .prod_id_hash = { 0, 0, (vh3), 0 }, } -#endif - -#define rcu_dereference_check(p, c) rcu_dereference(p) - -/** - * sysfs_attr_init - initialize a dynamically allocated sysfs attribute - * @attr: struct attribute to initialize - * - * Initialize a dynamically allocated struct attribute so we can - * make lockdep happy. This is a new requirement for attributes - * and initially this is only needed when lockdep is enabled. - * Lockdep gives a nice error when your attribute is added to - * sysfs if you don't have this. - */ -#ifdef CONFIG_DEBUG_LOCK_ALLOC -#define sysfs_attr_init(attr) \ -do { \ - static struct lock_class_key __key; \ - \ - (attr)->key = &__key; \ -} while(0) -#else -#define sysfs_attr_init(attr) do {} while(0) -#endif - -/** - * sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute - * @attr: struct bin_attribute to initialize - * - * Initialize a dynamically allocated struct bin_attribute so we - * can make lockdep happy. This is a new requirement for - * attributes and initially this is only needed when lockdep is - * enabled. Lockdep gives a nice error when your attribute is - * added to sysfs if you don't have this. - */ -#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr) - -#define usb_alloc_coherent(dev, size, mem_flags, dma) usb_buffer_alloc(dev, size, mem_flags, dma) -#define usb_free_coherent(dev, size, addr, dma) usb_buffer_free(dev, size, addr, dma) - -/* only include this if DEFINE_DMA_UNMAP_ADDR is not set as debian squeeze also backports this */ -#ifndef DEFINE_DMA_UNMAP_ADDR -#ifdef CONFIG_NEED_DMA_MAP_STATE -#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME -#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME -#define dma_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME) -#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL)) -#define dma_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME) -#define dma_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL)) -#else -#define DEFINE_DMA_UNMAP_ADDR(ADDR_NAME) -#define DEFINE_DMA_UNMAP_LEN(LEN_NAME) -#define dma_unmap_addr(PTR, ADDR_NAME) (0) -#define dma_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) -#define dma_unmap_len(PTR, LEN_NAME) (0) -#define dma_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) -#endif -#endif - -/* mask dma_set_coherent_mask as debian squeeze also backports this */ -#define dma_set_coherent_mask(a, b) compat_dma_set_coherent_mask(a, b) - -static inline int dma_set_coherent_mask(struct device *dev, u64 mask) -{ - if (!dma_supported(dev, mask)) - return -EIO; - dev->coherent_dma_mask = mask; - return 0; -} - -/* USB autosuspend and autoresume */ -static inline int usb_enable_autosuspend(struct usb_device *udev) -{ return 0; } -static inline int usb_disable_autosuspend(struct usb_device *udev) -{ return 0; } - -#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */ -#define sdio_set_host_pm_flags(a, b) 0 - -#define rcu_dereference_protected(p, c) (p) -#define rcu_access_pointer(p) ACCESS_ONCE(p) - -#define rcu_dereference_raw(p) rcu_dereference(p) - -#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ - -/* - * This looks more complex than it should be. But we need to - * get the type for the ~ right in round_down (it needs to be - * as wide as the result!), and we want to evaluate the macro - * arguments just once each. - */ -#define __round_mask(x, y) ((__typeof__(x))((y)-1)) -#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) -#define round_down(x, y) ((x) & ~__round_mask(x, y)) - -static inline int rcu_read_lock_held(void) -{ - return 1; -} - -#ifdef CONFIG_PROVE_LOCKING -/* - * Obviously, this is wrong. But the base kernel will have rtnl_mutex - * declared static, with no way to access it. I think this is the best - * we can do... - */ -static inline int lockdep_rtnl_is_held(void) -{ - return 1; -} -#endif /* #ifdef CONFIG_PROVE_LOCKING */ - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) */ - -#endif /* LINUX_26_34_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.35.h b/openairITS/mac/DOT11/include/linux/compat-2.6.35.h deleted file mode 100644 index 581412392e6..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.35.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef LINUX_26_35_COMPAT_H -#define LINUX_26_35_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) -#include <linux/etherdevice.h> -#include <net/sock.h> -#include <linux/types.h> -#include <linux/usb.h> - -/* added on linux/kernel.h */ -#define USHRT_MAX ((u16)(~0U)) -#define SHRT_MAX ((s16)(USHRT_MAX>>1)) -#define SHRT_MIN ((s16)(-SHRT_MAX - 1)) - -#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */ -#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */ - -#define netdev_hw_addr dev_mc_list - -/* - * We cannot backport this guy as the IRQ data structure - * was modified in the kernel itself to support this. We - * treat the system as uni-processor in this case. - */ -static inline int irq_set_affinity_hint(unsigned int irq, - const struct cpumask *m) -{ - return -EINVAL; -} - -static inline wait_queue_head_t *sk_sleep(struct sock *sk) -{ - return sk->sk_sleep; -} - -#define sdio_writeb_readb(func, write_byte, addr, err_ret) sdio_readb(func, addr, err_ret) - -/* mask hex_to_bin as RHEL6 backports this */ -#define hex_to_bin(a) compat_hex_to_bin(a) - -int hex_to_bin(char ch); - -extern loff_t noop_llseek(struct file *file, loff_t offset, int origin); - -#define pm_qos_request(_qos) pm_qos_requirement(_qos) - -static inline struct usb_host_endpoint * -usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe) -{ - struct usb_host_endpoint **eps; - eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out; - return eps[usb_pipeendpoint(pipe)]; -} - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) */ - -#endif /* LINUX_26_35_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.36.h b/openairITS/mac/DOT11/include/linux/compat-2.6.36.h deleted file mode 100644 index 56d5961916d..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.36.h +++ /dev/null @@ -1,212 +0,0 @@ -#ifndef LINUX_26_36_COMPAT_H -#define LINUX_26_36_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) - -#include <linux/usb.h> -#include <pcmcia/cistpl.h> -#include <pcmcia/ds.h> -#include <linux/pm_qos_params.h> -#include <linux/smp_lock.h> - -#define kparam_block_sysfs_write(a) -#define kparam_unblock_sysfs_write(a) - -/* mask va_format as RHEL6 backports this */ -#define va_format compat_va_format - -struct va_format { - const char *fmt; - va_list *va; -}; - -#define device_rename(dev, new_name) device_rename(dev, (char *)new_name) - -#ifdef CONFIG_COMPAT_USB_URB_THREAD_FIX -#define usb_scuttle_anchored_urbs(anchor) compat_usb_scuttle_anchored_urbs(anchor) -#define usb_get_from_anchor(anchor) compat_usb_get_from_anchor(anchor) -#define usb_unlink_anchored_urbs(anchor) compat_usb_unlink_anchored_urbs(anchor) - -extern void compat_usb_unlink_anchored_urbs(struct usb_anchor *anchor); -extern struct urb *compat_usb_get_from_anchor(struct usb_anchor *anchor); -extern void compat_usb_scuttle_anchored_urbs(struct usb_anchor *anchor); -#endif - -/** - * pcmcia_read_config_byte() - read a byte from a card configuration register - * - * pcmcia_read_config_byte() reads a byte from a configuration register in - * attribute memory. - */ -static inline int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val) -{ - int ret; - conf_reg_t reg = { 0, CS_READ, where, 0 }; - ret = pcmcia_access_configuration_register(p_dev, ®); - *val = reg.Value; - return ret; -} - -/** - * pcmcia_write_config_byte() - write a byte to a card configuration register - * - * pcmcia_write_config_byte() writes a byte to a configuration register in - * attribute memory. - */ -static inline int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val) -{ - conf_reg_t reg = { 0, CS_WRITE, where, val }; - return pcmcia_access_configuration_register(p_dev, ®); -} - -struct pm_qos_request_list { - u32 qos; - void *request; -}; - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) - -#define pm_qos_add_request(_req, _class, _value) do { \ - (_req)->request = #_req; \ - (_req)->qos = _class; \ - pm_qos_add_requirement((_class), (_req)->request, (_value)); \ - } while(0) - -#define pm_qos_update_request(_req, _value) \ - pm_qos_update_requirement((_req)->qos, (_req)->request, (_value)) - -#define pm_qos_remove_request(_req) \ - pm_qos_remove_requirement((_req)->qos, (_req)->request) - -#else - -#define pm_qos_add_request(_req, _class, _value) do { \ - (_req)->request = pm_qos_add_request((_class), (_value)); \ - } while (0) - -#define pm_qos_update_request(_req, _value) \ - pm_qos_update_request((_req)->request, (_value)) - -#define pm_qos_remove_request(_req) \ - pm_qos_remove_request((_req)->request) - -#endif - -/* - * Dummy printk for disabled debugging statements to use whilst maintaining - * gcc's format and side-effect checking. - */ -static inline __attribute__ ((format (printf, 1, 2))) -int no_printk(const char *s, ...) { return 0; } - -#ifndef alloc_workqueue -#define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active, 0) -#endif - -#define EXTPROC 0200000 -#define TIOCPKT_IOCTL 64 - -static inline void tty_lock(void) __acquires(kernel_lock) -{ -#ifdef CONFIG_LOCK_KERNEL - /* kernel_locked is 1 for !CONFIG_LOCK_KERNEL */ - WARN_ON(kernel_locked()); -#endif - lock_kernel(); -} -static inline void tty_unlock(void) __releases(kernel_lock) -{ - unlock_kernel(); -} -#define tty_locked() (kernel_locked()) - -#define usleep_range(_min, _max) msleep((_max) / 1000) - -#define __rcu - -static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {} - -static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) -{ - return false; -} - -static inline void skb_tx_timestamp(struct sk_buff *skb) -{ -} - -/* - * System-wide workqueues which are always present. - * - * system_wq is the one used by schedule[_delayed]_work[_on](). - * Multi-CPU multi-threaded. There are users which expect relatively - * short queue flush time. Don't queue works which can run for too - * long. - * - * system_long_wq is similar to system_wq but may host long running - * works. Queue flushing might take relatively long. - * - * system_nrt_wq is non-reentrant and guarantees that any given work - * item is never executed in parallel by multiple CPUs. Queue - * flushing might take relatively long. - */ -extern struct workqueue_struct *system_wq; -extern struct workqueue_struct *system_long_wq; -extern struct workqueue_struct *system_nrt_wq; - -void compat_system_workqueue_create(void); -void compat_system_workqueue_destroy(void); - -int compat_schedule_work(struct work_struct *work); -int compat_schedule_work_on(int cpu, struct work_struct *work); -int compat_schedule_delayed_work(struct delayed_work *dwork, - unsigned long delay); -int compat_schedule_delayed_work_on(int cpu, - struct delayed_work *dwork, - unsigned long delay); -void compat_flush_scheduled_work(void); - -enum { - /* bit mask for work_busy() return values */ - WORK_BUSY_PENDING = 1 << 0, - WORK_BUSY_RUNNING = 1 << 1, -}; - -extern unsigned int work_busy(struct work_struct *work); - -#define schedule_work(work) compat_schedule_work(work) -#define schedule_work_on(cpu, work) compat_schedule_work_on(cpu, work) -#define schedule_delayed_work(dwork, delay) compat_schedule_delayed_work(dwork, delay) -#define schedule_delayed_work_on(cpu, dwork, delay) compat_schedule_delayed_work_on(cpu, dwork, delay) -#define flush_scheduled_work(a) compat_flush_scheduled_work(a) - -#define br_port_exists(dev) (dev->br_port) - -#else - -static inline void compat_system_workqueue_create(void) -{ -} - -static inline void compat_system_workqueue_destroy(void) -{ -} - -/* - * This is not part of The 2.6.37 kernel yet but we - * we use it to optimize the backport code we - * need to implement. Instead of using ifdefs - * to check what version of the check we use - * we just replace all checks on current code - * with this. I'll submit this upstream too, that - * way all we'd have to do is to implement this - * for older kernels, then we would not have to - * edit the upstrema code for backport efforts. - */ -#define br_port_exists(dev) (dev->priv_flags & IFF_BRIDGE_PORT) - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */ - -#endif /* LINUX_26_36_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.37.h b/openairITS/mac/DOT11/include/linux/compat-2.6.37.h deleted file mode 100644 index c19e781846b..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.37.h +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef LINUX_26_37_COMPAT_H -#define LINUX_26_37_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) - -#include <linux/skbuff.h> -#include <linux/leds.h> - -#define SDIO_CLASS_BT_AMP 0x09 /* Type-A Bluetooth AMP interface */ - -extern struct kobj_ns_type_operations net_ns_type_operations; - -/* mask skb_checksum_none_assert as RHEL6 backports this */ -#define skb_checksum_none_assert(a) compat_skb_checksum_none_assert(a) - -/** - * skb_checksum_none_assert - make sure skb ip_summed is CHECKSUM_NONE - * @skb: skb to check - * - * fresh skbs have their ip_summed set to CHECKSUM_NONE. - * Instead of forcing ip_summed to CHECKSUM_NONE, we can - * use this helper, to document places where we make this assertion. - */ -static inline void skb_checksum_none_assert(struct sk_buff *skb) -{ -#ifdef DEBUG - BUG_ON(skb->ip_summed != CHECKSUM_NONE); -#endif -} - -#define pcmcia_enable_device(link) pcmcia_request_configuration(link, &link->conf) - -#include <net/genetlink.h> - -struct compat_genl_info { - struct genl_info *info; - - u32 snd_seq; - u32 snd_pid; - struct genlmsghdr *genlhdr; - struct nlattr **attrs; - void *user_ptr[2]; -}; -#define genl_info compat_genl_info - -struct compat_genl_ops { - struct genl_ops ops; - - u8 cmd; - u8 internal_flags; - unsigned int flags; - const struct nla_policy *policy; - - int (*doit)(struct sk_buff *skb, struct genl_info *info); - int (*dumpit)(struct sk_buff *skb, struct netlink_callback *cb); - int (*done)(struct netlink_callback *cb); -}; -#define genl_ops compat_genl_ops - -struct compat_genl_family { - struct genl_family family; - - struct list_head list; - - unsigned int id, hdrsize, version, maxattr; - const char *name; - bool netnsok; - - struct nlattr **attrbuf; - - int (*pre_doit)(struct genl_ops *ops, struct sk_buff *skb, - struct genl_info *info); - - void (*post_doit)(struct genl_ops *ops, struct sk_buff *skb, - struct genl_info *info); -}; - -#define genl_family compat_genl_family - -#define genl_register_family_with_ops compat_genl_register_family_with_ops - -int genl_register_family_with_ops(struct genl_family *family, - struct genl_ops *ops, size_t n_ops); - -#define genl_unregister_family compat_genl_unregister_family - -int genl_unregister_family(struct genl_family *family); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) -#define genl_info_net(_info) genl_info_net((_info)->info) -#endif - -#define genlmsg_reply(_msg, _info) genlmsg_reply(_msg, (_info)->info) -#define genlmsg_put(_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd) -#define genl_register_mc_group(_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp) -#define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp) - - -extern void led_blink_set(struct led_classdev *led_cdev, - unsigned long *delay_on, - unsigned long *delay_off); - -#define led_classdev_unregister compat_led_classdev_unregister -extern void compat_led_classdev_unregister(struct led_classdev *led_cdev); - -#define led_brightness_set compat_led_brightness_set -extern void compat_led_brightness_set(struct led_classdev *led_cdev, - enum led_brightness brightness); - -#define alloc_ordered_workqueue(name, flags) create_singlethread_workqueue(name) - -#define netdev_refcnt_read(a) atomic_read(&a->refcnt) - -/* mask vzalloc as RHEL6 backports this */ -#define vzalloc(a) compat_vzalloc(a) - -extern void *vzalloc(unsigned long size); - -#define rtnl_dereference(p) \ - rcu_dereference_protected(p, lockdep_rtnl_is_held()) - -/** - * RCU_INIT_POINTER() - initialize an RCU protected pointer - * - * Initialize an RCU-protected pointer in such a way to avoid RCU-lockdep - * splats. - */ -#define RCU_INIT_POINTER(p, v) \ - p = (typeof(*v) __force __rcu *)(v) - -static inline bool skb_has_frag_list(const struct sk_buff *skb) -{ - return skb_shinfo(skb)->frag_list != NULL; -} - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */ - -#endif /* LINUX_26_37_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.38.h b/openairITS/mac/DOT11/include/linux/compat-2.6.38.h deleted file mode 100644 index 63f9dd6a0ef..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.38.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef LINUX_26_38_COMPAT_H -#define LINUX_26_38_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)) - -#include <linux/kernel.h> -#include <linux/skbuff.h> -#include <linux/etherdevice.h> - -/* rename member in struct mmc_host in include/linux/mmc/host.h */ -#define max_segs max_hw_segs - - -/* Exponentially weighted moving average (EWMA) */ - -/* For more documentation see lib/average.c */ - -struct ewma { - unsigned long internal; - unsigned long factor; - unsigned long weight; -}; - -extern void ewma_init(struct ewma *avg, unsigned long factor, - unsigned long weight); - -extern struct ewma *ewma_add(struct ewma *avg, unsigned long val); - -/** - * ewma_read() - Get average value - * @avg: Average structure - * - * Returns the average value held in @avg. - */ -static inline unsigned long ewma_read(const struct ewma *avg) -{ - return DIV_ROUND_CLOSEST(avg->internal, avg->factor); -} - -#define pr_warn pr_warning -#define create_freezable_workqueue create_freezeable_workqueue - -static inline int skb_checksum_start_offset(const struct sk_buff *skb) -{ - return skb->csum_start - skb_headroom(skb); -} - -/* from include/linux/printk.h */ -#define pr_emerg_once(fmt, ...) \ - printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) -#define pr_alert_once(fmt, ...) \ - printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) -#define pr_crit_once(fmt, ...) \ - printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) -#define pr_err_once(fmt, ...) \ - printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) -#define pr_warn_once(fmt, ...) \ - printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) -#define pr_notice_once(fmt, ...) \ - printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) -#define pr_info_once(fmt, ...) \ - printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) -#define pr_cont_once(fmt, ...) \ - printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) -#if defined(DEBUG) -#define pr_debug_once(fmt, ...) \ - printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) -#else -#define pr_debug_once(fmt, ...) \ - no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) -#endif - -/* include/linux/netdevice.h */ -#define alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs) \ - alloc_netdev_mq(sizeof_priv, name, setup, \ - max_t(unsigned int, txqs, rxqs)) - -#define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */ - -/** - * is_unicast_ether_addr - Determine if the Ethernet address is unicast - * @addr: Pointer to a six-byte array containing the Ethernet address - * - * Return true if the address is a unicast address. - */ -static inline int is_unicast_ether_addr(const u8 *addr) -{ - return !is_multicast_ether_addr(addr); -} - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)) */ - -#endif /* LINUX_26_38_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.39.h b/openairITS/mac/DOT11/include/linux/compat-2.6.39.h deleted file mode 100644 index 406f8ebfc9d..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.39.h +++ /dev/null @@ -1,169 +0,0 @@ -#ifndef LINUX_26_39_COMPAT_H -#define LINUX_26_39_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) - -#include <linux/tty.h> -#include <linux/irq.h> -#include <linux/kernel.h> - -#define tiocmget(tty) tiocmget(tty, NULL) -#define tiocmset(tty, set, clear) tiocmset(tty, NULL, set, clear) - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) -extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) */ - -static inline int irq_set_irq_wake(unsigned int irq, unsigned int on) -{ - return set_irq_wake(irq, on); -} -static inline int irq_set_chip(unsigned int irq, struct irq_chip *chip) -{ - return set_irq_chip(irq, chip); -} -static inline int irq_set_handler_data(unsigned int irq, void *data) -{ - return set_irq_data(irq, data); -} -static inline int irq_set_chip_data(unsigned int irq, void *data) -{ - return set_irq_chip_data(irq, data); -} -static inline int irq_set_irq_type(unsigned int irq, unsigned int type) -{ - return set_irq_type(irq, type); -} -static inline int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry) -{ - return set_irq_msi(irq, entry); -} -static inline struct irq_chip *irq_get_chip(unsigned int irq) -{ - return get_irq_chip(irq); -} -static inline void *irq_get_chip_data(unsigned int irq) -{ - return get_irq_chip_data(irq); -} -static inline void *irq_get_handler_data(unsigned int irq) -{ - return get_irq_data(irq); -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) -static inline void *irq_data_get_irq_handler_data(struct irq_data *d) -{ - return irq_data_get_irq_data(d); -} -#endif - -static inline struct msi_desc *irq_get_msi_desc(unsigned int irq) -{ - return get_irq_msi(irq); -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) -static inline void irq_set_noprobe(unsigned int irq) -{ - set_irq_noprobe(irq); -} -static inline void irq_set_probe(unsigned int irq) -{ - set_irq_probe(irq); -} -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) -static inline struct irq_chip *irq_desc_get_chip(struct irq_desc *desc) -{ - return get_irq_desc_chip(desc); -} -static inline void *irq_desc_get_handler_data(struct irq_desc *desc) -{ - return get_irq_desc_data(desc); -} - -static inline void *irq_desc_get_chip_data(struct irq_desc *desc) -{ - return get_irq_desc_chip_data(desc); -} - -static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc) -{ - return get_irq_desc_msi(desc); -} -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) */ - -/* - * kstrto* was included in kernel 2.6.38.4 and causes conflicts with the - * version included in compat-wireless. We use strict_strtol to check if - * kstrto* is already available. - */ -#ifndef strict_strtol -/* Internal, do not use. */ -int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res); -int __must_check _kstrtol(const char *s, unsigned int base, long *res); - -int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res); -int __must_check kstrtoll(const char *s, unsigned int base, long long *res); -static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res) -{ - /* - * We want to shortcut function call, but - * __builtin_types_compatible_p(unsigned long, unsigned long long) = 0. - */ - if (sizeof(unsigned long) == sizeof(unsigned long long) && - __alignof__(unsigned long) == __alignof__(unsigned long long)) - return kstrtoull(s, base, (unsigned long long *)res); - else - return _kstrtoul(s, base, res); -} - -static inline int __must_check kstrtol(const char *s, unsigned int base, long *res) -{ - /* - * We want to shortcut function call, but - * __builtin_types_compatible_p(long, long long) = 0. - */ - if (sizeof(long) == sizeof(long long) && - __alignof__(long) == __alignof__(long long)) - return kstrtoll(s, base, (long long *)res); - else - return _kstrtol(s, base, res); -} - -int __must_check kstrtouint(const char *s, unsigned int base, unsigned int *res); -int __must_check kstrtoint(const char *s, unsigned int base, int *res); - -static inline int __must_check kstrtou64(const char *s, unsigned int base, u64 *res) -{ - return kstrtoull(s, base, res); -} - -static inline int __must_check kstrtos64(const char *s, unsigned int base, s64 *res) -{ - return kstrtoll(s, base, res); -} - -static inline int __must_check kstrtou32(const char *s, unsigned int base, u32 *res) -{ - return kstrtouint(s, base, res); -} - -static inline int __must_check kstrtos32(const char *s, unsigned int base, s32 *res) -{ - return kstrtoint(s, base, res); -} - -int __must_check kstrtou16(const char *s, unsigned int base, u16 *res); -int __must_check kstrtos16(const char *s, unsigned int base, s16 *res); -int __must_check kstrtou8(const char *s, unsigned int base, u8 *res); -int __must_check kstrtos8(const char *s, unsigned int base, s8 *res); -#endif /* ifndef strict_strtol */ - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */ - -#endif /* LINUX_26_39_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-2.6.h b/openairITS/mac/DOT11/include/linux/compat-2.6.h deleted file mode 100644 index 17905598f5e..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-2.6.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef LINUX_26_COMPAT_H -#define LINUX_26_COMPAT_H - -#include <linux/version.h> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) -#include <linux/kconfig.h> -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) -#include <generated/autoconf.h> -#else -#include <linux/autoconf.h> -#endif -#include <linux/compat_autoconf.h> -#include <linux/init.h> - -/* - * The define overwriting module_init is based on the original module_init - * which looks like this: - * #define module_init(initfn) \ - * static inline initcall_t __inittest(void) \ - * { return initfn; } \ - * int init_module(void) __attribute__((alias(#initfn))); - * - * To the call to the initfn we added the symbol dependency on compat - * to make sure that compat.ko gets loaded for any compat modules. - */ -void compat_dependency_symbol(void); - -#undef module_init -#define module_init(initfn) \ - static int __init __init_compat(void) \ - { \ - compat_dependency_symbol(); \ - return initfn(); \ - } \ - int init_module(void) __attribute__((alias("__init_compat"))); - -/* - * Each compat file represents compatibility code for new kernel - * code introduced for *that* kernel revision. - */ - -#include <linux/compat-2.6.22.h> -#include <linux/compat-2.6.23.h> -#include <linux/compat-2.6.24.h> -#include <linux/compat-2.6.25.h> -#include <linux/compat-2.6.26.h> -#include <linux/compat-2.6.27.h> -#include <linux/compat-2.6.28.h> -#include <linux/compat-2.6.29.h> -#include <linux/compat-2.6.30.h> -#include <linux/compat-2.6.31.h> -#include <linux/compat-2.6.32.h> -#include <linux/compat-2.6.33.h> -#include <linux/compat-2.6.34.h> -#include <linux/compat-2.6.35.h> -#include <linux/compat-2.6.36.h> -#include <linux/compat-2.6.37.h> -#include <linux/compat-2.6.38.h> -#include <linux/compat-2.6.39.h> -#include <linux/compat-3.0.h> -#include <linux/compat-3.1.h> -#include <linux/compat-3.2.h> -#include <linux/compat-3.3.h> -#include <linux/compat-3.4.h> -#include <linux/compat-3.5.h> - -#endif /* LINUX_26_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-3.0.h b/openairITS/mac/DOT11/include/linux/compat-3.0.h deleted file mode 100644 index 22ab5399ad1..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-3.0.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef LINUX_3_0_COMPAT_H -#define LINUX_3_0_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) - -#include <linux/rcupdate.h> - -/* - * since commit 1c5cae815d19ffe02bdfda1260949ef2b1806171 - * "net: call dev_alloc_name from register_netdevice" dev_alloc_name is - * called automatically. This is not implemented in older kernel - * versions so it will result in device wrong names. - */ -static inline int register_netdevice_name(struct net_device *dev) -{ - int err; - - if (strchr(dev->name, '%')) { - err = dev_alloc_name(dev, dev->name); - if (err < 0) - return err; - } - - return register_netdevice(dev); -} - -#define register_netdevice(dev) register_netdevice_name(dev) - -/* BCMA core, see drivers/bcma/ */ -#ifndef BCMA_CORE -/* Broadcom's specific AMBA core, see drivers/bcma/ */ -struct bcma_device_id { - __u16 manuf; - __u16 id; - __u8 rev; - __u8 class; -}; -#define BCMA_CORE(_manuf, _id, _rev, _class) \ - { .manuf = _manuf, .id = _id, .rev = _rev, .class = _class, } -#define BCMA_CORETABLE_END \ - { 0, }, - -#define BCMA_ANY_MANUF 0xFFFF -#define BCMA_ANY_ID 0xFFFF -#define BCMA_ANY_REV 0xFF -#define BCMA_ANY_CLASS 0xFF -#endif /* BCMA_CORE */ - -int mac_pton(const char *s, u8 *mac); - -int __must_check kstrtoull_from_user(const char __user *s, size_t count, unsigned int base, unsigned long long *res); -int __must_check kstrtoll_from_user(const char __user *s, size_t count, unsigned int base, long long *res); -int __must_check kstrtoul_from_user(const char __user *s, size_t count, unsigned int base, unsigned long *res); -int __must_check kstrtol_from_user(const char __user *s, size_t count, unsigned int base, long *res); -int __must_check kstrtouint_from_user(const char __user *s, size_t count, unsigned int base, unsigned int *res); -int __must_check kstrtoint_from_user(const char __user *s, size_t count, unsigned int base, int *res); -int __must_check kstrtou16_from_user(const char __user *s, size_t count, unsigned int base, u16 *res); -int __must_check kstrtos16_from_user(const char __user *s, size_t count, unsigned int base, s16 *res); -int __must_check kstrtou8_from_user(const char __user *s, size_t count, unsigned int base, u8 *res); -int __must_check kstrtos8_from_user(const char __user *s, size_t count, unsigned int base, s8 *res); - -static inline int __must_check kstrtou64_from_user(const char __user *s, size_t count, unsigned int base, u64 *res) -{ - return kstrtoull_from_user(s, count, base, res); -} - -static inline int __must_check kstrtos64_from_user(const char __user *s, size_t count, unsigned int base, s64 *res) -{ - return kstrtoll_from_user(s, count, base, res); -} - -static inline int __must_check kstrtou32_from_user(const char __user *s, size_t count, unsigned int base, u32 *res) -{ - return kstrtouint_from_user(s, count, base, res); -} - -static inline int __must_check kstrtos32_from_user(const char __user *s, size_t count, unsigned int base, s32 *res) -{ - return kstrtoint_from_user(s, count, base, res); -} - -/* - * This adds a nested function everywhere kfree_rcu() was called. This - * function frees the memory and is given as a function to call_rcu(). - * The rcu callback could happen every time also after the module was - * unloaded and this will cause problems. - */ -#define kfree_rcu(data, rcuhead) do { \ - void __kfree_rcu_fn(struct rcu_head *rcu_head) \ - { \ - void *___ptr; \ - ___ptr = container_of(rcu_head, typeof(*(data)), rcuhead);\ - kfree(___ptr); \ - } \ - call_rcu(&(data)->rcuhead, __kfree_rcu_fn); \ - } while (0) - -#ifdef MODULE - -/* - * The define overwriting module_exit is based on the original module_exit - * which looks like this: - * #define module_exit(exitfn) \ - * static inline exitcall_t __exittest(void) \ - * { return exitfn; } \ - * void cleanup_module(void) __attribute__((alias(#exitfn))); - * - * We replaced the call to the actual function exitfn() with a call to our - * function which calls the original exitfn() and then rcu_barrier() - * - * As a module will not be unloaded that ofter it should not have a big - * performance impact when rcu_barrier() is called on every module exit, - * also when no kfree_rcu() backport is used in that module. - */ -#undef module_exit -#define module_exit(exitfn) \ - static void __exit __exit_compat(void) \ - { \ - exitfn(); \ - rcu_barrier(); \ - } \ - void cleanup_module(void) __attribute__((alias("__exit_compat"))); - -#endif - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) */ - -#endif /* LINUX_3_0_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-3.1.h b/openairITS/mac/DOT11/include/linux/compat-3.1.h deleted file mode 100644 index 1e8e05edb1b..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-3.1.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef LINUX_3_1_COMPAT_H -#define LINUX_3_1_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) - -#include <linux/security.h> -#include <linux/skbuff.h> - -static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev, - unsigned int length, gfp_t gfp) -{ - struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp); - - if (NET_IP_ALIGN && skb) - skb_reserve(skb, NET_IP_ALIGN); - return skb; -} - -#define IS_ENABLED(option) defined(option) - -#define genl_dump_check_consistent(cb, user_hdr, family) - -#define IFF_TX_SKB_SHARING 0x10000 /* The interface supports sharing - * skbs on transmit */ - -#define PCMCIA_DEVICE_MANF_CARD_PROD_ID3(manf, card, v3, vh3) { \ - .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ - PCMCIA_DEV_ID_MATCH_CARD_ID| \ - PCMCIA_DEV_ID_MATCH_PROD_ID3, \ - .manf_id = (manf), \ - .card_id = (card), \ - .prod_id = { NULL, NULL, (v3), NULL }, \ - .prod_id_hash = { 0, 0, (vh3), 0 }, } - -/* - * This has been defined in include/linux/security.h for some time, but was - * only given an EXPORT_SYMBOL for 3.1. Add a compat_* definition to avoid - * breaking the compile. - */ -#define security_sk_clone(a, b) compat_security_sk_clone(a, b) - -static inline void security_sk_clone(const struct sock *sk, struct sock *newsk) -{ -} - -/* - * In many versions, several architectures do not seem to include an - * atomic64_t implementation, and do not include the software emulation from - * asm-generic/atomic64_t. - * Detect and handle this here. - */ -#include <asm/atomic.h> - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) && !defined(ATOMIC64_INIT) && !defined(CONFIG_X86) && !((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) && defined(CONFIG_ARM) && !defined(CONFIG_GENERIC_ATOMIC64)) -#include <asm-generic/atomic64.h> -#endif - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) */ - -#endif /* LINUX_3_1_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-3.2.h b/openairITS/mac/DOT11/include/linux/compat-3.2.h deleted file mode 100644 index cb14f0b1204..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-3.2.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef LINUX_3_2_COMPAT_H -#define LINUX_3_2_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) - -#include <linux/skbuff.h> -#include <linux/dma-mapping.h> - -#define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0) - -/** - * skb_frag_page - retrieve the page refered to by a paged fragment - * @frag: the paged fragment - * - * Returns the &struct page associated with @frag. - */ -static inline struct page *skb_frag_page(const skb_frag_t *frag) -{ - return frag->page; -} - -/** - * skb_frag_dma_map - maps a paged fragment via the DMA API - * @device: the device to map the fragment to - * @frag: the paged fragment to map - * @offset: the offset within the fragment (starting at the - * fragment's own offset) - * @size: the number of bytes to map - * @direction: the direction of the mapping (%PCI_DMA_*) - * - * Maps the page associated with @frag to @device. - */ -static inline dma_addr_t skb_frag_dma_map(struct device *dev, - const skb_frag_t *frag, - size_t offset, size_t size, - enum dma_data_direction dir) -{ - return dma_map_page(dev, skb_frag_page(frag), - frag->page_offset + offset, size, dir); -} - -#define ETH_P_TDLS 0x890D /* TDLS */ - -static inline unsigned int skb_frag_size(const skb_frag_t *frag) -{ - return frag->size; -} - -static inline char *hex_byte_pack(char *buf, u8 byte) -{ - *buf++ = hex_asc_hi(byte); - *buf++ = hex_asc_lo(byte); - return buf; -} - -/* module_platform_driver() - Helper macro for drivers that don't do - * anything special in module init/exit. This eliminates a lot of - * boilerplate. Each module may only use this macro once, and - * calling it replaces module_init() and module_exit() - */ -#define module_platform_driver(__platform_driver) \ - module_driver(__platform_driver, platform_driver_register, \ - platform_driver_unregister) - -static inline void *dma_zalloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t flag) -{ - void *ret = dma_alloc_coherent(dev, size, dma_handle, flag); - if (ret) - memset(ret, 0, size); - return ret; -} - -extern int __netdev_printk(const char *level, const struct net_device *dev, - struct va_format *vaf); - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,2,0)) */ - -#endif /* LINUX_3_2_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-3.3.h b/openairITS/mac/DOT11/include/linux/compat-3.3.h deleted file mode 100644 index 69bdcd0bbe4..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-3.3.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef LINUX_3_3_COMPAT_H -#define LINUX_3_3_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) - -/* include to override NL80211_FEATURE_SK_TX_STATUS */ -#include <linux/nl80211.h> -#include <linux/skbuff.h> - -extern struct sk_buff *__pskb_copy(struct sk_buff *skb, - int headroom, gfp_t gfp_mask); - -static inline void skb_complete_wifi_ack(struct sk_buff *skb, bool acked) -{ - WARN_ON(1); -} -#define NL80211_FEATURE_SK_TX_STATUS 0 - -typedef u32 netdev_features_t; - -/* source include/linux/device.h */ -/** - * module_driver() - Helper macro for drivers that don't do anything - * special in module init/exit. This eliminates a lot of boilerplate. - * Each module may only use this macro once, and calling it replaces - * module_init() and module_exit(). - * - * Use this macro to construct bus specific macros for registering - * drivers, and do not use it on its own. - */ -#define module_driver(__driver, __register, __unregister) \ -static int __init __driver##_init(void) \ -{ \ - return __register(&(__driver)); \ -} \ -module_init(__driver##_init); \ -static void __exit __driver##_exit(void) \ -{ \ - __unregister(&(__driver)); \ -} \ -module_exit(__driver##_exit); - -/* source include/linux/usb.h */ -/** - * module_usb_driver() - Helper macro for registering a USB driver - * @__usb_driver: usb_driver struct - * - * Helper macro for USB drivers which do not do anything special in module - * init/exit. This eliminates a lot of boilerplate. Each module may only - * use this macro once, and calling it replaces module_init() and module_exit() - */ -#define module_usb_driver(__usb_driver) \ - module_driver(__usb_driver, usb_register, \ - usb_deregister) - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */ - -#endif /* LINUX_3_3_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-3.4.h b/openairITS/mac/DOT11/include/linux/compat-3.4.h deleted file mode 100644 index e82e52fa782..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-3.4.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef LINUX_3_4_COMPAT_H -#define LINUX_3_4_COMPAT_H - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) - -#include <linux/etherdevice.h> -#include <linux/skbuff.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) -#define skb_add_rx_frag(skb, i, page, off, size, truesize) \ - v2_6_28_skb_add_rx_frag(skb, i, page, off, size) -#else -#define skb_add_rx_frag(skb, i, page, off, size, truesize) \ - skb_add_rx_frag(skb, i, page, off, size) -#endif - -#ifdef CONFIG_X86_X32_ABI -#define COMPAT_USE_64BIT_TIME \ - (!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)) -#else -#define COMPAT_USE_64BIT_TIME 0 -#endif - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)) -static inline void eth_hw_addr_random(struct net_device *dev) -{ -#error eth_hw_addr_random() needs to be implemented for < 2.6.12 -} -#else /* kernels >= 2.6.12 */ - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) -static inline void eth_hw_addr_random(struct net_device *dev) -{ - get_random_bytes(dev->dev_addr, ETH_ALEN); - dev->dev_addr[0] &= 0xfe; /* clear multicast bit */ - dev->dev_addr[0] |= 0x02; /* set local assignment bit (IEEE802) */ -} -#else /* kernels >= 2.6.31 */ - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) -/* So this is 2.6.31..2.6.35 */ - -/* Just have the flags present, they won't really mean anything though */ -#define NET_ADDR_PERM 0 /* address is permanent (default) */ -#define NET_ADDR_RANDOM 1 /* address is generated randomly */ -#define NET_ADDR_STOLEN 2 /* address is stolen from other device */ - -static inline void eth_hw_addr_random(struct net_device *dev) -{ - random_ether_addr(dev->dev_addr); -} - -#else /* 2.6.36 and on */ -static inline void eth_hw_addr_random(struct net_device *dev) -{ - dev_hw_addr_random(dev, dev->dev_addr); -} -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */ - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */ -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)) */ - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) */ - -#endif /* LINUX_5_4_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat-3.5.h b/openairITS/mac/DOT11/include/linux/compat-3.5.h deleted file mode 100644 index 9c10a42806c..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat-3.5.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef LINUX_3_5_COMPAT_H -#define LINUX_3_5_COMPAT_H - -#include <linux/version.h> -#include <linux/fs.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) - -extern int simple_open(struct inode *inode, struct file *file); - -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */ - -#endif /* LINUX_3_5_COMPAT_H */ diff --git a/openairITS/mac/DOT11/include/linux/compat_autoconf.h b/openairITS/mac/DOT11/include/linux/compat_autoconf.h deleted file mode 100644 index 8c7263c64be..00000000000 --- a/openairITS/mac/DOT11/include/linux/compat_autoconf.h +++ /dev/null @@ -1,767 +0,0 @@ -#ifndef COMPAT_AUTOCONF_INCLUDED -#define COMPAT_AUTOCONF_INCLUDED -/* - * Automatically generated C config: don't edit - * Wed Jan 8 15:57:07 CET 2014 - * compat-wireless-2.6: compat-wireless-v3.4-rc3-1 - * linux-2.6: v3.4-rc3 - */ -#define COMPAT_RELEASE "compat-wireless-v3.4-rc3-1" -#define COMPAT_KERNEL_RELEASE "v3.4-rc3" -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) -#error Compat-wireless requirement: Linux >= 2,6,24 -#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) */ -#ifndef CONFIG_COMPAT_KERNEL_3_3 -#define CONFIG_COMPAT_KERNEL_3_3 1 -#endif /* CONFIG_COMPAT_KERNEL_3_3 */ -#ifndef CONFIG_COMPAT_KERNEL_3_4 -#define CONFIG_COMPAT_KERNEL_3_4 1 -#endif /* CONFIG_COMPAT_KERNEL_3_4 */ -#ifndef CONFIG_COMPAT_KERNEL_3_5 -#define CONFIG_COMPAT_KERNEL_3_5 1 -#endif /* CONFIG_COMPAT_KERNEL_3_5 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) -#endif /* CONFIG_COMPAT_KERNEL_2_6_24 */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) -#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) -#if (!defined(RHEL_MAJOR) || RHEL_MAJOR != 6 || RHEL_MINOR < 1) -#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE) -#ifndef CONFIG_COMPAT_FIRMWARE_CLASS -#define CONFIG_COMPAT_FIRMWARE_CLASS 1 -#endif /* CONFIG_COMPAT_FIRMWARE_CLASS */ -#endif /* CONFIG_FW_LOADER */ -#endif /* CONFIG_COMPAT_RHEL_6_1 */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_33 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) -#if (!defined(RHEL_MAJOR) || RHEL_MAJOR != 6 || RHEL_MINOR < 1) -#endif /* CONFIG_COMPAT_RHEL_6_1 */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_36 */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) -#ifndef CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN -#define CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN 1 -#endif /* CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_33 */ -#if (defined(RHEL_MAJOR) && RHEL_MAJOR == 6 && RHEL_MINOR >= 0) -#ifndef CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN -#define CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN 1 -#endif /* CONFIG_COMPAT_BT_SOCK_CREATE_NEEDS_KERN */ -#endif /* CONFIG_COMPAT_RHEL_6_0 */ -#if (defined(RHEL_MAJOR) && RHEL_MAJOR == 6 && RHEL_MINOR >= 0) -#ifndef CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP -#define CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP 1 -#endif /* CONFIG_COMPAT_FIRMWARE_DATA_RW_NEEDS_FILP */ -#endif /* CONFIG_COMPAT_RHEL_6_0 */ -#ifndef CONFIG_MAC80211 -#define CONFIG_MAC80211 1 -#endif /* CONFIG_MAC80211 */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) -#ifndef CONFIG_COMPAT_MAC80211_DRIVER_API_TRACER -#define CONFIG_COMPAT_MAC80211_DRIVER_API_TRACER 1 -#endif /* CONFIG_COMPAT_MAC80211_DRIVER_API_TRACER */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_33 */ -#ifndef CONFIG_MAC80211_RC_DEFAULT -#define CONFIG_MAC80211_RC_DEFAULT "minstrel_ht" -#endif /* CONFIG_MAC80211_RC_DEFAULT */ -#ifndef CONFIG_MAC80211_RC_DEFAULT_MINSTREL -#define CONFIG_MAC80211_RC_DEFAULT_MINSTREL 1 -#endif /* CONFIG_MAC80211_RC_DEFAULT_MINSTREL */ -#ifndef CONFIG_COMPAT_MAC80211_RC_DEFAULT -#define CONFIG_COMPAT_MAC80211_RC_DEFAULT "minstrel_ht" -#endif /* CONFIG_COMPAT_MAC80211_RC_DEFAULT */ -#ifndef CONFIG_MAC80211_RC_PID -#define CONFIG_MAC80211_RC_PID 1 -#endif /* CONFIG_MAC80211_RC_PID */ -#ifndef CONFIG_MAC80211_RC_MINSTREL -#define CONFIG_MAC80211_RC_MINSTREL 1 -#endif /* CONFIG_MAC80211_RC_MINSTREL */ -#ifndef CONFIG_MAC80211_RC_MINSTREL_HT -#define CONFIG_MAC80211_RC_MINSTREL_HT 1 -#endif /* CONFIG_MAC80211_RC_MINSTREL_HT */ -#if defined(CONFIG_LEDS_TRIGGERS) || defined(CONFIG_LEDS_TRIGGERS_MODULE) -#ifndef CONFIG_MAC80211_LEDS -#define CONFIG_MAC80211_LEDS 1 -#endif /* CONFIG_MAC80211_LEDS */ -#endif /* CONFIG_LEDS_TRIGGERS */ -#ifndef CONFIG_MAC80211_MESH -#define CONFIG_MAC80211_MESH 1 -#endif /* CONFIG_MAC80211_MESH */ -#ifndef CONFIG_CFG80211 -#define CONFIG_CFG80211 1 -#endif /* CONFIG_CFG80211 */ -#ifndef CONFIG_CFG80211_DEFAULT_PS -#define CONFIG_CFG80211_DEFAULT_PS 1 -#endif /* CONFIG_CFG80211_DEFAULT_PS */ -#ifndef CONFIG_LIB80211 -#define CONFIG_LIB80211 1 -#endif /* CONFIG_LIB80211 */ -#ifndef CONFIG_LIB80211_CRYPT_WEP -#define CONFIG_LIB80211_CRYPT_WEP 1 -#endif /* CONFIG_LIB80211_CRYPT_WEP */ -#ifndef CONFIG_LIB80211_CRYPT_CCMP -#define CONFIG_LIB80211_CRYPT_CCMP 1 -#endif /* CONFIG_LIB80211_CRYPT_CCMP */ -#ifndef CONFIG_LIB80211_CRYPT_TKIP -#define CONFIG_LIB80211_CRYPT_TKIP 1 -#endif /* CONFIG_LIB80211_CRYPT_TKIP */ -#ifndef CONFIG_BT -#define CONFIG_BT 1 -#endif /* CONFIG_BT */ -#ifndef CONFIG_BT_RFCOMM -#define CONFIG_BT_RFCOMM 1 -#endif /* CONFIG_BT_RFCOMM */ -#ifndef CONFIG_BT_RFCOMM_TTY -#define CONFIG_BT_RFCOMM_TTY 1 -#endif /* CONFIG_BT_RFCOMM_TTY */ -#ifndef CONFIG_BT_BNEP -#define CONFIG_BT_BNEP 1 -#endif /* CONFIG_BT_BNEP */ -#ifndef CONFIG_BT_BNEP_MC_FILTER -#define CONFIG_BT_BNEP_MC_FILTER 1 -#endif /* CONFIG_BT_BNEP_MC_FILTER */ -#ifndef CONFIG_BT_BNEP_PROTO_FILTER -#define CONFIG_BT_BNEP_PROTO_FILTER 1 -#endif /* CONFIG_BT_BNEP_PROTO_FILTER */ -#if defined(CONFIG_ISDN_CAPI) || defined(CONFIG_ISDN_CAPI_MODULE) -#ifndef CONFIG_BT_CMTP -#define CONFIG_BT_CMTP 1 -#endif /* CONFIG_BT_CMTP */ -#endif /* CONFIG_ISDN_CAPI */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) -#ifndef CONFIG_COMPAT_BT_HIDP -#define CONFIG_COMPAT_BT_HIDP 1 -#endif /* CONFIG_COMPAT_BT_HIDP */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_28 */ -#ifndef CONFIG_BT_HCIUART -#define CONFIG_BT_HCIUART "M" -#endif /* CONFIG_BT_HCIUART */ -#ifndef CONFIG_BT_HCIUART_H4 -#define CONFIG_BT_HCIUART_H4 1 -#endif /* CONFIG_BT_HCIUART_H4 */ -#ifndef CONFIG_BT_HCIUART_BCSP -#define CONFIG_BT_HCIUART_BCSP 1 -#endif /* CONFIG_BT_HCIUART_BCSP */ -#ifndef CONFIG_BT_HCIUART_ATH3K -#define CONFIG_BT_HCIUART_ATH3K 1 -#endif /* CONFIG_BT_HCIUART_ATH3K */ -#ifndef CONFIG_BT_HCIUART_LL -#define CONFIG_BT_HCIUART_LL 1 -#endif /* CONFIG_BT_HCIUART_LL */ -#ifndef CONFIG_BT_HCIVHCI -#define CONFIG_BT_HCIVHCI 1 -#endif /* CONFIG_BT_HCIVHCI */ -#ifndef CONFIG_BT_MRVL -#define CONFIG_BT_MRVL 1 -#endif /* CONFIG_BT_MRVL */ -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) -#ifndef CONFIG_BT_HCIDTL1 -#define CONFIG_BT_HCIDTL1 1 -#endif /* CONFIG_BT_HCIDTL1 */ -#ifndef CONFIG_BT_HCIBT3C -#define CONFIG_BT_HCIBT3C 1 -#endif /* CONFIG_BT_HCIBT3C */ -#ifndef CONFIG_BT_HCIBLUECARD -#define CONFIG_BT_HCIBLUECARD 1 -#endif /* CONFIG_BT_HCIBLUECARD */ -#ifndef CONFIG_BT_HCIBTUART -#define CONFIG_BT_HCIBTUART 1 -#endif /* CONFIG_BT_HCIBTUART */ -#endif /* CONFIG_PCMCIA */ -#if defined(CONFIG_WIRELESS_EXT) || defined(CONFIG_WIRELESS_EXT_MODULE) -#ifndef CONFIG_CFG80211_WEXT -#define CONFIG_CFG80211_WEXT 1 -#endif /* CONFIG_CFG80211_WEXT */ -#else /* CONFIG_CFG80211_WEXT */ -#endif /* CONFIG_WIRELESS_EXT */ -#if defined(CONFIG_STAGING) || defined(CONFIG_STAGING_MODULE) -#ifndef CONFIG_COMPAT_STAGING -#define CONFIG_COMPAT_STAGING 1 -#endif /* CONFIG_COMPAT_STAGING */ -#endif /* CONFIG_STAGING */ -#ifndef CONFIG_MAC80211_HWSIM -#define CONFIG_MAC80211_HWSIM 1 -#endif /* CONFIG_MAC80211_HWSIM */ -#ifndef CONFIG_ATH5K -#define CONFIG_ATH5K 1 -#endif /* CONFIG_ATH5K */ -#ifndef CONFIG_ATH9K -#define CONFIG_ATH9K 1 -#endif /* CONFIG_ATH9K */ -#ifndef CONFIG_ATH9K_HW -#define CONFIG_ATH9K_HW 1 -#endif /* CONFIG_ATH9K_HW */ -#ifndef CONFIG_ATH9K_COMMON -#define CONFIG_ATH9K_COMMON 1 -#endif /* CONFIG_ATH9K_COMMON */ -#ifndef CONFIG_COMPAT_ATH9K_RATE_CONTROL -#define CONFIG_COMPAT_ATH9K_RATE_CONTROL 1 -#endif /* CONFIG_COMPAT_ATH9K_RATE_CONTROL */ -#ifndef CONFIG_ATH9K_BTCOEX_SUPPORT -#define CONFIG_ATH9K_BTCOEX_SUPPORT 1 -#endif /* CONFIG_ATH9K_BTCOEX_SUPPORT */ -#if defined(CONFIG_PCI) || defined(CONFIG_PCI_MODULE) -#ifndef CONFIG_ATH5K_PCI -#define CONFIG_ATH5K_PCI 1 -#endif /* CONFIG_ATH5K_PCI */ -#ifndef CONFIG_ATH9K_PCI -#define CONFIG_ATH9K_PCI 1 -#endif /* CONFIG_ATH9K_PCI */ -#ifndef CONFIG_IWLWIFI -#define CONFIG_IWLWIFI 1 -#endif /* CONFIG_IWLWIFI */ -#ifndef CONFIG_IWLWIFI_P2P -#define CONFIG_IWLWIFI_P2P 1 -#endif /* CONFIG_IWLWIFI_P2P */ -#ifndef CONFIG_IWLEGACY -#define CONFIG_IWLEGACY 1 -#endif /* CONFIG_IWLEGACY */ -#ifndef CONFIG_COMPAT_IWL4965 -#define CONFIG_COMPAT_IWL4965 1 -#endif /* CONFIG_COMPAT_IWL4965 */ -#ifndef CONFIG_IWL3945 -#define CONFIG_IWL3945 1 -#endif /* CONFIG_IWL3945 */ -#ifndef CONFIG_B43 -#define CONFIG_B43 1 -#endif /* CONFIG_B43 */ -#ifndef CONFIG_B43_HWRNG -#define CONFIG_B43_HWRNG 1 -#endif /* CONFIG_B43_HWRNG */ -#ifndef CONFIG_B43_PCI_AUTOSELECT -#define CONFIG_B43_PCI_AUTOSELECT 1 -#endif /* CONFIG_B43_PCI_AUTOSELECT */ -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) -#ifndef CONFIG_B43_PCMCIA -#define CONFIG_B43_PCMCIA 1 -#endif /* CONFIG_B43_PCMCIA */ -#endif /* CONFIG_PCMCIA */ -#if defined(CONFIG_MAC80211_LEDS) || defined(CONFIG_MAC80211_LEDS_MODULE) -#ifndef CONFIG_B43_LEDS -#define CONFIG_B43_LEDS 1 -#endif /* CONFIG_B43_LEDS */ -#endif /* CONFIG_MAC80211_LEDS */ -#ifndef CONFIG_B43_PHY_LP -#define CONFIG_B43_PHY_LP 1 -#endif /* CONFIG_B43_PHY_LP */ -#ifndef CONFIG_B43_PHY_N -#define CONFIG_B43_PHY_N 1 -#endif /* CONFIG_B43_PHY_N */ -#ifndef CONFIG_B43_PHY_HT -#define CONFIG_B43_PHY_HT 1 -#endif /* CONFIG_B43_PHY_HT */ -#ifndef CONFIG_B43LEGACY -#define CONFIG_B43LEGACY 1 -#endif /* CONFIG_B43LEGACY */ -#ifndef CONFIG_B43LEGACY_HWRNG -#define CONFIG_B43LEGACY_HWRNG 1 -#endif /* CONFIG_B43LEGACY_HWRNG */ -#ifndef CONFIG_B43LEGACY_PCI_AUTOSELECT -#define CONFIG_B43LEGACY_PCI_AUTOSELECT 1 -#endif /* CONFIG_B43LEGACY_PCI_AUTOSELECT */ -#if defined(CONFIG_MAC80211_LEDS) || defined(CONFIG_MAC80211_LEDS_MODULE) -#ifndef CONFIG_B43LEGACY_LEDS -#define CONFIG_B43LEGACY_LEDS 1 -#endif /* CONFIG_B43LEGACY_LEDS */ -#endif /* CONFIG_MAC80211_LEDS */ -#ifndef CONFIG_B43LEGACY_DMA -#define CONFIG_B43LEGACY_DMA 1 -#endif /* CONFIG_B43LEGACY_DMA */ -#ifndef CONFIG_B43LEGACY_PIO -#define CONFIG_B43LEGACY_PIO 1 -#endif /* CONFIG_B43LEGACY_PIO */ -#if defined(CONFIG_WIRELESS_EXT) || defined(CONFIG_WIRELESS_EXT_MODULE) -#ifndef CONFIG_LIBIPW -#define CONFIG_LIBIPW 1 -#endif /* CONFIG_LIBIPW */ -#ifndef CONFIG_IPW2100 -#define CONFIG_IPW2100 1 -#endif /* CONFIG_IPW2100 */ -#ifndef CONFIG_IPW2100_MONITOR -#define CONFIG_IPW2100_MONITOR 1 -#endif /* CONFIG_IPW2100_MONITOR */ -#ifndef CONFIG_IPW2200 -#define CONFIG_IPW2200 1 -#endif /* CONFIG_IPW2200 */ -#ifndef CONFIG_IPW2200_MONITOR -#define CONFIG_IPW2200_MONITOR 1 -#endif /* CONFIG_IPW2200_MONITOR */ -#ifndef CONFIG_IPW2200_RADIOTAP -#define CONFIG_IPW2200_RADIOTAP 1 -#endif /* CONFIG_IPW2200_RADIOTAP */ -#ifndef CONFIG_IPW2200_PROMISCUOUS -#define CONFIG_IPW2200_PROMISCUOUS 1 -#endif /* CONFIG_IPW2200_PROMISCUOUS */ -#ifndef CONFIG_IPW2200_QOS -#define CONFIG_IPW2200_QOS 1 -#endif /* CONFIG_IPW2200_QOS */ -#endif /* CONFIG_WIRELESS_EXT */ -#if defined(CONFIG_SSB) || defined(CONFIG_SSB_MODULE) -#ifndef CONFIG_SSB_SPROM -#define CONFIG_SSB_SPROM 1 -#endif /* CONFIG_SSB_SPROM */ -#ifndef CONFIG_SSB_BLOCKIO -#define CONFIG_SSB_BLOCKIO 1 -#endif /* CONFIG_SSB_BLOCKIO */ -#ifndef CONFIG_SSB_PCIHOST -#define CONFIG_SSB_PCIHOST 1 -#endif /* CONFIG_SSB_PCIHOST */ -#ifndef CONFIG_SSB_B43_PCI_BRIDGE -#define CONFIG_SSB_B43_PCI_BRIDGE 1 -#endif /* CONFIG_SSB_B43_PCI_BRIDGE */ -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) -#ifndef CONFIG_SSB_PCMCIAHOST -#define CONFIG_SSB_PCMCIAHOST 1 -#endif /* CONFIG_SSB_PCMCIAHOST */ -#endif /* CONFIG_PCMCIA */ -#ifndef CONFIG_SSB_DRIVER_PCICORE -#define CONFIG_SSB_DRIVER_PCICORE 1 -#endif /* CONFIG_SSB_DRIVER_PCICORE */ -#ifndef CONFIG_B43_SSB -#define CONFIG_B43_SSB 1 -#endif /* CONFIG_B43_SSB */ -#endif /* CONFIG_SSB */ -#ifndef CONFIG_BCMA -#define CONFIG_BCMA 1 -#endif /* CONFIG_BCMA */ -#ifndef CONFIG_BCMA_BLOCKIO -#define CONFIG_BCMA_BLOCKIO 1 -#endif /* CONFIG_BCMA_BLOCKIO */ -#ifndef CONFIG_BCMA_HOST_PCI -#define CONFIG_BCMA_HOST_PCI 1 -#endif /* CONFIG_BCMA_HOST_PCI */ -#ifndef CONFIG_B43_BCMA -#define CONFIG_B43_BCMA 1 -#endif /* CONFIG_B43_BCMA */ -#ifndef CONFIG_B43_BCMA_EXTRA -#define CONFIG_B43_BCMA_EXTRA 1 -#endif /* CONFIG_B43_BCMA_EXTRA */ -#ifndef CONFIG_P54_PCI -#define CONFIG_P54_PCI 1 -#endif /* CONFIG_P54_PCI */ -#ifndef CONFIG_B44 -#define CONFIG_B44 1 -#endif /* CONFIG_B44 */ -#ifndef CONFIG_B44_PCI -#define CONFIG_B44_PCI 1 -#endif /* CONFIG_B44_PCI */ -#ifndef CONFIG_RTL8180 -#define CONFIG_RTL8180 1 -#endif /* CONFIG_RTL8180 */ -#ifndef CONFIG_ADM8211 -#define CONFIG_ADM8211 1 -#endif /* CONFIG_ADM8211 */ -#ifndef CONFIG_RT2X00_LIB_PCI -#define CONFIG_RT2X00_LIB_PCI 1 -#endif /* CONFIG_RT2X00_LIB_PCI */ -#ifndef CONFIG_RT2400PCI -#define CONFIG_RT2400PCI 1 -#endif /* CONFIG_RT2400PCI */ -#ifndef CONFIG_RT2500PCI -#define CONFIG_RT2500PCI 1 -#endif /* CONFIG_RT2500PCI */ -#if defined(CONFIG_CRC_CCITT) || defined(CONFIG_CRC_CCITT_MODULE) -#ifndef CONFIG_RT2800PCI -#define CONFIG_RT2800PCI 1 -#endif /* CONFIG_RT2800PCI */ -#ifndef CONFIG_RT2800PCI_RT33XX -#define CONFIG_RT2800PCI_RT33XX 1 -#endif /* CONFIG_RT2800PCI_RT33XX */ -#ifndef CONFIG_RT2800PCI_RT35XX -#define CONFIG_RT2800PCI_RT35XX 1 -#endif /* CONFIG_RT2800PCI_RT35XX */ -#ifndef CONFIG_RT2800PCI_RT53XX -#define CONFIG_RT2800PCI_RT53XX 1 -#endif /* CONFIG_RT2800PCI_RT53XX */ -#endif /* CONFIG_CRC_CCITT */ -#if defined(CONFIG_CRC_ITU_T) || defined(CONFIG_CRC_ITU_T_MODULE) -#ifndef CONFIG_RT61PCI -#define CONFIG_RT61PCI 1 -#endif /* CONFIG_RT61PCI */ -#endif /* CONFIG_CRC_ITU_T */ -#ifndef CONFIG_MWL8K -#define CONFIG_MWL8K 1 -#endif /* CONFIG_MWL8K */ -#ifndef CONFIG_ATL1 -#define CONFIG_ATL1 1 -#endif /* CONFIG_ATL1 */ -#ifndef CONFIG_ATL2 -#define CONFIG_ATL2 1 -#endif /* CONFIG_ATL2 */ -#ifndef CONFIG_ATL1E -#define CONFIG_ATL1E 1 -#endif /* CONFIG_ATL1E */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) -#undef CONFIG_ATL1C -#ifndef CONFIG_ALX -#define CONFIG_ALX 1 -#endif /* CONFIG_ALX */ -#else /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#undef CONFIG_ATL1C -#ifndef CONFIG_ALX -#define CONFIG_ALX 1 -#endif /* CONFIG_ALX */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#if defined(CONFIG_WIRELESS_EXT) || defined(CONFIG_WIRELESS_EXT_MODULE) -#ifndef CONFIG_HERMES -#define CONFIG_HERMES 1 -#endif /* CONFIG_HERMES */ -#ifndef CONFIG_HERMES_CACHE_FW_ON_INIT -#define CONFIG_HERMES_CACHE_FW_ON_INIT 1 -#endif /* CONFIG_HERMES_CACHE_FW_ON_INIT */ -#if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_PMAC_MODULE) -#ifndef CONFIG_APPLE_AIRPORT -#define CONFIG_APPLE_AIRPORT 1 -#endif /* CONFIG_APPLE_AIRPORT */ -#endif /* CONFIG_PPC_PMAC */ -#ifndef CONFIG_PLX_HERMES -#define CONFIG_PLX_HERMES 1 -#endif /* CONFIG_PLX_HERMES */ -#ifndef CONFIG_TMD_HERMES -#define CONFIG_TMD_HERMES 1 -#endif /* CONFIG_TMD_HERMES */ -#ifndef CONFIG_NORTEL_HERMES -#define CONFIG_NORTEL_HERMES 1 -#endif /* CONFIG_NORTEL_HERMES */ -#ifndef CONFIG_PCI_HERMES -#define CONFIG_PCI_HERMES 1 -#endif /* CONFIG_PCI_HERMES */ -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) -#ifndef CONFIG_PCMCIA_HERMES -#define CONFIG_PCMCIA_HERMES 1 -#endif /* CONFIG_PCMCIA_HERMES */ -#ifndef CONFIG_PCMCIA_SPECTRUM -#define CONFIG_PCMCIA_SPECTRUM 1 -#endif /* CONFIG_PCMCIA_SPECTRUM */ -#endif /* CONFIG_PCMCIA */ -#endif /* CONFIG_WIRELESS_EXT */ -#ifndef CONFIG_RTL8192CE -#define CONFIG_RTL8192CE 1 -#endif /* CONFIG_RTL8192CE */ -#ifndef CONFIG_RTL8192SE -#define CONFIG_RTL8192SE 1 -#endif /* CONFIG_RTL8192SE */ -#ifndef CONFIG_RTL8192DE -#define CONFIG_RTL8192DE 1 -#endif /* CONFIG_RTL8192DE */ -#ifndef CONFIG_BRCMSMAC -#define CONFIG_BRCMSMAC 1 -#endif /* CONFIG_BRCMSMAC */ -#ifndef CONFIG_MWIFIEX_PCIE -#define CONFIG_MWIFIEX_PCIE 1 -#endif /* CONFIG_MWIFIEX_PCIE */ -#endif /* CONFIG_PCI */ -#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) -#undef CONFIG_LIBERTAS -#undef CONFIG_LIBERTAS_CS -#else /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#ifndef CONFIG_LIBERTAS_CS -#define CONFIG_LIBERTAS_CS 1 -#endif /* CONFIG_LIBERTAS_CS */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#endif /* CONFIG_PCMCIA */ -#ifndef CONFIG_EEPROM_93CX6 -#define CONFIG_EEPROM_93CX6 1 -#endif /* CONFIG_EEPROM_93CX6 */ -#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) -#ifndef CONFIG_COMPAT_ZD1211RW -#define CONFIG_COMPAT_ZD1211RW 1 -#endif /* CONFIG_COMPAT_ZD1211RW */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_29 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) -#undef CONFIG_USB_COMPAT_USBNET -#undef CONFIG_USB_NET_COMPAT_RNDIS_HOST -#undef CONFIG_USB_NET_COMPAT_RNDIS_WLAN -#undef CONFIG_USB_NET_COMPAT_CDCETHER -#else /* CONFIG_COMPAT_KERNEL_2_6_29 */ -#ifndef CONFIG_USB_COMPAT_USBNET -#define CONFIG_USB_COMPAT_USBNET 1 -#endif /* CONFIG_USB_COMPAT_USBNET */ -#if defined(CONFIG_USB_NET_CDCETHER) || defined(CONFIG_USB_NET_CDCETHER_MODULE) -#ifndef CONFIG_USB_NET_COMPAT_RNDIS_HOST -#define CONFIG_USB_NET_COMPAT_RNDIS_HOST 1 -#endif /* CONFIG_USB_NET_COMPAT_RNDIS_HOST */ -#ifndef CONFIG_USB_NET_COMPAT_RNDIS_WLAN -#define CONFIG_USB_NET_COMPAT_RNDIS_WLAN 1 -#endif /* CONFIG_USB_NET_COMPAT_RNDIS_WLAN */ -#endif /* CONFIG_USB_NET_CDCETHER */ -#if defined(CONFIG_USB_NET_CDCETHER_MODULE) || defined(CONFIG_USB_NET_CDCETHER_MODULE_MODULE) -#ifndef CONFIG_USB_NET_COMPAT_RNDIS_HOST -#define CONFIG_USB_NET_COMPAT_RNDIS_HOST 1 -#endif /* CONFIG_USB_NET_COMPAT_RNDIS_HOST */ -#ifndef CONFIG_USB_NET_COMPAT_RNDIS_WLAN -#define CONFIG_USB_NET_COMPAT_RNDIS_WLAN 1 -#endif /* CONFIG_USB_NET_COMPAT_RNDIS_WLAN */ -#endif /* CONFIG_USB_NET_CDCETHER */ -#ifndef CONFIG_USB_NET_COMPAT_CDCETHER -#define CONFIG_USB_NET_COMPAT_CDCETHER 1 -#endif /* CONFIG_USB_NET_COMPAT_CDCETHER */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_29 */ -#ifndef CONFIG_P54_USB -#define CONFIG_P54_USB 1 -#endif /* CONFIG_P54_USB */ -#ifndef CONFIG_RTL8187 -#define CONFIG_RTL8187 1 -#endif /* CONFIG_RTL8187 */ -#if defined(CONFIG_MAC80211_LEDS) || defined(CONFIG_MAC80211_LEDS_MODULE) -#ifndef CONFIG_RTL8187_LEDS -#define CONFIG_RTL8187_LEDS 1 -#endif /* CONFIG_RTL8187_LEDS */ -#endif /* CONFIG_MAC80211_LEDS */ -#ifndef CONFIG_AT76C50X_USB -#define CONFIG_AT76C50X_USB 1 -#endif /* CONFIG_AT76C50X_USB */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) -#ifndef CONFIG_CARL9170 -#define CONFIG_CARL9170 1 -#endif /* CONFIG_CARL9170 */ -#if defined(CONFIG_MAC80211_LEDS) || defined(CONFIG_MAC80211_LEDS_MODULE) -#ifndef CONFIG_CARL9170_LEDS -#define CONFIG_CARL9170_LEDS 1 -#endif /* CONFIG_CARL9170_LEDS */ -#endif /* CONFIG_MAC80211_LEDS */ -#ifndef CONFIG_CARL9170_WPC -#define CONFIG_CARL9170_WPC 1 -#endif /* CONFIG_CARL9170_WPC */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_29 */ -#ifndef CONFIG_COMPAT_USB_URB_THREAD_FIX -#define CONFIG_COMPAT_USB_URB_THREAD_FIX 1 -#endif /* CONFIG_COMPAT_USB_URB_THREAD_FIX */ -#ifndef CONFIG_ATH9K_HTC -#define CONFIG_ATH9K_HTC 1 -#endif /* CONFIG_ATH9K_HTC */ -#ifndef CONFIG_RT2500USB -#define CONFIG_RT2500USB 1 -#endif /* CONFIG_RT2500USB */ -#if defined(CONFIG_CRC_CCITT) || defined(CONFIG_CRC_CCITT_MODULE) -#ifndef CONFIG_RT2800USB -#define CONFIG_RT2800USB 1 -#endif /* CONFIG_RT2800USB */ -#ifndef CONFIG_RT2800USB_RT33XX -#define CONFIG_RT2800USB_RT33XX 1 -#endif /* CONFIG_RT2800USB_RT33XX */ -#ifndef CONFIG_RT2800USB_RT35XX -#define CONFIG_RT2800USB_RT35XX 1 -#endif /* CONFIG_RT2800USB_RT35XX */ -#ifndef CONFIG_RT2800USB_RT53XX -#define CONFIG_RT2800USB_RT53XX 1 -#endif /* CONFIG_RT2800USB_RT53XX */ -#ifndef CONFIG_RT2800USB_UNKNOWN -#define CONFIG_RT2800USB_UNKNOWN 1 -#endif /* CONFIG_RT2800USB_UNKNOWN */ -#endif /* CONFIG_CRC_CCITT */ -#ifndef CONFIG_RT2X00_LIB_USB -#define CONFIG_RT2X00_LIB_USB 1 -#endif /* CONFIG_RT2X00_LIB_USB */ -#if defined(CONFIG_CRC_ITU_T) || defined(CONFIG_CRC_ITU_T_MODULE) -#ifndef CONFIG_RT73USB -#define CONFIG_RT73USB 1 -#endif /* CONFIG_RT73USB */ -#endif /* CONFIG_CRC_ITU_T */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) -#undef CONFIG_LIBERTAS_THINFIRM_USB -#undef CONFIG_LIBERTAS_USB -#else /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#ifndef CONFIG_LIBERTAS_THINFIRM_USB -#define CONFIG_LIBERTAS_THINFIRM_USB 1 -#endif /* CONFIG_LIBERTAS_THINFIRM_USB */ -#ifndef CONFIG_LIBERTAS_USB -#define CONFIG_LIBERTAS_USB 1 -#endif /* CONFIG_LIBERTAS_USB */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#ifndef CONFIG_ORINOCO_USB -#define CONFIG_ORINOCO_USB 1 -#endif /* CONFIG_ORINOCO_USB */ -#ifndef CONFIG_BT_HCIBTUSB -#define CONFIG_BT_HCIBTUSB 1 -#endif /* CONFIG_BT_HCIBTUSB */ -#ifndef CONFIG_BT_HCIBCM203X -#define CONFIG_BT_HCIBCM203X 1 -#endif /* CONFIG_BT_HCIBCM203X */ -#ifndef CONFIG_BT_HCIBPA10X -#define CONFIG_BT_HCIBPA10X 1 -#endif /* CONFIG_BT_HCIBPA10X */ -#ifndef CONFIG_BT_HCIBFUSB -#define CONFIG_BT_HCIBFUSB 1 -#endif /* CONFIG_BT_HCIBFUSB */ -#ifndef CONFIG_BT_ATH3K -#define CONFIG_BT_ATH3K 1 -#endif /* CONFIG_BT_ATH3K */ -#ifndef CONFIG_RTL8192CU -#define CONFIG_RTL8192CU 1 -#endif /* CONFIG_RTL8192CU */ -#endif /* CONFIG_USB */ -#if defined(CONFIG_SPI_MASTER) || defined(CONFIG_SPI_MASTER_MODULE) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) -#if defined(CONFIG_CRC7) || defined(CONFIG_CRC7_MODULE) -#ifndef CONFIG_WL1251_SPI -#define CONFIG_WL1251_SPI 1 -#endif /* CONFIG_WL1251_SPI */ -#ifndef CONFIG_WL12XX_SPI -#define CONFIG_WL12XX_SPI 1 -#endif /* CONFIG_WL12XX_SPI */ -#endif /* CONFIG_CRC7 */ -#ifndef CONFIG_P54_SPI -#define CONFIG_P54_SPI 1 -#endif /* CONFIG_P54_SPI */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) -#undef CONFIG_LIBERTAS_SPI -#else /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#ifndef CONFIG_LIBERTAS_SPI -#define CONFIG_LIBERTAS_SPI 1 -#endif /* CONFIG_LIBERTAS_SPI */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_25 */ -#endif /* CONFIG_SPI_MASTER */ -#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE) -#ifndef CONFIG_SSB_SDIOHOST -#define CONFIG_SSB_SDIOHOST 1 -#endif /* CONFIG_SSB_SDIOHOST */ -#ifndef CONFIG_B43_SDIO -#define CONFIG_B43_SDIO 1 -#endif /* CONFIG_B43_SDIO */ -#if defined(CONFIG_CRC7) || defined(CONFIG_CRC7_MODULE) -#if defined(CONFIG_WL12XX_PLATFORM_DATA) || defined(CONFIG_WL12XX_PLATFORM_DATA_MODULE) -#ifndef CONFIG_COMPAT_WL1251_SDIO -#define CONFIG_COMPAT_WL1251_SDIO 1 -#endif /* CONFIG_COMPAT_WL1251_SDIO */ -#endif /* CONFIG_WL12XX_PLATFORM_DATA */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) -#if defined(CONFIG_WL12XX_PLATFORM_DATA) || defined(CONFIG_WL12XX_PLATFORM_DATA_MODULE) -#ifndef CONFIG_COMPAT_WL12XX_SDIO -#define CONFIG_COMPAT_WL12XX_SDIO 1 -#endif /* CONFIG_COMPAT_WL12XX_SDIO */ -#endif /* CONFIG_WL12XX_PLATFORM_DATA */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_32 */ -#endif /* CONFIG_CRC7 */ -#ifndef CONFIG_MWIFIEX_SDIO -#define CONFIG_MWIFIEX_SDIO 1 -#endif /* CONFIG_MWIFIEX_SDIO */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) -#ifndef CONFIG_COMPAT_LIBERTAS_SDIO -#define CONFIG_COMPAT_LIBERTAS_SDIO 1 -#endif /* CONFIG_COMPAT_LIBERTAS_SDIO */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_32 */ -#ifndef CONFIG_IWM -#define CONFIG_IWM 1 -#endif /* CONFIG_IWM */ -#ifndef CONFIG_BT_HCIBTSDIO -#define CONFIG_BT_HCIBTSDIO 1 -#endif /* CONFIG_BT_HCIBTSDIO */ -#ifndef CONFIG_BT_MRVL_SDIO -#define CONFIG_BT_MRVL_SDIO 1 -#endif /* CONFIG_BT_MRVL_SDIO */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) -#ifndef CONFIG_ATH6KL -#define CONFIG_ATH6KL 1 -#endif /* CONFIG_ATH6KL */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) -#ifndef CONFIG_BRCMFMAC -#define CONFIG_BRCMFMAC 1 -#endif /* CONFIG_BRCMFMAC */ -#ifndef CONFIG_BRCMFMAC_SDIO -#define CONFIG_BRCMFMAC_SDIO 1 -#endif /* CONFIG_BRCMFMAC_SDIO */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_29 */ -#endif /* CONFIG_MMC */ -#ifndef CONFIG_RTLWIFI -#define CONFIG_RTLWIFI 1 -#endif /* CONFIG_RTLWIFI */ -#ifndef CONFIG_RTL8192C_COMMON -#define CONFIG_RTL8192C_COMMON 1 -#endif /* CONFIG_RTL8192C_COMMON */ -#ifndef CONFIG_RT2X00 -#define CONFIG_RT2X00 1 -#endif /* CONFIG_RT2X00 */ -#ifndef CONFIG_RT2X00_LIB -#define CONFIG_RT2X00_LIB 1 -#endif /* CONFIG_RT2X00_LIB */ -#ifndef CONFIG_RT2800_LIB -#define CONFIG_RT2800_LIB 1 -#endif /* CONFIG_RT2800_LIB */ -#ifndef CONFIG_RT2X00_LIB_FIRMWARE -#define CONFIG_RT2X00_LIB_FIRMWARE 1 -#endif /* CONFIG_RT2X00_LIB_FIRMWARE */ -#ifndef CONFIG_RT2X00_LIB_CRYPTO -#define CONFIG_RT2X00_LIB_CRYPTO 1 -#endif /* CONFIG_RT2X00_LIB_CRYPTO */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) -#undef CONFIG_RT2X00_LIB_LEDS -#else /* CONFIG_COMPAT_KERNEL_2_6_25 */ -#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) -#ifndef CONFIG_RT2X00_LIB_LEDS -#define CONFIG_RT2X00_LIB_LEDS 1 -#endif /* CONFIG_RT2X00_LIB_LEDS */ -#endif /* CONFIG_LEDS_CLASS */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_25 */ -#ifndef CONFIG_P54_COMMON -#define CONFIG_P54_COMMON 1 -#endif /* CONFIG_P54_COMMON */ -#if defined(CONFIG_MAC80211_LEDS) || defined(CONFIG_MAC80211_LEDS_MODULE) -#ifndef CONFIG_P54_LEDS -#define CONFIG_P54_LEDS 1 -#endif /* CONFIG_P54_LEDS */ -#endif /* CONFIG_MAC80211_LEDS */ -#ifndef CONFIG_ATH_COMMON -#define CONFIG_ATH_COMMON 1 -#endif /* CONFIG_ATH_COMMON */ -#ifndef CONFIG_BRCMUTIL -#define CONFIG_BRCMUTIL 1 -#endif /* CONFIG_BRCMUTIL */ -#if defined(CONFIG_CRC7) || defined(CONFIG_CRC7_MODULE) -#ifndef CONFIG_WL1251 -#define CONFIG_WL1251 1 -#endif /* CONFIG_WL1251 */ -#ifndef CONFIG_WL12XX -#define CONFIG_WL12XX 1 -#endif /* CONFIG_WL12XX */ -#endif /* CONFIG_CRC7 */ -#ifndef CONFIG_MWIFIEX -#define CONFIG_MWIFIEX 1 -#endif /* CONFIG_MWIFIEX */ -#if !defined(CONFIG_CORDIC) && !defined(CONFIG_CORDIC_MODULE) -#ifndef CONFIG_COMPAT_CORDIC -#define CONFIG_COMPAT_CORDIC 1 -#endif /* CONFIG_COMPAT_CORDIC */ -#endif /* CONFIG_CORDIC */ -#if !defined(CONFIG_CRC8) && !defined(CONFIG_CRC8_MODULE) -#ifndef CONFIG_COMPAT_CRC8 -#define CONFIG_COMPAT_CRC8 1 -#endif /* CONFIG_COMPAT_CRC8 */ -#endif /* CONFIG_CRC8 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) -#undef CONFIG_LIBERTAS -#else /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#ifndef CONFIG_LIBERTAS_THINFIRM -#define CONFIG_LIBERTAS_THINFIRM 1 -#endif /* CONFIG_LIBERTAS_THINFIRM */ -#ifndef CONFIG_LIBERTAS -#define CONFIG_LIBERTAS 1 -#endif /* CONFIG_LIBERTAS */ -#ifndef CONFIG_LIBERTAS_MESH -#define CONFIG_LIBERTAS_MESH 1 -#endif /* CONFIG_LIBERTAS_MESH */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_27 */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) -#ifndef CONFIG_RFKILL_BACKPORT -#define CONFIG_RFKILL_BACKPORT 1 -#endif /* CONFIG_RFKILL_BACKPORT */ -#if defined(CONFIG_LEDS_TRIGGERS) || defined(CONFIG_LEDS_TRIGGERS_MODULE) -#ifndef CONFIG_RFKILL_BACKPORT_LEDS -#define CONFIG_RFKILL_BACKPORT_LEDS 1 -#endif /* CONFIG_RFKILL_BACKPORT_LEDS */ -#endif /* CONFIG_LEDS_TRIGGERS */ -#ifndef CONFIG_RFKILL_BACKPORT_INPUT -#define CONFIG_RFKILL_BACKPORT_INPUT 1 -#endif /* CONFIG_RFKILL_BACKPORT_INPUT */ -#endif /* CONFIG_COMPAT_KERNEL_2_6_31 */ -#ifdef CONFIG_NET_SCHED -#ifdef CONFIG_NETDEVICES_MULTIQUEUE -#ifndef CONFIG_MAC80211_QOS -#define CONFIG_MAC80211_QOS 1 -#endif /* CONFIG_MAC80211_QOS */ -#endif -#endif -#endif /* COMPAT_AUTOCONF_INCLUDED */ diff --git a/openairITS/mac/DOT11/include/linux/cordic.h b/openairITS/mac/DOT11/include/linux/cordic.h deleted file mode 100644 index f932093e20c..00000000000 --- a/openairITS/mac/DOT11/include/linux/cordic.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef __CORDIC_H_ -#define __CORDIC_H_ - -#include <linux/types.h> - -/** - * struct cordic_iq - i/q coordinate. - * - * @i: real part of coordinate (in phase). - * @q: imaginary part of coordinate (quadrature). - */ -struct cordic_iq { - s32 i; - s32 q; -}; - -/** - * cordic_calc_iq() - calculates the i/q coordinate for given angle. - * - * @theta: angle in degrees for which i/q coordinate is to be calculated. - * @coord: function output parameter holding the i/q coordinate. - * - * The function calculates the i/q coordinate for a given angle using - * cordic algorithm. The coordinate consists of a real (i) and an - * imaginary (q) part. The real part is essentially the cosine of the - * angle and the imaginary part is the sine of the angle. The returned - * values are scaled by 2^16 for precision. The range for theta is - * for -180 degrees to +180 degrees. Passed values outside this range are - * converted before doing the actual calculation. - */ -struct cordic_iq cordic_calc_iq(s32 theta); - -#endif /* __CORDIC_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/crc8.h b/openairITS/mac/DOT11/include/linux/crc8.h deleted file mode 100644 index 13c8dabb044..00000000000 --- a/openairITS/mac/DOT11/include/linux/crc8.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2011 Broadcom Corporation - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#ifndef __CRC8_H_ -#define __CRC8_H_ - -#include <linux/types.h> - -/* see usage of this value in crc8() description */ -#define CRC8_INIT_VALUE 0xFF - -/* - * Return value of crc8() indicating valid message+crc. This is true - * if a CRC is inverted before transmission. The CRC computed over the - * whole received bitstream is _table[x], where x is the bit pattern - * of the modification (almost always 0xff). - */ -#define CRC8_GOOD_VALUE(_table) (_table[0xFF]) - -/* required table size for crc8 algorithm */ -#define CRC8_TABLE_SIZE 256 - -/* helper macro assuring right table size is used */ -#define DECLARE_CRC8_TABLE(_table) \ - static u8 _table[CRC8_TABLE_SIZE] - -/** - * crc8_populate_lsb - fill crc table for given polynomial in regular bit order. - * - * @table: table to be filled. - * @polynomial: polynomial for which table is to be filled. - * - * This function fills the provided table according the polynomial provided for - * regular bit order (lsb first). Polynomials in CRC algorithms are typically - * represented as shown below. - * - * poly = x^8 + x^7 + x^6 + x^4 + x^2 + 1 - * - * For lsb first direction x^7 maps to the lsb. So the polynomial is as below. - * - * - lsb first: poly = 10101011(1) = 0xAB - */ -void crc8_populate_lsb(u8 table[CRC8_TABLE_SIZE], u8 polynomial); - -/** - * crc8_populate_msb - fill crc table for given polynomial in reverse bit order. - * - * @table: table to be filled. - * @polynomial: polynomial for which table is to be filled. - * - * This function fills the provided table according the polynomial provided for - * reverse bit order (msb first). Polynomials in CRC algorithms are typically - * represented as shown below. - * - * poly = x^8 + x^7 + x^6 + x^4 + x^2 + 1 - * - * For msb first direction x^7 maps to the msb. So the polynomial is as below. - * - * - msb first: poly = (1)11010101 = 0xD5 - */ -void crc8_populate_msb(u8 table[CRC8_TABLE_SIZE], u8 polynomial); - -/** - * crc8() - calculate a crc8 over the given input data. - * - * @table: crc table used for calculation. - * @pdata: pointer to data buffer. - * @nbytes: number of bytes in data buffer. - * @crc: previous returned crc8 value. - * - * The CRC8 is calculated using the polynomial given in crc8_populate_msb() - * or crc8_populate_lsb(). - * - * The caller provides the initial value (either %CRC8_INIT_VALUE - * or the previous returned value) to allow for processing of - * discontiguous blocks of data. When generating the CRC the - * caller is responsible for complementing the final return value - * and inserting it into the byte stream. When validating a byte - * stream (including CRC8), a final return value of %CRC8_GOOD_VALUE - * indicates the byte stream data can be considered valid. - * - * Reference: - * "A Painless Guide to CRC Error Detection Algorithms", ver 3, Aug 1993 - * Williams, Ross N., ross<at>ross.net - * (see URL http://www.ross.net/crc/download/crc_v3.txt). - */ -u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc); - -#endif /* __CRC8_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/eeprom_93cx6.h b/openairITS/mac/DOT11/include/linux/eeprom_93cx6.h deleted file mode 100644 index e50f98b0297..00000000000 --- a/openairITS/mac/DOT11/include/linux/eeprom_93cx6.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2004 - 2006 rt2x00 SourceForge Project - <http://rt2x00.serialmonkey.com> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the - Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - Module: eeprom_93cx6 - Abstract: EEPROM reader datastructures for 93cx6 chipsets. - Supported chipsets: 93c46, 93c56 and 93c66. - */ - -/* - * EEPROM operation defines. - */ -#define PCI_EEPROM_WIDTH_93C46 6 -#define PCI_EEPROM_WIDTH_93C56 8 -#define PCI_EEPROM_WIDTH_93C66 8 -#define PCI_EEPROM_WIDTH_93C86 8 -#define PCI_EEPROM_WIDTH_OPCODE 3 -#define PCI_EEPROM_WRITE_OPCODE 0x05 -#define PCI_EEPROM_ERASE_OPCODE 0x07 -#define PCI_EEPROM_READ_OPCODE 0x06 -#define PCI_EEPROM_EWDS_OPCODE 0x10 -#define PCI_EEPROM_EWEN_OPCODE 0x13 - -/** - * struct eeprom_93cx6 - control structure for setting the commands - * for reading the eeprom data. - * @data: private pointer for the driver. - * @register_read(struct eeprom_93cx6 *eeprom): handler to - * read the eeprom register, this function should set all reg_* fields. - * @register_write(struct eeprom_93cx6 *eeprom): handler to - * write to the eeprom register by using all reg_* fields. - * @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines - * @drive_data: Set if we're driving the data line. - * @reg_data_in: register field to indicate data input - * @reg_data_out: register field to indicate data output - * @reg_data_clock: register field to set the data clock - * @reg_chip_select: register field to set the chip select - * - * This structure is used for the communication between the driver - * and the eeprom_93cx6 handlers for reading the eeprom. - */ -struct eeprom_93cx6 { - void *data; - - void (*register_read)(struct eeprom_93cx6 *eeprom); - void (*register_write)(struct eeprom_93cx6 *eeprom); - - int width; - - char drive_data; - char reg_data_in; - char reg_data_out; - char reg_data_clock; - char reg_chip_select; -}; - -extern void eeprom_93cx6_read(struct eeprom_93cx6 *eeprom, - const u8 word, u16 *data); -extern void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, - const u8 word, __le16 *data, const u16 words); - -extern void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable); - -extern void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom, - u8 addr, u16 data); diff --git a/openairITS/mac/DOT11/include/linux/export.h b/openairITS/mac/DOT11/include/linux/export.h deleted file mode 100644 index f7842b7a582..00000000000 --- a/openairITS/mac/DOT11/include/linux/export.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _COMPAT_LINUX_EXPORT_H -#define _COMPAT_LINUX_EXPORT_H 1 - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) -#include_next <linux/export.h> -#else -#include <linux/module.h> -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */ - -#endif /* _COMPAT_LINUX_EXPORT_H */ diff --git a/openairITS/mac/DOT11/include/linux/ieee80211.h b/openairITS/mac/DOT11/include/linux/ieee80211.h deleted file mode 100644 index 210e2c32553..00000000000 --- a/openairITS/mac/DOT11/include/linux/ieee80211.h +++ /dev/null @@ -1,1878 +0,0 @@ -/* - * IEEE 802.11 defines - * - * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - * <jkmaline@cc.hut.fi> - * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi> - * Copyright (c) 2005, Devicescape Software, Inc. - * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef LINUX_IEEE80211_H -#define LINUX_IEEE80211_H - -#include <linux/types.h> -#include <asm/byteorder.h> - -/* - * DS bit usage - * - * TA = transmitter address - * RA = receiver address - * DA = destination address - * SA = source address - * - * ToDS FromDS A1(RA) A2(TA) A3 A4 Use - * ----------------------------------------------------------------- - * 0 0 DA SA BSSID - IBSS/DLS - * 0 1 DA BSSID SA - AP -> STA - * 1 0 BSSID SA DA - AP <- STA - * 1 1 RA TA DA SA unspecified (WDS) - */ - -#define FCS_LEN 4 - -#define IEEE80211_FCTL_VERS 0x0003 -#define IEEE80211_FCTL_FTYPE 0x000c -#define IEEE80211_FCTL_STYPE 0x00f0 -#define IEEE80211_FCTL_TODS 0x0100 -#define IEEE80211_FCTL_FROMDS 0x0200 -#define IEEE80211_FCTL_MOREFRAGS 0x0400 -#define IEEE80211_FCTL_RETRY 0x0800 -#define IEEE80211_FCTL_PM 0x1000 -#define IEEE80211_FCTL_MOREDATA 0x2000 -#define IEEE80211_FCTL_PROTECTED 0x4000 -#define IEEE80211_FCTL_ORDER 0x8000 - -#define IEEE80211_SCTL_FRAG 0x000F -#define IEEE80211_SCTL_SEQ 0xFFF0 - -#define IEEE80211_FTYPE_MGMT 0x0000 -#define IEEE80211_FTYPE_CTL 0x0004 -#define IEEE80211_FTYPE_DATA 0x0008 - -/* management */ -#define IEEE80211_STYPE_ASSOC_REQ 0x0000 -#define IEEE80211_STYPE_ASSOC_RESP 0x0010 -#define IEEE80211_STYPE_REASSOC_REQ 0x0020 -#define IEEE80211_STYPE_REASSOC_RESP 0x0030 -#define IEEE80211_STYPE_PROBE_REQ 0x0040 -#define IEEE80211_STYPE_PROBE_RESP 0x0050 -#define IEEE80211_STYPE_BEACON 0x0080 -#define IEEE80211_STYPE_ATIM 0x0090 -#define IEEE80211_STYPE_DISASSOC 0x00A0 -#define IEEE80211_STYPE_AUTH 0x00B0 -#define IEEE80211_STYPE_DEAUTH 0x00C0 -#define IEEE80211_STYPE_ACTION 0x00D0 - -/* control */ -#define IEEE80211_STYPE_BACK_REQ 0x0080 -#define IEEE80211_STYPE_BACK 0x0090 -#define IEEE80211_STYPE_PSPOLL 0x00A0 -#define IEEE80211_STYPE_RTS 0x00B0 -#define IEEE80211_STYPE_CTS 0x00C0 -#define IEEE80211_STYPE_ACK 0x00D0 -#define IEEE80211_STYPE_CFEND 0x00E0 -#define IEEE80211_STYPE_CFENDACK 0x00F0 - -/* data */ -#define IEEE80211_STYPE_DATA 0x0000 -#define IEEE80211_STYPE_DATA_CFACK 0x0010 -#define IEEE80211_STYPE_DATA_CFPOLL 0x0020 -#define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030 -#define IEEE80211_STYPE_NULLFUNC 0x0040 -#define IEEE80211_STYPE_CFACK 0x0050 -#define IEEE80211_STYPE_CFPOLL 0x0060 -#define IEEE80211_STYPE_CFACKPOLL 0x0070 -#define IEEE80211_STYPE_QOS_DATA 0x0080 -#define IEEE80211_STYPE_QOS_DATA_CFACK 0x0090 -#define IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0 -#define IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0 -#define IEEE80211_STYPE_QOS_NULLFUNC 0x00C0 -#define IEEE80211_STYPE_QOS_CFACK 0x00D0 -#define IEEE80211_STYPE_QOS_CFPOLL 0x00E0 -#define IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0 - - -/* miscellaneous IEEE 802.11 constants */ -#define IEEE80211_MAX_FRAG_THRESHOLD 2352 -#define IEEE80211_MAX_RTS_THRESHOLD 2353 -#define IEEE80211_MAX_AID 2007 -#define IEEE80211_MAX_TIM_LEN 251 -/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section - 6.2.1.1.2. - - 802.11e clarifies the figure in section 7.1.2. The frame body is - up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */ -#define IEEE80211_MAX_DATA_LEN 2304 -/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */ -#define IEEE80211_MAX_FRAME_LEN 2352 - -#define IEEE80211_MAX_SSID_LEN 32 - -#define IEEE80211_MAX_MESH_ID_LEN 32 - -#define IEEE80211_QOS_CTL_LEN 2 -/* 1d tag mask */ -#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 -/* TID mask */ -#define IEEE80211_QOS_CTL_TID_MASK 0x000f -/* EOSP */ -#define IEEE80211_QOS_CTL_EOSP 0x0010 -/* ACK policy */ -#define IEEE80211_QOS_CTL_ACK_POLICY_NORMAL 0x0000 -#define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020 -#define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040 -#define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060 -#define IEEE80211_QOS_CTL_ACK_POLICY_MASK 0x0060 -/* A-MSDU 802.11n */ -#define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080 -/* Mesh Control 802.11s */ -#define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT 0x0100 - -/* U-APSD queue for WMM IEs sent by AP */ -#define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7) -#define IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK 0x0f - -/* U-APSD queues for WMM IEs sent by STA */ -#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VO (1<<0) -#define IEEE80211_WMM_IE_STA_QOSINFO_AC_VI (1<<1) -#define IEEE80211_WMM_IE_STA_QOSINFO_AC_BK (1<<2) -#define IEEE80211_WMM_IE_STA_QOSINFO_AC_BE (1<<3) -#define IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK 0x0f - -/* U-APSD max SP length for WMM IEs sent by STA */ -#define IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 0x00 -#define IEEE80211_WMM_IE_STA_QOSINFO_SP_2 0x01 -#define IEEE80211_WMM_IE_STA_QOSINFO_SP_4 0x02 -#define IEEE80211_WMM_IE_STA_QOSINFO_SP_6 0x03 -#define IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK 0x03 -#define IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT 5 - -#define IEEE80211_HT_CTL_LEN 4 - -struct ieee80211_hdr { - __le16 frame_control; - __le16 duration_id; - u8 addr1[6]; - u8 addr2[6]; - u8 addr3[6]; - __le16 seq_ctrl; - u8 addr4[6]; -} __attribute__ ((packed)); - -struct ieee80211_hdr_3addr { - __le16 frame_control; - __le16 duration_id; - u8 addr1[6]; - u8 addr2[6]; - u8 addr3[6]; - __le16 seq_ctrl; -} __attribute__ ((packed)); - -struct ieee80211_qos_hdr { - __le16 frame_control; - __le16 duration_id; - u8 addr1[6]; - u8 addr2[6]; - u8 addr3[6]; - __le16 seq_ctrl; - __le16 qos_ctrl; -} __attribute__ ((packed)); - -/** - * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_has_tods(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_TODS)) != 0; -} - -/** - * ieee80211_has_fromds - check if IEEE80211_FCTL_FROMDS is set - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_has_fromds(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FROMDS)) != 0; -} - -/** - * ieee80211_has_a4 - check if IEEE80211_FCTL_TODS and IEEE80211_FCTL_FROMDS are set - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_has_a4(__le16 fc) -{ - __le16 tmp = cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS); - return (fc & tmp) == tmp; -} - -/** - * ieee80211_has_morefrags - check if IEEE80211_FCTL_MOREFRAGS is set - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_has_morefrags(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) != 0; -} - -/** - * ieee80211_has_retry - check if IEEE80211_FCTL_RETRY is set - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_has_retry(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_RETRY)) != 0; -} - -/** - * ieee80211_has_pm - check if IEEE80211_FCTL_PM is set - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_has_pm(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_PM)) != 0; -} - -/** - * ieee80211_has_moredata - check if IEEE80211_FCTL_MOREDATA is set - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_has_moredata(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) != 0; -} - -/** - * ieee80211_has_protected - check if IEEE80211_FCTL_PROTECTED is set - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_has_protected(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_PROTECTED)) != 0; -} - -/** - * ieee80211_has_order - check if IEEE80211_FCTL_ORDER is set - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_has_order(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_ORDER)) != 0; -} - -/** - * ieee80211_is_mgmt - check if type is IEEE80211_FTYPE_MGMT - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_mgmt(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT); -} - -/** - * ieee80211_is_ctl - check if type is IEEE80211_FTYPE_CTL - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_ctl(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == - cpu_to_le16(IEEE80211_FTYPE_CTL); -} - -/** - * ieee80211_is_data - check if type is IEEE80211_FTYPE_DATA - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_data(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) == - cpu_to_le16(IEEE80211_FTYPE_DATA); -} - -/** - * ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_data_qos(__le16 fc) -{ - /* - * mask with QOS_DATA rather than IEEE80211_FCTL_STYPE as we just need - * to check the one bit - */ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_STYPE_QOS_DATA)) == - cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA); -} - -/** - * ieee80211_is_data_present - check if type is IEEE80211_FTYPE_DATA and has data - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_data_present(__le16 fc) -{ - /* - * mask with 0x40 and test that that bit is clear to only return true - * for the data-containing substypes. - */ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | 0x40)) == - cpu_to_le16(IEEE80211_FTYPE_DATA); -} - -/** - * ieee80211_is_assoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_REQ - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_assoc_req(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ); -} - -/** - * ieee80211_is_assoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_RESP - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_assoc_resp(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP); -} - -/** - * ieee80211_is_reassoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_REQ - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_reassoc_req(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ); -} - -/** - * ieee80211_is_reassoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_RESP - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_reassoc_resp(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP); -} - -/** - * ieee80211_is_probe_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_REQ - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_probe_req(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ); -} - -/** - * ieee80211_is_probe_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_RESP - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_probe_resp(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); -} - -/** - * ieee80211_is_beacon - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_BEACON - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_beacon(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); -} - -/** - * ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_atim(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM); -} - -/** - * ieee80211_is_disassoc - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DISASSOC - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_disassoc(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC); -} - -/** - * ieee80211_is_auth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_AUTH - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_auth(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH); -} - -/** - * ieee80211_is_deauth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DEAUTH - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_deauth(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH); -} - -/** - * ieee80211_is_action - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ACTION - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_action(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION); -} - -/** - * ieee80211_is_back_req - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK_REQ - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_back_req(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ); -} - -/** - * ieee80211_is_back - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_back(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK); -} - -/** - * ieee80211_is_pspoll - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_PSPOLL - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_pspoll(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL); -} - -/** - * ieee80211_is_rts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_RTS - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_rts(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS); -} - -/** - * ieee80211_is_cts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CTS - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_cts(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS); -} - -/** - * ieee80211_is_ack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_ACK - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_ack(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK); -} - -/** - * ieee80211_is_cfend - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFEND - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_cfend(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND); -} - -/** - * ieee80211_is_cfendack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFENDACK - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_cfendack(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK); -} - -/** - * ieee80211_is_nullfunc - check if frame is a regular (non-QoS) nullfunc frame - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_nullfunc(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC); -} - -/** - * ieee80211_is_qos_nullfunc - check if frame is a QoS nullfunc frame - * @fc: frame control bytes in little-endian byteorder - */ -static inline int ieee80211_is_qos_nullfunc(__le16 fc) -{ - return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) == - cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); -} - -/** - * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set - * @seq_ctrl: frame sequence control bytes in little-endian byteorder - */ -static inline int ieee80211_is_first_frag(__le16 seq_ctrl) -{ - return (seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0; -} - -struct ieee80211s_hdr { - u8 flags; - u8 ttl; - __le32 seqnum; - u8 eaddr1[6]; - u8 eaddr2[6]; -} __attribute__ ((packed)); - -/* Mesh flags */ -#define MESH_FLAGS_AE_A4 0x1 -#define MESH_FLAGS_AE_A5_A6 0x2 -#define MESH_FLAGS_AE 0x3 -#define MESH_FLAGS_PS_DEEP 0x4 - -/** - * struct ieee80211_quiet_ie - * - * This structure refers to "Quiet information element" - */ -struct ieee80211_quiet_ie { - u8 count; - u8 period; - __le16 duration; - __le16 offset; -} __attribute__ ((packed)); - -/** - * struct ieee80211_msrment_ie - * - * This structure refers to "Measurement Request/Report information element" - */ -struct ieee80211_msrment_ie { - u8 token; - u8 mode; - u8 type; - u8 request[0]; -} __attribute__ ((packed)); - -/** - * struct ieee80211_channel_sw_ie - * - * This structure refers to "Channel Switch Announcement information element" - */ -struct ieee80211_channel_sw_ie { - u8 mode; - u8 new_ch_num; - u8 count; -} __attribute__ ((packed)); - -/** - * struct ieee80211_tim - * - * This structure refers to "Traffic Indication Map information element" - */ -struct ieee80211_tim_ie { - u8 dtim_count; - u8 dtim_period; - u8 bitmap_ctrl; - /* variable size: 1 - 251 bytes */ - u8 virtual_map[1]; -} __attribute__ ((packed)); - -/** - * struct ieee80211_meshconf_ie - * - * This structure refers to "Mesh Configuration information element" - */ -struct ieee80211_meshconf_ie { - u8 meshconf_psel; - u8 meshconf_pmetric; - u8 meshconf_congest; - u8 meshconf_synch; - u8 meshconf_auth; - u8 meshconf_form; - u8 meshconf_cap; -} __attribute__ ((packed)); - -/** - * struct ieee80211_rann_ie - * - * This structure refers to "Root Announcement information element" - */ -struct ieee80211_rann_ie { - u8 rann_flags; - u8 rann_hopcount; - u8 rann_ttl; - u8 rann_addr[6]; - u32 rann_seq; - u32 rann_interval; - u32 rann_metric; -} __attribute__ ((packed)); - -enum ieee80211_rann_flags { - RANN_FLAG_IS_GATE = 1 << 0, -}; - -#define WLAN_SA_QUERY_TR_ID_LEN 2 - -struct ieee80211_mgmt { - __le16 frame_control; - __le16 duration; - u8 da[6]; - u8 sa[6]; - u8 bssid[6]; - __le16 seq_ctrl; - union { - struct { - __le16 auth_alg; - __le16 auth_transaction; - __le16 status_code; - /* possibly followed by Challenge text */ - u8 variable[0]; - } __attribute__ ((packed)) auth; - struct { - __le16 reason_code; - } __attribute__ ((packed)) deauth; - struct { - __le16 capab_info; - __le16 listen_interval; - /* followed by SSID and Supported rates */ - u8 variable[0]; - } __attribute__ ((packed)) assoc_req; - struct { - __le16 capab_info; - __le16 status_code; - __le16 aid; - /* followed by Supported rates */ - u8 variable[0]; - } __attribute__ ((packed)) assoc_resp, reassoc_resp; - struct { - __le16 capab_info; - __le16 listen_interval; - u8 current_ap[6]; - /* followed by SSID and Supported rates */ - u8 variable[0]; - } __attribute__ ((packed)) reassoc_req; - struct { - __le16 reason_code; - } __attribute__ ((packed)) disassoc; - struct { - __le64 timestamp; - __le16 beacon_int; - __le16 capab_info; - /* followed by some of SSID, Supported rates, - * FH Params, DS Params, CF Params, IBSS Params, TIM */ - u8 variable[0]; - } __attribute__ ((packed)) beacon; - struct { - /* only variable items: SSID, Supported rates */ - u8 variable[0]; - } __attribute__ ((packed)) probe_req; - struct { - __le64 timestamp; - __le16 beacon_int; - __le16 capab_info; - /* followed by some of SSID, Supported rates, - * FH Params, DS Params, CF Params, IBSS Params */ - u8 variable[0]; - } __attribute__ ((packed)) probe_resp; - struct { - u8 category; - union { - struct { - u8 action_code; - u8 dialog_token; - u8 status_code; - u8 variable[0]; - } __attribute__ ((packed)) wme_action; - struct{ - u8 action_code; - u8 element_id; - u8 length; - struct ieee80211_channel_sw_ie sw_elem; - } __attribute__((packed)) chan_switch; - struct{ - u8 action_code; - u8 dialog_token; - u8 element_id; - u8 length; - struct ieee80211_msrment_ie msr_elem; - } __attribute__((packed)) measurement; - struct{ - u8 action_code; - u8 dialog_token; - __le16 capab; - __le16 timeout; - __le16 start_seq_num; - } __attribute__((packed)) addba_req; - struct{ - u8 action_code; - u8 dialog_token; - __le16 status; - __le16 capab; - __le16 timeout; - } __attribute__((packed)) addba_resp; - struct{ - u8 action_code; - __le16 params; - __le16 reason_code; - } __attribute__((packed)) delba; - struct { - u8 action_code; - u8 variable[0]; - } __attribute__((packed)) self_prot; - struct{ - u8 action_code; - u8 variable[0]; - } __attribute__((packed)) mesh_action; - struct { - u8 action; - u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN]; - } __attribute__ ((packed)) sa_query; - struct { - u8 action; - u8 smps_control; - } __attribute__ ((packed)) ht_smps; - struct { - u8 action_code; - u8 dialog_token; - __le16 capability; - u8 variable[0]; - } __packed tdls_discover_resp; - } u; - } __attribute__ ((packed)) action; - } u; -} __attribute__ ((packed)); - -/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */ -#define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127 - -/* mgmt header + 1 byte category code */ -#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u) - - -/* Management MIC information element (IEEE 802.11w) */ -struct ieee80211_mmie { - u8 element_id; - u8 length; - __le16 key_id; - u8 sequence_number[6]; - u8 mic[8]; -} __attribute__ ((packed)); - -struct ieee80211_vendor_ie { - u8 element_id; - u8 len; - u8 oui[3]; - u8 oui_type; -} __packed; - -/* Control frames */ -struct ieee80211_rts { - __le16 frame_control; - __le16 duration; - u8 ra[6]; - u8 ta[6]; -} __attribute__ ((packed)); - -struct ieee80211_cts { - __le16 frame_control; - __le16 duration; - u8 ra[6]; -} __attribute__ ((packed)); - -struct ieee80211_pspoll { - __le16 frame_control; - __le16 aid; - u8 bssid[6]; - u8 ta[6]; -} __attribute__ ((packed)); - -/* TDLS */ - -/* Link-id information element */ -struct ieee80211_tdls_lnkie { - u8 ie_type; /* Link Identifier IE */ - u8 ie_len; - u8 bssid[6]; - u8 init_sta[6]; - u8 resp_sta[6]; -} __packed; - -struct ieee80211_tdls_data { - u8 da[6]; - u8 sa[6]; - __be16 ether_type; - u8 payload_type; - u8 category; - u8 action_code; - union { - struct { - u8 dialog_token; - __le16 capability; - u8 variable[0]; - } __packed setup_req; - struct { - __le16 status_code; - u8 dialog_token; - __le16 capability; - u8 variable[0]; - } __packed setup_resp; - struct { - __le16 status_code; - u8 dialog_token; - u8 variable[0]; - } __packed setup_cfm; - struct { - __le16 reason_code; - u8 variable[0]; - } __packed teardown; - struct { - u8 dialog_token; - u8 variable[0]; - } __packed discover_req; - } u; -} __packed; - -/** - * struct ieee80211_bar - HT Block Ack Request - * - * This structure refers to "HT BlockAckReq" as - * described in 802.11n draft section 7.2.1.7.1 - */ -struct ieee80211_bar { - __le16 frame_control; - __le16 duration; - __u8 ra[6]; - __u8 ta[6]; - __le16 control; - __le16 start_seq_num; -} __attribute__((packed)); - -/* 802.11 BAR control masks */ -#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 -#define IEEE80211_BAR_CTRL_MULTI_TID 0x0002 -#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 -#define IEEE80211_BAR_CTRL_TID_INFO_MASK 0xf000 -#define IEEE80211_BAR_CTRL_TID_INFO_SHIFT 12 - -#define IEEE80211_HT_MCS_MASK_LEN 10 - -/** - * struct ieee80211_mcs_info - MCS information - * @rx_mask: RX mask - * @rx_highest: highest supported RX rate. If set represents - * the highest supported RX data rate in units of 1 Mbps. - * If this field is 0 this value should not be used to - * consider the highest RX data rate supported. - * @tx_params: TX parameters - */ -struct ieee80211_mcs_info { - u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN]; - __le16 rx_highest; - u8 tx_params; - u8 reserved[3]; -} __attribute__((packed)); - -/* 802.11n HT capability MSC set */ -#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff -#define IEEE80211_HT_MCS_TX_DEFINED 0x01 -#define IEEE80211_HT_MCS_TX_RX_DIFF 0x02 -/* value 0 == 1 stream etc */ -#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C -#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2 -#define IEEE80211_HT_MCS_TX_MAX_STREAMS 4 -#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10 - -/* - * 802.11n D5.0 20.3.5 / 20.6 says: - * - indices 0 to 7 and 32 are single spatial stream - * - 8 to 31 are multiple spatial streams using equal modulation - * [8..15 for two streams, 16..23 for three and 24..31 for four] - * - remainder are multiple spatial streams using unequal modulation - */ -#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33 -#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \ - (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8) - -/** - * struct ieee80211_ht_cap - HT capabilities - * - * This structure is the "HT capabilities element" as - * described in 802.11n D5.0 7.3.2.57 - */ -struct ieee80211_ht_cap { - __le16 cap_info; - u8 ampdu_params_info; - - /* 16 bytes MCS information */ - struct ieee80211_mcs_info mcs; - - __le16 extended_ht_cap_info; - __le32 tx_BF_cap_info; - u8 antenna_selection_info; -} __attribute__ ((packed)); - -/* 802.11n HT capabilities masks (for cap_info) */ -#define IEEE80211_HT_CAP_LDPC_CODING 0x0001 -#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002 -#define IEEE80211_HT_CAP_SM_PS 0x000C -#define IEEE80211_HT_CAP_SM_PS_SHIFT 2 -#define IEEE80211_HT_CAP_GRN_FLD 0x0010 -#define IEEE80211_HT_CAP_SGI_20 0x0020 -#define IEEE80211_HT_CAP_SGI_40 0x0040 -#define IEEE80211_HT_CAP_TX_STBC 0x0080 -#define IEEE80211_HT_CAP_RX_STBC 0x0300 -#define IEEE80211_HT_CAP_RX_STBC_SHIFT 8 -#define IEEE80211_HT_CAP_DELAY_BA 0x0400 -#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 -#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 -#define IEEE80211_HT_CAP_RESERVED 0x2000 -#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000 -#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 - -/* 802.11n HT extended capabilities masks (for extended_ht_cap_info) */ -#define IEEE80211_HT_EXT_CAP_PCO 0x0001 -#define IEEE80211_HT_EXT_CAP_PCO_TIME 0x0006 -#define IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT 1 -#define IEEE80211_HT_EXT_CAP_MCS_FB 0x0300 -#define IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT 8 -#define IEEE80211_HT_EXT_CAP_HTC_SUP 0x0400 -#define IEEE80211_HT_EXT_CAP_RD_RESPONDER 0x0800 - -/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ -#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03 -#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C -#define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2 - -/* - * Maximum length of AMPDU that the STA can receive. - * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets) - */ -enum ieee80211_max_ampdu_length_exp { - IEEE80211_HT_MAX_AMPDU_8K = 0, - IEEE80211_HT_MAX_AMPDU_16K = 1, - IEEE80211_HT_MAX_AMPDU_32K = 2, - IEEE80211_HT_MAX_AMPDU_64K = 3 -}; - -#define IEEE80211_HT_MAX_AMPDU_FACTOR 13 - -/* Minimum MPDU start spacing */ -enum ieee80211_min_mpdu_spacing { - IEEE80211_HT_MPDU_DENSITY_NONE = 0, /* No restriction */ - IEEE80211_HT_MPDU_DENSITY_0_25 = 1, /* 1/4 usec */ - IEEE80211_HT_MPDU_DENSITY_0_5 = 2, /* 1/2 usec */ - IEEE80211_HT_MPDU_DENSITY_1 = 3, /* 1 usec */ - IEEE80211_HT_MPDU_DENSITY_2 = 4, /* 2 usec */ - IEEE80211_HT_MPDU_DENSITY_4 = 5, /* 4 usec */ - IEEE80211_HT_MPDU_DENSITY_8 = 6, /* 8 usec */ - IEEE80211_HT_MPDU_DENSITY_16 = 7 /* 16 usec */ -}; - -/** - * struct ieee80211_ht_info - HT information - * - * This structure is the "HT information element" as - * described in 802.11n D5.0 7.3.2.58 - */ -struct ieee80211_ht_info { - u8 control_chan; - u8 ht_param; - __le16 operation_mode; - __le16 stbc_param; - u8 basic_set[16]; -} __attribute__ ((packed)); - -/* for ht_param */ -#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03 -#define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00 -#define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01 -#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03 -#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04 -#define IEEE80211_HT_PARAM_RIFS_MODE 0x08 -#define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10 -#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0 - -/* for operation_mode */ -#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003 -#define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0 -#define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1 -#define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2 -#define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3 -#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004 -#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010 - -/* for stbc_param */ -#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040 -#define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080 -#define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100 -#define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200 -#define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400 -#define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800 - - -/* block-ack parameters */ -#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 -#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C -#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0 -#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 -#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 - -/* - * A-PMDU buffer sizes - * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) - */ -#define IEEE80211_MIN_AMPDU_BUF 0x8 -#define IEEE80211_MAX_AMPDU_BUF 0x40 - - -/* Spatial Multiplexing Power Save Modes (for capability) */ -#define WLAN_HT_CAP_SM_PS_STATIC 0 -#define WLAN_HT_CAP_SM_PS_DYNAMIC 1 -#define WLAN_HT_CAP_SM_PS_INVALID 2 -#define WLAN_HT_CAP_SM_PS_DISABLED 3 - -/* for SM power control field lower two bits */ -#define WLAN_HT_SMPS_CONTROL_DISABLED 0 -#define WLAN_HT_SMPS_CONTROL_STATIC 1 -#define WLAN_HT_SMPS_CONTROL_DYNAMIC 3 - -/* Authentication algorithms */ -#define WLAN_AUTH_OPEN 0 -#define WLAN_AUTH_SHARED_KEY 1 -#define WLAN_AUTH_FT 2 -#define WLAN_AUTH_SAE 3 -#define WLAN_AUTH_LEAP 128 - -#define WLAN_AUTH_CHALLENGE_LEN 128 - -#define WLAN_CAPABILITY_ESS (1<<0) -#define WLAN_CAPABILITY_IBSS (1<<1) - -/* - * A mesh STA sets the ESS and IBSS capability bits to zero. - * however, this holds true for p2p probe responses (in the p2p_find - * phase) as well. - */ -#define WLAN_CAPABILITY_IS_STA_BSS(cap) \ - (!((cap) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS))) - -#define WLAN_CAPABILITY_CF_POLLABLE (1<<2) -#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3) -#define WLAN_CAPABILITY_PRIVACY (1<<4) -#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5) -#define WLAN_CAPABILITY_PBCC (1<<6) -#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) - -/* 802.11h */ -#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) -#define WLAN_CAPABILITY_QOS (1<<9) -#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) -#define WLAN_CAPABILITY_DSSS_OFDM (1<<13) -/* measurement */ -#define IEEE80211_SPCT_MSR_RPRT_MODE_LATE (1<<0) -#define IEEE80211_SPCT_MSR_RPRT_MODE_INCAPABLE (1<<1) -#define IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED (1<<2) - -#define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC 0 -#define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA 1 -#define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI 2 - - -/* 802.11g ERP information element */ -#define WLAN_ERP_NON_ERP_PRESENT (1<<0) -#define WLAN_ERP_USE_PROTECTION (1<<1) -#define WLAN_ERP_BARKER_PREAMBLE (1<<2) - -/* WLAN_ERP_BARKER_PREAMBLE values */ -enum { - WLAN_ERP_PREAMBLE_SHORT = 0, - WLAN_ERP_PREAMBLE_LONG = 1, -}; - -/* Status codes */ -enum ieee80211_statuscode { - WLAN_STATUS_SUCCESS = 0, - WLAN_STATUS_UNSPECIFIED_FAILURE = 1, - WLAN_STATUS_CAPS_UNSUPPORTED = 10, - WLAN_STATUS_REASSOC_NO_ASSOC = 11, - WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, - WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, - WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, - WLAN_STATUS_CHALLENGE_FAIL = 15, - WLAN_STATUS_AUTH_TIMEOUT = 16, - WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, - WLAN_STATUS_ASSOC_DENIED_RATES = 18, - /* 802.11b */ - WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, - WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, - WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, - /* 802.11h */ - WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, - WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, - WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, - /* 802.11g */ - WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, - WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, - /* 802.11w */ - WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30, - WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31, - /* 802.11i */ - WLAN_STATUS_INVALID_IE = 40, - WLAN_STATUS_INVALID_GROUP_CIPHER = 41, - WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, - WLAN_STATUS_INVALID_AKMP = 43, - WLAN_STATUS_UNSUPP_RSN_VERSION = 44, - WLAN_STATUS_INVALID_RSN_IE_CAP = 45, - WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, - /* 802.11e */ - WLAN_STATUS_UNSPECIFIED_QOS = 32, - WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33, - WLAN_STATUS_ASSOC_DENIED_LOWACK = 34, - WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35, - WLAN_STATUS_REQUEST_DECLINED = 37, - WLAN_STATUS_INVALID_QOS_PARAM = 38, - WLAN_STATUS_CHANGE_TSPEC = 39, - WLAN_STATUS_WAIT_TS_DELAY = 47, - WLAN_STATUS_NO_DIRECT_LINK = 48, - WLAN_STATUS_STA_NOT_PRESENT = 49, - WLAN_STATUS_STA_NOT_QSTA = 50, - /* 802.11s */ - WLAN_STATUS_ANTI_CLOG_REQUIRED = 76, - WLAN_STATUS_FCG_NOT_SUPP = 78, - WLAN_STATUS_STA_NO_TBTT = 78, -}; - - -/* Reason codes */ -enum ieee80211_reasoncode { - WLAN_REASON_UNSPECIFIED = 1, - WLAN_REASON_PREV_AUTH_NOT_VALID = 2, - WLAN_REASON_DEAUTH_LEAVING = 3, - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, - WLAN_REASON_DISASSOC_AP_BUSY = 5, - WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, - WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, - WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, - WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, - /* 802.11h */ - WLAN_REASON_DISASSOC_BAD_POWER = 10, - WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, - /* 802.11i */ - WLAN_REASON_INVALID_IE = 13, - WLAN_REASON_MIC_FAILURE = 14, - WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, - WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, - WLAN_REASON_IE_DIFFERENT = 17, - WLAN_REASON_INVALID_GROUP_CIPHER = 18, - WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, - WLAN_REASON_INVALID_AKMP = 20, - WLAN_REASON_UNSUPP_RSN_VERSION = 21, - WLAN_REASON_INVALID_RSN_IE_CAP = 22, - WLAN_REASON_IEEE8021X_FAILED = 23, - WLAN_REASON_CIPHER_SUITE_REJECTED = 24, - /* 802.11e */ - WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32, - WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33, - WLAN_REASON_DISASSOC_LOW_ACK = 34, - WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35, - WLAN_REASON_QSTA_LEAVE_QBSS = 36, - WLAN_REASON_QSTA_NOT_USE = 37, - WLAN_REASON_QSTA_REQUIRE_SETUP = 38, - WLAN_REASON_QSTA_TIMEOUT = 39, - WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45, - /* 802.11s */ - WLAN_REASON_MESH_PEER_CANCELED = 52, - WLAN_REASON_MESH_MAX_PEERS = 53, - WLAN_REASON_MESH_CONFIG = 54, - WLAN_REASON_MESH_CLOSE = 55, - WLAN_REASON_MESH_MAX_RETRIES = 56, - WLAN_REASON_MESH_CONFIRM_TIMEOUT = 57, - WLAN_REASON_MESH_INVALID_GTK = 58, - WLAN_REASON_MESH_INCONSISTENT_PARAM = 59, - WLAN_REASON_MESH_INVALID_SECURITY = 60, - WLAN_REASON_MESH_PATH_ERROR = 61, - WLAN_REASON_MESH_PATH_NOFORWARD = 62, - WLAN_REASON_MESH_PATH_DEST_UNREACHABLE = 63, - WLAN_REASON_MAC_EXISTS_IN_MBSS = 64, - WLAN_REASON_MESH_CHAN_REGULATORY = 65, - WLAN_REASON_MESH_CHAN = 66, -}; - - -/* Information Element IDs */ -enum ieee80211_eid { - WLAN_EID_SSID = 0, - WLAN_EID_SUPP_RATES = 1, - WLAN_EID_FH_PARAMS = 2, - WLAN_EID_DS_PARAMS = 3, - WLAN_EID_CF_PARAMS = 4, - WLAN_EID_TIM = 5, - WLAN_EID_IBSS_PARAMS = 6, - WLAN_EID_CHALLENGE = 16, - - WLAN_EID_COUNTRY = 7, - WLAN_EID_HP_PARAMS = 8, - WLAN_EID_HP_TABLE = 9, - WLAN_EID_REQUEST = 10, - - WLAN_EID_QBSS_LOAD = 11, - WLAN_EID_EDCA_PARAM_SET = 12, - WLAN_EID_TSPEC = 13, - WLAN_EID_TCLAS = 14, - WLAN_EID_SCHEDULE = 15, - WLAN_EID_TS_DELAY = 43, - WLAN_EID_TCLAS_PROCESSING = 44, - WLAN_EID_QOS_CAPA = 46, - /* 802.11z */ - WLAN_EID_LINK_ID = 101, - /* 802.11s */ - WLAN_EID_MESH_CONFIG = 113, - WLAN_EID_MESH_ID = 114, - WLAN_EID_LINK_METRIC_REPORT = 115, - WLAN_EID_CONGESTION_NOTIFICATION = 116, - WLAN_EID_PEER_MGMT = 117, - WLAN_EID_CHAN_SWITCH_PARAM = 118, - WLAN_EID_MESH_AWAKE_WINDOW = 119, - WLAN_EID_BEACON_TIMING = 120, - WLAN_EID_MCCAOP_SETUP_REQ = 121, - WLAN_EID_MCCAOP_SETUP_RESP = 122, - WLAN_EID_MCCAOP_ADVERT = 123, - WLAN_EID_MCCAOP_TEARDOWN = 124, - WLAN_EID_GANN = 125, - WLAN_EID_RANN = 126, - WLAN_EID_PREQ = 130, - WLAN_EID_PREP = 131, - WLAN_EID_PERR = 132, - WLAN_EID_PXU = 137, - WLAN_EID_PXUC = 138, - WLAN_EID_AUTH_MESH_PEER_EXCH = 139, - WLAN_EID_MIC = 140, - - WLAN_EID_PWR_CONSTRAINT = 32, - WLAN_EID_PWR_CAPABILITY = 33, - WLAN_EID_TPC_REQUEST = 34, - WLAN_EID_TPC_REPORT = 35, - WLAN_EID_SUPPORTED_CHANNELS = 36, - WLAN_EID_CHANNEL_SWITCH = 37, - WLAN_EID_MEASURE_REQUEST = 38, - WLAN_EID_MEASURE_REPORT = 39, - WLAN_EID_QUIET = 40, - WLAN_EID_IBSS_DFS = 41, - - WLAN_EID_ERP_INFO = 42, - WLAN_EID_EXT_SUPP_RATES = 50, - - WLAN_EID_HT_CAPABILITY = 45, - WLAN_EID_HT_INFORMATION = 61, - - WLAN_EID_RSN = 48, - WLAN_EID_MMIE = 76, - WLAN_EID_WPA = 221, - WLAN_EID_GENERIC = 221, - WLAN_EID_VENDOR_SPECIFIC = 221, - WLAN_EID_QOS_PARAMETER = 222, - - WLAN_EID_AP_CHAN_REPORT = 51, - WLAN_EID_NEIGHBOR_REPORT = 52, - WLAN_EID_RCPI = 53, - WLAN_EID_BSS_AVG_ACCESS_DELAY = 63, - WLAN_EID_ANTENNA_INFO = 64, - WLAN_EID_RSNI = 65, - WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66, - WLAN_EID_BSS_AVAILABLE_CAPACITY = 67, - WLAN_EID_BSS_AC_ACCESS_DELAY = 68, - WLAN_EID_RRM_ENABLED_CAPABILITIES = 70, - WLAN_EID_MULTIPLE_BSSID = 71, - WLAN_EID_BSS_COEX_2040 = 72, - WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74, - WLAN_EID_EXT_CAPABILITY = 127, - - WLAN_EID_MOBILITY_DOMAIN = 54, - WLAN_EID_FAST_BSS_TRANSITION = 55, - WLAN_EID_TIMEOUT_INTERVAL = 56, - WLAN_EID_RIC_DATA = 57, - WLAN_EID_RIC_DESCRIPTOR = 75, - - WLAN_EID_DSE_REGISTERED_LOCATION = 58, - WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59, - WLAN_EID_EXT_CHANSWITCH_ANN = 60, -}; - -/* Action category code */ -enum ieee80211_category { - WLAN_CATEGORY_SPECTRUM_MGMT = 0, - WLAN_CATEGORY_QOS = 1, - WLAN_CATEGORY_DLS = 2, - WLAN_CATEGORY_BACK = 3, - WLAN_CATEGORY_PUBLIC = 4, - WLAN_CATEGORY_HT = 7, - WLAN_CATEGORY_SA_QUERY = 8, - WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, - WLAN_CATEGORY_TDLS = 12, - WLAN_CATEGORY_MESH_ACTION = 13, - WLAN_CATEGORY_MULTIHOP_ACTION = 14, - WLAN_CATEGORY_SELF_PROTECTED = 15, - WLAN_CATEGORY_WMM = 17, - WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, - WLAN_CATEGORY_VENDOR_SPECIFIC = 127, -}; - -/* SPECTRUM_MGMT action code */ -enum ieee80211_spectrum_mgmt_actioncode { - WLAN_ACTION_SPCT_MSR_REQ = 0, - WLAN_ACTION_SPCT_MSR_RPRT = 1, - WLAN_ACTION_SPCT_TPC_REQ = 2, - WLAN_ACTION_SPCT_TPC_RPRT = 3, - WLAN_ACTION_SPCT_CHL_SWITCH = 4, -}; - -/* HT action codes */ -enum ieee80211_ht_actioncode { - WLAN_HT_ACTION_NOTIFY_CHANWIDTH = 0, - WLAN_HT_ACTION_SMPS = 1, - WLAN_HT_ACTION_PSMP = 2, - WLAN_HT_ACTION_PCO_PHASE = 3, - WLAN_HT_ACTION_CSI = 4, - WLAN_HT_ACTION_NONCOMPRESSED_BF = 5, - WLAN_HT_ACTION_COMPRESSED_BF = 6, - WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7, -}; - -/* Self Protected Action codes */ -enum ieee80211_self_protected_actioncode { - WLAN_SP_RESERVED = 0, - WLAN_SP_MESH_PEERING_OPEN = 1, - WLAN_SP_MESH_PEERING_CONFIRM = 2, - WLAN_SP_MESH_PEERING_CLOSE = 3, - WLAN_SP_MGK_INFORM = 4, - WLAN_SP_MGK_ACK = 5, -}; - -/* Mesh action codes */ -enum ieee80211_mesh_actioncode { - WLAN_MESH_ACTION_LINK_METRIC_REPORT, - WLAN_MESH_ACTION_HWMP_PATH_SELECTION, - WLAN_MESH_ACTION_GATE_ANNOUNCEMENT, - WLAN_MESH_ACTION_CONGESTION_CONTROL_NOTIFICATION, - WLAN_MESH_ACTION_MCCA_SETUP_REQUEST, - WLAN_MESH_ACTION_MCCA_SETUP_REPLY, - WLAN_MESH_ACTION_MCCA_ADVERTISEMENT_REQUEST, - WLAN_MESH_ACTION_MCCA_ADVERTISEMENT, - WLAN_MESH_ACTION_MCCA_TEARDOWN, - WLAN_MESH_ACTION_TBTT_ADJUSTMENT_REQUEST, - WLAN_MESH_ACTION_TBTT_ADJUSTMENT_RESPONSE, -}; - -/* Security key length */ -enum ieee80211_key_len { - WLAN_KEY_LEN_WEP40 = 5, - WLAN_KEY_LEN_WEP104 = 13, - WLAN_KEY_LEN_CCMP = 16, - WLAN_KEY_LEN_TKIP = 32, - WLAN_KEY_LEN_AES_CMAC = 16, -}; - -/* Public action codes */ -enum ieee80211_pub_actioncode { - WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14, -}; - -/* TDLS action codes */ -enum ieee80211_tdls_actioncode { - WLAN_TDLS_SETUP_REQUEST = 0, - WLAN_TDLS_SETUP_RESPONSE = 1, - WLAN_TDLS_SETUP_CONFIRM = 2, - WLAN_TDLS_TEARDOWN = 3, - WLAN_TDLS_PEER_TRAFFIC_INDICATION = 4, - WLAN_TDLS_CHANNEL_SWITCH_REQUEST = 5, - WLAN_TDLS_CHANNEL_SWITCH_RESPONSE = 6, - WLAN_TDLS_PEER_PSM_REQUEST = 7, - WLAN_TDLS_PEER_PSM_RESPONSE = 8, - WLAN_TDLS_PEER_TRAFFIC_RESPONSE = 9, - WLAN_TDLS_DISCOVERY_REQUEST = 10, -}; - -/* - * TDLS capabililites to be enabled in the 5th byte of the - * @WLAN_EID_EXT_CAPABILITY information element - */ -#define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5) -#define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6) - -/* TDLS specific payload type in the LLC/SNAP header */ -#define WLAN_TDLS_SNAP_RFTYPE 0x2 - -/** - * enum - mesh path selection protocol identifier - * - * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol - * @IEEE80211_PATH_PROTOCOL_VENDOR: a vendor specific protocol that will - * be specified in a vendor specific information element - */ -enum { - IEEE80211_PATH_PROTOCOL_HWMP = 0, - IEEE80211_PATH_PROTOCOL_VENDOR = 255, -}; - -/** - * enum - mesh path selection metric identifier - * - * @IEEE80211_PATH_METRIC_AIRTIME: the default path selection metric - * @IEEE80211_PATH_METRIC_VENDOR: a vendor specific metric that will be - * specified in a vendor specific information element - */ -enum { - IEEE80211_PATH_METRIC_AIRTIME = 0, - IEEE80211_PATH_METRIC_VENDOR = 255, -}; - - -/* - * IEEE 802.11-2007 7.3.2.9 Country information element - * - * Minimum length is 8 octets, ie len must be evenly - * divisible by 2 - */ - -/* Although the spec says 8 I'm seeing 6 in practice */ -#define IEEE80211_COUNTRY_IE_MIN_LEN 6 - -/* The Country String field of the element shall be 3 octets in length */ -#define IEEE80211_COUNTRY_STRING_LEN 3 - -/* - * For regulatory extension stuff see IEEE 802.11-2007 - * Annex I (page 1141) and Annex J (page 1147). Also - * review 7.3.2.9. - * - * When dot11RegulatoryClassesRequired is true and the - * first_channel/reg_extension_id is >= 201 then the IE - * compromises of the 'ext' struct represented below: - * - * - Regulatory extension ID - when generating IE this just needs - * to be monotonically increasing for each triplet passed in - * the IE - * - Regulatory class - index into set of rules - * - Coverage class - index into air propagation time (Table 7-27), - * in microseconds, you can compute the air propagation time from - * the index by multiplying by 3, so index 10 yields a propagation - * of 10 us. Valid values are 0-31, values 32-255 are not defined - * yet. A value of 0 inicates air propagation of <= 1 us. - * - * See also Table I.2 for Emission limit sets and table - * I.3 for Behavior limit sets. Table J.1 indicates how to map - * a reg_class to an emission limit set and behavior limit set. - */ -#define IEEE80211_COUNTRY_EXTENSION_ID 201 - -/* - * Channels numbers in the IE must be monotonically increasing - * if dot11RegulatoryClassesRequired is not true. - * - * If dot11RegulatoryClassesRequired is true consecutive - * subband triplets following a regulatory triplet shall - * have monotonically increasing first_channel number fields. - * - * Channel numbers shall not overlap. - * - * Note that max_power is signed. - */ -struct ieee80211_country_ie_triplet { - union { - struct { - u8 first_channel; - u8 num_channels; - s8 max_power; - } __attribute__ ((packed)) chans; - struct { - u8 reg_extension_id; - u8 reg_class; - u8 coverage_class; - } __attribute__ ((packed)) ext; - }; -} __attribute__ ((packed)); - -enum ieee80211_timeout_interval_type { - WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */, - WLAN_TIMEOUT_KEY_LIFETIME = 2 /* 802.11r */, - WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */, -}; - -/* BACK action code */ -enum ieee80211_back_actioncode { - WLAN_ACTION_ADDBA_REQ = 0, - WLAN_ACTION_ADDBA_RESP = 1, - WLAN_ACTION_DELBA = 2, -}; - -/* BACK (block-ack) parties */ -enum ieee80211_back_parties { - WLAN_BACK_RECIPIENT = 0, - WLAN_BACK_INITIATOR = 1, -}; - -/* SA Query action */ -enum ieee80211_sa_query_action { - WLAN_ACTION_SA_QUERY_REQUEST = 0, - WLAN_ACTION_SA_QUERY_RESPONSE = 1, -}; - - -/* cipher suite selectors */ -#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00 -#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01 -#define WLAN_CIPHER_SUITE_TKIP 0x000FAC02 -/* reserved: 0x000FAC03 */ -#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04 -#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05 -#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06 - -#define WLAN_CIPHER_SUITE_SMS4 0x00147201 - -/* AKM suite selectors */ -#define WLAN_AKM_SUITE_8021X 0x000FAC01 -#define WLAN_AKM_SUITE_PSK 0x000FAC02 -#define WLAN_AKM_SUITE_SAE 0x000FAC08 -#define WLAN_AKM_SUITE_FT_OVER_SAE 0x000FAC09 - -#define WLAN_MAX_KEY_LEN 32 - -#define WLAN_PMKID_LEN 16 - -#define WLAN_OUI_WFA 0x506f9a -#define WLAN_OUI_TYPE_WFA_P2P 9 - -/* - * WMM/802.11e Tspec Element - */ -#define IEEE80211_WMM_IE_TSPEC_TID_MASK 0x0F -#define IEEE80211_WMM_IE_TSPEC_TID_SHIFT 1 - -enum ieee80211_tspec_status_code { - IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED = 0, - IEEE80211_TSPEC_STATUS_ADDTS_INVAL_PARAMS = 0x1, -}; - -struct ieee80211_tspec_ie { - u8 element_id; - u8 len; - u8 oui[3]; - u8 oui_type; - u8 oui_subtype; - u8 version; - __le16 tsinfo; - u8 tsinfo_resvd; - __le16 nominal_msdu; - __le16 max_msdu; - __le32 min_service_int; - __le32 max_service_int; - __le32 inactivity_int; - __le32 suspension_int; - __le32 service_start_time; - __le32 min_data_rate; - __le32 mean_data_rate; - __le32 peak_data_rate; - __le32 max_burst_size; - __le32 delay_bound; - __le32 min_phy_rate; - __le16 sba; - __le16 medium_time; -} __packed; - -/** - * ieee80211_get_qos_ctl - get pointer to qos control bytes - * @hdr: the frame - * - * The qos ctrl bytes come after the frame_control, duration, seq_num - * and 3 or 4 addresses of length ETH_ALEN. - * 3 addr: 2 + 2 + 2 + 3*6 = 24 - * 4 addr: 2 + 2 + 2 + 4*6 = 30 - */ -static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr) -{ - if (ieee80211_has_a4(hdr->frame_control)) - return (u8 *)hdr + 30; - else - return (u8 *)hdr + 24; -} - -/** - * ieee80211_get_SA - get pointer to SA - * @hdr: the frame - * - * Given an 802.11 frame, this function returns the offset - * to the source address (SA). It does not verify that the - * header is long enough to contain the address, and the - * header must be long enough to contain the frame control - * field. - */ -static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr) -{ - if (ieee80211_has_a4(hdr->frame_control)) - return hdr->addr4; - if (ieee80211_has_fromds(hdr->frame_control)) - return hdr->addr3; - return hdr->addr2; -} - -/** - * ieee80211_get_DA - get pointer to DA - * @hdr: the frame - * - * Given an 802.11 frame, this function returns the offset - * to the destination address (DA). It does not verify that - * the header is long enough to contain the address, and the - * header must be long enough to contain the frame control - * field. - */ -static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr) -{ - if (ieee80211_has_tods(hdr->frame_control)) - return hdr->addr3; - else - return hdr->addr1; -} - -/** - * ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame - * @hdr: the frame (buffer must include at least the first octet of payload) - */ -static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr) -{ - if (ieee80211_is_disassoc(hdr->frame_control) || - ieee80211_is_deauth(hdr->frame_control)) - return true; - - if (ieee80211_is_action(hdr->frame_control)) { - u8 *category; - - /* - * Action frames, excluding Public Action frames, are Robust - * Management Frames. However, if we are looking at a Protected - * frame, skip the check since the data may be encrypted and - * the frame has already been found to be a Robust Management - * Frame (by the other end). - */ - if (ieee80211_has_protected(hdr->frame_control)) - return true; - category = ((u8 *) hdr) + 24; - return *category != WLAN_CATEGORY_PUBLIC && - *category != WLAN_CATEGORY_HT && - *category != WLAN_CATEGORY_SELF_PROTECTED && - *category != WLAN_CATEGORY_VENDOR_SPECIFIC; - } - - return false; -} - -/** - * ieee80211_is_public_action - check if frame is a public action frame - * @hdr: the frame - * @len: length of the frame - */ -static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr, - size_t len) -{ - struct ieee80211_mgmt *mgmt = (void *)hdr; - - if (len < IEEE80211_MIN_ACTION_SIZE) - return false; - if (!ieee80211_is_action(hdr->frame_control)) - return false; - return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC; -} - -/** - * ieee80211_fhss_chan_to_freq - get channel frequency - * @channel: the FHSS channel - * - * Convert IEEE802.11 FHSS channel to frequency (MHz) - * Ref IEEE 802.11-2007 section 14.6 - */ -static inline int ieee80211_fhss_chan_to_freq(int channel) -{ - if ((channel > 1) && (channel < 96)) - return channel + 2400; - else - return -1; -} - -/** - * ieee80211_freq_to_fhss_chan - get channel - * @freq: the channels frequency - * - * Convert frequency (MHz) to IEEE802.11 FHSS channel - * Ref IEEE 802.11-2007 section 14.6 - */ -static inline int ieee80211_freq_to_fhss_chan(int freq) -{ - if ((freq > 2401) && (freq < 2496)) - return freq - 2400; - else - return -1; -} - -/** - * ieee80211_dsss_chan_to_freq - get channel center frequency - * @channel: the DSSS channel - * - * Convert IEEE802.11 DSSS channel to the center frequency (MHz). - * Ref IEEE 802.11-2007 section 15.6 - */ -static inline int ieee80211_dsss_chan_to_freq(int channel) -{ - if ((channel > 0) && (channel < 14)) - return 2407 + (channel * 5); - else if (channel == 14) - return 2484; - else - return -1; -} - -/** - * ieee80211_freq_to_dsss_chan - get channel - * @freq: the frequency - * - * Convert frequency (MHz) to IEEE802.11 DSSS channel - * Ref IEEE 802.11-2007 section 15.6 - * - * This routine selects the channel with the closest center frequency. - */ -static inline int ieee80211_freq_to_dsss_chan(int freq) -{ - if ((freq >= 2410) && (freq < 2475)) - return (freq - 2405) / 5; - else if ((freq >= 2482) && (freq < 2487)) - return 14; - else - return -1; -} - -/* Convert IEEE802.11 HR DSSS channel to frequency (MHz) and back - * Ref IEEE 802.11-2007 section 18.4.6.2 - * - * The channels and frequencies are the same as those defined for DSSS - */ -#define ieee80211_hr_chan_to_freq(chan) ieee80211_dsss_chan_to_freq(chan) -#define ieee80211_freq_to_hr_chan(freq) ieee80211_freq_to_dsss_chan(freq) - -/* Convert IEEE802.11 ERP channel to frequency (MHz) and back - * Ref IEEE 802.11-2007 section 19.4.2 - */ -#define ieee80211_erp_chan_to_freq(chan) ieee80211_hr_chan_to_freq(chan) -#define ieee80211_freq_to_erp_chan(freq) ieee80211_freq_to_hr_chan(freq) - -/** - * ieee80211_ofdm_chan_to_freq - get channel center frequency - * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz - * @channel: the OFDM channel - * - * Convert IEEE802.11 OFDM channel to center frequency (MHz) - * Ref IEEE 802.11-2007 section 17.3.8.3.2 - */ -static inline int ieee80211_ofdm_chan_to_freq(int s_freq, int channel) -{ - if ((channel > 0) && (channel <= 200) && - (s_freq >= 4000)) - return s_freq + (channel * 5); - else - return -1; -} - -/** - * ieee80211_freq_to_ofdm_channel - get channel - * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz - * @freq: the frequency - * - * Convert frequency (MHz) to IEEE802.11 OFDM channel - * Ref IEEE 802.11-2007 section 17.3.8.3.2 - * - * This routine selects the channel with the closest center frequency. - */ -static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq) -{ - if ((freq > (s_freq + 2)) && (freq <= (s_freq + 1202)) && - (s_freq >= 4000)) - return (freq + 2 - s_freq) / 5; - else - return -1; -} - -/** - * ieee80211_tu_to_usec - convert time units (TU) to microseconds - * @tu: the TUs - */ -static inline unsigned long ieee80211_tu_to_usec(unsigned long tu) -{ - return 1024 * tu; -} - -/** - * ieee80211_check_tim - check if AID bit is set in TIM - * @tim: the TIM IE - * @tim_len: length of the TIM IE - * @aid: the AID to look for - */ -static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim, - u8 tim_len, u16 aid) -{ - u8 mask; - u8 index, indexn1, indexn2; - - if (unlikely(!tim || tim_len < sizeof(*tim))) - return false; - - aid &= 0x3fff; - index = aid / 8; - mask = 1 << (aid & 7); - - indexn1 = tim->bitmap_ctrl & 0xfe; - indexn2 = tim_len + indexn1 - 4; - - if (index < indexn1 || index > indexn2) - return false; - - index -= indexn1; - - return !!(tim->virtual_map[index] & mask); -} - -#endif /* LINUX_IEEE80211_H */ diff --git a/openairITS/mac/DOT11/include/linux/kfifo.h b/openairITS/mac/DOT11/include/linux/kfifo.h deleted file mode 100644 index e30bb546a0e..00000000000 --- a/openairITS/mac/DOT11/include/linux/kfifo.h +++ /dev/null @@ -1,857 +0,0 @@ -#include <linux/version.h> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) -#include_next <linux/kfifo.h> -#else -/* - * A generic kernel FIFO implementation - * - * Copyright (C) 2009/2010 Stefani Seibold <stefani@seibold.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef _LINUX_KFIFO_H -#define _LINUX_KFIFO_H - -/* - * How to porting drivers to the new generic FIFO API: - * - * - Modify the declaration of the "struct kfifo *" object into a - * in-place "struct kfifo" object - * - Init the in-place object with kfifo_alloc() or kfifo_init() - * Note: The address of the in-place "struct kfifo" object must be - * passed as the first argument to this functions - * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get - * into kfifo_out - * - Replace the use of kfifo_put into kfifo_in_spinlocked and kfifo_get - * into kfifo_out_spinlocked - * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc - * must be passed now to the kfifo_in_spinlocked and kfifo_out_spinlocked - * as the last parameter - * - The formerly __kfifo_* functions are renamed into kfifo_* - */ - -/* - * Note about locking : There is no locking required until only * one reader - * and one writer is using the fifo and no kfifo_reset() will be * called - * kfifo_reset_out() can be safely used, until it will be only called - * in the reader thread. - * For multiple writer and one reader there is only a need to lock the writer. - * And vice versa for only one writer and multiple reader there is only a need - * to lock the reader. - */ - -#include <linux/kernel.h> -#include <linux/spinlock.h> -#include <linux/stddef.h> -#include <linux/scatterlist.h> - -struct __kfifo { - unsigned int in; - unsigned int out; - unsigned int mask; - unsigned int esize; - void *data; -}; - -#define __STRUCT_KFIFO_COMMON(datatype, recsize, ptrtype) \ - union { \ - struct __kfifo kfifo; \ - datatype *type; \ - char (*rectype)[recsize]; \ - ptrtype *ptr; \ - const ptrtype *ptr_const; \ - } - -#define __STRUCT_KFIFO(type, size, recsize, ptrtype) \ -{ \ - __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \ - type buf[((size < 2) || (size & (size - 1))) ? -1 : size]; \ -} - -#define STRUCT_KFIFO(type, size) \ - struct __STRUCT_KFIFO(type, size, 0, type) - -#define __STRUCT_KFIFO_PTR(type, recsize, ptrtype) \ -{ \ - __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \ - type buf[0]; \ -} - -#define STRUCT_KFIFO_PTR(type) \ - struct __STRUCT_KFIFO_PTR(type, 0, type) - -/* - * define compatibility "struct kfifo" for dynamic allocated fifos - */ -struct kfifo __STRUCT_KFIFO_PTR(unsigned char, 0, void); - -#define STRUCT_KFIFO_REC_1(size) \ - struct __STRUCT_KFIFO(unsigned char, size, 1, void) - -#define STRUCT_KFIFO_REC_2(size) \ - struct __STRUCT_KFIFO(unsigned char, size, 2, void) - -/* - * define kfifo_rec types - */ -struct kfifo_rec_ptr_1 __STRUCT_KFIFO_PTR(unsigned char, 1, void); -struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void); - -/* - * helper macro to distinguish between real in place fifo where the fifo - * array is a part of the structure and the fifo type where the array is - * outside of the fifo structure. - */ -#define __is_kfifo_ptr(fifo) (sizeof(*fifo) == sizeof(struct __kfifo)) - -/** - * DECLARE_KFIFO_PTR - macro to declare a fifo pointer object - * @fifo: name of the declared fifo - * @type: type of the fifo elements - */ -#define DECLARE_KFIFO_PTR(fifo, type) STRUCT_KFIFO_PTR(type) fifo - -/** - * DECLARE_KFIFO - macro to declare a fifo object - * @fifo: name of the declared fifo - * @type: type of the fifo elements - * @size: the number of elements in the fifo, this must be a power of 2 - */ -#define DECLARE_KFIFO(fifo, type, size) STRUCT_KFIFO(type, size) fifo - -/** - * INIT_KFIFO - Initialize a fifo declared by DECLARE_KFIFO - * @fifo: name of the declared fifo datatype - */ -#define INIT_KFIFO(fifo) \ -(void)({ \ - typeof(&(fifo)) __tmp = &(fifo); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - __kfifo->in = 0; \ - __kfifo->out = 0; \ - __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : ARRAY_SIZE(__tmp->buf) - 1;\ - __kfifo->esize = sizeof(*__tmp->buf); \ - __kfifo->data = __is_kfifo_ptr(__tmp) ? NULL : __tmp->buf; \ -}) - -/** - * DEFINE_KFIFO - macro to define and initialize a fifo - * @fifo: name of the declared fifo datatype - * @type: type of the fifo elements - * @size: the number of elements in the fifo, this must be a power of 2 - * - * Note: the macro can be used for global and local fifo data type variables. - */ -#define DEFINE_KFIFO(fifo, type, size) \ - DECLARE_KFIFO(fifo, type, size) = \ - (typeof(fifo)) { \ - { \ - { \ - .in = 0, \ - .out = 0, \ - .mask = __is_kfifo_ptr(&(fifo)) ? \ - 0 : \ - ARRAY_SIZE((fifo).buf) - 1, \ - .esize = sizeof(*(fifo).buf), \ - .data = __is_kfifo_ptr(&(fifo)) ? \ - NULL : \ - (fifo).buf, \ - } \ - } \ - } - - -static inline unsigned int __must_check -__kfifo_uint_must_check_helper(unsigned int val) -{ - return val; -} - -static inline int __must_check -__kfifo_int_must_check_helper(int val) -{ - return val; -} - -/** - * kfifo_initialized - Check if the fifo is initialized - * @fifo: address of the fifo to check - * - * Return %true if fifo is initialized, otherwise %false. - * Assumes the fifo was 0 before. - */ -#define kfifo_initialized(fifo) ((fifo)->kfifo.mask) - -/** - * kfifo_esize - returns the size of the element managed by the fifo - * @fifo: address of the fifo to be used - */ -#define kfifo_esize(fifo) ((fifo)->kfifo.esize) - -/** - * kfifo_recsize - returns the size of the record length field - * @fifo: address of the fifo to be used - */ -#define kfifo_recsize(fifo) (sizeof(*(fifo)->rectype)) - -/** - * kfifo_size - returns the size of the fifo in elements - * @fifo: address of the fifo to be used - */ -#define kfifo_size(fifo) ((fifo)->kfifo.mask + 1) - -/** - * kfifo_reset - removes the entire fifo content - * @fifo: address of the fifo to be used - * - * Note: usage of kfifo_reset() is dangerous. It should be only called when the - * fifo is exclusived locked or when it is secured that no other thread is - * accessing the fifo. - */ -#define kfifo_reset(fifo) \ -(void)({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - __tmp->kfifo.in = __tmp->kfifo.out = 0; \ -}) - -/** - * kfifo_reset_out - skip fifo content - * @fifo: address of the fifo to be used - * - * Note: The usage of kfifo_reset_out() is safe until it will be only called - * from the reader thread and there is only one concurrent reader. Otherwise - * it is dangerous and must be handled in the same way as kfifo_reset(). - */ -#define kfifo_reset_out(fifo) \ -(void)({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - __tmp->kfifo.out = __tmp->kfifo.in; \ -}) - -/** - * kfifo_len - returns the number of used elements in the fifo - * @fifo: address of the fifo to be used - */ -#define kfifo_len(fifo) \ -({ \ - typeof((fifo) + 1) __tmpl = (fifo); \ - __tmpl->kfifo.in - __tmpl->kfifo.out; \ -}) - -/** - * kfifo_is_empty - returns true if the fifo is empty - * @fifo: address of the fifo to be used - */ -#define kfifo_is_empty(fifo) \ -({ \ - typeof((fifo) + 1) __tmpq = (fifo); \ - __tmpq->kfifo.in == __tmpq->kfifo.out; \ -}) - -/** - * kfifo_is_full - returns true if the fifo is full - * @fifo: address of the fifo to be used - */ -#define kfifo_is_full(fifo) \ -({ \ - typeof((fifo) + 1) __tmpq = (fifo); \ - kfifo_len(__tmpq) > __tmpq->kfifo.mask; \ -}) - -/** - * kfifo_avail - returns the number of unused elements in the fifo - * @fifo: address of the fifo to be used - */ -#define kfifo_avail(fifo) \ -__kfifo_uint_must_check_helper( \ -({ \ - typeof((fifo) + 1) __tmpq = (fifo); \ - const size_t __recsize = sizeof(*__tmpq->rectype); \ - unsigned int __avail = kfifo_size(__tmpq) - kfifo_len(__tmpq); \ - (__recsize) ? ((__avail <= __recsize) ? 0 : \ - __kfifo_max_r(__avail - __recsize, __recsize)) : \ - __avail; \ -}) \ -) - -/** - * kfifo_skip - skip output data - * @fifo: address of the fifo to be used - */ -#define kfifo_skip(fifo) \ -(void)({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - if (__recsize) \ - __kfifo_skip_r(__kfifo, __recsize); \ - else \ - __kfifo->out++; \ -}) - -/** - * kfifo_peek_len - gets the size of the next fifo record - * @fifo: address of the fifo to be used - * - * This function returns the size of the next fifo record in number of bytes. - */ -#define kfifo_peek_len(fifo) \ -__kfifo_uint_must_check_helper( \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - (!__recsize) ? kfifo_len(__tmp) * sizeof(*__tmp->type) : \ - __kfifo_len_r(__kfifo, __recsize); \ -}) \ -) - -/** - * kfifo_alloc - dynamically allocates a new fifo buffer - * @fifo: pointer to the fifo - * @size: the number of elements in the fifo, this must be a power of 2 - * @gfp_mask: get_free_pages mask, passed to kmalloc() - * - * This macro dynamically allocates a new fifo buffer. - * - * The numer of elements will be rounded-up to a power of 2. - * The fifo will be release with kfifo_free(). - * Return 0 if no error, otherwise an error code. - */ -#define kfifo_alloc(fifo, size, gfp_mask) \ -__kfifo_int_must_check_helper( \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - __is_kfifo_ptr(__tmp) ? \ - __kfifo_alloc(__kfifo, size, sizeof(*__tmp->type), gfp_mask) : \ - -EINVAL; \ -}) \ -) - -/** - * kfifo_free - frees the fifo - * @fifo: the fifo to be freed - */ -#define kfifo_free(fifo) \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - if (__is_kfifo_ptr(__tmp)) \ - __kfifo_free(__kfifo); \ -}) - -/** - * kfifo_init - initialize a fifo using a preallocated buffer - * @fifo: the fifo to assign the buffer - * @buffer: the preallocated buffer to be used - * @size: the size of the internal buffer, this have to be a power of 2 - * - * This macro initialize a fifo using a preallocated buffer. - * - * The numer of elements will be rounded-up to a power of 2. - * Return 0 if no error, otherwise an error code. - */ -#define kfifo_init(fifo, buffer, size) \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - __is_kfifo_ptr(__tmp) ? \ - __kfifo_init(__kfifo, buffer, size, sizeof(*__tmp->type)) : \ - -EINVAL; \ -}) - -/** - * kfifo_put - put data into the fifo - * @fifo: address of the fifo to be used - * @val: the data to be added - * - * This macro copies the given value into the fifo. - * It returns 0 if the fifo was full. Otherwise it returns the number - * processed elements. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macro. - */ -#define kfifo_put(fifo, val) \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - typeof((val) + 1) __val = (val); \ - unsigned int __ret; \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - if (0) { \ - typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \ - __dummy = (typeof(__val))NULL; \ - } \ - if (__recsize) \ - __ret = __kfifo_in_r(__kfifo, __val, sizeof(*__val), \ - __recsize); \ - else { \ - __ret = !kfifo_is_full(__tmp); \ - if (__ret) { \ - (__is_kfifo_ptr(__tmp) ? \ - ((typeof(__tmp->type))__kfifo->data) : \ - (__tmp->buf) \ - )[__kfifo->in & __tmp->kfifo.mask] = \ - *(typeof(__tmp->type))__val; \ - smp_wmb(); \ - __kfifo->in++; \ - } \ - } \ - __ret; \ -}) - -/** - * kfifo_get - get data from the fifo - * @fifo: address of the fifo to be used - * @val: the var where to store the data to be added - * - * This macro reads the data from the fifo. - * It returns 0 if the fifo was empty. Otherwise it returns the number - * processed elements. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macro. - */ -#define kfifo_get(fifo, val) \ -__kfifo_uint_must_check_helper( \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - typeof((val) + 1) __val = (val); \ - unsigned int __ret; \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - if (0) \ - __val = (typeof(__tmp->ptr))0; \ - if (__recsize) \ - __ret = __kfifo_out_r(__kfifo, __val, sizeof(*__val), \ - __recsize); \ - else { \ - __ret = !kfifo_is_empty(__tmp); \ - if (__ret) { \ - *(typeof(__tmp->type))__val = \ - (__is_kfifo_ptr(__tmp) ? \ - ((typeof(__tmp->type))__kfifo->data) : \ - (__tmp->buf) \ - )[__kfifo->out & __tmp->kfifo.mask]; \ - smp_wmb(); \ - __kfifo->out++; \ - } \ - } \ - __ret; \ -}) \ -) - -/** - * kfifo_peek - get data from the fifo without removing - * @fifo: address of the fifo to be used - * @val: the var where to store the data to be added - * - * This reads the data from the fifo without removing it from the fifo. - * It returns 0 if the fifo was empty. Otherwise it returns the number - * processed elements. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macro. - */ -#define kfifo_peek(fifo, val) \ -__kfifo_uint_must_check_helper( \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - typeof((val) + 1) __val = (val); \ - unsigned int __ret; \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - if (0) \ - __val = (typeof(__tmp->ptr))NULL; \ - if (__recsize) \ - __ret = __kfifo_out_peek_r(__kfifo, __val, sizeof(*__val), \ - __recsize); \ - else { \ - __ret = !kfifo_is_empty(__tmp); \ - if (__ret) { \ - *(typeof(__tmp->type))__val = \ - (__is_kfifo_ptr(__tmp) ? \ - ((typeof(__tmp->type))__kfifo->data) : \ - (__tmp->buf) \ - )[__kfifo->out & __tmp->kfifo.mask]; \ - smp_wmb(); \ - } \ - } \ - __ret; \ -}) \ -) - -/** - * kfifo_in - put data into the fifo - * @fifo: address of the fifo to be used - * @buf: the data to be added - * @n: number of elements to be added - * - * This macro copies the given buffer into the fifo and returns the - * number of copied elements. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macro. - */ -#define kfifo_in(fifo, buf, n) \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - typeof((buf) + 1) __buf = (buf); \ - unsigned long __n = (n); \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - if (0) { \ - typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \ - __dummy = (typeof(__buf))NULL; \ - } \ - (__recsize) ?\ - __kfifo_in_r(__kfifo, __buf, __n, __recsize) : \ - __kfifo_in(__kfifo, __buf, __n); \ -}) - -/** - * kfifo_in_spinlocked - put data into the fifo using a spinlock for locking - * @fifo: address of the fifo to be used - * @buf: the data to be added - * @n: number of elements to be added - * @lock: pointer to the spinlock to use for locking - * - * This macro copies the given values buffer into the fifo and returns the - * number of copied elements. - */ -#define kfifo_in_spinlocked(fifo, buf, n, lock) \ -({ \ - unsigned long __flags; \ - unsigned int __ret; \ - spin_lock_irqsave(lock, __flags); \ - __ret = kfifo_in(fifo, buf, n); \ - spin_unlock_irqrestore(lock, __flags); \ - __ret; \ -}) - -/* alias for kfifo_in_spinlocked, will be removed in a future release */ -#define kfifo_in_locked(fifo, buf, n, lock) \ - kfifo_in_spinlocked(fifo, buf, n, lock) - -/** - * kfifo_out - get data from the fifo - * @fifo: address of the fifo to be used - * @buf: pointer to the storage buffer - * @n: max. number of elements to get - * - * This macro get some data from the fifo and return the numbers of elements - * copied. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macro. - */ -#define kfifo_out(fifo, buf, n) \ -__kfifo_uint_must_check_helper( \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - typeof((buf) + 1) __buf = (buf); \ - unsigned long __n = (n); \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - if (0) { \ - typeof(__tmp->ptr) __dummy = NULL; \ - __buf = __dummy; \ - } \ - (__recsize) ?\ - __kfifo_out_r(__kfifo, __buf, __n, __recsize) : \ - __kfifo_out(__kfifo, __buf, __n); \ -}) \ -) - -/** - * kfifo_out_spinlocked - get data from the fifo using a spinlock for locking - * @fifo: address of the fifo to be used - * @buf: pointer to the storage buffer - * @n: max. number of elements to get - * @lock: pointer to the spinlock to use for locking - * - * This macro get the data from the fifo and return the numbers of elements - * copied. - */ -#define kfifo_out_spinlocked(fifo, buf, n, lock) \ -__kfifo_uint_must_check_helper( \ -({ \ - unsigned long __flags; \ - unsigned int __ret; \ - spin_lock_irqsave(lock, __flags); \ - __ret = kfifo_out(fifo, buf, n); \ - spin_unlock_irqrestore(lock, __flags); \ - __ret; \ -}) \ -) - -/* alias for kfifo_out_spinlocked, will be removed in a future release */ -#define kfifo_out_locked(fifo, buf, n, lock) \ - kfifo_out_spinlocked(fifo, buf, n, lock) - -/** - * kfifo_from_user - puts some data from user space into the fifo - * @fifo: address of the fifo to be used - * @from: pointer to the data to be added - * @len: the length of the data to be added - * @copied: pointer to output variable to store the number of copied bytes - * - * This macro copies at most @len bytes from the @from into the - * fifo, depending of the available space and returns -EFAULT/0. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macro. - */ -#define kfifo_from_user(fifo, from, len, copied) \ -__kfifo_uint_must_check_helper( \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - const void __user *__from = (from); \ - unsigned int __len = (len); \ - unsigned int *__copied = (copied); \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - (__recsize) ? \ - __kfifo_from_user_r(__kfifo, __from, __len, __copied, __recsize) : \ - __kfifo_from_user(__kfifo, __from, __len, __copied); \ -}) \ -) - -/** - * kfifo_to_user - copies data from the fifo into user space - * @fifo: address of the fifo to be used - * @to: where the data must be copied - * @len: the size of the destination buffer - * @copied: pointer to output variable to store the number of copied bytes - * - * This macro copies at most @len bytes from the fifo into the - * @to buffer and returns -EFAULT/0. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macro. - */ -#define kfifo_to_user(fifo, to, len, copied) \ -__kfifo_uint_must_check_helper( \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - void __user *__to = (to); \ - unsigned int __len = (len); \ - unsigned int *__copied = (copied); \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - (__recsize) ? \ - __kfifo_to_user_r(__kfifo, __to, __len, __copied, __recsize) : \ - __kfifo_to_user(__kfifo, __to, __len, __copied); \ -}) \ -) - -/** - * kfifo_dma_in_prepare - setup a scatterlist for DMA input - * @fifo: address of the fifo to be used - * @sgl: pointer to the scatterlist array - * @nents: number of entries in the scatterlist array - * @len: number of elements to transfer - * - * This macro fills a scatterlist for DMA input. - * It returns the number entries in the scatterlist array. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macros. - */ -#define kfifo_dma_in_prepare(fifo, sgl, nents, len) \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - struct scatterlist *__sgl = (sgl); \ - int __nents = (nents); \ - unsigned int __len = (len); \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - (__recsize) ? \ - __kfifo_dma_in_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \ - __kfifo_dma_in_prepare(__kfifo, __sgl, __nents, __len); \ -}) - -/** - * kfifo_dma_in_finish - finish a DMA IN operation - * @fifo: address of the fifo to be used - * @len: number of bytes to received - * - * This macro finish a DMA IN operation. The in counter will be updated by - * the len parameter. No error checking will be done. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macros. - */ -#define kfifo_dma_in_finish(fifo, len) \ -(void)({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - unsigned int __len = (len); \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - if (__recsize) \ - __kfifo_dma_in_finish_r(__kfifo, __len, __recsize); \ - else \ - __kfifo->in += __len / sizeof(*__tmp->type); \ -}) - -/** - * kfifo_dma_out_prepare - setup a scatterlist for DMA output - * @fifo: address of the fifo to be used - * @sgl: pointer to the scatterlist array - * @nents: number of entries in the scatterlist array - * @len: number of elements to transfer - * - * This macro fills a scatterlist for DMA output which at most @len bytes - * to transfer. - * It returns the number entries in the scatterlist array. - * A zero means there is no space available and the scatterlist is not filled. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macros. - */ -#define kfifo_dma_out_prepare(fifo, sgl, nents, len) \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - struct scatterlist *__sgl = (sgl); \ - int __nents = (nents); \ - unsigned int __len = (len); \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - (__recsize) ? \ - __kfifo_dma_out_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \ - __kfifo_dma_out_prepare(__kfifo, __sgl, __nents, __len); \ -}) - -/** - * kfifo_dma_out_finish - finish a DMA OUT operation - * @fifo: address of the fifo to be used - * @len: number of bytes transferd - * - * This macro finish a DMA OUT operation. The out counter will be updated by - * the len parameter. No error checking will be done. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macros. - */ -#define kfifo_dma_out_finish(fifo, len) \ -(void)({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - unsigned int __len = (len); \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - if (__recsize) \ - __kfifo_dma_out_finish_r(__kfifo, __recsize); \ - else \ - __kfifo->out += __len / sizeof(*__tmp->type); \ -}) - -/** - * kfifo_out_peek - gets some data from the fifo - * @fifo: address of the fifo to be used - * @buf: pointer to the storage buffer - * @n: max. number of elements to get - * - * This macro get the data from the fifo and return the numbers of elements - * copied. The data is not removed from the fifo. - * - * Note that with only one concurrent reader and one concurrent - * writer, you don't need extra locking to use these macro. - */ -#define kfifo_out_peek(fifo, buf, n) \ -__kfifo_uint_must_check_helper( \ -({ \ - typeof((fifo) + 1) __tmp = (fifo); \ - typeof((buf) + 1) __buf = (buf); \ - unsigned long __n = (n); \ - const size_t __recsize = sizeof(*__tmp->rectype); \ - struct __kfifo *__kfifo = &__tmp->kfifo; \ - if (0) { \ - typeof(__tmp->ptr) __dummy __attribute__ ((unused)) = NULL; \ - __buf = __dummy; \ - } \ - (__recsize) ? \ - __kfifo_out_peek_r(__kfifo, __buf, __n, __recsize) : \ - __kfifo_out_peek(__kfifo, __buf, __n); \ -}) \ -) - -extern int __kfifo_alloc(struct __kfifo *fifo, unsigned int size, - size_t esize, gfp_t gfp_mask); - -extern void __kfifo_free(struct __kfifo *fifo); - -extern int __kfifo_init(struct __kfifo *fifo, void *buffer, - unsigned int size, size_t esize); - -extern unsigned int __kfifo_in(struct __kfifo *fifo, - const void *buf, unsigned int len); - -extern unsigned int __kfifo_out(struct __kfifo *fifo, - void *buf, unsigned int len); - -extern int __kfifo_from_user(struct __kfifo *fifo, - const void __user *from, unsigned long len, unsigned int *copied); - -extern int __kfifo_to_user(struct __kfifo *fifo, - void __user *to, unsigned long len, unsigned int *copied); - -extern unsigned int __kfifo_dma_in_prepare(struct __kfifo *fifo, - struct scatterlist *sgl, int nents, unsigned int len); - -extern unsigned int __kfifo_dma_out_prepare(struct __kfifo *fifo, - struct scatterlist *sgl, int nents, unsigned int len); - -extern unsigned int __kfifo_out_peek(struct __kfifo *fifo, - void *buf, unsigned int len); - -extern unsigned int __kfifo_in_r(struct __kfifo *fifo, - const void *buf, unsigned int len, size_t recsize); - -extern unsigned int __kfifo_out_r(struct __kfifo *fifo, - void *buf, unsigned int len, size_t recsize); - -extern int __kfifo_from_user_r(struct __kfifo *fifo, - const void __user *from, unsigned long len, unsigned int *copied, - size_t recsize); - -extern int __kfifo_to_user_r(struct __kfifo *fifo, void __user *to, - unsigned long len, unsigned int *copied, size_t recsize); - -extern unsigned int __kfifo_dma_in_prepare_r(struct __kfifo *fifo, - struct scatterlist *sgl, int nents, unsigned int len, size_t recsize); - -extern void __kfifo_dma_in_finish_r(struct __kfifo *fifo, - unsigned int len, size_t recsize); - -extern unsigned int __kfifo_dma_out_prepare_r(struct __kfifo *fifo, - struct scatterlist *sgl, int nents, unsigned int len, size_t recsize); - -extern void __kfifo_dma_out_finish_r(struct __kfifo *fifo, size_t recsize); - -extern unsigned int __kfifo_len_r(struct __kfifo *fifo, size_t recsize); - -extern void __kfifo_skip_r(struct __kfifo *fifo, size_t recsize); - -extern unsigned int __kfifo_out_peek_r(struct __kfifo *fifo, - void *buf, unsigned int len, size_t recsize); - -extern unsigned int __kfifo_max_r(unsigned int len, size_t recsize); - -#endif -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) */ diff --git a/openairITS/mac/DOT11/include/linux/math64.h b/openairITS/mac/DOT11/include/linux/math64.h deleted file mode 100644 index eb9e8e15225..00000000000 --- a/openairITS/mac/DOT11/include/linux/math64.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _COMPAT_LINUX_MATH64_H -#define _COMPAT_LINUX_MATH64_H 1 - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)) -#include_next <linux/math64.h> -#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)) */ - -#endif /* _COMPAT_LINUX_MATH64_H */ diff --git a/openairITS/mac/DOT11/include/linux/nl80211.h b/openairITS/mac/DOT11/include/linux/nl80211.h deleted file mode 100644 index bed749330c0..00000000000 --- a/openairITS/mac/DOT11/include/linux/nl80211.h +++ /dev/null @@ -1,2870 +0,0 @@ -#ifndef __LINUX_NL80211_H -#define __LINUX_NL80211_H -/* - * 802.11 netlink interface public header - * - * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> - * Copyright 2008 Michael Wu <flamingice@sourmilk.net> - * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> - * Copyright 2008 Michael Buesch <m@bues.ch> - * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com> - * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> - * Copyright 2008 Colin McCabe <colin@cozybit.com> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#include <linux/types.h> - -/** - * DOC: Station handling - * - * Stations are added per interface, but a special case exists with VLAN - * interfaces. When a station is bound to an AP interface, it may be moved - * into a VLAN identified by a VLAN interface index (%NL80211_ATTR_STA_VLAN). - * The station is still assumed to belong to the AP interface it was added - * to. - * - * TODO: need more info? - */ - -/** - * DOC: Frame transmission/registration support - * - * Frame transmission and registration support exists to allow userspace - * management entities such as wpa_supplicant react to management frames - * that are not being handled by the kernel. This includes, for example, - * certain classes of action frames that cannot be handled in the kernel - * for various reasons. - * - * Frame registration is done on a per-interface basis and registrations - * cannot be removed other than by closing the socket. It is possible to - * specify a registration filter to register, for example, only for a - * certain type of action frame. In particular with action frames, those - * that userspace registers for will not be returned as unhandled by the - * driver, so that the registered application has to take responsibility - * for doing that. - * - * The type of frame that can be registered for is also dependent on the - * driver and interface type. The frame types are advertised in wiphy - * attributes so applications know what to expect. - * - * NOTE: When an interface changes type while registrations are active, - * these registrations are ignored until the interface type is - * changed again. This means that changing the interface type can - * lead to a situation that couldn't otherwise be produced, but - * any such registrations will be dormant in the sense that they - * will not be serviced, i.e. they will not receive any frames. - * - * Frame transmission allows userspace to send for example the required - * responses to action frames. It is subject to some sanity checking, - * but many frames can be transmitted. When a frame was transmitted, its - * status is indicated to the sending socket. - * - * For more technical details, see the corresponding command descriptions - * below. - */ - -/** - * DOC: Virtual interface / concurrency capabilities - * - * Some devices are able to operate with virtual MACs, they can have - * more than one virtual interface. The capability handling for this - * is a bit complex though, as there may be a number of restrictions - * on the types of concurrency that are supported. - * - * To start with, each device supports the interface types listed in - * the %NL80211_ATTR_SUPPORTED_IFTYPES attribute, but by listing the - * types there no concurrency is implied. - * - * Once concurrency is desired, more attributes must be observed: - * To start with, since some interface types are purely managed in - * software, like the AP-VLAN type in mac80211 for example, there's - * an additional list of these, they can be added at any time and - * are only restricted by some semantic restrictions (e.g. AP-VLAN - * cannot be added without a corresponding AP interface). This list - * is exported in the %NL80211_ATTR_SOFTWARE_IFTYPES attribute. - * - * Further, the list of supported combinations is exported. This is - * in the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute. Basically, - * it exports a list of "groups", and at any point in time the - * interfaces that are currently active must fall into any one of - * the advertised groups. Within each group, there are restrictions - * on the number of interfaces of different types that are supported - * and also the number of different channels, along with potentially - * some other restrictions. See &enum nl80211_if_combination_attrs. - * - * All together, these attributes define the concurrency of virtual - * interfaces that a given device supports. - */ - -/** - * enum nl80211_commands - supported nl80211 commands - * - * @NL80211_CMD_UNSPEC: unspecified command to catch errors - * - * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request - * to get a list of all present wiphys. - * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or - * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME, - * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, - * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT, - * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, - * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD. - * However, for setting the channel, see %NL80211_CMD_SET_CHANNEL - * instead, the support here is for backward compatibility only. - * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request - * or rename notification. Has attributes %NL80211_ATTR_WIPHY and - * %NL80211_ATTR_WIPHY_NAME. - * @NL80211_CMD_DEL_WIPHY: Wiphy deleted. Has attributes - * %NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME. - * - * @NL80211_CMD_GET_INTERFACE: Request an interface's configuration; - * either a dump request on a %NL80211_ATTR_WIPHY or a specific get - * on an %NL80211_ATTR_IFINDEX is supported. - * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires - * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE. - * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response - * to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX, - * %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also - * be sent from userspace to request creation of a new virtual interface, - * then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and - * %NL80211_ATTR_IFNAME. - * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes - * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from - * userspace to request deletion of a virtual interface, then requires - * attribute %NL80211_ATTR_IFINDEX. - * - * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified - * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. - * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, - * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. - * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, - * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER, - * and %NL80211_ATTR_KEY_SEQ attributes. - * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX - * or %NL80211_ATTR_MAC. - * - * @NL80211_CMD_GET_BEACON: (not used) - * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface - * using the %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL - * attributes. For drivers that generate the beacon and probe responses - * internally, the following attributes must be provided: %NL80211_ATTR_IE, - * %NL80211_ATTR_IE_PROBE_RESP and %NL80211_ATTR_IE_ASSOC_RESP. - * @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters - * are like for %NL80211_CMD_SET_BEACON, and additionally parameters that - * do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL, - * %NL80211_ATTR_DTIM_PERIOD, %NL80211_ATTR_SSID, - * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, - * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, - * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, - * %NL80211_ATTR_AUTH_TYPE and %NL80211_ATTR_INACTIVITY_TIMEOUT. - * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP - * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface - * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP - * - * @NL80211_CMD_GET_STATION: Get station attributes for station identified by - * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. - * @NL80211_CMD_SET_STATION: Set station attributes for station identified by - * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. - * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the - * the interface identified by %NL80211_ATTR_IFINDEX. - * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC - * or, if no MAC address given, all stations, on the interface identified - * by %NL80211_ATTR_IFINDEX. - * - * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to - * destination %NL80211_ATTR_MAC on the interface identified by - * %NL80211_ATTR_IFINDEX. - * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to - * destination %NL80211_ATTR_MAC on the interface identified by - * %NL80211_ATTR_IFINDEX. - * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by - * %NL80211_ATTR_MAC via %NL80211_ATTR_MPATH_NEXT_HOP. - * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by - * %NL80211_ATTR_MAC. - * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the - * the interface identified by %NL80211_ATTR_IFINDEX. - * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC - * or, if no MAC address given, all mesh paths, on the interface identified - * by %NL80211_ATTR_IFINDEX. - * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by - * %NL80211_ATTR_IFINDEX. - * - * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set - * regulatory domain. - * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command - * after being queried by the kernel. CRDA replies by sending a regulatory - * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our - * current alpha2 if it found a match. It also provides - * NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each - * regulatory rule is a nested set of attributes given by - * %NL80211_ATTR_REG_RULE_FREQ_[START|END] and - * %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by - * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and - * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP. - * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain - * to the specified ISO/IEC 3166-1 alpha2 country code. The core will - * store this as a valid request and then query userspace for it. - * - * @NL80211_CMD_GET_MESH_CONFIG: Get mesh networking properties for the - * interface identified by %NL80211_ATTR_IFINDEX - * - * @NL80211_CMD_SET_MESH_CONFIG: Set mesh networking properties for the - * interface identified by %NL80211_ATTR_IFINDEX - * - * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The - * interface is identified with %NL80211_ATTR_IFINDEX and the management - * frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be - * added to the end of the specified management frame is specified with - * %NL80211_ATTR_IE. If the command succeeds, the requested data will be - * added to all specified management frames generated by - * kernel/firmware/driver. - * Note: This command has been removed and it is only reserved at this - * point to avoid re-using existing command number. The functionality this - * command was planned for has been provided with cleaner design with the - * option to specify additional IEs in NL80211_CMD_TRIGGER_SCAN, - * NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE, - * NL80211_CMD_DEAUTHENTICATE, and NL80211_CMD_DISASSOCIATE. - * - * @NL80211_CMD_GET_SCAN: get scan results - * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters - * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the - * probe requests at CCK rate or not. - * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to - * NL80211_CMD_GET_SCAN and on the "scan" multicast group) - * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons, - * partial scan results may be available - * - * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain - * intervals, as specified by %NL80211_ATTR_SCHED_SCAN_INTERVAL. - * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS) - * are passed, they are used in the probe requests. For - * broadcast, a broadcast SSID must be passed (ie. an empty - * string). If no SSID is passed, no probe requests are sent and - * a passive scan is performed. %NL80211_ATTR_SCAN_FREQUENCIES, - * if passed, define which channels should be scanned; if not - * passed, all channels allowed for the current regulatory domain - * are used. Extra IEs can also be passed from the userspace by - * using the %NL80211_ATTR_IE attribute. - * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT - * if scheduled scan is not running. - * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan - * results available. - * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has - * stopped. The driver may issue this event at any time during a - * scheduled scan. One reason for stopping the scan is if the hardware - * does not support starting an association or a normal scan while running - * a scheduled scan. This event is also sent when the - * %NL80211_CMD_STOP_SCHED_SCAN command is received or when the interface - * is brought down while a scheduled scan was running. - * - * @NL80211_CMD_GET_SURVEY: get survey resuls, e.g. channel occupation - * or noise level - * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to - * NL80211_CMD_GET_SURVEY and on the "scan" multicast group) - * - * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain - * has been changed and provides details of the request information - * that caused the change such as who initiated the regulatory request - * (%NL80211_ATTR_REG_INITIATOR), the wiphy_idx - * (%NL80211_ATTR_REG_ALPHA2) on which the request was made from if - * the initiator was %NL80211_REGDOM_SET_BY_COUNTRY_IE or - * %NL80211_REGDOM_SET_BY_DRIVER, the type of regulatory domain - * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is - * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on - * to (%NL80211_ATTR_REG_ALPHA2). - * @NL80211_CMD_REG_BEACON_HINT: indicates to userspace that an AP beacon - * has been found while world roaming thus enabling active scan or - * any mode of operation that initiates TX (beacons) on a channel - * where we would not have been able to do either before. As an example - * if you are world roaming (regulatory domain set to world or if your - * driver is using a custom world roaming regulatory domain) and while - * doing a passive scan on the 5 GHz band you find an AP there (if not - * on a DFS channel) you will now be able to actively scan for that AP - * or use AP mode on your card on that same channel. Note that this will - * never be used for channels 1-11 on the 2 GHz band as they are always - * enabled world wide. This beacon hint is only sent if your device had - * either disabled active scanning or beaconing on a channel. We send to - * userspace the wiphy on which we removed a restriction from - * (%NL80211_ATTR_WIPHY) and the channel on which this occurred - * before (%NL80211_ATTR_FREQ_BEFORE) and after (%NL80211_ATTR_FREQ_AFTER) - * the beacon hint was processed. - * - * @NL80211_CMD_AUTHENTICATE: authentication request and notification. - * This command is used both as a command (request to authenticate) and - * as an event on the "mlme" multicast group indicating completion of the - * authentication process. - * When used as a command, %NL80211_ATTR_IFINDEX is used to identify the - * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and - * BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify - * the SSID (mainly for association, but is included in authentication - * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ is used - * to specify the frequence of the channel in MHz. %NL80211_ATTR_AUTH_TYPE - * is used to specify the authentication type. %NL80211_ATTR_IE is used to - * define IEs (VendorSpecificInfo, but also including RSN IE and FT IEs) - * to be added to the frame. - * When used as an event, this reports reception of an Authentication - * frame in station and IBSS modes when the local MLME processed the - * frame, i.e., it was for the local STA and was received in correct - * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the - * MLME SAP interface (kernel providing MLME, userspace SME). The - * included %NL80211_ATTR_FRAME attribute contains the management frame - * (including both the header and frame body, but not FCS). This event is - * also used to indicate if the authentication attempt timed out. In that - * case the %NL80211_ATTR_FRAME attribute is replaced with a - * %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which - * pending authentication timed out). - * @NL80211_CMD_ASSOCIATE: association request and notification; like - * NL80211_CMD_AUTHENTICATE but for Association and Reassociation - * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, - * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). - * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like - * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to - * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication - * primitives). - * @NL80211_CMD_DISASSOCIATE: disassociation request and notification; like - * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to - * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives). - * - * @NL80211_CMD_MICHAEL_MIC_FAILURE: notification of a locally detected Michael - * MIC (part of TKIP) failure; sent on the "mlme" multicast group; the - * event includes %NL80211_ATTR_MAC to describe the source MAC address of - * the frame with invalid MIC, %NL80211_ATTR_KEY_TYPE to show the key - * type, %NL80211_ATTR_KEY_IDX to indicate the key identifier, and - * %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this - * event matches with MLME-MICHAELMICFAILURE.indication() primitive - * - * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a - * FREQ attribute (for the initial frequency if no peer can be found) - * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those - * should be fixed rather than automatically determined. Can only be - * executed on a network interface that is UP, and fixed BSSID/FREQ - * may be rejected. Another optional parameter is the beacon interval, - * given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not - * given defaults to 100 TU (102.4ms). - * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is - * determined by the network interface. - * - * @NL80211_CMD_TESTMODE: testmode command, takes a wiphy (or ifindex) attribute - * to identify the device, and the TESTDATA blob attribute to pass through - * to the driver. - * - * @NL80211_CMD_CONNECT: connection request and notification; this command - * requests to connect to a specified network but without separating - * auth and assoc steps. For this, you need to specify the SSID in a - * %NL80211_ATTR_SSID attribute, and can optionally specify the association - * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_MAC, - * %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT, - * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE and - * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT. - * Background scan period can optionally be - * specified in %NL80211_ATTR_BG_SCAN_PERIOD, - * if not specified default background scan configuration - * in driver is used and if period value is 0, bg scan will be disabled. - * This attribute is ignored if driver does not support roam scan. - * It is also sent as an event, with the BSSID and response IEs when the - * connection is established or failed to be established. This can be - * determined by the STATUS_CODE attribute. - * @NL80211_CMD_ROAM: request that the card roam (currently not implemented), - * sent as an event when the card/driver roamed by itself. - * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify - * userspace that a connection was dropped by the AP or due to other - * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and - * %NL80211_ATTR_REASON_CODE attributes are used. - * - * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices - * associated with this wiphy must be down and will follow. - * - * @NL80211_CMD_REMAIN_ON_CHANNEL: Request to remain awake on the specified - * channel for the specified amount of time. This can be used to do - * off-channel operations like transmit a Public Action frame and wait for - * a response while being associated to an AP on another channel. - * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus - * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the - * frequency for the operation and %NL80211_ATTR_WIPHY_CHANNEL_TYPE may be - * optionally used to specify additional channel parameters. - * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds - * to remain on the channel. This command is also used as an event to - * notify when the requested duration starts (it may take a while for the - * driver to schedule this time due to other concurrent needs for the - * radio). - * When called, this operation returns a cookie (%NL80211_ATTR_COOKIE) - * that will be included with any events pertaining to this request; - * the cookie is also used to cancel the request. - * @NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL: This command can be used to cancel a - * pending remain-on-channel duration if the desired operation has been - * completed prior to expiration of the originally requested duration. - * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify the - * radio. The %NL80211_ATTR_COOKIE attribute must be given as well to - * uniquely identify the request. - * This command is also used as an event to notify when a requested - * remain-on-channel duration has expired. - * - * @NL80211_CMD_SET_TX_BITRATE_MASK: Set the mask of rates to be used in TX - * rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface - * and @NL80211_ATTR_TX_RATES the set of allowed rates. - * - * @NL80211_CMD_REGISTER_FRAME: Register for receiving certain mgmt frames - * (via @NL80211_CMD_FRAME) for processing in userspace. This command - * requires an interface index, a frame type attribute (optional for - * backward compatibility reasons, if not given assumes action frames) - * and a match attribute containing the first few bytes of the frame - * that should match, e.g. a single byte for only a category match or - * four bytes for vendor frames including the OUI. The registration - * cannot be dropped, but is removed automatically when the netlink - * socket is closed. Multiple registrations can be made. - * @NL80211_CMD_REGISTER_ACTION: Alias for @NL80211_CMD_REGISTER_FRAME for - * backward compatibility - * @NL80211_CMD_FRAME: Management frame TX request and RX notification. This - * command is used both as a request to transmit a management frame and - * as an event indicating reception of a frame that was not processed in - * kernel code, but is for us (i.e., which may need to be processed in a - * user space application). %NL80211_ATTR_FRAME is used to specify the - * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and - * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on - * which channel the frame is to be transmitted or was received. If this - * channel is not the current channel (remain-on-channel or the - * operational channel) the device will switch to the given channel and - * transmit the frame, optionally waiting for a response for the time - * specified using %NL80211_ATTR_DURATION. When called, this operation - * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the - * TX status event pertaining to the TX request. - * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the - * management frames at CCK rate or not in 2GHz band. - * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this - * command may be used with the corresponding cookie to cancel the wait - * time if it is known that it is no longer necessary. - * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility. - * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame - * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies - * the TX command and %NL80211_ATTR_FRAME includes the contents of the - * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged - * the frame. - * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for - * backward compatibility. - * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command - * is used to configure connection quality monitoring notification trigger - * levels. - * @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This - * command is used as an event to indicate the that a trigger level was - * reached. - * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ - * and %NL80211_ATTR_WIPHY_CHANNEL_TYPE) the given interface (identifed - * by %NL80211_ATTR_IFINDEX) shall operate on. - * In case multiple channels are supported by the device, the mechanism - * with which it switches channels is implementation-defined. - * When a monitor interface is given, it can only switch channel while - * no other interfaces are operating to avoid disturbing the operation - * of any other interfaces, and other interfaces will again take - * precedence when they are used. - * - * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface. - * - * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial - * mesh config parameters may be given. - * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the - * network is determined by the network interface. - * - * @NL80211_CMD_UNPROT_DEAUTHENTICATE: Unprotected deauthentication frame - * notification. This event is used to indicate that an unprotected - * deauthentication frame was dropped when MFP is in use. - * @NL80211_CMD_UNPROT_DISASSOCIATE: Unprotected disassociation frame - * notification. This event is used to indicate that an unprotected - * disassociation frame was dropped when MFP is in use. - * - * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a - * beacon or probe response from a compatible mesh peer. This is only - * sent while no station information (sta_info) exists for the new peer - * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH is set. On - * reception of this notification, userspace may decide to create a new - * station (@NL80211_CMD_NEW_STATION). To stop this notification from - * reoccurring, the userspace authentication daemon may want to create the - * new station with the AUTHENTICATED flag unset and maybe change it later - * depending on the authentication result. - * - * @NL80211_CMD_GET_WOWLAN: get Wake-on-Wireless-LAN (WoWLAN) settings. - * @NL80211_CMD_SET_WOWLAN: set Wake-on-Wireless-LAN (WoWLAN) settings. - * Since wireless is more complex than wired ethernet, it supports - * various triggers. These triggers can be configured through this - * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For - * more background information, see - * http://wireless.kernel.org/en/users/Documentation/WoWLAN. - * - * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver - * the necessary information for supporting GTK rekey offload. This - * feature is typically used during WoWLAN. The configuration data - * is contained in %NL80211_ATTR_REKEY_DATA (which is nested and - * contains the data in sub-attributes). After rekeying happened, - * this command may also be sent by the driver as an MLME event to - * inform userspace of the new replay counter. - * - * @NL80211_CMD_PMKSA_CANDIDATE: This is used as an event to inform userspace - * of PMKSA caching dandidates. - * - * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup). - * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. - * - * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP - * (or GO) interface (i.e. hostapd) to ask for unexpected frames to - * implement sending deauth to stations that send unexpected class 3 - * frames. Also used as the event sent by the kernel when such a frame - * is received. - * For the event, the %NL80211_ATTR_MAC attribute carries the TA and - * other attributes like the interface index are present. - * If used as the command it must have an interface index and you can - * only unsubscribe from the event by closing the socket. Subscription - * is also for %NL80211_CMD_UNEXPECTED_4ADDR_FRAME events. - * - * @NL80211_CMD_UNEXPECTED_4ADDR_FRAME: Sent as an event indicating that the - * associated station identified by %NL80211_ATTR_MAC sent a 4addr frame - * and wasn't already in a 4-addr VLAN. The event will be sent similarly - * to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener. - * - * @NL80211_CMD_PROBE_CLIENT: Probe an associated station on an AP interface - * by sending a null data frame to it and reporting when the frame is - * acknowleged. This is used to allow timing out inactive clients. Uses - * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_MAC. The command returns a - * direct reply with an %NL80211_ATTR_COOKIE that is later used to match - * up the event with the request. The event includes the same data and - * has %NL80211_ATTR_ACK set if the frame was ACKed. - * - * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from - * other BSSes when any interfaces are in AP mode. This helps implement - * OLBC handling in hostapd. Beacons are reported in %NL80211_CMD_FRAME - * messages. Note that per PHY only one application may register. - * - * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether - * No Acknowledgement Policy should be applied. - * - * @NL80211_CMD_MAX: highest used command number - * @__NL80211_CMD_AFTER_LAST: internal use - */ -enum nl80211_commands { -/* don't change the order or add anything between, this is ABI! */ - NL80211_CMD_UNSPEC, - - NL80211_CMD_GET_WIPHY, /* can dump */ - NL80211_CMD_SET_WIPHY, - NL80211_CMD_NEW_WIPHY, - NL80211_CMD_DEL_WIPHY, - - NL80211_CMD_GET_INTERFACE, /* can dump */ - NL80211_CMD_SET_INTERFACE, - NL80211_CMD_NEW_INTERFACE, - NL80211_CMD_DEL_INTERFACE, - - NL80211_CMD_GET_KEY, - NL80211_CMD_SET_KEY, - NL80211_CMD_NEW_KEY, - NL80211_CMD_DEL_KEY, - - NL80211_CMD_GET_BEACON, - NL80211_CMD_SET_BEACON, - NL80211_CMD_START_AP, - NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP, - NL80211_CMD_STOP_AP, - NL80211_CMD_DEL_BEACON = NL80211_CMD_STOP_AP, - - NL80211_CMD_GET_STATION, - NL80211_CMD_SET_STATION, - NL80211_CMD_NEW_STATION, - NL80211_CMD_DEL_STATION, - - NL80211_CMD_GET_MPATH, - NL80211_CMD_SET_MPATH, - NL80211_CMD_NEW_MPATH, - NL80211_CMD_DEL_MPATH, - - NL80211_CMD_SET_BSS, - - NL80211_CMD_SET_REG, - NL80211_CMD_REQ_SET_REG, - - NL80211_CMD_GET_MESH_CONFIG, - NL80211_CMD_SET_MESH_CONFIG, - - NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */, - - NL80211_CMD_GET_REG, - - NL80211_CMD_GET_SCAN, - NL80211_CMD_TRIGGER_SCAN, - NL80211_CMD_NEW_SCAN_RESULTS, - NL80211_CMD_SCAN_ABORTED, - - NL80211_CMD_REG_CHANGE, - - NL80211_CMD_AUTHENTICATE, - NL80211_CMD_ASSOCIATE, - NL80211_CMD_DEAUTHENTICATE, - NL80211_CMD_DISASSOCIATE, - - NL80211_CMD_MICHAEL_MIC_FAILURE, - - NL80211_CMD_REG_BEACON_HINT, - - NL80211_CMD_JOIN_IBSS, - NL80211_CMD_LEAVE_IBSS, - - NL80211_CMD_TESTMODE, - - NL80211_CMD_CONNECT, - NL80211_CMD_ROAM, - NL80211_CMD_DISCONNECT, - - NL80211_CMD_SET_WIPHY_NETNS, - - NL80211_CMD_GET_SURVEY, - NL80211_CMD_NEW_SURVEY_RESULTS, - - NL80211_CMD_SET_PMKSA, - NL80211_CMD_DEL_PMKSA, - NL80211_CMD_FLUSH_PMKSA, - - NL80211_CMD_REMAIN_ON_CHANNEL, - NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, - - NL80211_CMD_SET_TX_BITRATE_MASK, - - NL80211_CMD_REGISTER_FRAME, - NL80211_CMD_REGISTER_ACTION = NL80211_CMD_REGISTER_FRAME, - NL80211_CMD_FRAME, - NL80211_CMD_ACTION = NL80211_CMD_FRAME, - NL80211_CMD_FRAME_TX_STATUS, - NL80211_CMD_ACTION_TX_STATUS = NL80211_CMD_FRAME_TX_STATUS, - - NL80211_CMD_SET_POWER_SAVE, - NL80211_CMD_GET_POWER_SAVE, - - NL80211_CMD_SET_CQM, - NL80211_CMD_NOTIFY_CQM, - - NL80211_CMD_SET_CHANNEL, - NL80211_CMD_SET_WDS_PEER, - - NL80211_CMD_FRAME_WAIT_CANCEL, - - NL80211_CMD_JOIN_MESH, - NL80211_CMD_LEAVE_MESH, - - NL80211_CMD_UNPROT_DEAUTHENTICATE, - NL80211_CMD_UNPROT_DISASSOCIATE, - - NL80211_CMD_NEW_PEER_CANDIDATE, - - NL80211_CMD_GET_WOWLAN, - NL80211_CMD_SET_WOWLAN, - - NL80211_CMD_START_SCHED_SCAN, - NL80211_CMD_STOP_SCHED_SCAN, - NL80211_CMD_SCHED_SCAN_RESULTS, - NL80211_CMD_SCHED_SCAN_STOPPED, - - NL80211_CMD_SET_REKEY_OFFLOAD, - - NL80211_CMD_PMKSA_CANDIDATE, - - NL80211_CMD_TDLS_OPER, - NL80211_CMD_TDLS_MGMT, - - NL80211_CMD_UNEXPECTED_FRAME, - - NL80211_CMD_PROBE_CLIENT, - - NL80211_CMD_REGISTER_BEACONS, - - NL80211_CMD_UNEXPECTED_4ADDR_FRAME, - - NL80211_CMD_SET_NOACK_MAP, - - /* add new commands above here */ - - /* used to define NL80211_CMD_MAX below */ - __NL80211_CMD_AFTER_LAST, - NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 -}; - -/* - * Allow user space programs to use #ifdef on new commands by defining them - * here - */ -#define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS -#define NL80211_CMD_SET_MGMT_EXTRA_IE NL80211_CMD_SET_MGMT_EXTRA_IE -#define NL80211_CMD_REG_CHANGE NL80211_CMD_REG_CHANGE -#define NL80211_CMD_AUTHENTICATE NL80211_CMD_AUTHENTICATE -#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE -#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE -#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE -#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT - -#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS - -/* source-level API compatibility */ -#define NL80211_CMD_GET_MESH_PARAMS NL80211_CMD_GET_MESH_CONFIG -#define NL80211_CMD_SET_MESH_PARAMS NL80211_CMD_SET_MESH_CONFIG -#define NL80211_MESH_SETUP_VENDOR_PATH_SEL_IE NL80211_MESH_SETUP_IE - -/** - * enum nl80211_attrs - nl80211 netlink attributes - * - * @NL80211_ATTR_UNSPEC: unspecified attribute to catch errors - * - * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf. - * /sys/class/ieee80211/<phyname>/index - * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming) - * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters - * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz - * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ - * if HT20 or HT40 are allowed (i.e., 802.11n disabled if not included): - * NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including - * this attribute) - * NL80211_CHAN_HT20 = HT20 only - * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel - * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel - * @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is - * less than or equal to the RTS threshold; allowed range: 1..255; - * dot11ShortRetryLimit; u8 - * @NL80211_ATTR_WIPHY_RETRY_LONG: TX retry limit for frames whose length is - * greater than the RTS threshold; allowed range: 1..255; - * dot11ShortLongLimit; u8 - * @NL80211_ATTR_WIPHY_FRAG_THRESHOLD: fragmentation threshold, i.e., maximum - * length in octets for frames; allowed range: 256..8000, disable - * fragmentation with (u32)-1; dot11FragmentationThreshold; u32 - * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length - * larger than or equal to this use RTS/CTS handshake); allowed range: - * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32 - * @NL80211_ATTR_WIPHY_COVERAGE_CLASS: Coverage Class as defined by IEEE 802.11 - * section 7.3.2.9; dot11CoverageClass; u8 - * - * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on - * @NL80211_ATTR_IFNAME: network interface name - * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype - * - * @NL80211_ATTR_MAC: MAC address (various uses) - * - * @NL80211_ATTR_KEY_DATA: (temporal) key data; for TKIP this consists of - * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC - * keys - * @NL80211_ATTR_KEY_IDX: key ID (u8, 0-3) - * @NL80211_ATTR_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11 - * section 7.3.2.25.1, e.g. 0x000FAC04) - * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and - * CCMP keys, each six bytes in little endian - * - * @NL80211_ATTR_BEACON_INTERVAL: beacon interval in TU - * @NL80211_ATTR_DTIM_PERIOD: DTIM period for beaconing - * @NL80211_ATTR_BEACON_HEAD: portion of the beacon before the TIM IE - * @NL80211_ATTR_BEACON_TAIL: portion of the beacon after the TIM IE - * - * @NL80211_ATTR_STA_AID: Association ID for the station (u16) - * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of - * &enum nl80211_sta_flags (deprecated, use %NL80211_ATTR_STA_FLAGS2) - * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by - * IEEE 802.11 7.3.1.6 (u16). - * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported - * rates as defined by IEEE 802.11 7.3.2.2 but without the length - * restriction (at most %NL80211_MAX_SUPP_RATES). - * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station - * to, or the AP interface the station was originally added to to. - * @NL80211_ATTR_STA_INFO: information about a station, part of station info - * given for %NL80211_CMD_GET_STATION, nested attribute containing - * info as possible, see &enum nl80211_sta_info. - * - * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands, - * consisting of a nested array. - * - * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes). - * @NL80211_ATTR_STA_PLINK_ACTION: action to perform on the mesh peer link. - * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path. - * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path - * info given for %NL80211_CMD_GET_MPATH, nested attribute described at - * &enum nl80211_mpath_info. - * - * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of - * &enum nl80211_mntr_flags. - * - * @NL80211_ATTR_REG_ALPHA2: an ISO-3166-alpha2 country code for which the - * current regulatory domain should be set to or is already set to. - * For example, 'CR', for Costa Rica. This attribute is used by the kernel - * to query the CRDA to retrieve one regulatory domain. This attribute can - * also be used by userspace to query the kernel for the currently set - * regulatory domain. We chose an alpha2 as that is also used by the - * IEEE-802.11d country information element to identify a country. - * Users can also simply ask the wireless core to set regulatory domain - * to a specific alpha2. - * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory - * rules. - * - * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1) - * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled - * (u8, 0 or 1) - * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled - * (u8, 0 or 1) - * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic - * rates in format defined by IEEE 802.11 7.3.2.2 but without the length - * restriction (at most %NL80211_MAX_SUPP_RATES). - * - * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from - * association request when used with NL80211_CMD_NEW_STATION) - * - * @NL80211_ATTR_SUPPORTED_IFTYPES: nested attribute containing all - * supported interface types, each a flag attribute with the number - * of the interface mode. - * - * @NL80211_ATTR_MGMT_SUBTYPE: Management frame subtype for - * %NL80211_CMD_SET_MGMT_EXTRA_IE. - * - * @NL80211_ATTR_IE: Information element(s) data (used, e.g., with - * %NL80211_CMD_SET_MGMT_EXTRA_IE). - * - * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with - * a single scan request, a wiphy attribute. - * @NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS: number of SSIDs you can - * scan with a single scheduled scan request, a wiphy attribute. - * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements - * that can be added to a scan request - * @NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN: maximum length of information - * elements that can be added to a scheduled scan request - * @NL80211_ATTR_MAX_MATCH_SETS: maximum number of sets that can be - * used with @NL80211_ATTR_SCHED_SCAN_MATCH, a wiphy attribute. - * - * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) - * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive - * scanning and include a zero-length SSID (wildcard) for wildcard scan - * @NL80211_ATTR_BSS: scan result BSS - * - * @NL80211_ATTR_REG_INITIATOR: indicates who requested the regulatory domain - * currently in effect. This could be any of the %NL80211_REGDOM_SET_BY_* - * @NL80211_ATTR_REG_TYPE: indicates the type of the regulatory domain currently - * set. This can be one of the nl80211_reg_type (%NL80211_REGDOM_TYPE_*) - * - * @NL80211_ATTR_SUPPORTED_COMMANDS: wiphy attribute that specifies - * an array of command numbers (i.e. a mapping index to command number) - * that the driver for the given wiphy supports. - * - * @NL80211_ATTR_FRAME: frame data (binary attribute), including frame header - * and body, but not FCS; used, e.g., with NL80211_CMD_AUTHENTICATE and - * NL80211_CMD_ASSOCIATE events - * @NL80211_ATTR_SSID: SSID (binary attribute, 0..32 octets) - * @NL80211_ATTR_AUTH_TYPE: AuthenticationType, see &enum nl80211_auth_type, - * represented as a u32 - * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and - * %NL80211_CMD_DISASSOCIATE, u16 - * - * @NL80211_ATTR_KEY_TYPE: Key Type, see &enum nl80211_key_type, represented as - * a u32 - * - * @NL80211_ATTR_FREQ_BEFORE: A channel which has suffered a regulatory change - * due to considerations from a beacon hint. This attribute reflects - * the state of the channel _before_ the beacon hint processing. This - * attributes consists of a nested attribute containing - * NL80211_FREQUENCY_ATTR_* - * @NL80211_ATTR_FREQ_AFTER: A channel which has suffered a regulatory change - * due to considerations from a beacon hint. This attribute reflects - * the state of the channel _after_ the beacon hint processing. This - * attributes consists of a nested attribute containing - * NL80211_FREQUENCY_ATTR_* - * - * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported - * cipher suites - * - * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look - * for other networks on different channels - * - * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this - * is used, e.g., with %NL80211_CMD_AUTHENTICATE event - * - * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is - * used for the association (&enum nl80211_mfp, represented as a u32); - * this attribute can be used - * with %NL80211_CMD_ASSOCIATE request - * - * @NL80211_ATTR_STA_FLAGS2: Attribute containing a - * &struct nl80211_sta_flag_update. - * - * @NL80211_ATTR_CONTROL_PORT: A flag indicating whether user space controls - * IEEE 802.1X port, i.e., sets/clears %NL80211_STA_FLAG_AUTHORIZED, in - * station mode. If the flag is included in %NL80211_CMD_ASSOCIATE - * request, the driver will assume that the port is unauthorized until - * authorized by user space. Otherwise, port is marked authorized by - * default in station mode. - * @NL80211_ATTR_CONTROL_PORT_ETHERTYPE: A 16-bit value indicating the - * ethertype that will be used for key negotiation. It can be - * specified with the associate and connect commands. If it is not - * specified, the value defaults to 0x888E (PAE, 802.1X). This - * attribute is also used as a flag in the wiphy information to - * indicate that protocols other than PAE are supported. - * @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with - * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom - * ethertype frames used for key negotiation must not be encrypted. - * - * @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver. - * We recommend using nested, driver-specific attributes within this. - * - * @NL80211_ATTR_DISCONNECTED_BY_AP: A flag indicating that the DISCONNECT - * event was due to the AP disconnecting the station, and not due to - * a local disconnect request. - * @NL80211_ATTR_STATUS_CODE: StatusCode for the %NL80211_CMD_CONNECT - * event (u16) - * @NL80211_ATTR_PRIVACY: Flag attribute, used with connect(), indicating - * that protected APs should be used. This is also used with NEW_BEACON to - * indicate that the BSS is to use protection. - * - * @NL80211_ATTR_CIPHERS_PAIRWISE: Used with CONNECT, ASSOCIATE, and NEW_BEACON - * to indicate which unicast key ciphers will be used with the connection - * (an array of u32). - * @NL80211_ATTR_CIPHER_GROUP: Used with CONNECT, ASSOCIATE, and NEW_BEACON to - * indicate which group key cipher will be used with the connection (a - * u32). - * @NL80211_ATTR_WPA_VERSIONS: Used with CONNECT, ASSOCIATE, and NEW_BEACON to - * indicate which WPA version(s) the AP we want to associate with is using - * (a u32 with flags from &enum nl80211_wpa_versions). - * @NL80211_ATTR_AKM_SUITES: Used with CONNECT, ASSOCIATE, and NEW_BEACON to - * indicate which key management algorithm(s) to use (an array of u32). - * - * @NL80211_ATTR_REQ_IE: (Re)association request information elements as - * sent out by the card, for ROAM and successful CONNECT events. - * @NL80211_ATTR_RESP_IE: (Re)association response information elements as - * sent by peer, for ROAM and successful CONNECT events. - * - * @NL80211_ATTR_PREV_BSSID: previous BSSID, to be used by in ASSOCIATE - * commands to specify using a reassociate frame - * - * @NL80211_ATTR_KEY: key information in a nested attribute with - * %NL80211_KEY_* sub-attributes - * @NL80211_ATTR_KEYS: array of keys for static WEP keys for connect() - * and join_ibss(), key information is in a nested attribute each - * with %NL80211_KEY_* sub-attributes - * - * @NL80211_ATTR_PID: Process ID of a network namespace. - * - * @NL80211_ATTR_GENERATION: Used to indicate consistent snapshots for - * dumps. This number increases whenever the object list being - * dumped changes, and as such userspace can verify that it has - * obtained a complete and consistent snapshot by verifying that - * all dump messages contain the same generation number. If it - * changed then the list changed and the dump should be repeated - * completely from scratch. - * - * @NL80211_ATTR_4ADDR: Use 4-address frames on a virtual interface - * - * @NL80211_ATTR_SURVEY_INFO: survey information about a channel, part of - * the survey response for %NL80211_CMD_GET_SURVEY, nested attribute - * containing info as possible, see &enum survey_info. - * - * @NL80211_ATTR_PMKID: PMK material for PMKSA caching. - * @NL80211_ATTR_MAX_NUM_PMKIDS: maximum number of PMKIDs a firmware can - * cache, a wiphy attribute. - * - * @NL80211_ATTR_DURATION: Duration of an operation in milliseconds, u32. - * @NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION: Device attribute that - * specifies the maximum duration that can be requested with the - * remain-on-channel operation, in milliseconds, u32. - * - * @NL80211_ATTR_COOKIE: Generic 64-bit cookie to identify objects. - * - * @NL80211_ATTR_TX_RATES: Nested set of attributes - * (enum nl80211_tx_rate_attributes) describing TX rates per band. The - * enum nl80211_band value is used as the index (nla_type() of the nested - * data. If a band is not included, it will be configured to allow all - * rates based on negotiated supported rates information. This attribute - * is used with %NL80211_CMD_SET_TX_BITRATE_MASK. - * - * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain - * at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME. - * @NL80211_ATTR_FRAME_TYPE: A u16 indicating the frame type/subtype for the - * @NL80211_CMD_REGISTER_FRAME command. - * @NL80211_ATTR_TX_FRAME_TYPES: wiphy capability attribute, which is a - * nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing - * information about which frame types can be transmitted with - * %NL80211_CMD_FRAME. - * @NL80211_ATTR_RX_FRAME_TYPES: wiphy capability attribute, which is a - * nested attribute of %NL80211_ATTR_FRAME_TYPE attributes, containing - * information about which frame types can be registered for RX. - * - * @NL80211_ATTR_ACK: Flag attribute indicating that the frame was - * acknowledged by the recipient. - * - * @NL80211_ATTR_CQM: connection quality monitor configuration in a - * nested attribute with %NL80211_ATTR_CQM_* sub-attributes. - * - * @NL80211_ATTR_LOCAL_STATE_CHANGE: Flag attribute to indicate that a command - * is requesting a local authentication/association state change without - * invoking actual management frame exchange. This can be used with - * NL80211_CMD_AUTHENTICATE, NL80211_CMD_DEAUTHENTICATE, - * NL80211_CMD_DISASSOCIATE. - * - * @NL80211_ATTR_AP_ISOLATE: (AP mode) Do not forward traffic between stations - * connected to this BSS. - * - * @NL80211_ATTR_WIPHY_TX_POWER_SETTING: Transmit power setting type. See - * &enum nl80211_tx_power_setting for possible values. - * @NL80211_ATTR_WIPHY_TX_POWER_LEVEL: Transmit power level in signed mBm units. - * This is used in association with @NL80211_ATTR_WIPHY_TX_POWER_SETTING - * for non-automatic settings. - * - * @NL80211_ATTR_SUPPORT_IBSS_RSN: The device supports IBSS RSN, which mostly - * means support for per-station GTKs. - * - * @NL80211_ATTR_WIPHY_ANTENNA_TX: Bitmap of allowed antennas for transmitting. - * This can be used to mask out antennas which are not attached or should - * not be used for transmitting. If an antenna is not selected in this - * bitmap the hardware is not allowed to transmit on this antenna. - * - * Each bit represents one antenna, starting with antenna 1 at the first - * bit. Depending on which antennas are selected in the bitmap, 802.11n - * drivers can derive which chainmasks to use (if all antennas belonging to - * a particular chain are disabled this chain should be disabled) and if - * a chain has diversity antennas wether diversity should be used or not. - * HT capabilities (STBC, TX Beamforming, Antenna selection) can be - * derived from the available chains after applying the antenna mask. - * Non-802.11n drivers can derive wether to use diversity or not. - * Drivers may reject configurations or RX/TX mask combinations they cannot - * support by returning -EINVAL. - * - * @NL80211_ATTR_WIPHY_ANTENNA_RX: Bitmap of allowed antennas for receiving. - * This can be used to mask out antennas which are not attached or should - * not be used for receiving. If an antenna is not selected in this bitmap - * the hardware should not be configured to receive on this antenna. - * For a more detailed description see @NL80211_ATTR_WIPHY_ANTENNA_TX. - * - * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX: Bitmap of antennas which are available - * for configuration as TX antennas via the above parameters. - * - * @NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX: Bitmap of antennas which are available - * for configuration as RX antennas via the above parameters. - * - * @NL80211_ATTR_MCAST_RATE: Multicast tx rate (in 100 kbps) for IBSS - * - * @NL80211_ATTR_OFFCHANNEL_TX_OK: For management frame TX, the frame may be - * transmitted on another channel when the channel given doesn't match - * the current channel. If the current channel doesn't match and this - * flag isn't set, the frame will be rejected. This is also used as an - * nl80211 capability flag. - * - * @NL80211_ATTR_BSS_HTOPMODE: HT operation mode (u16) - * - * @NL80211_ATTR_KEY_DEFAULT_TYPES: A nested attribute containing flags - * attributes, specifying what a key should be set as default as. - * See &enum nl80211_key_default_types. - * - * @NL80211_ATTR_MESH_SETUP: Optional mesh setup parameters. These cannot be - * changed once the mesh is active. - * @NL80211_ATTR_MESH_CONFIG: Mesh configuration parameters, a nested attribute - * containing attributes from &enum nl80211_meshconf_params. - * @NL80211_ATTR_SUPPORT_MESH_AUTH: Currently, this means the underlying driver - * allows auth frames in a mesh to be passed to userspace for processing via - * the @NL80211_MESH_SETUP_USERSPACE_AUTH flag. - * @NL80211_ATTR_STA_PLINK_STATE: The state of a mesh peer link as - * defined in &enum nl80211_plink_state. Used when userspace is - * driving the peer link management state machine. - * @NL80211_MESH_SETUP_USERSPACE_AMPE must be enabled. - * - * @NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED: indicates, as part of the wiphy - * capabilities, the supported WoWLAN triggers - * @NL80211_ATTR_WOWLAN_TRIGGERS: used by %NL80211_CMD_SET_WOWLAN to - * indicate which WoW triggers should be enabled. This is also - * used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN - * triggers. - - * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan - * cycles, in msecs. - - * @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more - * sets of attributes to match during scheduled scans. Only BSSs - * that match any of the sets will be reported. These are - * pass-thru filter rules. - * For a match to succeed, the BSS must match all attributes of a - * set. Since not every hardware supports matching all types of - * attributes, there is no guarantee that the reported BSSs are - * fully complying with the match sets and userspace needs to be - * able to ignore them by itself. - * Thus, the implementation is somewhat hardware-dependent, but - * this is only an optimization and the userspace application - * needs to handle all the non-filtered results anyway. - * If the match attributes don't make sense when combined with - * the values passed in @NL80211_ATTR_SCAN_SSIDS (eg. if an SSID - * is included in the probe request, but the match attributes - * will never let it go through), -EINVAL may be returned. - * If ommited, no filtering is done. - * - * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported - * interface combinations. In each nested item, it contains attributes - * defined in &enum nl80211_if_combination_attrs. - * @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like - * %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that - * are managed in software: interfaces of these types aren't subject to - * any restrictions in their number or combinations. - * - * @%NL80211_ATTR_REKEY_DATA: nested attribute containing the information - * necessary for GTK rekeying in the device, see &enum nl80211_rekey_data. - * - * @NL80211_ATTR_SCAN_SUPP_RATES: rates per to be advertised as supported in scan, - * nested array attribute containing an entry for each band, with the entry - * being a list of supported rates as defined by IEEE 802.11 7.3.2.2 but - * without the length restriction (at most %NL80211_MAX_SUPP_RATES). - * - * @NL80211_ATTR_HIDDEN_SSID: indicates whether SSID is to be hidden from Beacon - * and Probe Response (when response to wildcard Probe Request); see - * &enum nl80211_hidden_ssid, represented as a u32 - * - * @NL80211_ATTR_IE_PROBE_RESP: Information element(s) for Probe Response frame. - * This is used with %NL80211_CMD_NEW_BEACON and %NL80211_CMD_SET_BEACON to - * provide extra IEs (e.g., WPS/P2P IE) into Probe Response frames when the - * driver (or firmware) replies to Probe Request frames. - * @NL80211_ATTR_IE_ASSOC_RESP: Information element(s) for (Re)Association - * Response frames. This is used with %NL80211_CMD_NEW_BEACON and - * %NL80211_CMD_SET_BEACON to provide extra IEs (e.g., WPS/P2P IE) into - * (Re)Association Response frames when the driver (or firmware) replies to - * (Re)Association Request frames. - * - * @NL80211_ATTR_STA_WME: Nested attribute containing the wme configuration - * of the station, see &enum nl80211_sta_wme_attr. - * @NL80211_ATTR_SUPPORT_AP_UAPSD: the device supports uapsd when working - * as AP. - * - * @NL80211_ATTR_ROAM_SUPPORT: Indicates whether the firmware is capable of - * roaming to another AP in the same ESS if the signal lever is low. - * - * @NL80211_ATTR_PMKSA_CANDIDATE: Nested attribute containing the PMKSA caching - * candidate information, see &enum nl80211_pmksa_candidate_attr. - * - * @NL80211_ATTR_TX_NO_CCK_RATE: Indicates whether to use CCK rate or not - * for management frames transmission. In order to avoid p2p probe/action - * frames are being transmitted at CCK rate in 2GHz band, the user space - * applications use this attribute. - * This attribute is used with %NL80211_CMD_TRIGGER_SCAN and - * %NL80211_CMD_FRAME commands. - * - * @NL80211_ATTR_TDLS_ACTION: Low level TDLS action code (e.g. link setup - * request, link setup confirm, link teardown, etc.). Values are - * described in the TDLS (802.11z) specification. - * @NL80211_ATTR_TDLS_DIALOG_TOKEN: Non-zero token for uniquely identifying a - * TDLS conversation between two devices. - * @NL80211_ATTR_TDLS_OPERATION: High level TDLS operation; see - * &enum nl80211_tdls_operation, represented as a u8. - * @NL80211_ATTR_TDLS_SUPPORT: A flag indicating the device can operate - * as a TDLS peer sta. - * @NL80211_ATTR_TDLS_EXTERNAL_SETUP: The TDLS discovery/setup and teardown - * procedures should be performed by sending TDLS packets via - * %NL80211_CMD_TDLS_MGMT. Otherwise %NL80211_CMD_TDLS_OPER should be - * used for asking the driver to perform a TDLS operation. - * - * @NL80211_ATTR_DEVICE_AP_SME: This u32 attribute may be listed for devices - * that have AP support to indicate that they have the AP SME integrated - * with support for the features listed in this attribute, see - * &enum nl80211_ap_sme_features. - * - * @NL80211_ATTR_DONT_WAIT_FOR_ACK: Used with %NL80211_CMD_FRAME, this tells - * the driver to not wait for an acknowledgement. Note that due to this, - * it will also not give a status callback nor return a cookie. This is - * mostly useful for probe responses to save airtime. - * - * @NL80211_ATTR_FEATURE_FLAGS: This u32 attribute contains flags from - * &enum nl80211_feature_flags and is advertised in wiphy information. - * @NL80211_ATTR_PROBE_RESP_OFFLOAD: Indicates that the HW responds to probe - * - * requests while operating in AP-mode. - * This attribute holds a bitmap of the supported protocols for - * offloading (see &enum nl80211_probe_resp_offload_support_attr). - * - * @NL80211_ATTR_PROBE_RESP: Probe Response template data. Contains the entire - * probe-response frame. The DA field in the 802.11 header is zero-ed out, - * to be filled by the FW. - * @NL80211_ATTR_DISABLE_HT: Force HT capable interfaces to disable - * this feature. Currently, only supported in mac80211 drivers. - * @NL80211_ATTR_HT_CAPABILITY_MASK: Specify which bits of the - * ATTR_HT_CAPABILITY to which attention should be paid. - * Currently, only mac80211 NICs support this feature. - * The values that may be configured are: - * MCS rates, MAX-AMSDU, HT-20-40 and HT_CAP_SGI_40 - * AMPDU density and AMPDU factor. - * All values are treated as suggestions and may be ignored - * by the driver as required. The actual values may be seen in - * the station debugfs ht_caps file. - * - * @NL80211_ATTR_DFS_REGION: region for regulatory rules which this country - * abides to when initiating radiation on DFS channels. A country maps - * to one DFS region. - * - * @NL80211_ATTR_NOACK_MAP: This u16 bitmap contains the No Ack Policy of - * up to 16 TIDs. - * - * @NL80211_ATTR_INACTIVITY_TIMEOUT: timeout value in seconds, this can be - * used by the drivers which has MLME in firmware and does not have support - * to report per station tx/rx activity to free up the staion entry from - * the list. This needs to be used when the driver advertises the - * capability to timeout the stations. - * - * @NL80211_ATTR_RX_SIGNAL_DBM: signal strength in dBm (as a 32-bit int); - * this attribute is (depending on the driver capabilities) added to - * received frames indicated with %NL80211_CMD_FRAME. - * - * @NL80211_ATTR_BG_SCAN_PERIOD: Background scan period in seconds - * or 0 to disable background scan. - * - * @NL80211_ATTR_MAX: highest attribute number currently defined - * @__NL80211_ATTR_AFTER_LAST: internal use - */ -enum nl80211_attrs { -/* don't change the order or add anything between, this is ABI! */ - NL80211_ATTR_UNSPEC, - - NL80211_ATTR_WIPHY, - NL80211_ATTR_WIPHY_NAME, - - NL80211_ATTR_IFINDEX, - NL80211_ATTR_IFNAME, - NL80211_ATTR_IFTYPE, - - NL80211_ATTR_MAC, - - NL80211_ATTR_KEY_DATA, - NL80211_ATTR_KEY_IDX, - NL80211_ATTR_KEY_CIPHER, - NL80211_ATTR_KEY_SEQ, - NL80211_ATTR_KEY_DEFAULT, - - NL80211_ATTR_BEACON_INTERVAL, - NL80211_ATTR_DTIM_PERIOD, - NL80211_ATTR_BEACON_HEAD, - NL80211_ATTR_BEACON_TAIL, - - NL80211_ATTR_STA_AID, - NL80211_ATTR_STA_FLAGS, - NL80211_ATTR_STA_LISTEN_INTERVAL, - NL80211_ATTR_STA_SUPPORTED_RATES, - NL80211_ATTR_STA_VLAN, - NL80211_ATTR_STA_INFO, - - NL80211_ATTR_WIPHY_BANDS, - - NL80211_ATTR_MNTR_FLAGS, - - NL80211_ATTR_MESH_ID, - NL80211_ATTR_STA_PLINK_ACTION, - NL80211_ATTR_MPATH_NEXT_HOP, - NL80211_ATTR_MPATH_INFO, - - NL80211_ATTR_BSS_CTS_PROT, - NL80211_ATTR_BSS_SHORT_PREAMBLE, - NL80211_ATTR_BSS_SHORT_SLOT_TIME, - - NL80211_ATTR_HT_CAPABILITY, - - NL80211_ATTR_SUPPORTED_IFTYPES, - - NL80211_ATTR_REG_ALPHA2, - NL80211_ATTR_REG_RULES, - - NL80211_ATTR_MESH_CONFIG, - - NL80211_ATTR_BSS_BASIC_RATES, - - NL80211_ATTR_WIPHY_TXQ_PARAMS, - NL80211_ATTR_WIPHY_FREQ, - NL80211_ATTR_WIPHY_CHANNEL_TYPE, - - NL80211_ATTR_KEY_DEFAULT_MGMT, - - NL80211_ATTR_MGMT_SUBTYPE, - NL80211_ATTR_IE, - - NL80211_ATTR_MAX_NUM_SCAN_SSIDS, - - NL80211_ATTR_SCAN_FREQUENCIES, - NL80211_ATTR_SCAN_SSIDS, - NL80211_ATTR_GENERATION, /* replaces old SCAN_GENERATION */ - NL80211_ATTR_BSS, - - NL80211_ATTR_REG_INITIATOR, - NL80211_ATTR_REG_TYPE, - - NL80211_ATTR_SUPPORTED_COMMANDS, - - NL80211_ATTR_FRAME, - NL80211_ATTR_SSID, - NL80211_ATTR_AUTH_TYPE, - NL80211_ATTR_REASON_CODE, - - NL80211_ATTR_KEY_TYPE, - - NL80211_ATTR_MAX_SCAN_IE_LEN, - NL80211_ATTR_CIPHER_SUITES, - - NL80211_ATTR_FREQ_BEFORE, - NL80211_ATTR_FREQ_AFTER, - - NL80211_ATTR_FREQ_FIXED, - - - NL80211_ATTR_WIPHY_RETRY_SHORT, - NL80211_ATTR_WIPHY_RETRY_LONG, - NL80211_ATTR_WIPHY_FRAG_THRESHOLD, - NL80211_ATTR_WIPHY_RTS_THRESHOLD, - - NL80211_ATTR_TIMED_OUT, - - NL80211_ATTR_USE_MFP, - - NL80211_ATTR_STA_FLAGS2, - - NL80211_ATTR_CONTROL_PORT, - - NL80211_ATTR_TESTDATA, - - NL80211_ATTR_PRIVACY, - - NL80211_ATTR_DISCONNECTED_BY_AP, - NL80211_ATTR_STATUS_CODE, - - NL80211_ATTR_CIPHER_SUITES_PAIRWISE, - NL80211_ATTR_CIPHER_SUITE_GROUP, - NL80211_ATTR_WPA_VERSIONS, - NL80211_ATTR_AKM_SUITES, - - NL80211_ATTR_REQ_IE, - NL80211_ATTR_RESP_IE, - - NL80211_ATTR_PREV_BSSID, - - NL80211_ATTR_KEY, - NL80211_ATTR_KEYS, - - NL80211_ATTR_PID, - - NL80211_ATTR_4ADDR, - - NL80211_ATTR_SURVEY_INFO, - - NL80211_ATTR_PMKID, - NL80211_ATTR_MAX_NUM_PMKIDS, - - NL80211_ATTR_DURATION, - - NL80211_ATTR_COOKIE, - - NL80211_ATTR_WIPHY_COVERAGE_CLASS, - - NL80211_ATTR_TX_RATES, - - NL80211_ATTR_FRAME_MATCH, - - NL80211_ATTR_ACK, - - NL80211_ATTR_PS_STATE, - - NL80211_ATTR_CQM, - - NL80211_ATTR_LOCAL_STATE_CHANGE, - - NL80211_ATTR_AP_ISOLATE, - - NL80211_ATTR_WIPHY_TX_POWER_SETTING, - NL80211_ATTR_WIPHY_TX_POWER_LEVEL, - - NL80211_ATTR_TX_FRAME_TYPES, - NL80211_ATTR_RX_FRAME_TYPES, - NL80211_ATTR_FRAME_TYPE, - - NL80211_ATTR_CONTROL_PORT_ETHERTYPE, - NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, - - NL80211_ATTR_SUPPORT_IBSS_RSN, - - NL80211_ATTR_WIPHY_ANTENNA_TX, - NL80211_ATTR_WIPHY_ANTENNA_RX, - - NL80211_ATTR_MCAST_RATE, - - NL80211_ATTR_OFFCHANNEL_TX_OK, - - NL80211_ATTR_BSS_HT_OPMODE, - - NL80211_ATTR_KEY_DEFAULT_TYPES, - - NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, - - NL80211_ATTR_MESH_SETUP, - - NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, - NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, - - NL80211_ATTR_SUPPORT_MESH_AUTH, - NL80211_ATTR_STA_PLINK_STATE, - - NL80211_ATTR_WOWLAN_TRIGGERS, - NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, - - NL80211_ATTR_SCHED_SCAN_INTERVAL, - - NL80211_ATTR_INTERFACE_COMBINATIONS, - NL80211_ATTR_SOFTWARE_IFTYPES, - - NL80211_ATTR_REKEY_DATA, - - NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, - NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, - - NL80211_ATTR_SCAN_SUPP_RATES, - - NL80211_ATTR_HIDDEN_SSID, - - NL80211_ATTR_IE_PROBE_RESP, - NL80211_ATTR_IE_ASSOC_RESP, - - NL80211_ATTR_STA_WME, - NL80211_ATTR_SUPPORT_AP_UAPSD, - - NL80211_ATTR_ROAM_SUPPORT, - - NL80211_ATTR_SCHED_SCAN_MATCH, - NL80211_ATTR_MAX_MATCH_SETS, - - NL80211_ATTR_PMKSA_CANDIDATE, - - NL80211_ATTR_TX_NO_CCK_RATE, - - NL80211_ATTR_TDLS_ACTION, - NL80211_ATTR_TDLS_DIALOG_TOKEN, - NL80211_ATTR_TDLS_OPERATION, - NL80211_ATTR_TDLS_SUPPORT, - NL80211_ATTR_TDLS_EXTERNAL_SETUP, - - NL80211_ATTR_DEVICE_AP_SME, - - NL80211_ATTR_DONT_WAIT_FOR_ACK, - - NL80211_ATTR_FEATURE_FLAGS, - - NL80211_ATTR_PROBE_RESP_OFFLOAD, - - NL80211_ATTR_PROBE_RESP, - - NL80211_ATTR_DFS_REGION, - - NL80211_ATTR_DISABLE_HT, - NL80211_ATTR_HT_CAPABILITY_MASK, - - NL80211_ATTR_NOACK_MAP, - - NL80211_ATTR_INACTIVITY_TIMEOUT, - - NL80211_ATTR_RX_SIGNAL_DBM, - - NL80211_ATTR_BG_SCAN_PERIOD, - - /* add attributes here, update the policy in nl80211.c */ - - __NL80211_ATTR_AFTER_LAST, - NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 -}; - -/* source-level API compatibility */ -#define NL80211_ATTR_SCAN_GENERATION NL80211_ATTR_GENERATION -#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG - -/* - * Allow user space programs to use #ifdef on new attributes by defining them - * here - */ -#define NL80211_CMD_CONNECT NL80211_CMD_CONNECT -#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY -#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES -#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS -#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ -#define NL80211_ATTR_WIPHY_CHANNEL_TYPE NL80211_ATTR_WIPHY_CHANNEL_TYPE -#define NL80211_ATTR_MGMT_SUBTYPE NL80211_ATTR_MGMT_SUBTYPE -#define NL80211_ATTR_IE NL80211_ATTR_IE -#define NL80211_ATTR_REG_INITIATOR NL80211_ATTR_REG_INITIATOR -#define NL80211_ATTR_REG_TYPE NL80211_ATTR_REG_TYPE -#define NL80211_ATTR_FRAME NL80211_ATTR_FRAME -#define NL80211_ATTR_SSID NL80211_ATTR_SSID -#define NL80211_ATTR_AUTH_TYPE NL80211_ATTR_AUTH_TYPE -#define NL80211_ATTR_REASON_CODE NL80211_ATTR_REASON_CODE -#define NL80211_ATTR_CIPHER_SUITES_PAIRWISE NL80211_ATTR_CIPHER_SUITES_PAIRWISE -#define NL80211_ATTR_CIPHER_SUITE_GROUP NL80211_ATTR_CIPHER_SUITE_GROUP -#define NL80211_ATTR_WPA_VERSIONS NL80211_ATTR_WPA_VERSIONS -#define NL80211_ATTR_AKM_SUITES NL80211_ATTR_AKM_SUITES -#define NL80211_ATTR_KEY NL80211_ATTR_KEY -#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS -#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS - -#define NL80211_MAX_SUPP_RATES 32 -#define NL80211_MAX_SUPP_HT_RATES 77 -#define NL80211_MAX_SUPP_REG_RULES 32 -#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 -#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 -#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 -#define NL80211_HT_CAPABILITY_LEN 26 - -#define NL80211_MAX_NR_CIPHER_SUITES 5 -#define NL80211_MAX_NR_AKM_SUITES 2 - -/** - * enum nl80211_iftype - (virtual) interface types - * - * @NL80211_IFTYPE_UNSPECIFIED: unspecified type, driver decides - * @NL80211_IFTYPE_ADHOC: independent BSS member - * @NL80211_IFTYPE_STATION: managed BSS member - * @NL80211_IFTYPE_AP: access point - * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces - * are a bit special in that they must always be tied to a pre-existing - * AP type interface. - * @NL80211_IFTYPE_WDS: wireless distribution interface - * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames - * @NL80211_IFTYPE_MESH_POINT: mesh point - * @NL80211_IFTYPE_P2P_CLIENT: P2P client - * @NL80211_IFTYPE_P2P_GO: P2P group owner - * @NL80211_IFTYPE_MAX: highest interface type number currently defined - * @NUM_NL80211_IFTYPES: number of defined interface types - * - * These values are used with the %NL80211_ATTR_IFTYPE - * to set the type of an interface. - * - */ -enum nl80211_iftype { - NL80211_IFTYPE_UNSPECIFIED, - NL80211_IFTYPE_ADHOC, - NL80211_IFTYPE_STATION, - NL80211_IFTYPE_AP, - NL80211_IFTYPE_AP_VLAN, - NL80211_IFTYPE_WDS, - NL80211_IFTYPE_MONITOR, - NL80211_IFTYPE_MESH_POINT, - NL80211_IFTYPE_P2P_CLIENT, - NL80211_IFTYPE_P2P_GO, - - /* keep last */ - NUM_NL80211_IFTYPES, - NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1 -}; - -/** - * enum nl80211_sta_flags - station flags - * - * Station flags. When a station is added to an AP interface, it is - * assumed to be already associated (and hence authenticated.) - * - * @__NL80211_STA_FLAG_INVALID: attribute number 0 is reserved - * @NL80211_STA_FLAG_AUTHORIZED: station is authorized (802.1X) - * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames - * with short barker preamble - * @NL80211_STA_FLAG_WME: station is WME/QoS capable - * @NL80211_STA_FLAG_MFP: station uses management frame protection - * @NL80211_STA_FLAG_AUTHENTICATED: station is authenticated - * @NL80211_STA_FLAG_TDLS_PEER: station is a TDLS peer -- this flag should - * only be used in managed mode (even in the flags mask). Note that the - * flag can't be changed, it is only valid while adding a station, and - * attempts to change it will silently be ignored (rather than rejected - * as errors.) - * @NL80211_STA_FLAG_MAX: highest station flag number currently defined - * @__NL80211_STA_FLAG_AFTER_LAST: internal use - */ -enum nl80211_sta_flags { - __NL80211_STA_FLAG_INVALID, - NL80211_STA_FLAG_AUTHORIZED, - NL80211_STA_FLAG_SHORT_PREAMBLE, - NL80211_STA_FLAG_WME, - NL80211_STA_FLAG_MFP, - NL80211_STA_FLAG_AUTHENTICATED, - NL80211_STA_FLAG_TDLS_PEER, - - /* keep last */ - __NL80211_STA_FLAG_AFTER_LAST, - NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 -}; - -/** - * struct nl80211_sta_flag_update - station flags mask/set - * @mask: mask of station flags to set - * @set: which values to set them to - * - * Both mask and set contain bits as per &enum nl80211_sta_flags. - */ -struct nl80211_sta_flag_update { - __u32 mask; - __u32 set; -} __attribute__((packed)); - -/** - * enum nl80211_rate_info - bitrate information - * - * These attribute types are used with %NL80211_STA_INFO_TXRATE - * when getting information about the bitrate of a station. - * - * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved - * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s) - * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8) - * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 Mhz dualchannel bitrate - * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval - * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined - * @__NL80211_RATE_INFO_AFTER_LAST: internal use - */ -enum nl80211_rate_info { - __NL80211_RATE_INFO_INVALID, - NL80211_RATE_INFO_BITRATE, - NL80211_RATE_INFO_MCS, - NL80211_RATE_INFO_40_MHZ_WIDTH, - NL80211_RATE_INFO_SHORT_GI, - - /* keep last */ - __NL80211_RATE_INFO_AFTER_LAST, - NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1 -}; - -/** - * enum nl80211_sta_bss_param - BSS information collected by STA - * - * These attribute types are used with %NL80211_STA_INFO_BSS_PARAM - * when getting information about the bitrate of a station. - * - * @__NL80211_STA_BSS_PARAM_INVALID: attribute number 0 is reserved - * @NL80211_STA_BSS_PARAM_CTS_PROT: whether CTS protection is enabled (flag) - * @NL80211_STA_BSS_PARAM_SHORT_PREAMBLE: whether short preamble is enabled - * (flag) - * @NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME: whether short slot time is enabled - * (flag) - * @NL80211_STA_BSS_PARAM_DTIM_PERIOD: DTIM period for beaconing (u8) - * @NL80211_STA_BSS_PARAM_BEACON_INTERVAL: Beacon interval (u16) - * @NL80211_STA_BSS_PARAM_MAX: highest sta_bss_param number currently defined - * @__NL80211_STA_BSS_PARAM_AFTER_LAST: internal use - */ -enum nl80211_sta_bss_param { - __NL80211_STA_BSS_PARAM_INVALID, - NL80211_STA_BSS_PARAM_CTS_PROT, - NL80211_STA_BSS_PARAM_SHORT_PREAMBLE, - NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME, - NL80211_STA_BSS_PARAM_DTIM_PERIOD, - NL80211_STA_BSS_PARAM_BEACON_INTERVAL, - - /* keep last */ - __NL80211_STA_BSS_PARAM_AFTER_LAST, - NL80211_STA_BSS_PARAM_MAX = __NL80211_STA_BSS_PARAM_AFTER_LAST - 1 -}; - -/** - * enum nl80211_sta_info - station information - * - * These attribute types are used with %NL80211_ATTR_STA_INFO - * when getting information about a station. - * - * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved - * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) - * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station) - * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) - * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) - * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute - * containing info as possible, see &enum nl80211_rate_info - * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station) - * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this - * station) - * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station) - * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station) - * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm) - * @NL80211_STA_INFO_LLID: the station's mesh LLID - * @NL80211_STA_INFO_PLID: the station's mesh PLID - * @NL80211_STA_INFO_PLINK_STATE: peer link state for the station - * (see %enum nl80211_plink_state) - * @NL80211_STA_INFO_RX_BITRATE: last unicast data frame rx rate, nested - * attribute, like NL80211_STA_INFO_TX_BITRATE. - * @NL80211_STA_INFO_BSS_PARAM: current station's view of BSS, nested attribute - * containing info as possible, see &enum nl80211_sta_bss_param - * @NL80211_STA_INFO_CONNECTED_TIME: time since the station is last connected - * @NL80211_STA_INFO_STA_FLAGS: Contains a struct nl80211_sta_flag_update. - * @NL80211_STA_INFO_BEACON_LOSS: count of times beacon loss was detected (u32) - * @__NL80211_STA_INFO_AFTER_LAST: internal - * @NL80211_STA_INFO_MAX: highest possible station info attribute - */ -enum nl80211_sta_info { - __NL80211_STA_INFO_INVALID, - NL80211_STA_INFO_INACTIVE_TIME, - NL80211_STA_INFO_RX_BYTES, - NL80211_STA_INFO_TX_BYTES, - NL80211_STA_INFO_LLID, - NL80211_STA_INFO_PLID, - NL80211_STA_INFO_PLINK_STATE, - NL80211_STA_INFO_SIGNAL, - NL80211_STA_INFO_TX_BITRATE, - NL80211_STA_INFO_RX_PACKETS, - NL80211_STA_INFO_TX_PACKETS, - NL80211_STA_INFO_TX_RETRIES, - NL80211_STA_INFO_TX_FAILED, - NL80211_STA_INFO_SIGNAL_AVG, - NL80211_STA_INFO_RX_BITRATE, - NL80211_STA_INFO_BSS_PARAM, - NL80211_STA_INFO_CONNECTED_TIME, - NL80211_STA_INFO_STA_FLAGS, - NL80211_STA_INFO_BEACON_LOSS, - - /* keep last */ - __NL80211_STA_INFO_AFTER_LAST, - NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1 -}; - -/** - * enum nl80211_mpath_flags - nl80211 mesh path flags - * - * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active - * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running - * @NL80211_MPATH_FLAG_SN_VALID: the mesh path contains a valid SN - * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set - * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded - */ -enum nl80211_mpath_flags { - NL80211_MPATH_FLAG_ACTIVE = 1<<0, - NL80211_MPATH_FLAG_RESOLVING = 1<<1, - NL80211_MPATH_FLAG_SN_VALID = 1<<2, - NL80211_MPATH_FLAG_FIXED = 1<<3, - NL80211_MPATH_FLAG_RESOLVED = 1<<4, -}; - -/** - * enum nl80211_mpath_info - mesh path information - * - * These attribute types are used with %NL80211_ATTR_MPATH_INFO when getting - * information about a mesh path. - * - * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved - * @NL80211_MPATH_INFO_FRAME_QLEN: number of queued frames for this destination - * @NL80211_MPATH_INFO_SN: destination sequence number - * @NL80211_MPATH_INFO_METRIC: metric (cost) of this mesh path - * @NL80211_MPATH_INFO_EXPTIME: expiration time for the path, in msec from now - * @NL80211_MPATH_INFO_FLAGS: mesh path flags, enumerated in - * &enum nl80211_mpath_flags; - * @NL80211_MPATH_INFO_DISCOVERY_TIMEOUT: total path discovery timeout, in msec - * @NL80211_MPATH_INFO_DISCOVERY_RETRIES: mesh path discovery retries - * @NL80211_MPATH_INFO_MAX: highest mesh path information attribute number - * currently defind - * @__NL80211_MPATH_INFO_AFTER_LAST: internal use - */ -enum nl80211_mpath_info { - __NL80211_MPATH_INFO_INVALID, - NL80211_MPATH_INFO_FRAME_QLEN, - NL80211_MPATH_INFO_SN, - NL80211_MPATH_INFO_METRIC, - NL80211_MPATH_INFO_EXPTIME, - NL80211_MPATH_INFO_FLAGS, - NL80211_MPATH_INFO_DISCOVERY_TIMEOUT, - NL80211_MPATH_INFO_DISCOVERY_RETRIES, - - /* keep last */ - __NL80211_MPATH_INFO_AFTER_LAST, - NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1 -}; - -/** - * enum nl80211_band_attr - band attributes - * @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved - * @NL80211_BAND_ATTR_FREQS: supported frequencies in this band, - * an array of nested frequency attributes - * @NL80211_BAND_ATTR_RATES: supported bitrates in this band, - * an array of nested bitrate attributes - * @NL80211_BAND_ATTR_HT_MCS_SET: 16-byte attribute containing the MCS set as - * defined in 802.11n - * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE - * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n - * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n - * @NL80211_BAND_ATTR_MAX: highest band attribute currently defined - * @__NL80211_BAND_ATTR_AFTER_LAST: internal use - */ -enum nl80211_band_attr { - __NL80211_BAND_ATTR_INVALID, - NL80211_BAND_ATTR_FREQS, - NL80211_BAND_ATTR_RATES, - - NL80211_BAND_ATTR_HT_MCS_SET, - NL80211_BAND_ATTR_HT_CAPA, - NL80211_BAND_ATTR_HT_AMPDU_FACTOR, - NL80211_BAND_ATTR_HT_AMPDU_DENSITY, - - /* keep last */ - __NL80211_BAND_ATTR_AFTER_LAST, - NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1 -}; - -#define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA - -/** - * enum nl80211_frequency_attr - frequency attributes - * @__NL80211_FREQUENCY_ATTR_INVALID: attribute number 0 is reserved - * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz - * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current - * regulatory domain. - * @NL80211_FREQUENCY_ATTR_PASSIVE_SCAN: Only passive scanning is - * permitted on this channel in current regulatory domain. - * @NL80211_FREQUENCY_ATTR_NO_IBSS: IBSS networks are not permitted - * on this channel in current regulatory domain. - * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory - * on this channel in current regulatory domain. - * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm - * (100 * dBm). - * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number - * currently defined - * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use - */ -enum nl80211_frequency_attr { - __NL80211_FREQUENCY_ATTR_INVALID, - NL80211_FREQUENCY_ATTR_FREQ, - NL80211_FREQUENCY_ATTR_DISABLED, - NL80211_FREQUENCY_ATTR_PASSIVE_SCAN, - NL80211_FREQUENCY_ATTR_NO_IBSS, - NL80211_FREQUENCY_ATTR_RADAR, - NL80211_FREQUENCY_ATTR_MAX_TX_POWER, - - /* keep last */ - __NL80211_FREQUENCY_ATTR_AFTER_LAST, - NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1 -}; - -#define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER - -/** - * enum nl80211_bitrate_attr - bitrate attributes - * @__NL80211_BITRATE_ATTR_INVALID: attribute number 0 is reserved - * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps - * @NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE: Short preamble supported - * in 2.4 GHz band. - * @NL80211_BITRATE_ATTR_MAX: highest bitrate attribute number - * currently defined - * @__NL80211_BITRATE_ATTR_AFTER_LAST: internal use - */ -enum nl80211_bitrate_attr { - __NL80211_BITRATE_ATTR_INVALID, - NL80211_BITRATE_ATTR_RATE, - NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE, - - /* keep last */ - __NL80211_BITRATE_ATTR_AFTER_LAST, - NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1 -}; - -/** - * enum nl80211_initiator - Indicates the initiator of a reg domain request - * @NL80211_REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world - * regulatory domain. - * @NL80211_REGDOM_SET_BY_USER: User asked the wireless core to set the - * regulatory domain. - * @NL80211_REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the - * wireless core it thinks its knows the regulatory domain we should be in. - * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an - * 802.11 country information element with regulatory information it - * thinks we should consider. cfg80211 only processes the country - * code from the IE, and relies on the regulatory domain information - * structure passed by userspace (CRDA) from our wireless-regdb. - * If a channel is enabled but the country code indicates it should - * be disabled we disable the channel and re-enable it upon disassociation. - */ -enum nl80211_reg_initiator { - NL80211_REGDOM_SET_BY_CORE, - NL80211_REGDOM_SET_BY_USER, - NL80211_REGDOM_SET_BY_DRIVER, - NL80211_REGDOM_SET_BY_COUNTRY_IE, -}; - -/** - * enum nl80211_reg_type - specifies the type of regulatory domain - * @NL80211_REGDOM_TYPE_COUNTRY: the regulatory domain set is one that pertains - * to a specific country. When this is set you can count on the - * ISO / IEC 3166 alpha2 country code being valid. - * @NL80211_REGDOM_TYPE_WORLD: the regulatory set domain is the world regulatory - * domain. - * @NL80211_REGDOM_TYPE_CUSTOM_WORLD: the regulatory domain set is a custom - * driver specific world regulatory domain. These do not apply system-wide - * and are only applicable to the individual devices which have requested - * them to be applied. - * @NL80211_REGDOM_TYPE_INTERSECTION: the regulatory domain set is the product - * of an intersection between two regulatory domains -- the previously - * set regulatory domain on the system and the last accepted regulatory - * domain request to be processed. - */ -enum nl80211_reg_type { - NL80211_REGDOM_TYPE_COUNTRY, - NL80211_REGDOM_TYPE_WORLD, - NL80211_REGDOM_TYPE_CUSTOM_WORLD, - NL80211_REGDOM_TYPE_INTERSECTION, -}; - -/** - * enum nl80211_reg_rule_attr - regulatory rule attributes - * @__NL80211_REG_RULE_ATTR_INVALID: attribute number 0 is reserved - * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional - * considerations for a given frequency range. These are the - * &enum nl80211_reg_rule_flags. - * @NL80211_ATTR_FREQ_RANGE_START: starting frequencry for the regulatory - * rule in KHz. This is not a center of frequency but an actual regulatory - * band edge. - * @NL80211_ATTR_FREQ_RANGE_END: ending frequency for the regulatory rule - * in KHz. This is not a center a frequency but an actual regulatory - * band edge. - * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this - * frequency range, in KHz. - * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain - * for a given frequency range. The value is in mBi (100 * dBi). - * If you don't have one then don't send this. - * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for - * a given frequency range. The value is in mBm (100 * dBm). - * @NL80211_REG_RULE_ATTR_MAX: highest regulatory rule attribute number - * currently defined - * @__NL80211_REG_RULE_ATTR_AFTER_LAST: internal use - */ -enum nl80211_reg_rule_attr { - __NL80211_REG_RULE_ATTR_INVALID, - NL80211_ATTR_REG_RULE_FLAGS, - - NL80211_ATTR_FREQ_RANGE_START, - NL80211_ATTR_FREQ_RANGE_END, - NL80211_ATTR_FREQ_RANGE_MAX_BW, - - NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, - NL80211_ATTR_POWER_RULE_MAX_EIRP, - - /* keep last */ - __NL80211_REG_RULE_ATTR_AFTER_LAST, - NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1 -}; - -/** - * enum nl80211_sched_scan_match_attr - scheduled scan match attributes - * @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved - * @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching, - * only report BSS with matching SSID. - * @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter - * attribute number currently defined - * @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use - */ -enum nl80211_sched_scan_match_attr { - __NL80211_SCHED_SCAN_MATCH_ATTR_INVALID, - - NL80211_ATTR_SCHED_SCAN_MATCH_SSID, - - /* keep last */ - __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST, - NL80211_SCHED_SCAN_MATCH_ATTR_MAX = - __NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST - 1 -}; - -/** - * enum nl80211_reg_rule_flags - regulatory rule flags - * - * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed - * @NL80211_RRF_NO_CCK: CCK modulation not allowed - * @NL80211_RRF_NO_INDOOR: indoor operation not allowed - * @NL80211_RRF_NO_OUTDOOR: outdoor operation not allowed - * @NL80211_RRF_DFS: DFS support is required to be used - * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links - * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links - * @NL80211_RRF_PASSIVE_SCAN: passive scan is required - * @NL80211_RRF_NO_IBSS: no IBSS is allowed - */ -enum nl80211_reg_rule_flags { - NL80211_RRF_NO_OFDM = 1<<0, - NL80211_RRF_NO_CCK = 1<<1, - NL80211_RRF_NO_INDOOR = 1<<2, - NL80211_RRF_NO_OUTDOOR = 1<<3, - NL80211_RRF_DFS = 1<<4, - NL80211_RRF_PTP_ONLY = 1<<5, - NL80211_RRF_PTMP_ONLY = 1<<6, - NL80211_RRF_PASSIVE_SCAN = 1<<7, - NL80211_RRF_NO_IBSS = 1<<8, -}; - -/** - * enum nl80211_dfs_regions - regulatory DFS regions - * - * @NL80211_DFS_UNSET: Country has no DFS master region specified - * @NL80211_DFS_FCC_: Country follows DFS master rules from FCC - * @NL80211_DFS_FCC_: Country follows DFS master rules from ETSI - * @NL80211_DFS_JP_: Country follows DFS master rules from JP/MKK/Telec - */ -enum nl80211_dfs_regions { - NL80211_DFS_UNSET = 0, - NL80211_DFS_FCC = 1, - NL80211_DFS_ETSI = 2, - NL80211_DFS_JP = 3, -}; - -/** - * enum nl80211_survey_info - survey information - * - * These attribute types are used with %NL80211_ATTR_SURVEY_INFO - * when getting information about a survey. - * - * @__NL80211_SURVEY_INFO_INVALID: attribute number 0 is reserved - * @NL80211_SURVEY_INFO_FREQUENCY: center frequency of channel - * @NL80211_SURVEY_INFO_NOISE: noise level of channel (u8, dBm) - * @NL80211_SURVEY_INFO_IN_USE: channel is currently being used - * @NL80211_SURVEY_INFO_CHANNEL_TIME: amount of time (in ms) that the radio - * spent on this channel - * @NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY: amount of the time the primary - * channel was sensed busy (either due to activity or energy detect) - * @NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: amount of time the extension - * channel was sensed busy - * @NL80211_SURVEY_INFO_CHANNEL_TIME_RX: amount of time the radio spent - * receiving data - * @NL80211_SURVEY_INFO_CHANNEL_TIME_TX: amount of time the radio spent - * transmitting data - * @NL80211_SURVEY_INFO_MAX: highest survey info attribute number - * currently defined - * @__NL80211_SURVEY_INFO_AFTER_LAST: internal use - */ -enum nl80211_survey_info { - __NL80211_SURVEY_INFO_INVALID, - NL80211_SURVEY_INFO_FREQUENCY, - NL80211_SURVEY_INFO_NOISE, - NL80211_SURVEY_INFO_IN_USE, - NL80211_SURVEY_INFO_CHANNEL_TIME, - NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY, - NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY, - NL80211_SURVEY_INFO_CHANNEL_TIME_RX, - NL80211_SURVEY_INFO_CHANNEL_TIME_TX, - - /* keep last */ - __NL80211_SURVEY_INFO_AFTER_LAST, - NL80211_SURVEY_INFO_MAX = __NL80211_SURVEY_INFO_AFTER_LAST - 1 -}; - -/** - * enum nl80211_mntr_flags - monitor configuration flags - * - * Monitor configuration flags. - * - * @__NL80211_MNTR_FLAG_INVALID: reserved - * - * @NL80211_MNTR_FLAG_FCSFAIL: pass frames with bad FCS - * @NL80211_MNTR_FLAG_PLCPFAIL: pass frames with bad PLCP - * @NL80211_MNTR_FLAG_CONTROL: pass control frames - * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering - * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing. - * overrides all other flags. - * - * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use - * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag - */ -enum nl80211_mntr_flags { - __NL80211_MNTR_FLAG_INVALID, - NL80211_MNTR_FLAG_FCSFAIL, - NL80211_MNTR_FLAG_PLCPFAIL, - NL80211_MNTR_FLAG_CONTROL, - NL80211_MNTR_FLAG_OTHER_BSS, - NL80211_MNTR_FLAG_COOK_FRAMES, - - /* keep last */ - __NL80211_MNTR_FLAG_AFTER_LAST, - NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1 -}; - -/** - * enum nl80211_meshconf_params - mesh configuration parameters - * - * Mesh configuration parameters. These can be changed while the mesh is - * active. - * - * @__NL80211_MESHCONF_INVALID: internal use - * - * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in - * millisecond units, used by the Peer Link Open message - * - * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the initial confirm timeout, in - * millisecond units, used by the peer link management to close a peer link - * - * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in - * millisecond units - * - * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed - * on this mesh interface - * - * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link - * open retries that can be sent to establish a new peer link instance in a - * mesh - * - * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh - * point. - * - * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically - * open peer links when we detect compatible mesh peers. - * - * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames - * containing a PREQ that an MP can send to a particular destination (path - * target) - * - * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths - * (in milliseconds) - * - * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait - * until giving up on a path discovery (in milliseconds) - * - * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh - * points receiving a PREQ shall consider the forwarding information from the - * root to be valid. (TU = time unit) - * - * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in - * TUs) during which an MP can send only one action frame containing a PREQ - * reference element - * - * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs) - * that it takes for an HWMP information element to propagate across the mesh - * - * @NL80211_MESHCONF_HWMP_ROOTMODE: whether root mode is enabled or not - * - * @NL80211_MESHCONF_ELEMENT_TTL: specifies the value of TTL field set at a - * source mesh point for path selection elements. - * - * @NL80211_MESHCONF_HWMP_RANN_INTERVAL: The interval of time (in TUs) between - * root announcements are transmitted. - * - * @NL80211_MESHCONF_GATE_ANNOUNCEMENTS: Advertise that this mesh station has - * access to a broader network beyond the MBSS. This is done via Root - * Announcement frames. - * - * @NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL: The minimum interval of time (in - * TUs) during which a mesh STA can send only one Action frame containing a - * PERR element. - * - * @NL80211_MESHCONF_FORWARDING: set Mesh STA as forwarding or non-forwarding - * or forwarding entity (default is TRUE - forwarding entity) - * - * @NL80211_MESHCONF_RSSI_THRESHOLD: RSSI threshold in dBm. This specifies the - * threshold for average signal strength of candidate station to establish - * a peer link. - * - * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute - * - * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use - */ -enum nl80211_meshconf_params { - __NL80211_MESHCONF_INVALID, - NL80211_MESHCONF_RETRY_TIMEOUT, - NL80211_MESHCONF_CONFIRM_TIMEOUT, - NL80211_MESHCONF_HOLDING_TIMEOUT, - NL80211_MESHCONF_MAX_PEER_LINKS, - NL80211_MESHCONF_MAX_RETRIES, - NL80211_MESHCONF_TTL, - NL80211_MESHCONF_AUTO_OPEN_PLINKS, - NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, - NL80211_MESHCONF_PATH_REFRESH_TIME, - NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, - NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, - NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, - NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, - NL80211_MESHCONF_HWMP_ROOTMODE, - NL80211_MESHCONF_ELEMENT_TTL, - NL80211_MESHCONF_HWMP_RANN_INTERVAL, - NL80211_MESHCONF_GATE_ANNOUNCEMENTS, - NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, - NL80211_MESHCONF_FORWARDING, - NL80211_MESHCONF_RSSI_THRESHOLD, - - /* keep last */ - __NL80211_MESHCONF_ATTR_AFTER_LAST, - NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1 -}; - -/** - * enum nl80211_mesh_setup_params - mesh setup parameters - * - * Mesh setup parameters. These are used to start/join a mesh and cannot be - * changed while the mesh is active. - * - * @__NL80211_MESH_SETUP_INVALID: Internal use - * - * @NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL: Enable this option to use a - * vendor specific path selection algorithm or disable it to use the default - * HWMP. - * - * @NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC: Enable this option to use a - * vendor specific path metric or disable it to use the default Airtime - * metric. - * - * @NL80211_MESH_SETUP_IE: Information elements for this mesh, for instance, a - * robust security network ie, or a vendor specific information element that - * vendors will use to identify the path selection methods and metrics in use. - * - * @NL80211_MESH_SETUP_USERSPACE_AUTH: Enable this option if an authentication - * daemon will be authenticating mesh candidates. - * - * @NL80211_MESH_SETUP_USERSPACE_AMPE: Enable this option if an authentication - * daemon will be securing peer link frames. AMPE is a secured version of Mesh - * Peering Management (MPM) and is implemented with the assistance of a - * userspace daemon. When this flag is set, the kernel will send peer - * management frames to a userspace daemon that will implement AMPE - * functionality (security capabilities selection, key confirmation, and key - * management). When the flag is unset (default), the kernel can autonomously - * complete (unsecured) mesh peering without the need of a userspace daemon. - * - * @NL80211_MESH_SETUP_ATTR_MAX: highest possible mesh setup attribute number - * @__NL80211_MESH_SETUP_ATTR_AFTER_LAST: Internal use - */ -enum nl80211_mesh_setup_params { - __NL80211_MESH_SETUP_INVALID, - NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL, - NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC, - NL80211_MESH_SETUP_IE, - NL80211_MESH_SETUP_USERSPACE_AUTH, - NL80211_MESH_SETUP_USERSPACE_AMPE, - - /* keep last */ - __NL80211_MESH_SETUP_ATTR_AFTER_LAST, - NL80211_MESH_SETUP_ATTR_MAX = __NL80211_MESH_SETUP_ATTR_AFTER_LAST - 1 -}; - -/** - * enum nl80211_txq_attr - TX queue parameter attributes - * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved - * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*) - * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning - * disabled - * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form - * 2^n-1 in the range 1..32767] - * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form - * 2^n-1 in the range 1..32767] - * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255] - * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal - * @NL80211_TXQ_ATTR_MAX: Maximum TXQ attribute number - */ -enum nl80211_txq_attr { - __NL80211_TXQ_ATTR_INVALID, - NL80211_TXQ_ATTR_QUEUE, - NL80211_TXQ_ATTR_TXOP, - NL80211_TXQ_ATTR_CWMIN, - NL80211_TXQ_ATTR_CWMAX, - NL80211_TXQ_ATTR_AIFS, - - /* keep last */ - __NL80211_TXQ_ATTR_AFTER_LAST, - NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1 -}; - -enum nl80211_txq_q { - NL80211_TXQ_Q_VO, - NL80211_TXQ_Q_VI, - NL80211_TXQ_Q_BE, - NL80211_TXQ_Q_BK -}; - -enum nl80211_channel_type { - NL80211_CHAN_NO_HT, - NL80211_CHAN_HT20, - NL80211_CHAN_HT40MINUS, - NL80211_CHAN_HT40PLUS -}; - -/** - * enum nl80211_bss - netlink attributes for a BSS - * - * @__NL80211_BSS_INVALID: invalid - * @NL80211_BSS_BSSID: BSSID of the BSS (6 octets) - * @NL80211_BSS_FREQUENCY: frequency in MHz (u32) - * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64) - * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16) - * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16) - * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the - * raw information elements from the probe response/beacon (bin); - * if the %NL80211_BSS_BEACON_IES attribute is present, the IEs here are - * from a Probe Response frame; otherwise they are from a Beacon frame. - * However, if the driver does not indicate the source of the IEs, these - * IEs may be from either frame subtype. - * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon - * in mBm (100 * dBm) (s32) - * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon - * in unspecified units, scaled to 0..100 (u8) - * @NL80211_BSS_STATUS: status, if this BSS is "used" - * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms - * @NL80211_BSS_BEACON_IES: binary attribute containing the raw information - * elements from a Beacon frame (bin); not present if no Beacon frame has - * yet been received - * @__NL80211_BSS_AFTER_LAST: internal - * @NL80211_BSS_MAX: highest BSS attribute - */ -enum nl80211_bss { - __NL80211_BSS_INVALID, - NL80211_BSS_BSSID, - NL80211_BSS_FREQUENCY, - NL80211_BSS_TSF, - NL80211_BSS_BEACON_INTERVAL, - NL80211_BSS_CAPABILITY, - NL80211_BSS_INFORMATION_ELEMENTS, - NL80211_BSS_SIGNAL_MBM, - NL80211_BSS_SIGNAL_UNSPEC, - NL80211_BSS_STATUS, - NL80211_BSS_SEEN_MS_AGO, - NL80211_BSS_BEACON_IES, - - /* keep last */ - __NL80211_BSS_AFTER_LAST, - NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1 -}; - -/** - * enum nl80211_bss_status - BSS "status" - * @NL80211_BSS_STATUS_AUTHENTICATED: Authenticated with this BSS. - * @NL80211_BSS_STATUS_ASSOCIATED: Associated with this BSS. - * @NL80211_BSS_STATUS_IBSS_JOINED: Joined to this IBSS. - * - * The BSS status is a BSS attribute in scan dumps, which - * indicates the status the interface has wrt. this BSS. - */ -enum nl80211_bss_status { - NL80211_BSS_STATUS_AUTHENTICATED, - NL80211_BSS_STATUS_ASSOCIATED, - NL80211_BSS_STATUS_IBSS_JOINED, -}; - -/** - * enum nl80211_auth_type - AuthenticationType - * - * @NL80211_AUTHTYPE_OPEN_SYSTEM: Open System authentication - * @NL80211_AUTHTYPE_SHARED_KEY: Shared Key authentication (WEP only) - * @NL80211_AUTHTYPE_FT: Fast BSS Transition (IEEE 802.11r) - * @NL80211_AUTHTYPE_NETWORK_EAP: Network EAP (some Cisco APs and mainly LEAP) - * @__NL80211_AUTHTYPE_NUM: internal - * @NL80211_AUTHTYPE_MAX: maximum valid auth algorithm - * @NL80211_AUTHTYPE_AUTOMATIC: determine automatically (if necessary by - * trying multiple times); this is invalid in netlink -- leave out - * the attribute for this on CONNECT commands. - */ -enum nl80211_auth_type { - NL80211_AUTHTYPE_OPEN_SYSTEM, - NL80211_AUTHTYPE_SHARED_KEY, - NL80211_AUTHTYPE_FT, - NL80211_AUTHTYPE_NETWORK_EAP, - - /* keep last */ - __NL80211_AUTHTYPE_NUM, - NL80211_AUTHTYPE_MAX = __NL80211_AUTHTYPE_NUM - 1, - NL80211_AUTHTYPE_AUTOMATIC -}; - -/** - * enum nl80211_key_type - Key Type - * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key - * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key - * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS) - * @NUM_NL80211_KEYTYPES: number of defined key types - */ -enum nl80211_key_type { - NL80211_KEYTYPE_GROUP, - NL80211_KEYTYPE_PAIRWISE, - NL80211_KEYTYPE_PEERKEY, - - NUM_NL80211_KEYTYPES -}; - -/** - * enum nl80211_mfp - Management frame protection state - * @NL80211_MFP_NO: Management frame protection not used - * @NL80211_MFP_REQUIRED: Management frame protection required - */ -enum nl80211_mfp { - NL80211_MFP_NO, - NL80211_MFP_REQUIRED, -}; - -enum nl80211_wpa_versions { - NL80211_WPA_VERSION_1 = 1 << 0, - NL80211_WPA_VERSION_2 = 1 << 1, -}; - -/** - * enum nl80211_key_default_types - key default types - * @__NL80211_KEY_DEFAULT_TYPE_INVALID: invalid - * @NL80211_KEY_DEFAULT_TYPE_UNICAST: key should be used as default - * unicast key - * @NL80211_KEY_DEFAULT_TYPE_MULTICAST: key should be used as default - * multicast key - * @NUM_NL80211_KEY_DEFAULT_TYPES: number of default types - */ -enum nl80211_key_default_types { - __NL80211_KEY_DEFAULT_TYPE_INVALID, - NL80211_KEY_DEFAULT_TYPE_UNICAST, - NL80211_KEY_DEFAULT_TYPE_MULTICAST, - - NUM_NL80211_KEY_DEFAULT_TYPES -}; - -/** - * enum nl80211_key_attributes - key attributes - * @__NL80211_KEY_INVALID: invalid - * @NL80211_KEY_DATA: (temporal) key data; for TKIP this consists of - * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC - * keys - * @NL80211_KEY_IDX: key ID (u8, 0-3) - * @NL80211_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11 - * section 7.3.2.25.1, e.g. 0x000FAC04) - * @NL80211_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and - * CCMP keys, each six bytes in little endian - * @NL80211_KEY_DEFAULT: flag indicating default key - * @NL80211_KEY_DEFAULT_MGMT: flag indicating default management key - * @NL80211_KEY_TYPE: the key type from enum nl80211_key_type, if not - * specified the default depends on whether a MAC address was - * given with the command using the key or not (u32) - * @NL80211_KEY_DEFAULT_TYPES: A nested attribute containing flags - * attributes, specifying what a key should be set as default as. - * See &enum nl80211_key_default_types. - * @__NL80211_KEY_AFTER_LAST: internal - * @NL80211_KEY_MAX: highest key attribute - */ -enum nl80211_key_attributes { - __NL80211_KEY_INVALID, - NL80211_KEY_DATA, - NL80211_KEY_IDX, - NL80211_KEY_CIPHER, - NL80211_KEY_SEQ, - NL80211_KEY_DEFAULT, - NL80211_KEY_DEFAULT_MGMT, - NL80211_KEY_TYPE, - NL80211_KEY_DEFAULT_TYPES, - - /* keep last */ - __NL80211_KEY_AFTER_LAST, - NL80211_KEY_MAX = __NL80211_KEY_AFTER_LAST - 1 -}; - -/** - * enum nl80211_tx_rate_attributes - TX rate set attributes - * @__NL80211_TXRATE_INVALID: invalid - * @NL80211_TXRATE_LEGACY: Legacy (non-MCS) rates allowed for TX rate selection - * in an array of rates as defined in IEEE 802.11 7.3.2.2 (u8 values with - * 1 = 500 kbps) but without the IE length restriction (at most - * %NL80211_MAX_SUPP_RATES in a single array). - * @NL80211_TXRATE_MCS: HT (MCS) rates allowed for TX rate selection - * in an array of MCS numbers. - * @__NL80211_TXRATE_AFTER_LAST: internal - * @NL80211_TXRATE_MAX: highest TX rate attribute - */ -enum nl80211_tx_rate_attributes { - __NL80211_TXRATE_INVALID, - NL80211_TXRATE_LEGACY, - NL80211_TXRATE_MCS, - - /* keep last */ - __NL80211_TXRATE_AFTER_LAST, - NL80211_TXRATE_MAX = __NL80211_TXRATE_AFTER_LAST - 1 -}; - -/** - * enum nl80211_band - Frequency band - * @NL80211_BAND_2GHZ: 2.4 GHz ISM band - * @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz) - * @NL80211_BAND_5_9GHZ: around the ITS 5.9GHz band (5.875GHz - 5.905GHz) - * @NL80211_BAND_0_8GHZ: around the 800 MHz band - */ -enum nl80211_band { - NL80211_BAND_2GHZ, - NL80211_BAND_5GHZ, - NL80211_BAND_5_9GHZ, - NL80211_BAND_0_8GHZ, -}; - -enum nl80211_ps_state { - NL80211_PS_DISABLED, - NL80211_PS_ENABLED, -}; - -/** - * enum nl80211_attr_cqm - connection quality monitor attributes - * @__NL80211_ATTR_CQM_INVALID: invalid - * @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies - * the threshold for the RSSI level at which an event will be sent. Zero - * to disable. - * @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies - * the minimum amount the RSSI level must change after an event before a - * new event may be issued (to reduce effects of RSSI oscillation). - * @NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT: RSSI threshold event - * @NL80211_ATTR_CQM_PKT_LOSS_EVENT: a u32 value indicating that this many - * consecutive packets were not acknowledged by the peer - * @__NL80211_ATTR_CQM_AFTER_LAST: internal - * @NL80211_ATTR_CQM_MAX: highest key attribute - */ -enum nl80211_attr_cqm { - __NL80211_ATTR_CQM_INVALID, - NL80211_ATTR_CQM_RSSI_THOLD, - NL80211_ATTR_CQM_RSSI_HYST, - NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, - NL80211_ATTR_CQM_PKT_LOSS_EVENT, - - /* keep last */ - __NL80211_ATTR_CQM_AFTER_LAST, - NL80211_ATTR_CQM_MAX = __NL80211_ATTR_CQM_AFTER_LAST - 1 -}; - -/** - * enum nl80211_cqm_rssi_threshold_event - RSSI threshold event - * @NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW: The RSSI level is lower than the - * configured threshold - * @NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH: The RSSI is higher than the - * configured threshold - */ -enum nl80211_cqm_rssi_threshold_event { - NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, - NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, -}; - - -/** - * enum nl80211_tx_power_setting - TX power adjustment - * @NL80211_TX_POWER_AUTOMATIC: automatically determine transmit power - * @NL80211_TX_POWER_LIMITED: limit TX power by the mBm parameter - * @NL80211_TX_POWER_FIXED: fix TX power to the mBm parameter - */ -enum nl80211_tx_power_setting { - NL80211_TX_POWER_AUTOMATIC, - NL80211_TX_POWER_LIMITED, - NL80211_TX_POWER_FIXED, -}; - -/** - * enum nl80211_wowlan_packet_pattern_attr - WoWLAN packet pattern attribute - * @__NL80211_WOWLAN_PKTPAT_INVALID: invalid number for nested attribute - * @NL80211_WOWLAN_PKTPAT_PATTERN: the pattern, values where the mask has - * a zero bit are ignored - * @NL80211_WOWLAN_PKTPAT_MASK: pattern mask, must be long enough to have - * a bit for each byte in the pattern. The lowest-order bit corresponds - * to the first byte of the pattern, but the bytes of the pattern are - * in a little-endian-like format, i.e. the 9th byte of the pattern - * corresponds to the lowest-order bit in the second byte of the mask. - * For example: The match 00:xx:00:00:xx:00:00:00:00:xx:xx:xx (where - * xx indicates "don't care") would be represented by a pattern of - * twelve zero bytes, and a mask of "0xed,0x07". - * Note that the pattern matching is done as though frames were not - * 802.11 frames but 802.3 frames, i.e. the frame is fully unpacked - * first (including SNAP header unpacking) and then matched. - * @NUM_NL80211_WOWLAN_PKTPAT: number of attributes - * @MAX_NL80211_WOWLAN_PKTPAT: max attribute number - */ -enum nl80211_wowlan_packet_pattern_attr { - __NL80211_WOWLAN_PKTPAT_INVALID, - NL80211_WOWLAN_PKTPAT_MASK, - NL80211_WOWLAN_PKTPAT_PATTERN, - - NUM_NL80211_WOWLAN_PKTPAT, - MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1, -}; - -/** - * struct nl80211_wowlan_pattern_support - pattern support information - * @max_patterns: maximum number of patterns supported - * @min_pattern_len: minimum length of each pattern - * @max_pattern_len: maximum length of each pattern - * - * This struct is carried in %NL80211_WOWLAN_TRIG_PKT_PATTERN when - * that is part of %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED in the - * capability information given by the kernel to userspace. - */ -struct nl80211_wowlan_pattern_support { - __u32 max_patterns; - __u32 min_pattern_len; - __u32 max_pattern_len; -} __attribute__((packed)); - -/** - * enum nl80211_wowlan_triggers - WoWLAN trigger definitions - * @__NL80211_WOWLAN_TRIG_INVALID: invalid number for nested attributes - * @NL80211_WOWLAN_TRIG_ANY: wake up on any activity, do not really put - * the chip into a special state -- works best with chips that have - * support for low-power operation already (flag) - * @NL80211_WOWLAN_TRIG_DISCONNECT: wake up on disconnect, the way disconnect - * is detected is implementation-specific (flag) - * @NL80211_WOWLAN_TRIG_MAGIC_PKT: wake up on magic packet (6x 0xff, followed - * by 16 repetitions of MAC addr, anywhere in payload) (flag) - * @NL80211_WOWLAN_TRIG_PKT_PATTERN: wake up on the specified packet patterns - * which are passed in an array of nested attributes, each nested attribute - * defining a with attributes from &struct nl80211_wowlan_trig_pkt_pattern. - * Each pattern defines a wakeup packet. The matching is done on the MSDU, - * i.e. as though the packet was an 802.3 packet, so the pattern matching - * is done after the packet is converted to the MSDU. - * - * In %NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED, it is a binary attribute - * carrying a &struct nl80211_wowlan_pattern_support. - * @NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED: Not a real trigger, and cannot be - * used when setting, used only to indicate that GTK rekeying is supported - * by the device (flag) - * @NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE: wake up on GTK rekey failure (if - * done by the device) (flag) - * @NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST: wake up on EAP Identity Request - * packet (flag) - * @NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE: wake up on 4-way handshake (flag) - * @NL80211_WOWLAN_TRIG_RFKILL_RELEASE: wake up when rfkill is released - * (on devices that have rfkill in the device) (flag) - * @NUM_NL80211_WOWLAN_TRIG: number of wake on wireless triggers - * @MAX_NL80211_WOWLAN_TRIG: highest wowlan trigger attribute number - */ -enum nl80211_wowlan_triggers { - __NL80211_WOWLAN_TRIG_INVALID, - NL80211_WOWLAN_TRIG_ANY, - NL80211_WOWLAN_TRIG_DISCONNECT, - NL80211_WOWLAN_TRIG_MAGIC_PKT, - NL80211_WOWLAN_TRIG_PKT_PATTERN, - NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED, - NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE, - NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST, - NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE, - NL80211_WOWLAN_TRIG_RFKILL_RELEASE, - - /* keep last */ - NUM_NL80211_WOWLAN_TRIG, - MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1 -}; - -/** - * enum nl80211_iface_limit_attrs - limit attributes - * @NL80211_IFACE_LIMIT_UNSPEC: (reserved) - * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that - * can be chosen from this set of interface types (u32) - * @NL80211_IFACE_LIMIT_TYPES: nested attribute containing a - * flag attribute for each interface type in this set - * @NUM_NL80211_IFACE_LIMIT: number of attributes - * @MAX_NL80211_IFACE_LIMIT: highest attribute number - */ -enum nl80211_iface_limit_attrs { - NL80211_IFACE_LIMIT_UNSPEC, - NL80211_IFACE_LIMIT_MAX, - NL80211_IFACE_LIMIT_TYPES, - - /* keep last */ - NUM_NL80211_IFACE_LIMIT, - MAX_NL80211_IFACE_LIMIT = NUM_NL80211_IFACE_LIMIT - 1 -}; - -/** - * enum nl80211_if_combination_attrs -- interface combination attributes - * - * @NL80211_IFACE_COMB_UNSPEC: (reserved) - * @NL80211_IFACE_COMB_LIMITS: Nested attributes containing the limits - * for given interface types, see &enum nl80211_iface_limit_attrs. - * @NL80211_IFACE_COMB_MAXNUM: u32 attribute giving the total number of - * interfaces that can be created in this group. This number doesn't - * apply to interfaces purely managed in software, which are listed - * in a separate attribute %NL80211_ATTR_INTERFACES_SOFTWARE. - * @NL80211_IFACE_COMB_STA_AP_BI_MATCH: flag attribute specifying that - * beacon intervals within this group must be all the same even for - * infrastructure and AP/GO combinations, i.e. the GO(s) must adopt - * the infrastructure network's beacon interval. - * @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many - * different channels may be used within this group. - * @NUM_NL80211_IFACE_COMB: number of attributes - * @MAX_NL80211_IFACE_COMB: highest attribute number - * - * Examples: - * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2 - * => allows an AP and a STA that must match BIs - * - * numbers = [ #{AP, P2P-GO} <= 8 ], channels = 1, max = 8 - * => allows 8 of AP/GO - * - * numbers = [ #{STA} <= 2 ], channels = 2, max = 2 - * => allows two STAs on different channels - * - * numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4 - * => allows a STA plus three P2P interfaces - * - * The list of these four possiblities could completely be contained - * within the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute to indicate - * that any of these groups must match. - * - * "Combinations" of just a single interface will not be listed here, - * a single interface of any valid interface type is assumed to always - * be possible by itself. This means that implicitly, for each valid - * interface type, the following group always exists: - * numbers = [ #{<type>} <= 1 ], channels = 1, max = 1 - */ -enum nl80211_if_combination_attrs { - NL80211_IFACE_COMB_UNSPEC, - NL80211_IFACE_COMB_LIMITS, - NL80211_IFACE_COMB_MAXNUM, - NL80211_IFACE_COMB_STA_AP_BI_MATCH, - NL80211_IFACE_COMB_NUM_CHANNELS, - - /* keep last */ - NUM_NL80211_IFACE_COMB, - MAX_NL80211_IFACE_COMB = NUM_NL80211_IFACE_COMB - 1 -}; - - -/** - * enum nl80211_plink_state - state of a mesh peer link finite state machine - * - * @NL80211_PLINK_LISTEN: initial state, considered the implicit - * state of non existant mesh peer links - * @NL80211_PLINK_OPN_SNT: mesh plink open frame has been sent to - * this mesh peer - * @NL80211_PLINK_OPN_RCVD: mesh plink open frame has been received - * from this mesh peer - * @NL80211_PLINK_CNF_RCVD: mesh plink confirm frame has been - * received from this mesh peer - * @NL80211_PLINK_ESTAB: mesh peer link is established - * @NL80211_PLINK_HOLDING: mesh peer link is being closed or cancelled - * @NL80211_PLINK_BLOCKED: all frames transmitted from this mesh - * plink are discarded - * @NUM_NL80211_PLINK_STATES: number of peer link states - * @MAX_NL80211_PLINK_STATES: highest numerical value of plink states - */ -enum nl80211_plink_state { - NL80211_PLINK_LISTEN, - NL80211_PLINK_OPN_SNT, - NL80211_PLINK_OPN_RCVD, - NL80211_PLINK_CNF_RCVD, - NL80211_PLINK_ESTAB, - NL80211_PLINK_HOLDING, - NL80211_PLINK_BLOCKED, - - /* keep last */ - NUM_NL80211_PLINK_STATES, - MAX_NL80211_PLINK_STATES = NUM_NL80211_PLINK_STATES - 1 -}; - -#define NL80211_KCK_LEN 16 -#define NL80211_KEK_LEN 16 -#define NL80211_REPLAY_CTR_LEN 8 - -/** - * enum nl80211_rekey_data - attributes for GTK rekey offload - * @__NL80211_REKEY_DATA_INVALID: invalid number for nested attributes - * @NL80211_REKEY_DATA_KEK: key encryption key (binary) - * @NL80211_REKEY_DATA_KCK: key confirmation key (binary) - * @NL80211_REKEY_DATA_REPLAY_CTR: replay counter (binary) - * @NUM_NL80211_REKEY_DATA: number of rekey attributes (internal) - * @MAX_NL80211_REKEY_DATA: highest rekey attribute (internal) - */ -enum nl80211_rekey_data { - __NL80211_REKEY_DATA_INVALID, - NL80211_REKEY_DATA_KEK, - NL80211_REKEY_DATA_KCK, - NL80211_REKEY_DATA_REPLAY_CTR, - - /* keep last */ - NUM_NL80211_REKEY_DATA, - MAX_NL80211_REKEY_DATA = NUM_NL80211_REKEY_DATA - 1 -}; - -/** - * enum nl80211_hidden_ssid - values for %NL80211_ATTR_HIDDEN_SSID - * @NL80211_HIDDEN_SSID_NOT_IN_USE: do not hide SSID (i.e., broadcast it in - * Beacon frames) - * @NL80211_HIDDEN_SSID_ZERO_LEN: hide SSID by using zero-length SSID element - * in Beacon frames - * @NL80211_HIDDEN_SSID_ZERO_CONTENTS: hide SSID by using correct length of SSID - * element in Beacon frames but zero out each byte in the SSID - */ -enum nl80211_hidden_ssid { - NL80211_HIDDEN_SSID_NOT_IN_USE, - NL80211_HIDDEN_SSID_ZERO_LEN, - NL80211_HIDDEN_SSID_ZERO_CONTENTS -}; - -/** - * enum nl80211_sta_wme_attr - station WME attributes - * @__NL80211_STA_WME_INVALID: invalid number for nested attribute - * @NL80211_STA_WME_UAPSD_QUEUES: bitmap of uapsd queues. the format - * is the same as the AC bitmap in the QoS info field. - * @NL80211_STA_WME_MAX_SP: max service period. the format is the same - * as the MAX_SP field in the QoS info field (but already shifted down). - * @__NL80211_STA_WME_AFTER_LAST: internal - * @NL80211_STA_WME_MAX: highest station WME attribute - */ -enum nl80211_sta_wme_attr { - __NL80211_STA_WME_INVALID, - NL80211_STA_WME_UAPSD_QUEUES, - NL80211_STA_WME_MAX_SP, - - /* keep last */ - __NL80211_STA_WME_AFTER_LAST, - NL80211_STA_WME_MAX = __NL80211_STA_WME_AFTER_LAST - 1 -}; - -/** - * enum nl80211_pmksa_candidate_attr - attributes for PMKSA caching candidates - * @__NL80211_PMKSA_CANDIDATE_INVALID: invalid number for nested attributes - * @NL80211_PMKSA_CANDIDATE_INDEX: candidate index (u32; the smaller, the higher - * priority) - * @NL80211_PMKSA_CANDIDATE_BSSID: candidate BSSID (6 octets) - * @NL80211_PMKSA_CANDIDATE_PREAUTH: RSN pre-authentication supported (flag) - * @NUM_NL80211_PMKSA_CANDIDATE: number of PMKSA caching candidate attributes - * (internal) - * @MAX_NL80211_PMKSA_CANDIDATE: highest PMKSA caching candidate attribute - * (internal) - */ -enum nl80211_pmksa_candidate_attr { - __NL80211_PMKSA_CANDIDATE_INVALID, - NL80211_PMKSA_CANDIDATE_INDEX, - NL80211_PMKSA_CANDIDATE_BSSID, - NL80211_PMKSA_CANDIDATE_PREAUTH, - - /* keep last */ - NUM_NL80211_PMKSA_CANDIDATE, - MAX_NL80211_PMKSA_CANDIDATE = NUM_NL80211_PMKSA_CANDIDATE - 1 -}; - -/** - * enum nl80211_tdls_operation - values for %NL80211_ATTR_TDLS_OPERATION - * @NL80211_TDLS_DISCOVERY_REQ: Send a TDLS discovery request - * @NL80211_TDLS_SETUP: Setup TDLS link - * @NL80211_TDLS_TEARDOWN: Teardown a TDLS link which is already established - * @NL80211_TDLS_ENABLE_LINK: Enable TDLS link - * @NL80211_TDLS_DISABLE_LINK: Disable TDLS link - */ -enum nl80211_tdls_operation { - NL80211_TDLS_DISCOVERY_REQ, - NL80211_TDLS_SETUP, - NL80211_TDLS_TEARDOWN, - NL80211_TDLS_ENABLE_LINK, - NL80211_TDLS_DISABLE_LINK, -}; - -/* - * enum nl80211_ap_sme_features - device-integrated AP features - * Reserved for future use, no bits are defined in - * NL80211_ATTR_DEVICE_AP_SME yet. -enum nl80211_ap_sme_features { -}; - */ - -/** - * enum nl80211_feature_flags - device/driver features - * @NL80211_FEATURE_SK_TX_STATUS: This driver supports reflecting back - * TX status to the socket error queue when requested with the - * socket option. - * @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates. - * @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up - * the connected inactive stations in AP mode. - */ -enum nl80211_feature_flags { - NL80211_FEATURE_SK_TX_STATUS = 1 << 0, - NL80211_FEATURE_HT_IBSS = 1 << 1, - NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2, -}; - -/** - * enum nl80211_probe_resp_offload_support_attr - optional supported - * protocols for probe-response offloading by the driver/FW. - * To be used with the %NL80211_ATTR_PROBE_RESP_OFFLOAD attribute. - * Each enum value represents a bit in the bitmap of supported - * protocols. Typically a subset of probe-requests belonging to a - * supported protocol will be excluded from offload and uploaded - * to the host. - * - * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS: Support for WPS ver. 1 - * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2: Support for WPS ver. 2 - * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P: Support for P2P - * @NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U: Support for 802.11u - */ -enum nl80211_probe_resp_offload_support_attr { - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS = 1<<0, - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 = 1<<1, - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P = 1<<2, - NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U = 1<<3, -}; - -#endif /* __LINUX_NL80211_H */ diff --git a/openairITS/mac/DOT11/include/linux/of.h b/openairITS/mac/DOT11/include/linux/of.h deleted file mode 100644 index c5dc87c2ef6..00000000000 --- a/openairITS/mac/DOT11/include/linux/of.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _COMPAT_LINUX_OF_H -#define _COMPAT_LINUX_OF_H 1 - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) -#include_next <linux/of.h> -#else - -#ifdef CONFIG_OF -#include_next <linux/of.h> -#endif /* CONFIG_OF */ - -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34)) */ - -#endif /* _COMPAT_LINUX_OF_H */ diff --git a/openairITS/mac/DOT11/include/linux/pci-aspm.h b/openairITS/mac/DOT11/include/linux/pci-aspm.h deleted file mode 100644 index 2bc6efb3330..00000000000 --- a/openairITS/mac/DOT11/include/linux/pci-aspm.h +++ /dev/null @@ -1,5 +0,0 @@ -#include <linux/version.h> - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)) -#include_next <linux/pci-aspm.h> -#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)) */ diff --git a/openairITS/mac/DOT11/include/linux/pci_ids.h b/openairITS/mac/DOT11/include/linux/pci_ids.h deleted file mode 100644 index 3329965ed63..00000000000 --- a/openairITS/mac/DOT11/include/linux/pci_ids.h +++ /dev/null @@ -1,2907 +0,0 @@ -/* - * PCI Class, Vendor and Device IDs - * - * Please keep sorted. - * - * Do not add new entries to this file unless the definitions - * are shared between multiple drivers. - */ - -/* Device classes and subclasses */ - -#define PCI_CLASS_NOT_DEFINED 0x0000 -#define PCI_CLASS_NOT_DEFINED_VGA 0x0001 - -#define PCI_BASE_CLASS_STORAGE 0x01 -#define PCI_CLASS_STORAGE_SCSI 0x0100 -#define PCI_CLASS_STORAGE_IDE 0x0101 -#define PCI_CLASS_STORAGE_FLOPPY 0x0102 -#define PCI_CLASS_STORAGE_IPI 0x0103 -#define PCI_CLASS_STORAGE_RAID 0x0104 -#define PCI_CLASS_STORAGE_SATA 0x0106 -#define PCI_CLASS_STORAGE_SATA_AHCI 0x010601 -#define PCI_CLASS_STORAGE_SAS 0x0107 -#define PCI_CLASS_STORAGE_OTHER 0x0180 - -#define PCI_BASE_CLASS_NETWORK 0x02 -#define PCI_CLASS_NETWORK_ETHERNET 0x0200 -#define PCI_CLASS_NETWORK_TOKEN_RING 0x0201 -#define PCI_CLASS_NETWORK_FDDI 0x0202 -#define PCI_CLASS_NETWORK_ATM 0x0203 -#define PCI_CLASS_NETWORK_OTHER 0x0280 - -#define PCI_BASE_CLASS_DISPLAY 0x03 -#define PCI_CLASS_DISPLAY_VGA 0x0300 -#define PCI_CLASS_DISPLAY_XGA 0x0301 -#define PCI_CLASS_DISPLAY_3D 0x0302 -#define PCI_CLASS_DISPLAY_OTHER 0x0380 - -#define PCI_BASE_CLASS_MULTIMEDIA 0x04 -#define PCI_CLASS_MULTIMEDIA_VIDEO 0x0400 -#define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401 -#define PCI_CLASS_MULTIMEDIA_PHONE 0x0402 -#define PCI_CLASS_MULTIMEDIA_OTHER 0x0480 - -#define PCI_BASE_CLASS_MEMORY 0x05 -#define PCI_CLASS_MEMORY_RAM 0x0500 -#define PCI_CLASS_MEMORY_FLASH 0x0501 -#define PCI_CLASS_MEMORY_OTHER 0x0580 - -#define PCI_BASE_CLASS_BRIDGE 0x06 -#define PCI_CLASS_BRIDGE_HOST 0x0600 -#define PCI_CLASS_BRIDGE_ISA 0x0601 -#define PCI_CLASS_BRIDGE_EISA 0x0602 -#define PCI_CLASS_BRIDGE_MC 0x0603 -#define PCI_CLASS_BRIDGE_PCI 0x0604 -#define PCI_CLASS_BRIDGE_PCMCIA 0x0605 -#define PCI_CLASS_BRIDGE_NUBUS 0x0606 -#define PCI_CLASS_BRIDGE_CARDBUS 0x0607 -#define PCI_CLASS_BRIDGE_RACEWAY 0x0608 -#define PCI_CLASS_BRIDGE_OTHER 0x0680 - -#define PCI_BASE_CLASS_COMMUNICATION 0x07 -#define PCI_CLASS_COMMUNICATION_SERIAL 0x0700 -#define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701 -#define PCI_CLASS_COMMUNICATION_MULTISERIAL 0x0702 -#define PCI_CLASS_COMMUNICATION_MODEM 0x0703 -#define PCI_CLASS_COMMUNICATION_OTHER 0x0780 - -#define PCI_BASE_CLASS_SYSTEM 0x08 -#define PCI_CLASS_SYSTEM_PIC 0x0800 -#define PCI_CLASS_SYSTEM_PIC_IOAPIC 0x080010 -#define PCI_CLASS_SYSTEM_PIC_IOXAPIC 0x080020 -#define PCI_CLASS_SYSTEM_DMA 0x0801 -#define PCI_CLASS_SYSTEM_TIMER 0x0802 -#define PCI_CLASS_SYSTEM_RTC 0x0803 -#define PCI_CLASS_SYSTEM_PCI_HOTPLUG 0x0804 -#define PCI_CLASS_SYSTEM_SDHCI 0x0805 -#define PCI_CLASS_SYSTEM_OTHER 0x0880 - -#define PCI_BASE_CLASS_INPUT 0x09 -#define PCI_CLASS_INPUT_KEYBOARD 0x0900 -#define PCI_CLASS_INPUT_PEN 0x0901 -#define PCI_CLASS_INPUT_MOUSE 0x0902 -#define PCI_CLASS_INPUT_SCANNER 0x0903 -#define PCI_CLASS_INPUT_GAMEPORT 0x0904 -#define PCI_CLASS_INPUT_OTHER 0x0980 - -#define PCI_BASE_CLASS_DOCKING 0x0a -#define PCI_CLASS_DOCKING_GENERIC 0x0a00 -#define PCI_CLASS_DOCKING_OTHER 0x0a80 - -#define PCI_BASE_CLASS_PROCESSOR 0x0b -#define PCI_CLASS_PROCESSOR_386 0x0b00 -#define PCI_CLASS_PROCESSOR_486 0x0b01 -#define PCI_CLASS_PROCESSOR_PENTIUM 0x0b02 -#define PCI_CLASS_PROCESSOR_ALPHA 0x0b10 -#define PCI_CLASS_PROCESSOR_POWERPC 0x0b20 -#define PCI_CLASS_PROCESSOR_MIPS 0x0b30 -#define PCI_CLASS_PROCESSOR_CO 0x0b40 - -#define PCI_BASE_CLASS_SERIAL 0x0c -#define PCI_CLASS_SERIAL_FIREWIRE 0x0c00 -#define PCI_CLASS_SERIAL_FIREWIRE_OHCI 0x0c0010 -#define PCI_CLASS_SERIAL_ACCESS 0x0c01 -#define PCI_CLASS_SERIAL_SSA 0x0c02 -#define PCI_CLASS_SERIAL_USB 0x0c03 -#define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300 -#define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310 -#define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320 -#define PCI_CLASS_SERIAL_USB_XHCI 0x0c0330 -#define PCI_CLASS_SERIAL_FIBER 0x0c04 -#define PCI_CLASS_SERIAL_SMBUS 0x0c05 - -#define PCI_BASE_CLASS_WIRELESS 0x0d -#define PCI_CLASS_WIRELESS_RF_CONTROLLER 0x0d10 -#define PCI_CLASS_WIRELESS_WHCI 0x0d1010 - -#define PCI_BASE_CLASS_INTELLIGENT 0x0e -#define PCI_CLASS_INTELLIGENT_I2O 0x0e00 - -#define PCI_BASE_CLASS_SATELLITE 0x0f -#define PCI_CLASS_SATELLITE_TV 0x0f00 -#define PCI_CLASS_SATELLITE_AUDIO 0x0f01 -#define PCI_CLASS_SATELLITE_VOICE 0x0f03 -#define PCI_CLASS_SATELLITE_DATA 0x0f04 - -#define PCI_BASE_CLASS_CRYPT 0x10 -#define PCI_CLASS_CRYPT_NETWORK 0x1000 -#define PCI_CLASS_CRYPT_ENTERTAINMENT 0x1001 -#define PCI_CLASS_CRYPT_OTHER 0x1080 - -#define PCI_BASE_CLASS_SIGNAL_PROCESSING 0x11 -#define PCI_CLASS_SP_DPIO 0x1100 -#define PCI_CLASS_SP_OTHER 0x1180 - -#define PCI_CLASS_OTHERS 0xff - -/* Vendors and devices. Sort key: vendor first, device next. */ - -#define PCI_VENDOR_ID_TTTECH 0x0357 -#define PCI_DEVICE_ID_TTTECH_MC322 0x000a - -#define PCI_VENDOR_ID_DYNALINK 0x0675 -#define PCI_DEVICE_ID_DYNALINK_IS64PH 0x1702 - -#define PCI_VENDOR_ID_BERKOM 0x0871 -#define PCI_DEVICE_ID_BERKOM_A1T 0xffa1 -#define PCI_DEVICE_ID_BERKOM_T_CONCEPT 0xffa2 -#define PCI_DEVICE_ID_BERKOM_A4T 0xffa4 -#define PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO 0xffa8 - -#define PCI_VENDOR_ID_COMPAQ 0x0e11 -#define PCI_DEVICE_ID_COMPAQ_TOKENRING 0x0508 -#define PCI_DEVICE_ID_COMPAQ_TACHYON 0xa0fc -#define PCI_DEVICE_ID_COMPAQ_SMART2P 0xae10 -#define PCI_DEVICE_ID_COMPAQ_NETEL100 0xae32 -#define PCI_DEVICE_ID_COMPAQ_NETEL10 0xae34 -#define PCI_DEVICE_ID_COMPAQ_TRIFLEX_IDE 0xae33 -#define PCI_DEVICE_ID_COMPAQ_NETFLEX3I 0xae35 -#define PCI_DEVICE_ID_COMPAQ_NETEL100D 0xae40 -#define PCI_DEVICE_ID_COMPAQ_NETEL100PI 0xae43 -#define PCI_DEVICE_ID_COMPAQ_NETEL100I 0xb011 -#define PCI_DEVICE_ID_COMPAQ_CISS 0xb060 -#define PCI_DEVICE_ID_COMPAQ_CISSB 0xb178 -#define PCI_DEVICE_ID_COMPAQ_CISSC 0x46 -#define PCI_DEVICE_ID_COMPAQ_THUNDER 0xf130 -#define PCI_DEVICE_ID_COMPAQ_NETFLEX3B 0xf150 - -#define PCI_VENDOR_ID_NCR 0x1000 -#define PCI_VENDOR_ID_LSI_LOGIC 0x1000 -#define PCI_DEVICE_ID_NCR_53C810 0x0001 -#define PCI_DEVICE_ID_NCR_53C820 0x0002 -#define PCI_DEVICE_ID_NCR_53C825 0x0003 -#define PCI_DEVICE_ID_NCR_53C815 0x0004 -#define PCI_DEVICE_ID_LSI_53C810AP 0x0005 -#define PCI_DEVICE_ID_NCR_53C860 0x0006 -#define PCI_DEVICE_ID_LSI_53C1510 0x000a -#define PCI_DEVICE_ID_NCR_53C896 0x000b -#define PCI_DEVICE_ID_NCR_53C895 0x000c -#define PCI_DEVICE_ID_NCR_53C885 0x000d -#define PCI_DEVICE_ID_NCR_53C875 0x000f -#define PCI_DEVICE_ID_NCR_53C1510 0x0010 -#define PCI_DEVICE_ID_LSI_53C895A 0x0012 -#define PCI_DEVICE_ID_LSI_53C875A 0x0013 -#define PCI_DEVICE_ID_LSI_53C1010_33 0x0020 -#define PCI_DEVICE_ID_LSI_53C1010_66 0x0021 -#define PCI_DEVICE_ID_LSI_53C1030 0x0030 -#define PCI_DEVICE_ID_LSI_1030_53C1035 0x0032 -#define PCI_DEVICE_ID_LSI_53C1035 0x0040 -#define PCI_DEVICE_ID_NCR_53C875J 0x008f -#define PCI_DEVICE_ID_LSI_FC909 0x0621 -#define PCI_DEVICE_ID_LSI_FC929 0x0622 -#define PCI_DEVICE_ID_LSI_FC929_LAN 0x0623 -#define PCI_DEVICE_ID_LSI_FC919 0x0624 -#define PCI_DEVICE_ID_LSI_FC919_LAN 0x0625 -#define PCI_DEVICE_ID_LSI_FC929X 0x0626 -#define PCI_DEVICE_ID_LSI_FC939X 0x0642 -#define PCI_DEVICE_ID_LSI_FC949X 0x0640 -#define PCI_DEVICE_ID_LSI_FC949ES 0x0646 -#define PCI_DEVICE_ID_LSI_FC919X 0x0628 -#define PCI_DEVICE_ID_NCR_YELLOWFIN 0x0701 -#define PCI_DEVICE_ID_LSI_61C102 0x0901 -#define PCI_DEVICE_ID_LSI_63C815 0x1000 -#define PCI_DEVICE_ID_LSI_SAS1064 0x0050 -#define PCI_DEVICE_ID_LSI_SAS1064R 0x0411 -#define PCI_DEVICE_ID_LSI_SAS1066 0x005E -#define PCI_DEVICE_ID_LSI_SAS1068 0x0054 -#define PCI_DEVICE_ID_LSI_SAS1064A 0x005C -#define PCI_DEVICE_ID_LSI_SAS1064E 0x0056 -#define PCI_DEVICE_ID_LSI_SAS1066E 0x005A -#define PCI_DEVICE_ID_LSI_SAS1068E 0x0058 -#define PCI_DEVICE_ID_LSI_SAS1078 0x0060 - -#define PCI_VENDOR_ID_ATI 0x1002 -/* Mach64 */ -#define PCI_DEVICE_ID_ATI_68800 0x4158 -#define PCI_DEVICE_ID_ATI_215CT222 0x4354 -#define PCI_DEVICE_ID_ATI_210888CX 0x4358 -#define PCI_DEVICE_ID_ATI_215ET222 0x4554 -/* Mach64 / Rage */ -#define PCI_DEVICE_ID_ATI_215GB 0x4742 -#define PCI_DEVICE_ID_ATI_215GD 0x4744 -#define PCI_DEVICE_ID_ATI_215GI 0x4749 -#define PCI_DEVICE_ID_ATI_215GP 0x4750 -#define PCI_DEVICE_ID_ATI_215GQ 0x4751 -#define PCI_DEVICE_ID_ATI_215XL 0x4752 -#define PCI_DEVICE_ID_ATI_215GT 0x4754 -#define PCI_DEVICE_ID_ATI_215GTB 0x4755 -#define PCI_DEVICE_ID_ATI_215_IV 0x4756 -#define PCI_DEVICE_ID_ATI_215_IW 0x4757 -#define PCI_DEVICE_ID_ATI_215_IZ 0x475A -#define PCI_DEVICE_ID_ATI_210888GX 0x4758 -#define PCI_DEVICE_ID_ATI_215_LB 0x4c42 -#define PCI_DEVICE_ID_ATI_215_LD 0x4c44 -#define PCI_DEVICE_ID_ATI_215_LG 0x4c47 -#define PCI_DEVICE_ID_ATI_215_LI 0x4c49 -#define PCI_DEVICE_ID_ATI_215_LM 0x4c4D -#define PCI_DEVICE_ID_ATI_215_LN 0x4c4E -#define PCI_DEVICE_ID_ATI_215_LR 0x4c52 -#define PCI_DEVICE_ID_ATI_215_LS 0x4c53 -#define PCI_DEVICE_ID_ATI_264_LT 0x4c54 -/* Mach64 VT */ -#define PCI_DEVICE_ID_ATI_264VT 0x5654 -#define PCI_DEVICE_ID_ATI_264VU 0x5655 -#define PCI_DEVICE_ID_ATI_264VV 0x5656 -/* Rage128 GL */ -#define PCI_DEVICE_ID_ATI_RAGE128_RE 0x5245 -#define PCI_DEVICE_ID_ATI_RAGE128_RF 0x5246 -#define PCI_DEVICE_ID_ATI_RAGE128_RG 0x5247 -/* Rage128 VR */ -#define PCI_DEVICE_ID_ATI_RAGE128_RK 0x524b -#define PCI_DEVICE_ID_ATI_RAGE128_RL 0x524c -#define PCI_DEVICE_ID_ATI_RAGE128_SE 0x5345 -#define PCI_DEVICE_ID_ATI_RAGE128_SF 0x5346 -#define PCI_DEVICE_ID_ATI_RAGE128_SG 0x5347 -#define PCI_DEVICE_ID_ATI_RAGE128_SH 0x5348 -#define PCI_DEVICE_ID_ATI_RAGE128_SK 0x534b -#define PCI_DEVICE_ID_ATI_RAGE128_SL 0x534c -#define PCI_DEVICE_ID_ATI_RAGE128_SM 0x534d -#define PCI_DEVICE_ID_ATI_RAGE128_SN 0x534e -/* Rage128 Ultra */ -#define PCI_DEVICE_ID_ATI_RAGE128_TF 0x5446 -#define PCI_DEVICE_ID_ATI_RAGE128_TL 0x544c -#define PCI_DEVICE_ID_ATI_RAGE128_TR 0x5452 -#define PCI_DEVICE_ID_ATI_RAGE128_TS 0x5453 -#define PCI_DEVICE_ID_ATI_RAGE128_TT 0x5454 -#define PCI_DEVICE_ID_ATI_RAGE128_TU 0x5455 -/* Rage128 M3 */ -#define PCI_DEVICE_ID_ATI_RAGE128_LE 0x4c45 -#define PCI_DEVICE_ID_ATI_RAGE128_LF 0x4c46 -/* Rage128 M4 */ -#define PCI_DEVICE_ID_ATI_RAGE128_MF 0x4d46 -#define PCI_DEVICE_ID_ATI_RAGE128_ML 0x4d4c -/* Rage128 Pro GL */ -#define PCI_DEVICE_ID_ATI_RAGE128_PA 0x5041 -#define PCI_DEVICE_ID_ATI_RAGE128_PB 0x5042 -#define PCI_DEVICE_ID_ATI_RAGE128_PC 0x5043 -#define PCI_DEVICE_ID_ATI_RAGE128_PD 0x5044 -#define PCI_DEVICE_ID_ATI_RAGE128_PE 0x5045 -#define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046 -/* Rage128 Pro VR */ -#define PCI_DEVICE_ID_ATI_RAGE128_PG 0x5047 -#define PCI_DEVICE_ID_ATI_RAGE128_PH 0x5048 -#define PCI_DEVICE_ID_ATI_RAGE128_PI 0x5049 -#define PCI_DEVICE_ID_ATI_RAGE128_PJ 0x504A -#define PCI_DEVICE_ID_ATI_RAGE128_PK 0x504B -#define PCI_DEVICE_ID_ATI_RAGE128_PL 0x504C -#define PCI_DEVICE_ID_ATI_RAGE128_PM 0x504D -#define PCI_DEVICE_ID_ATI_RAGE128_PN 0x504E -#define PCI_DEVICE_ID_ATI_RAGE128_PO 0x504F -#define PCI_DEVICE_ID_ATI_RAGE128_PP 0x5050 -#define PCI_DEVICE_ID_ATI_RAGE128_PQ 0x5051 -#define PCI_DEVICE_ID_ATI_RAGE128_PR 0x5052 -#define PCI_DEVICE_ID_ATI_RAGE128_PS 0x5053 -#define PCI_DEVICE_ID_ATI_RAGE128_PT 0x5054 -#define PCI_DEVICE_ID_ATI_RAGE128_PU 0x5055 -#define PCI_DEVICE_ID_ATI_RAGE128_PV 0x5056 -#define PCI_DEVICE_ID_ATI_RAGE128_PW 0x5057 -#define PCI_DEVICE_ID_ATI_RAGE128_PX 0x5058 -/* Rage128 M4 */ -/* Radeon R100 */ -#define PCI_DEVICE_ID_ATI_RADEON_QD 0x5144 -#define PCI_DEVICE_ID_ATI_RADEON_QE 0x5145 -#define PCI_DEVICE_ID_ATI_RADEON_QF 0x5146 -#define PCI_DEVICE_ID_ATI_RADEON_QG 0x5147 -/* Radeon RV100 (VE) */ -#define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159 -#define PCI_DEVICE_ID_ATI_RADEON_QZ 0x515a -/* Radeon R200 (8500) */ -#define PCI_DEVICE_ID_ATI_RADEON_QL 0x514c -#define PCI_DEVICE_ID_ATI_RADEON_QN 0x514e -#define PCI_DEVICE_ID_ATI_RADEON_QO 0x514f -#define PCI_DEVICE_ID_ATI_RADEON_Ql 0x516c -#define PCI_DEVICE_ID_ATI_RADEON_BB 0x4242 -/* Radeon R200 (9100) */ -#define PCI_DEVICE_ID_ATI_RADEON_QM 0x514d -/* Radeon RV200 (7500) */ -#define PCI_DEVICE_ID_ATI_RADEON_QW 0x5157 -#define PCI_DEVICE_ID_ATI_RADEON_QX 0x5158 -/* Radeon NV-100 */ -/* Radeon RV250 (9000) */ -#define PCI_DEVICE_ID_ATI_RADEON_Id 0x4964 -#define PCI_DEVICE_ID_ATI_RADEON_Ie 0x4965 -#define PCI_DEVICE_ID_ATI_RADEON_If 0x4966 -#define PCI_DEVICE_ID_ATI_RADEON_Ig 0x4967 -/* Radeon RV280 (9200) */ -#define PCI_DEVICE_ID_ATI_RADEON_Ya 0x5961 -#define PCI_DEVICE_ID_ATI_RADEON_Yd 0x5964 -/* Radeon R300 (9500) */ -/* Radeon R300 (9700) */ -#define PCI_DEVICE_ID_ATI_RADEON_ND 0x4e44 -#define PCI_DEVICE_ID_ATI_RADEON_NE 0x4e45 -#define PCI_DEVICE_ID_ATI_RADEON_NF 0x4e46 -#define PCI_DEVICE_ID_ATI_RADEON_NG 0x4e47 -/* Radeon R350 (9800) */ -/* Radeon RV350 (9600) */ -/* Radeon M6 */ -#define PCI_DEVICE_ID_ATI_RADEON_LY 0x4c59 -#define PCI_DEVICE_ID_ATI_RADEON_LZ 0x4c5a -/* Radeon M7 */ -#define PCI_DEVICE_ID_ATI_RADEON_LW 0x4c57 -#define PCI_DEVICE_ID_ATI_RADEON_LX 0x4c58 -/* Radeon M9 */ -#define PCI_DEVICE_ID_ATI_RADEON_Ld 0x4c64 -#define PCI_DEVICE_ID_ATI_RADEON_Le 0x4c65 -#define PCI_DEVICE_ID_ATI_RADEON_Lf 0x4c66 -#define PCI_DEVICE_ID_ATI_RADEON_Lg 0x4c67 -/* Radeon */ -/* RadeonIGP */ -#define PCI_DEVICE_ID_ATI_RS100 0xcab0 -#define PCI_DEVICE_ID_ATI_RS200 0xcab2 -#define PCI_DEVICE_ID_ATI_RS200_B 0xcbb2 -#define PCI_DEVICE_ID_ATI_RS250 0xcab3 -#define PCI_DEVICE_ID_ATI_RS300_100 0x5830 -#define PCI_DEVICE_ID_ATI_RS300_133 0x5831 -#define PCI_DEVICE_ID_ATI_RS300_166 0x5832 -#define PCI_DEVICE_ID_ATI_RS300_200 0x5833 -#define PCI_DEVICE_ID_ATI_RS350_100 0x7830 -#define PCI_DEVICE_ID_ATI_RS350_133 0x7831 -#define PCI_DEVICE_ID_ATI_RS350_166 0x7832 -#define PCI_DEVICE_ID_ATI_RS350_200 0x7833 -#define PCI_DEVICE_ID_ATI_RS400_100 0x5a30 -#define PCI_DEVICE_ID_ATI_RS400_133 0x5a31 -#define PCI_DEVICE_ID_ATI_RS400_166 0x5a32 -#define PCI_DEVICE_ID_ATI_RS400_200 0x5a33 -#define PCI_DEVICE_ID_ATI_RS480 0x5950 -/* ATI IXP Chipset */ -#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349 -#define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353 -#define PCI_DEVICE_ID_ATI_IXP300_SMBUS 0x4363 -#define PCI_DEVICE_ID_ATI_IXP300_IDE 0x4369 -#define PCI_DEVICE_ID_ATI_IXP300_SATA 0x436e -#define PCI_DEVICE_ID_ATI_IXP400_SMBUS 0x4372 -#define PCI_DEVICE_ID_ATI_IXP400_IDE 0x4376 -#define PCI_DEVICE_ID_ATI_IXP400_SATA 0x4379 -#define PCI_DEVICE_ID_ATI_IXP400_SATA2 0x437a -#define PCI_DEVICE_ID_ATI_IXP600_SATA 0x4380 -#define PCI_DEVICE_ID_ATI_SBX00_SMBUS 0x4385 -#define PCI_DEVICE_ID_ATI_IXP600_IDE 0x438c -#define PCI_DEVICE_ID_ATI_IXP700_SATA 0x4390 -#define PCI_DEVICE_ID_ATI_IXP700_IDE 0x439c - -#define PCI_VENDOR_ID_VLSI 0x1004 -#define PCI_DEVICE_ID_VLSI_82C592 0x0005 -#define PCI_DEVICE_ID_VLSI_82C593 0x0006 -#define PCI_DEVICE_ID_VLSI_82C594 0x0007 -#define PCI_DEVICE_ID_VLSI_82C597 0x0009 -#define PCI_DEVICE_ID_VLSI_82C541 0x000c -#define PCI_DEVICE_ID_VLSI_82C543 0x000d -#define PCI_DEVICE_ID_VLSI_82C532 0x0101 -#define PCI_DEVICE_ID_VLSI_82C534 0x0102 -#define PCI_DEVICE_ID_VLSI_82C535 0x0104 -#define PCI_DEVICE_ID_VLSI_82C147 0x0105 -#define PCI_DEVICE_ID_VLSI_VAS96011 0x0702 - -/* AMD RD890 Chipset */ -#define PCI_DEVICE_ID_RD890_IOMMU 0x5a23 - -#define PCI_VENDOR_ID_ADL 0x1005 -#define PCI_DEVICE_ID_ADL_2301 0x2301 - -#define PCI_VENDOR_ID_NS 0x100b -#define PCI_DEVICE_ID_NS_87415 0x0002 -#define PCI_DEVICE_ID_NS_87560_LIO 0x000e -#define PCI_DEVICE_ID_NS_87560_USB 0x0012 -#define PCI_DEVICE_ID_NS_83815 0x0020 -#define PCI_DEVICE_ID_NS_83820 0x0022 -#define PCI_DEVICE_ID_NS_CS5535_ISA 0x002b -#define PCI_DEVICE_ID_NS_CS5535_IDE 0x002d -#define PCI_DEVICE_ID_NS_CS5535_AUDIO 0x002e -#define PCI_DEVICE_ID_NS_CS5535_USB 0x002f -#define PCI_DEVICE_ID_NS_GX_VIDEO 0x0030 -#define PCI_DEVICE_ID_NS_SATURN 0x0035 -#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 -#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 -#define PCI_DEVICE_ID_NS_SCx200_IDE 0x0502 -#define PCI_DEVICE_ID_NS_SCx200_AUDIO 0x0503 -#define PCI_DEVICE_ID_NS_SCx200_VIDEO 0x0504 -#define PCI_DEVICE_ID_NS_SCx200_XBUS 0x0505 -#define PCI_DEVICE_ID_NS_SC1100_BRIDGE 0x0510 -#define PCI_DEVICE_ID_NS_SC1100_SMI 0x0511 -#define PCI_DEVICE_ID_NS_SC1100_XBUS 0x0515 -#define PCI_DEVICE_ID_NS_87410 0xd001 - -#define PCI_DEVICE_ID_NS_GX_HOST_BRIDGE 0x0028 - -#define PCI_VENDOR_ID_TSENG 0x100c -#define PCI_DEVICE_ID_TSENG_W32P_2 0x3202 -#define PCI_DEVICE_ID_TSENG_W32P_b 0x3205 -#define PCI_DEVICE_ID_TSENG_W32P_c 0x3206 -#define PCI_DEVICE_ID_TSENG_W32P_d 0x3207 -#define PCI_DEVICE_ID_TSENG_ET6000 0x3208 - -#define PCI_VENDOR_ID_WEITEK 0x100e -#define PCI_DEVICE_ID_WEITEK_P9000 0x9001 -#define PCI_DEVICE_ID_WEITEK_P9100 0x9100 - -#define PCI_VENDOR_ID_DEC 0x1011 -#define PCI_DEVICE_ID_DEC_BRD 0x0001 -#define PCI_DEVICE_ID_DEC_TULIP 0x0002 -#define PCI_DEVICE_ID_DEC_TGA 0x0004 -#define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009 -#define PCI_DEVICE_ID_DEC_TGA2 0x000D -#define PCI_DEVICE_ID_DEC_FDDI 0x000F -#define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014 -#define PCI_DEVICE_ID_DEC_21142 0x0019 -#define PCI_DEVICE_ID_DEC_21052 0x0021 -#define PCI_DEVICE_ID_DEC_21150 0x0022 -#define PCI_DEVICE_ID_DEC_21152 0x0024 -#define PCI_DEVICE_ID_DEC_21153 0x0025 -#define PCI_DEVICE_ID_DEC_21154 0x0026 -#define PCI_DEVICE_ID_DEC_21285 0x1065 -#define PCI_DEVICE_ID_COMPAQ_42XX 0x0046 - -#define PCI_VENDOR_ID_CIRRUS 0x1013 -#define PCI_DEVICE_ID_CIRRUS_7548 0x0038 -#define PCI_DEVICE_ID_CIRRUS_5430 0x00a0 -#define PCI_DEVICE_ID_CIRRUS_5434_4 0x00a4 -#define PCI_DEVICE_ID_CIRRUS_5434_8 0x00a8 -#define PCI_DEVICE_ID_CIRRUS_5436 0x00ac -#define PCI_DEVICE_ID_CIRRUS_5446 0x00b8 -#define PCI_DEVICE_ID_CIRRUS_5480 0x00bc -#define PCI_DEVICE_ID_CIRRUS_5462 0x00d0 -#define PCI_DEVICE_ID_CIRRUS_5464 0x00d4 -#define PCI_DEVICE_ID_CIRRUS_5465 0x00d6 -#define PCI_DEVICE_ID_CIRRUS_6729 0x1100 -#define PCI_DEVICE_ID_CIRRUS_6832 0x1110 -#define PCI_DEVICE_ID_CIRRUS_7543 0x1202 -#define PCI_DEVICE_ID_CIRRUS_4610 0x6001 -#define PCI_DEVICE_ID_CIRRUS_4612 0x6003 -#define PCI_DEVICE_ID_CIRRUS_4615 0x6004 - -#define PCI_VENDOR_ID_IBM 0x1014 -#define PCI_DEVICE_ID_IBM_TR 0x0018 -#define PCI_DEVICE_ID_IBM_TR_WAKE 0x003e -#define PCI_DEVICE_ID_IBM_CPC710_PCI64 0x00fc -#define PCI_DEVICE_ID_IBM_SNIPE 0x0180 -#define PCI_DEVICE_ID_IBM_CITRINE 0x028C -#define PCI_DEVICE_ID_IBM_GEMSTONE 0xB166 -#define PCI_DEVICE_ID_IBM_OBSIDIAN 0x02BD -#define PCI_DEVICE_ID_IBM_ICOM_DEV_ID_1 0x0031 -#define PCI_DEVICE_ID_IBM_ICOM_DEV_ID_2 0x0219 -#define PCI_DEVICE_ID_IBM_ICOM_V2_TWO_PORTS_RVX 0x021A -#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM 0x0251 -#define PCI_DEVICE_ID_IBM_ICOM_V2_ONE_PORT_RVX_ONE_PORT_MDM_PCIE 0x0361 -#define PCI_DEVICE_ID_IBM_ICOM_FOUR_PORT_MODEL 0x252 - -#define PCI_SUBVENDOR_ID_IBM 0x1014 -#define PCI_SUBDEVICE_ID_IBM_SATURN_SERIAL_ONE_PORT 0x03d4 - -#define PCI_VENDOR_ID_UNISYS 0x1018 -#define PCI_DEVICE_ID_UNISYS_DMA_DIRECTOR 0x001C - -#define PCI_VENDOR_ID_COMPEX2 0x101a /* pci.ids says "AT&T GIS (NCR)" */ -#define PCI_DEVICE_ID_COMPEX2_100VG 0x0005 - -#define PCI_VENDOR_ID_WD 0x101c -#define PCI_DEVICE_ID_WD_90C 0xc24a - -#define PCI_VENDOR_ID_AMI 0x101e -#define PCI_DEVICE_ID_AMI_MEGARAID3 0x1960 -#define PCI_DEVICE_ID_AMI_MEGARAID 0x9010 -#define PCI_DEVICE_ID_AMI_MEGARAID2 0x9060 - -#define PCI_VENDOR_ID_AMD 0x1022 -#define PCI_DEVICE_ID_AMD_K8_NB 0x1100 -#define PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP 0x1101 -#define PCI_DEVICE_ID_AMD_K8_NB_MEMCTL 0x1102 -#define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103 -#define PCI_DEVICE_ID_AMD_10H_NB_HT 0x1200 -#define PCI_DEVICE_ID_AMD_10H_NB_MAP 0x1201 -#define PCI_DEVICE_ID_AMD_10H_NB_DRAM 0x1202 -#define PCI_DEVICE_ID_AMD_10H_NB_MISC 0x1203 -#define PCI_DEVICE_ID_AMD_10H_NB_LINK 0x1204 -#define PCI_DEVICE_ID_AMD_11H_NB_HT 0x1300 -#define PCI_DEVICE_ID_AMD_11H_NB_MAP 0x1301 -#define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302 -#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303 -#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304 -#define PCI_DEVICE_ID_AMD_15H_NB_F0 0x1600 -#define PCI_DEVICE_ID_AMD_15H_NB_F1 0x1601 -#define PCI_DEVICE_ID_AMD_15H_NB_F2 0x1602 -#define PCI_DEVICE_ID_AMD_15H_NB_F3 0x1603 -#define PCI_DEVICE_ID_AMD_15H_NB_F4 0x1604 -#define PCI_DEVICE_ID_AMD_15H_NB_F5 0x1605 -#define PCI_DEVICE_ID_AMD_CNB17H_F3 0x1703 -#define PCI_DEVICE_ID_AMD_LANCE 0x2000 -#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 -#define PCI_DEVICE_ID_AMD_SCSI 0x2020 -#define PCI_DEVICE_ID_AMD_SERENADE 0x36c0 -#define PCI_DEVICE_ID_AMD_FE_GATE_7006 0x7006 -#define PCI_DEVICE_ID_AMD_FE_GATE_7007 0x7007 -#define PCI_DEVICE_ID_AMD_FE_GATE_700C 0x700C -#define PCI_DEVICE_ID_AMD_FE_GATE_700E 0x700E -#define PCI_DEVICE_ID_AMD_COBRA_7401 0x7401 -#define PCI_DEVICE_ID_AMD_VIPER_7409 0x7409 -#define PCI_DEVICE_ID_AMD_VIPER_740B 0x740B -#define PCI_DEVICE_ID_AMD_VIPER_7410 0x7410 -#define PCI_DEVICE_ID_AMD_VIPER_7411 0x7411 -#define PCI_DEVICE_ID_AMD_VIPER_7413 0x7413 -#define PCI_DEVICE_ID_AMD_VIPER_7440 0x7440 -#define PCI_DEVICE_ID_AMD_OPUS_7441 0x7441 -#define PCI_DEVICE_ID_AMD_OPUS_7443 0x7443 -#define PCI_DEVICE_ID_AMD_VIPER_7443 0x7443 -#define PCI_DEVICE_ID_AMD_OPUS_7445 0x7445 -#define PCI_DEVICE_ID_AMD_8111_PCI 0x7460 -#define PCI_DEVICE_ID_AMD_8111_LPC 0x7468 -#define PCI_DEVICE_ID_AMD_8111_IDE 0x7469 -#define PCI_DEVICE_ID_AMD_8111_SMBUS2 0x746a -#define PCI_DEVICE_ID_AMD_8111_SMBUS 0x746b -#define PCI_DEVICE_ID_AMD_8111_AUDIO 0x746d -#define PCI_DEVICE_ID_AMD_8151_0 0x7454 -#define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 -#define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 -#define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458 -#define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS 0x780b -#define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F -#define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090 -#define PCI_DEVICE_ID_AMD_CS5536_FLASH 0x2091 -#define PCI_DEVICE_ID_AMD_CS5536_AUDIO 0x2093 -#define PCI_DEVICE_ID_AMD_CS5536_OHC 0x2094 -#define PCI_DEVICE_ID_AMD_CS5536_EHC 0x2095 -#define PCI_DEVICE_ID_AMD_CS5536_UDC 0x2096 -#define PCI_DEVICE_ID_AMD_CS5536_UOC 0x2097 -#define PCI_DEVICE_ID_AMD_CS5536_IDE 0x209A -#define PCI_DEVICE_ID_AMD_LX_VIDEO 0x2081 -#define PCI_DEVICE_ID_AMD_LX_AES 0x2082 -#define PCI_DEVICE_ID_AMD_HUDSON2_IDE 0x780c -#define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE 0x7800 - -#define PCI_VENDOR_ID_TRIDENT 0x1023 -#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000 -#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001 -#define PCI_DEVICE_ID_TRIDENT_9320 0x9320 -#define PCI_DEVICE_ID_TRIDENT_9388 0x9388 -#define PCI_DEVICE_ID_TRIDENT_9397 0x9397 -#define PCI_DEVICE_ID_TRIDENT_939A 0x939A -#define PCI_DEVICE_ID_TRIDENT_9520 0x9520 -#define PCI_DEVICE_ID_TRIDENT_9525 0x9525 -#define PCI_DEVICE_ID_TRIDENT_9420 0x9420 -#define PCI_DEVICE_ID_TRIDENT_9440 0x9440 -#define PCI_DEVICE_ID_TRIDENT_9660 0x9660 -#define PCI_DEVICE_ID_TRIDENT_9750 0x9750 -#define PCI_DEVICE_ID_TRIDENT_9850 0x9850 -#define PCI_DEVICE_ID_TRIDENT_9880 0x9880 -#define PCI_DEVICE_ID_TRIDENT_8400 0x8400 -#define PCI_DEVICE_ID_TRIDENT_8420 0x8420 -#define PCI_DEVICE_ID_TRIDENT_8500 0x8500 - -#define PCI_VENDOR_ID_AI 0x1025 -#define PCI_DEVICE_ID_AI_M1435 0x1435 - -#define PCI_VENDOR_ID_DELL 0x1028 -#define PCI_DEVICE_ID_DELL_RACIII 0x0008 -#define PCI_DEVICE_ID_DELL_RAC4 0x0012 -#define PCI_DEVICE_ID_DELL_PERC5 0x0015 - -#define PCI_VENDOR_ID_MATROX 0x102B -#define PCI_DEVICE_ID_MATROX_MGA_2 0x0518 -#define PCI_DEVICE_ID_MATROX_MIL 0x0519 -#define PCI_DEVICE_ID_MATROX_MYS 0x051A -#define PCI_DEVICE_ID_MATROX_MIL_2 0x051b -#define PCI_DEVICE_ID_MATROX_MYS_AGP 0x051e -#define PCI_DEVICE_ID_MATROX_MIL_2_AGP 0x051f -#define PCI_DEVICE_ID_MATROX_MGA_IMP 0x0d10 -#define PCI_DEVICE_ID_MATROX_G100_MM 0x1000 -#define PCI_DEVICE_ID_MATROX_G100_AGP 0x1001 -#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520 -#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521 -#define PCI_DEVICE_ID_MATROX_G400 0x0525 -#define PCI_DEVICE_ID_MATROX_G200EV_PCI 0x0530 -#define PCI_DEVICE_ID_MATROX_G550 0x2527 -#define PCI_DEVICE_ID_MATROX_VIA 0x4536 - -#define PCI_VENDOR_ID_MOBILITY_ELECTRONICS 0x14f2 - -#define PCI_VENDOR_ID_CT 0x102c -#define PCI_DEVICE_ID_CT_69000 0x00c0 -#define PCI_DEVICE_ID_CT_65545 0x00d8 -#define PCI_DEVICE_ID_CT_65548 0x00dc -#define PCI_DEVICE_ID_CT_65550 0x00e0 -#define PCI_DEVICE_ID_CT_65554 0x00e4 -#define PCI_DEVICE_ID_CT_65555 0x00e5 - -#define PCI_VENDOR_ID_MIRO 0x1031 -#define PCI_DEVICE_ID_MIRO_36050 0x5601 -#define PCI_DEVICE_ID_MIRO_DC10PLUS 0x7efe -#define PCI_DEVICE_ID_MIRO_DC30PLUS 0xd801 - -#define PCI_VENDOR_ID_NEC 0x1033 -#define PCI_DEVICE_ID_NEC_CBUS_1 0x0001 /* PCI-Cbus Bridge */ -#define PCI_DEVICE_ID_NEC_LOCAL 0x0002 /* Local Bridge */ -#define PCI_DEVICE_ID_NEC_ATM 0x0003 /* ATM LAN Controller */ -#define PCI_DEVICE_ID_NEC_R4000 0x0004 /* R4000 Bridge */ -#define PCI_DEVICE_ID_NEC_486 0x0005 /* 486 Like Peripheral Bus Bridge */ -#define PCI_DEVICE_ID_NEC_ACCEL_1 0x0006 /* Graphic Accelerator */ -#define PCI_DEVICE_ID_NEC_UXBUS 0x0007 /* UX-Bus Bridge */ -#define PCI_DEVICE_ID_NEC_ACCEL_2 0x0008 /* Graphic Accelerator */ -#define PCI_DEVICE_ID_NEC_GRAPH 0x0009 /* PCI-CoreGraph Bridge */ -#define PCI_DEVICE_ID_NEC_VL 0x0016 /* PCI-VL Bridge */ -#define PCI_DEVICE_ID_NEC_STARALPHA2 0x002c /* STAR ALPHA2 */ -#define PCI_DEVICE_ID_NEC_CBUS_2 0x002d /* PCI-Cbus Bridge */ -#define PCI_DEVICE_ID_NEC_USB 0x0035 /* PCI-USB Host */ -#define PCI_DEVICE_ID_NEC_CBUS_3 0x003b -#define PCI_DEVICE_ID_NEC_NAPCCARD 0x003e -#define PCI_DEVICE_ID_NEC_PCX2 0x0046 /* PowerVR */ -#define PCI_DEVICE_ID_NEC_VRC5476 0x009b -#define PCI_DEVICE_ID_NEC_VRC4173 0x00a5 -#define PCI_DEVICE_ID_NEC_VRC5477_AC97 0x00a6 -#define PCI_DEVICE_ID_NEC_PC9821CS01 0x800c /* PC-9821-CS01 */ -#define PCI_DEVICE_ID_NEC_PC9821NRB06 0x800d /* PC-9821NR-B06 */ - -#define PCI_VENDOR_ID_FD 0x1036 -#define PCI_DEVICE_ID_FD_36C70 0x0000 - -#define PCI_VENDOR_ID_SI 0x1039 -#define PCI_DEVICE_ID_SI_5591_AGP 0x0001 -#define PCI_DEVICE_ID_SI_6202 0x0002 -#define PCI_DEVICE_ID_SI_503 0x0008 -#define PCI_DEVICE_ID_SI_ACPI 0x0009 -#define PCI_DEVICE_ID_SI_SMBUS 0x0016 -#define PCI_DEVICE_ID_SI_LPC 0x0018 -#define PCI_DEVICE_ID_SI_5597_VGA 0x0200 -#define PCI_DEVICE_ID_SI_6205 0x0205 -#define PCI_DEVICE_ID_SI_501 0x0406 -#define PCI_DEVICE_ID_SI_496 0x0496 -#define PCI_DEVICE_ID_SI_300 0x0300 -#define PCI_DEVICE_ID_SI_315H 0x0310 -#define PCI_DEVICE_ID_SI_315 0x0315 -#define PCI_DEVICE_ID_SI_315PRO 0x0325 -#define PCI_DEVICE_ID_SI_530 0x0530 -#define PCI_DEVICE_ID_SI_540 0x0540 -#define PCI_DEVICE_ID_SI_550 0x0550 -#define PCI_DEVICE_ID_SI_540_VGA 0x5300 -#define PCI_DEVICE_ID_SI_550_VGA 0x5315 -#define PCI_DEVICE_ID_SI_620 0x0620 -#define PCI_DEVICE_ID_SI_630 0x0630 -#define PCI_DEVICE_ID_SI_633 0x0633 -#define PCI_DEVICE_ID_SI_635 0x0635 -#define PCI_DEVICE_ID_SI_640 0x0640 -#define PCI_DEVICE_ID_SI_645 0x0645 -#define PCI_DEVICE_ID_SI_646 0x0646 -#define PCI_DEVICE_ID_SI_648 0x0648 -#define PCI_DEVICE_ID_SI_650 0x0650 -#define PCI_DEVICE_ID_SI_651 0x0651 -#define PCI_DEVICE_ID_SI_655 0x0655 -#define PCI_DEVICE_ID_SI_661 0x0661 -#define PCI_DEVICE_ID_SI_730 0x0730 -#define PCI_DEVICE_ID_SI_733 0x0733 -#define PCI_DEVICE_ID_SI_630_VGA 0x6300 -#define PCI_DEVICE_ID_SI_735 0x0735 -#define PCI_DEVICE_ID_SI_740 0x0740 -#define PCI_DEVICE_ID_SI_741 0x0741 -#define PCI_DEVICE_ID_SI_745 0x0745 -#define PCI_DEVICE_ID_SI_746 0x0746 -#define PCI_DEVICE_ID_SI_755 0x0755 -#define PCI_DEVICE_ID_SI_760 0x0760 -#define PCI_DEVICE_ID_SI_900 0x0900 -#define PCI_DEVICE_ID_SI_961 0x0961 -#define PCI_DEVICE_ID_SI_962 0x0962 -#define PCI_DEVICE_ID_SI_963 0x0963 -#define PCI_DEVICE_ID_SI_965 0x0965 -#define PCI_DEVICE_ID_SI_966 0x0966 -#define PCI_DEVICE_ID_SI_968 0x0968 -#define PCI_DEVICE_ID_SI_1180 0x1180 -#define PCI_DEVICE_ID_SI_5511 0x5511 -#define PCI_DEVICE_ID_SI_5513 0x5513 -#define PCI_DEVICE_ID_SI_5517 0x5517 -#define PCI_DEVICE_ID_SI_5518 0x5518 -#define PCI_DEVICE_ID_SI_5571 0x5571 -#define PCI_DEVICE_ID_SI_5581 0x5581 -#define PCI_DEVICE_ID_SI_5582 0x5582 -#define PCI_DEVICE_ID_SI_5591 0x5591 -#define PCI_DEVICE_ID_SI_5596 0x5596 -#define PCI_DEVICE_ID_SI_5597 0x5597 -#define PCI_DEVICE_ID_SI_5598 0x5598 -#define PCI_DEVICE_ID_SI_5600 0x5600 -#define PCI_DEVICE_ID_SI_7012 0x7012 -#define PCI_DEVICE_ID_SI_7013 0x7013 -#define PCI_DEVICE_ID_SI_7016 0x7016 -#define PCI_DEVICE_ID_SI_7018 0x7018 - -#define PCI_VENDOR_ID_HP 0x103c -#define PCI_DEVICE_ID_HP_VISUALIZE_EG 0x1005 -#define PCI_DEVICE_ID_HP_VISUALIZE_FX6 0x1006 -#define PCI_DEVICE_ID_HP_VISUALIZE_FX4 0x1008 -#define PCI_DEVICE_ID_HP_VISUALIZE_FX2 0x100a -#define PCI_DEVICE_ID_HP_TACHYON 0x1028 -#define PCI_DEVICE_ID_HP_TACHLITE 0x1029 -#define PCI_DEVICE_ID_HP_J2585A 0x1030 -#define PCI_DEVICE_ID_HP_J2585B 0x1031 -#define PCI_DEVICE_ID_HP_J2973A 0x1040 -#define PCI_DEVICE_ID_HP_J2970A 0x1042 -#define PCI_DEVICE_ID_HP_DIVA 0x1048 -#define PCI_DEVICE_ID_HP_DIVA_TOSCA1 0x1049 -#define PCI_DEVICE_ID_HP_DIVA_TOSCA2 0x104A -#define PCI_DEVICE_ID_HP_DIVA_MAESTRO 0x104B -#define PCI_DEVICE_ID_HP_REO_IOC 0x10f1 -#define PCI_DEVICE_ID_HP_VISUALIZE_FXE 0x108b -#define PCI_DEVICE_ID_HP_DIVA_HALFDOME 0x1223 -#define PCI_DEVICE_ID_HP_DIVA_KEYSTONE 0x1226 -#define PCI_DEVICE_ID_HP_DIVA_POWERBAR 0x1227 -#define PCI_DEVICE_ID_HP_ZX1_IOC 0x122a -#define PCI_DEVICE_ID_HP_PCIX_LBA 0x122e -#define PCI_DEVICE_ID_HP_SX1000_IOC 0x127c -#define PCI_DEVICE_ID_HP_DIVA_EVEREST 0x1282 -#define PCI_DEVICE_ID_HP_DIVA_AUX 0x1290 -#define PCI_DEVICE_ID_HP_DIVA_RMP3 0x1301 -#define PCI_DEVICE_ID_HP_DIVA_HURRICANE 0x132a -#define PCI_DEVICE_ID_HP_CISSA 0x3220 -#define PCI_DEVICE_ID_HP_CISSC 0x3230 -#define PCI_DEVICE_ID_HP_CISSD 0x3238 -#define PCI_DEVICE_ID_HP_CISSE 0x323a -#define PCI_DEVICE_ID_HP_CISSF 0x323b -#define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031 - -#define PCI_VENDOR_ID_PCTECH 0x1042 -#define PCI_DEVICE_ID_PCTECH_RZ1000 0x1000 -#define PCI_DEVICE_ID_PCTECH_RZ1001 0x1001 -#define PCI_DEVICE_ID_PCTECH_SAMURAI_IDE 0x3020 - -#define PCI_VENDOR_ID_ASUSTEK 0x1043 -#define PCI_DEVICE_ID_ASUSTEK_0675 0x0675 - -#define PCI_VENDOR_ID_DPT 0x1044 -#define PCI_DEVICE_ID_DPT 0xa400 - -#define PCI_VENDOR_ID_OPTI 0x1045 -#define PCI_DEVICE_ID_OPTI_82C558 0xc558 -#define PCI_DEVICE_ID_OPTI_82C621 0xc621 -#define PCI_DEVICE_ID_OPTI_82C700 0xc700 -#define PCI_DEVICE_ID_OPTI_82C825 0xd568 - -#define PCI_VENDOR_ID_ELSA 0x1048 -#define PCI_DEVICE_ID_ELSA_MICROLINK 0x1000 -#define PCI_DEVICE_ID_ELSA_QS3000 0x3000 - -#define PCI_VENDOR_ID_STMICRO 0x104A -#define PCI_DEVICE_ID_STMICRO_USB_HOST 0xCC00 -#define PCI_DEVICE_ID_STMICRO_USB_OHCI 0xCC01 -#define PCI_DEVICE_ID_STMICRO_USB_OTG 0xCC02 -#define PCI_DEVICE_ID_STMICRO_UART_HWFC 0xCC03 -#define PCI_DEVICE_ID_STMICRO_UART_NO_HWFC 0xCC04 -#define PCI_DEVICE_ID_STMICRO_SOC_DMA 0xCC05 -#define PCI_DEVICE_ID_STMICRO_SATA 0xCC06 -#define PCI_DEVICE_ID_STMICRO_I2C 0xCC07 -#define PCI_DEVICE_ID_STMICRO_SPI_HS 0xCC08 -#define PCI_DEVICE_ID_STMICRO_MAC 0xCC09 -#define PCI_DEVICE_ID_STMICRO_SDIO_EMMC 0xCC0A -#define PCI_DEVICE_ID_STMICRO_SDIO 0xCC0B -#define PCI_DEVICE_ID_STMICRO_GPIO 0xCC0C -#define PCI_DEVICE_ID_STMICRO_VIP 0xCC0D -#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_DMA 0xCC0E -#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_SRCS 0xCC0F -#define PCI_DEVICE_ID_STMICRO_AUDIO_ROUTER_MSPS 0xCC10 -#define PCI_DEVICE_ID_STMICRO_CAN 0xCC11 -#define PCI_DEVICE_ID_STMICRO_MLB 0xCC12 -#define PCI_DEVICE_ID_STMICRO_DBP 0xCC13 -#define PCI_DEVICE_ID_STMICRO_SATA_PHY 0xCC14 -#define PCI_DEVICE_ID_STMICRO_ESRAM 0xCC15 -#define PCI_DEVICE_ID_STMICRO_VIC 0xCC16 - -#define PCI_VENDOR_ID_BUSLOGIC 0x104B -#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 -#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040 -#define PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT 0x8130 - -#define PCI_VENDOR_ID_TI 0x104c -#define PCI_DEVICE_ID_TI_TVP4020 0x3d07 -#define PCI_DEVICE_ID_TI_4450 0x8011 -#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 -#define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033 -#define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 -#define PCI_DEVICE_ID_TI_X515 0x8036 -#define PCI_DEVICE_ID_TI_XX12 0x8039 -#define PCI_DEVICE_ID_TI_XX12_FM 0x803b -#define PCI_DEVICE_ID_TI_XIO2000A 0x8231 -#define PCI_DEVICE_ID_TI_1130 0xac12 -#define PCI_DEVICE_ID_TI_1031 0xac13 -#define PCI_DEVICE_ID_TI_1131 0xac15 -#define PCI_DEVICE_ID_TI_1250 0xac16 -#define PCI_DEVICE_ID_TI_1220 0xac17 -#define PCI_DEVICE_ID_TI_1221 0xac19 -#define PCI_DEVICE_ID_TI_1210 0xac1a -#define PCI_DEVICE_ID_TI_1450 0xac1b -#define PCI_DEVICE_ID_TI_1225 0xac1c -#define PCI_DEVICE_ID_TI_1251A 0xac1d -#define PCI_DEVICE_ID_TI_1211 0xac1e -#define PCI_DEVICE_ID_TI_1251B 0xac1f -#define PCI_DEVICE_ID_TI_4410 0xac41 -#define PCI_DEVICE_ID_TI_4451 0xac42 -#define PCI_DEVICE_ID_TI_4510 0xac44 -#define PCI_DEVICE_ID_TI_4520 0xac46 -#define PCI_DEVICE_ID_TI_7510 0xac47 -#define PCI_DEVICE_ID_TI_7610 0xac48 -#define PCI_DEVICE_ID_TI_7410 0xac49 -#define PCI_DEVICE_ID_TI_1410 0xac50 -#define PCI_DEVICE_ID_TI_1420 0xac51 -#define PCI_DEVICE_ID_TI_1451A 0xac52 -#define PCI_DEVICE_ID_TI_1620 0xac54 -#define PCI_DEVICE_ID_TI_1520 0xac55 -#define PCI_DEVICE_ID_TI_1510 0xac56 -#define PCI_DEVICE_ID_TI_X620 0xac8d -#define PCI_DEVICE_ID_TI_X420 0xac8e -#define PCI_DEVICE_ID_TI_XX20_FM 0xac8f - -#define PCI_VENDOR_ID_SONY 0x104d - -/* Winbond have two vendor IDs! See 0x10ad as well */ -#define PCI_VENDOR_ID_WINBOND2 0x1050 -#define PCI_DEVICE_ID_WINBOND2_89C940F 0x5a5a -#define PCI_DEVICE_ID_WINBOND2_6692 0x6692 - -#define PCI_VENDOR_ID_ANIGMA 0x1051 -#define PCI_DEVICE_ID_ANIGMA_MC145575 0x0100 - -#define PCI_VENDOR_ID_EFAR 0x1055 -#define PCI_DEVICE_ID_EFAR_SLC90E66_1 0x9130 -#define PCI_DEVICE_ID_EFAR_SLC90E66_3 0x9463 - -#define PCI_VENDOR_ID_MOTOROLA 0x1057 -#define PCI_DEVICE_ID_MOTOROLA_MPC105 0x0001 -#define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002 -#define PCI_DEVICE_ID_MOTOROLA_MPC107 0x0004 -#define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801 -#define PCI_DEVICE_ID_MOTOROLA_FALCON 0x4802 -#define PCI_DEVICE_ID_MOTOROLA_HAWK 0x4803 -#define PCI_DEVICE_ID_MOTOROLA_HARRIER 0x480b -#define PCI_DEVICE_ID_MOTOROLA_MPC5200 0x5803 -#define PCI_DEVICE_ID_MOTOROLA_MPC5200B 0x5809 - -#define PCI_VENDOR_ID_PROMISE 0x105a -#define PCI_DEVICE_ID_PROMISE_20265 0x0d30 -#define PCI_DEVICE_ID_PROMISE_20267 0x4d30 -#define PCI_DEVICE_ID_PROMISE_20246 0x4d33 -#define PCI_DEVICE_ID_PROMISE_20262 0x4d38 -#define PCI_DEVICE_ID_PROMISE_20263 0x0D38 -#define PCI_DEVICE_ID_PROMISE_20268 0x4d68 -#define PCI_DEVICE_ID_PROMISE_20269 0x4d69 -#define PCI_DEVICE_ID_PROMISE_20270 0x6268 -#define PCI_DEVICE_ID_PROMISE_20271 0x6269 -#define PCI_DEVICE_ID_PROMISE_20275 0x1275 -#define PCI_DEVICE_ID_PROMISE_20276 0x5275 -#define PCI_DEVICE_ID_PROMISE_20277 0x7275 - -#define PCI_VENDOR_ID_FOXCONN 0x105b - -#define PCI_VENDOR_ID_UMC 0x1060 -#define PCI_DEVICE_ID_UMC_UM8673F 0x0101 -#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a -#define PCI_DEVICE_ID_UMC_UM8886A 0x886a - -#define PCI_VENDOR_ID_PICOPOWER 0x1066 -#define PCI_DEVICE_ID_PICOPOWER_PT86C523 0x0002 -#define PCI_DEVICE_ID_PICOPOWER_PT86C523BBP 0x8002 - -#define PCI_VENDOR_ID_MYLEX 0x1069 -#define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001 -#define PCI_DEVICE_ID_MYLEX_DAC960_PD 0x0002 -#define PCI_DEVICE_ID_MYLEX_DAC960_PG 0x0010 -#define PCI_DEVICE_ID_MYLEX_DAC960_LA 0x0020 -#define PCI_DEVICE_ID_MYLEX_DAC960_LP 0x0050 -#define PCI_DEVICE_ID_MYLEX_DAC960_BA 0xBA56 -#define PCI_DEVICE_ID_MYLEX_DAC960_GEM 0xB166 - -#define PCI_VENDOR_ID_APPLE 0x106b -#define PCI_DEVICE_ID_APPLE_BANDIT 0x0001 -#define PCI_DEVICE_ID_APPLE_HYDRA 0x000e -#define PCI_DEVICE_ID_APPLE_UNI_N_FW 0x0018 -#define PCI_DEVICE_ID_APPLE_UNI_N_AGP 0x0020 -#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC 0x0021 -#define PCI_DEVICE_ID_APPLE_UNI_N_GMACP 0x0024 -#define PCI_DEVICE_ID_APPLE_UNI_N_AGP_P 0x0027 -#define PCI_DEVICE_ID_APPLE_UNI_N_AGP15 0x002d -#define PCI_DEVICE_ID_APPLE_UNI_N_PCI15 0x002e -#define PCI_DEVICE_ID_APPLE_UNI_N_GMAC2 0x0032 -#define PCI_DEVICE_ID_APPLE_UNI_N_ATA 0x0033 -#define PCI_DEVICE_ID_APPLE_UNI_N_AGP2 0x0034 -#define PCI_DEVICE_ID_APPLE_IPID_ATA100 0x003b -#define PCI_DEVICE_ID_APPLE_K2_ATA100 0x0043 -#define PCI_DEVICE_ID_APPLE_U3_AGP 0x004b -#define PCI_DEVICE_ID_APPLE_K2_GMAC 0x004c -#define PCI_DEVICE_ID_APPLE_SH_ATA 0x0050 -#define PCI_DEVICE_ID_APPLE_SH_SUNGEM 0x0051 -#define PCI_DEVICE_ID_APPLE_U3L_AGP 0x0058 -#define PCI_DEVICE_ID_APPLE_U3H_AGP 0x0059 -#define PCI_DEVICE_ID_APPLE_U4_PCIE 0x005b -#define PCI_DEVICE_ID_APPLE_IPID2_AGP 0x0066 -#define PCI_DEVICE_ID_APPLE_IPID2_ATA 0x0069 -#define PCI_DEVICE_ID_APPLE_IPID2_FW 0x006a -#define PCI_DEVICE_ID_APPLE_IPID2_GMAC 0x006b -#define PCI_DEVICE_ID_APPLE_TIGON3 0x1645 - -#define PCI_VENDOR_ID_YAMAHA 0x1073 -#define PCI_DEVICE_ID_YAMAHA_724 0x0004 -#define PCI_DEVICE_ID_YAMAHA_724F 0x000d -#define PCI_DEVICE_ID_YAMAHA_740 0x000a -#define PCI_DEVICE_ID_YAMAHA_740C 0x000c -#define PCI_DEVICE_ID_YAMAHA_744 0x0010 -#define PCI_DEVICE_ID_YAMAHA_754 0x0012 - -#define PCI_VENDOR_ID_QLOGIC 0x1077 -#define PCI_DEVICE_ID_QLOGIC_ISP10160 0x1016 -#define PCI_DEVICE_ID_QLOGIC_ISP1020 0x1020 -#define PCI_DEVICE_ID_QLOGIC_ISP1080 0x1080 -#define PCI_DEVICE_ID_QLOGIC_ISP12160 0x1216 -#define PCI_DEVICE_ID_QLOGIC_ISP1240 0x1240 -#define PCI_DEVICE_ID_QLOGIC_ISP1280 0x1280 -#define PCI_DEVICE_ID_QLOGIC_ISP2100 0x2100 -#define PCI_DEVICE_ID_QLOGIC_ISP2200 0x2200 -#define PCI_DEVICE_ID_QLOGIC_ISP2300 0x2300 -#define PCI_DEVICE_ID_QLOGIC_ISP2312 0x2312 -#define PCI_DEVICE_ID_QLOGIC_ISP2322 0x2322 -#define PCI_DEVICE_ID_QLOGIC_ISP6312 0x6312 -#define PCI_DEVICE_ID_QLOGIC_ISP6322 0x6322 -#define PCI_DEVICE_ID_QLOGIC_ISP2422 0x2422 -#define PCI_DEVICE_ID_QLOGIC_ISP2432 0x2432 -#define PCI_DEVICE_ID_QLOGIC_ISP2512 0x2512 -#define PCI_DEVICE_ID_QLOGIC_ISP2522 0x2522 -#define PCI_DEVICE_ID_QLOGIC_ISP5422 0x5422 -#define PCI_DEVICE_ID_QLOGIC_ISP5432 0x5432 - -#define PCI_VENDOR_ID_CYRIX 0x1078 -#define PCI_DEVICE_ID_CYRIX_5510 0x0000 -#define PCI_DEVICE_ID_CYRIX_PCI_MASTER 0x0001 -#define PCI_DEVICE_ID_CYRIX_5520 0x0002 -#define PCI_DEVICE_ID_CYRIX_5530_LEGACY 0x0100 -#define PCI_DEVICE_ID_CYRIX_5530_IDE 0x0102 -#define PCI_DEVICE_ID_CYRIX_5530_AUDIO 0x0103 -#define PCI_DEVICE_ID_CYRIX_5530_VIDEO 0x0104 - -#define PCI_VENDOR_ID_CONTAQ 0x1080 -#define PCI_DEVICE_ID_CONTAQ_82C693 0xc693 - -#define PCI_VENDOR_ID_OLICOM 0x108d -#define PCI_DEVICE_ID_OLICOM_OC2325 0x0012 -#define PCI_DEVICE_ID_OLICOM_OC2183 0x0013 -#define PCI_DEVICE_ID_OLICOM_OC2326 0x0014 - -#define PCI_VENDOR_ID_SUN 0x108e -#define PCI_DEVICE_ID_SUN_EBUS 0x1000 -#define PCI_DEVICE_ID_SUN_HAPPYMEAL 0x1001 -#define PCI_DEVICE_ID_SUN_RIO_EBUS 0x1100 -#define PCI_DEVICE_ID_SUN_RIO_GEM 0x1101 -#define PCI_DEVICE_ID_SUN_RIO_1394 0x1102 -#define PCI_DEVICE_ID_SUN_RIO_USB 0x1103 -#define PCI_DEVICE_ID_SUN_GEM 0x2bad -#define PCI_DEVICE_ID_SUN_SIMBA 0x5000 -#define PCI_DEVICE_ID_SUN_PBM 0x8000 -#define PCI_DEVICE_ID_SUN_SCHIZO 0x8001 -#define PCI_DEVICE_ID_SUN_SABRE 0xa000 -#define PCI_DEVICE_ID_SUN_HUMMINGBIRD 0xa001 -#define PCI_DEVICE_ID_SUN_TOMATILLO 0xa801 -#define PCI_DEVICE_ID_SUN_CASSINI 0xabba - -#define PCI_VENDOR_ID_NI 0x1093 -#define PCI_DEVICE_ID_NI_PCI2322 0xd130 -#define PCI_DEVICE_ID_NI_PCI2324 0xd140 -#define PCI_DEVICE_ID_NI_PCI2328 0xd150 -#define PCI_DEVICE_ID_NI_PXI8422_2322 0xd190 -#define PCI_DEVICE_ID_NI_PXI8422_2324 0xd1a0 -#define PCI_DEVICE_ID_NI_PXI8420_2322 0xd1d0 -#define PCI_DEVICE_ID_NI_PXI8420_2324 0xd1e0 -#define PCI_DEVICE_ID_NI_PXI8420_2328 0xd1f0 -#define PCI_DEVICE_ID_NI_PXI8420_23216 0xd1f1 -#define PCI_DEVICE_ID_NI_PCI2322I 0xd250 -#define PCI_DEVICE_ID_NI_PCI2324I 0xd270 -#define PCI_DEVICE_ID_NI_PCI23216 0xd2b0 -#define PCI_DEVICE_ID_NI_PXI8430_2322 0x7080 -#define PCI_DEVICE_ID_NI_PCI8430_2322 0x70db -#define PCI_DEVICE_ID_NI_PXI8430_2324 0x70dd -#define PCI_DEVICE_ID_NI_PCI8430_2324 0x70df -#define PCI_DEVICE_ID_NI_PXI8430_2328 0x70e2 -#define PCI_DEVICE_ID_NI_PCI8430_2328 0x70e4 -#define PCI_DEVICE_ID_NI_PXI8430_23216 0x70e6 -#define PCI_DEVICE_ID_NI_PCI8430_23216 0x70e7 -#define PCI_DEVICE_ID_NI_PXI8432_2322 0x70e8 -#define PCI_DEVICE_ID_NI_PCI8432_2322 0x70ea -#define PCI_DEVICE_ID_NI_PXI8432_2324 0x70ec -#define PCI_DEVICE_ID_NI_PCI8432_2324 0x70ee - -#define PCI_VENDOR_ID_CMD 0x1095 -#define PCI_DEVICE_ID_CMD_643 0x0643 -#define PCI_DEVICE_ID_CMD_646 0x0646 -#define PCI_DEVICE_ID_CMD_648 0x0648 -#define PCI_DEVICE_ID_CMD_649 0x0649 - -#define PCI_DEVICE_ID_SII_680 0x0680 -#define PCI_DEVICE_ID_SII_3112 0x3112 -#define PCI_DEVICE_ID_SII_1210SA 0x0240 - -#define PCI_VENDOR_ID_BROOKTREE 0x109e -#define PCI_DEVICE_ID_BROOKTREE_878 0x0878 -#define PCI_DEVICE_ID_BROOKTREE_879 0x0879 - -#define PCI_VENDOR_ID_SGI 0x10a9 -#define PCI_DEVICE_ID_SGI_IOC3 0x0003 -#define PCI_DEVICE_ID_SGI_LITHIUM 0x1002 -#define PCI_DEVICE_ID_SGI_IOC4 0x100a - -#define PCI_VENDOR_ID_WINBOND 0x10ad -#define PCI_DEVICE_ID_WINBOND_82C105 0x0105 -#define PCI_DEVICE_ID_WINBOND_83C553 0x0565 - -#define PCI_VENDOR_ID_PLX 0x10b5 -#define PCI_DEVICE_ID_PLX_R685 0x1030 -#define PCI_DEVICE_ID_PLX_ROMULUS 0x106a -#define PCI_DEVICE_ID_PLX_SPCOM800 0x1076 -#define PCI_DEVICE_ID_PLX_1077 0x1077 -#define PCI_DEVICE_ID_PLX_SPCOM200 0x1103 -#define PCI_DEVICE_ID_PLX_DJINN_ITOO 0x1151 -#define PCI_DEVICE_ID_PLX_R753 0x1152 -#define PCI_DEVICE_ID_PLX_OLITEC 0x1187 -#define PCI_DEVICE_ID_PLX_PCI200SYN 0x3196 -#define PCI_DEVICE_ID_PLX_9030 0x9030 -#define PCI_DEVICE_ID_PLX_9050 0x9050 -#define PCI_DEVICE_ID_PLX_9056 0x9056 -#define PCI_DEVICE_ID_PLX_9080 0x9080 -#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001 - -#define PCI_VENDOR_ID_MADGE 0x10b6 -#define PCI_DEVICE_ID_MADGE_MK2 0x0002 - -#define PCI_VENDOR_ID_3COM 0x10b7 -#define PCI_DEVICE_ID_3COM_3C985 0x0001 -#define PCI_DEVICE_ID_3COM_3C940 0x1700 -#define PCI_DEVICE_ID_3COM_3C339 0x3390 -#define PCI_DEVICE_ID_3COM_3C359 0x3590 -#define PCI_DEVICE_ID_3COM_3C940B 0x80eb -#define PCI_DEVICE_ID_3COM_3CR990 0x9900 -#define PCI_DEVICE_ID_3COM_3CR990_TX_95 0x9902 -#define PCI_DEVICE_ID_3COM_3CR990_TX_97 0x9903 -#define PCI_DEVICE_ID_3COM_3CR990B 0x9904 -#define PCI_DEVICE_ID_3COM_3CR990_FX 0x9905 -#define PCI_DEVICE_ID_3COM_3CR990SVR95 0x9908 -#define PCI_DEVICE_ID_3COM_3CR990SVR97 0x9909 -#define PCI_DEVICE_ID_3COM_3CR990SVR 0x990a - -#define PCI_VENDOR_ID_AL 0x10b9 -#define PCI_DEVICE_ID_AL_M1533 0x1533 -#define PCI_DEVICE_ID_AL_M1535 0x1535 -#define PCI_DEVICE_ID_AL_M1541 0x1541 -#define PCI_DEVICE_ID_AL_M1563 0x1563 -#define PCI_DEVICE_ID_AL_M1621 0x1621 -#define PCI_DEVICE_ID_AL_M1631 0x1631 -#define PCI_DEVICE_ID_AL_M1632 0x1632 -#define PCI_DEVICE_ID_AL_M1641 0x1641 -#define PCI_DEVICE_ID_AL_M1644 0x1644 -#define PCI_DEVICE_ID_AL_M1647 0x1647 -#define PCI_DEVICE_ID_AL_M1651 0x1651 -#define PCI_DEVICE_ID_AL_M1671 0x1671 -#define PCI_DEVICE_ID_AL_M1681 0x1681 -#define PCI_DEVICE_ID_AL_M1683 0x1683 -#define PCI_DEVICE_ID_AL_M1689 0x1689 -#define PCI_DEVICE_ID_AL_M5219 0x5219 -#define PCI_DEVICE_ID_AL_M5228 0x5228 -#define PCI_DEVICE_ID_AL_M5229 0x5229 -#define PCI_DEVICE_ID_AL_M5451 0x5451 -#define PCI_DEVICE_ID_AL_M7101 0x7101 - -#define PCI_VENDOR_ID_NEOMAGIC 0x10c8 -#define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005 -#define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006 -#define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016 - -#define PCI_VENDOR_ID_TCONRAD 0x10da -#define PCI_DEVICE_ID_TCONRAD_TOKENRING 0x0508 - -#define PCI_VENDOR_ID_NVIDIA 0x10de -#define PCI_DEVICE_ID_NVIDIA_TNT 0x0020 -#define PCI_DEVICE_ID_NVIDIA_TNT2 0x0028 -#define PCI_DEVICE_ID_NVIDIA_UTNT2 0x0029 -#define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a -#define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C -#define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2 0x003e -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_ULTRA 0x0040 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800 0x0041 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_LE 0x0042 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x0045 -#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_4000 0x004E -#define PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS 0x0052 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE 0x0053 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA 0x0054 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2 0x0055 -#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059 -#define PCI_DEVICE_ID_NVIDIA_CK804_PCIE 0x005d -#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064 -#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065 -#define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM 0x0069 -#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a -#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084 -#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085 -#define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089 -#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a -#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GT 0x0090 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GTX 0x0091 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_7800 0x0098 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_7800_GTX 0x0099 -#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0 -#define PCI_DEVICE_ID_GEFORCE_6800A 0x00c1 -#define PCI_DEVICE_ID_GEFORCE_6800A_LE 0x00c2 -#define PCI_DEVICE_ID_GEFORCE_GO_6800 0x00c8 -#define PCI_DEVICE_ID_GEFORCE_GO_6800_ULTRA 0x00c9 -#define PCI_DEVICE_ID_QUADRO_FX_GO1400 0x00cc -#define PCI_DEVICE_ID_QUADRO_FX_1400 0x00ce -#define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1 -#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00d4 -#define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5 -#define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM 0x00d9 -#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da -#define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1 -#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA 0x00e3 -#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS 0x00e4 -#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE 0x00e5 -#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea -#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee -#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0 -#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT1 0x00f1 -#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6600_ALT2 0x00f2 -#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6200_ALT1 0x00f3 -#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_GT 0x00f9 -#define PCIE_DEVICE_ID_NVIDIA_QUADRO_NVS280 0x00fd -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 -#define PCI_DEVICE_ID_NVIDIA_QUADRO 0x0103 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX 0x0110 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_MX2 0x0111 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GO 0x0112 -#define PCI_DEVICE_ID_NVIDIA_QUADRO2_MXR 0x0113 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6600_GT 0x0140 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6600 0x0141 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6610_XL 0x0145 -#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_540 0x014E -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6200 0x014F -#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS 0x0150 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_GTS2 0x0151 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE2_ULTRA 0x0152 -#define PCI_DEVICE_ID_NVIDIA_QUADRO2_PRO 0x0153 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6200_TURBOCACHE 0x0161 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6200 0x0164 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6250 0x0166 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6200_1 0x0167 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_GO_6250_1 0x0168 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_460 0x0170 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440 0x0171 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420 0x0172 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_SE 0x0173 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO 0x0174 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO 0x0175 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_420_GO_M32 0x0176 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_460_GO 0x0177 -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_500XGL 0x0178 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_440_GO_M64 0x0179 -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_200 0x017A -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_550XGL 0x017B -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_500_GOGL 0x017C -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_410_GO_M16 0x017D -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440_8X 0x0181 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_440SE_8X 0x0182 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_420_8X 0x0183 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_4000 0x0185 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_448_GO 0x0186 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_488_GO 0x0187 -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_580_XGL 0x0188 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_MX_MAC 0x0189 -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_280_NVS 0x018A -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_380_XGL 0x018B -#define PCI_DEVICE_ID_NVIDIA_IGEFORCE2 0x01a0 -#define PCI_DEVICE_ID_NVIDIA_NFORCE 0x01a4 -#define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO 0x01b1 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01b4 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc -#define PCI_DEVICE_ID_NVIDIA_MCP1_MODEM 0x01c1 -#define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE3_1 0x0201 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE3_2 0x0202 -#define PCI_DEVICE_ID_NVIDIA_QUADRO_DDC 0x0203 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B 0x0211 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B_LE 0x0212 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800B_GT 0x0215 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4600 0x0250 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4400 0x0251 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4200 0x0253 -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_900XGL 0x0258 -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_750XGL 0x0259 -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700XGL 0x025B -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SMBUS 0x0264 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE 0x0265 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA 0x0266 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_SATA2 0x0267 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SMBUS 0x0368 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_4200_GO 0x0286 -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_980_XGL 0x0288 -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_780_XGL 0x0289 -#define PCI_DEVICE_ID_NVIDIA_QUADRO4_700_GOGL 0x028C -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5800_ULTRA 0x0301 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5800 0x0302 -#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_2000 0x0308 -#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1000 0x0309 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600_ULTRA 0x0311 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600 0x0312 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5600SE 0x0314 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5600 0x031A -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5650 0x031B -#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO700 0x031C -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200 0x0320 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200_ULTRA 0x0321 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200_1 0x0322 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5200SE 0x0323 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5200 0x0324 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5250 0x0325 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5500 0x0326 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5100 0x0327 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5250_32 0x0328 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO_5200 0x0329 -#define PCI_DEVICE_ID_NVIDIA_QUADRO_NVS_280_PCI 0x032A -#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_500 0x032B -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5300 0x032C -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5100 0x032D -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900_ULTRA 0x0330 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900 0x0331 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900XT 0x0332 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5950_ULTRA 0x0333 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5900ZT 0x0334 -#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_3000 0x0338 -#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_700 0x033F -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700_ULTRA 0x0341 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700 0x0342 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700LE 0x0343 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_5700VE 0x0344 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_1 0x0347 -#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348 -#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C -#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E -#define PCI_DEVICE_ID_NVIDIA_MCP55_BRIDGE_V0 0x0360 -#define PCI_DEVICE_ID_NVIDIA_MCP55_BRIDGE_V4 0x0364 -#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SMBUS 0x03EB -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE 0x03EC -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_SMBUS 0x0446 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE 0x0448 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_SMBUS 0x0542 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP79_SMBUS 0x0AA2 -#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP89_SATA 0x0D85 - -#define PCI_VENDOR_ID_IMS 0x10e0 -#define PCI_DEVICE_ID_IMS_TT128 0x9128 -#define PCI_DEVICE_ID_IMS_TT3D 0x9135 - -#define PCI_VENDOR_ID_INTERG 0x10ea -#define PCI_DEVICE_ID_INTERG_1682 0x1682 -#define PCI_DEVICE_ID_INTERG_2000 0x2000 -#define PCI_DEVICE_ID_INTERG_2010 0x2010 -#define PCI_DEVICE_ID_INTERG_5000 0x5000 -#define PCI_DEVICE_ID_INTERG_5050 0x5050 - -#define PCI_VENDOR_ID_REALTEK 0x10ec -#define PCI_DEVICE_ID_REALTEK_8139 0x8139 - -#define PCI_VENDOR_ID_XILINX 0x10ee -#define PCI_DEVICE_ID_RME_DIGI96 0x3fc0 -#define PCI_DEVICE_ID_RME_DIGI96_8 0x3fc1 -#define PCI_DEVICE_ID_RME_DIGI96_8_PRO 0x3fc2 -#define PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST 0x3fc3 -#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5 -#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI 0x3fc6 - -#define PCI_VENDOR_ID_INIT 0x1101 - -#define PCI_VENDOR_ID_CREATIVE 0x1102 /* duplicate: ECTIVA */ -#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002 -#define PCI_DEVICE_ID_CREATIVE_20K1 0x0005 -#define PCI_DEVICE_ID_CREATIVE_20K2 0x000b -#define PCI_SUBDEVICE_ID_CREATIVE_SB0760 0x0024 -#define PCI_SUBDEVICE_ID_CREATIVE_SB08801 0x0041 -#define PCI_SUBDEVICE_ID_CREATIVE_SB08802 0x0042 -#define PCI_SUBDEVICE_ID_CREATIVE_SB08803 0x0043 -#define PCI_SUBDEVICE_ID_CREATIVE_SB1270 0x0062 -#define PCI_SUBDEVICE_ID_CREATIVE_HENDRIX 0x6000 - -#define PCI_VENDOR_ID_ECTIVA 0x1102 /* duplicate: CREATIVE */ -#define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938 - -#define PCI_VENDOR_ID_TTI 0x1103 -#define PCI_DEVICE_ID_TTI_HPT343 0x0003 -#define PCI_DEVICE_ID_TTI_HPT366 0x0004 -#define PCI_DEVICE_ID_TTI_HPT372 0x0005 -#define PCI_DEVICE_ID_TTI_HPT302 0x0006 -#define PCI_DEVICE_ID_TTI_HPT371 0x0007 -#define PCI_DEVICE_ID_TTI_HPT374 0x0008 -#define PCI_DEVICE_ID_TTI_HPT372N 0x0009 /* apparently a 372N variant? */ - -#define PCI_VENDOR_ID_VIA 0x1106 -#define PCI_DEVICE_ID_VIA_8763_0 0x0198 -#define PCI_DEVICE_ID_VIA_8380_0 0x0204 -#define PCI_DEVICE_ID_VIA_3238_0 0x0238 -#define PCI_DEVICE_ID_VIA_PT880 0x0258 -#define PCI_DEVICE_ID_VIA_PT880ULTRA 0x0308 -#define PCI_DEVICE_ID_VIA_PX8X0_0 0x0259 -#define PCI_DEVICE_ID_VIA_3269_0 0x0269 -#define PCI_DEVICE_ID_VIA_K8T800PRO_0 0x0282 -#define PCI_DEVICE_ID_VIA_3296_0 0x0296 -#define PCI_DEVICE_ID_VIA_8363_0 0x0305 -#define PCI_DEVICE_ID_VIA_P4M800CE 0x0314 -#define PCI_DEVICE_ID_VIA_P4M890 0x0327 -#define PCI_DEVICE_ID_VIA_VT3324 0x0324 -#define PCI_DEVICE_ID_VIA_VT3336 0x0336 -#define PCI_DEVICE_ID_VIA_VT3351 0x0351 -#define PCI_DEVICE_ID_VIA_VT3364 0x0364 -#define PCI_DEVICE_ID_VIA_8371_0 0x0391 -#define PCI_DEVICE_ID_VIA_6415 0x0415 -#define PCI_DEVICE_ID_VIA_8501_0 0x0501 -#define PCI_DEVICE_ID_VIA_82C561 0x0561 -#define PCI_DEVICE_ID_VIA_82C586_1 0x0571 -#define PCI_DEVICE_ID_VIA_82C576 0x0576 -#define PCI_DEVICE_ID_VIA_82C586_0 0x0586 -#define PCI_DEVICE_ID_VIA_82C596 0x0596 -#define PCI_DEVICE_ID_VIA_82C597_0 0x0597 -#define PCI_DEVICE_ID_VIA_82C598_0 0x0598 -#define PCI_DEVICE_ID_VIA_8601_0 0x0601 -#define PCI_DEVICE_ID_VIA_8605_0 0x0605 -#define PCI_DEVICE_ID_VIA_82C686 0x0686 -#define PCI_DEVICE_ID_VIA_82C691_0 0x0691 -#define PCI_DEVICE_ID_VIA_82C576_1 0x1571 -#define PCI_DEVICE_ID_VIA_82C586_2 0x3038 -#define PCI_DEVICE_ID_VIA_82C586_3 0x3040 -#define PCI_DEVICE_ID_VIA_82C596_3 0x3050 -#define PCI_DEVICE_ID_VIA_82C596B_3 0x3051 -#define PCI_DEVICE_ID_VIA_82C686_4 0x3057 -#define PCI_DEVICE_ID_VIA_82C686_5 0x3058 -#define PCI_DEVICE_ID_VIA_8233_5 0x3059 -#define PCI_DEVICE_ID_VIA_8233_0 0x3074 -#define PCI_DEVICE_ID_VIA_8633_0 0x3091 -#define PCI_DEVICE_ID_VIA_8367_0 0x3099 -#define PCI_DEVICE_ID_VIA_8653_0 0x3101 -#define PCI_DEVICE_ID_VIA_8622 0x3102 -#define PCI_DEVICE_ID_VIA_8235_USB_2 0x3104 -#define PCI_DEVICE_ID_VIA_8233C_0 0x3109 -#define PCI_DEVICE_ID_VIA_8361 0x3112 -#define PCI_DEVICE_ID_VIA_XM266 0x3116 -#define PCI_DEVICE_ID_VIA_612X 0x3119 -#define PCI_DEVICE_ID_VIA_862X_0 0x3123 -#define PCI_DEVICE_ID_VIA_8753_0 0x3128 -#define PCI_DEVICE_ID_VIA_8233A 0x3147 -#define PCI_DEVICE_ID_VIA_8703_51_0 0x3148 -#define PCI_DEVICE_ID_VIA_8237_SATA 0x3149 -#define PCI_DEVICE_ID_VIA_XN266 0x3156 -#define PCI_DEVICE_ID_VIA_6410 0x3164 -#define PCI_DEVICE_ID_VIA_8754C_0 0x3168 -#define PCI_DEVICE_ID_VIA_8235 0x3177 -#define PCI_DEVICE_ID_VIA_8385_0 0x3188 -#define PCI_DEVICE_ID_VIA_8377_0 0x3189 -#define PCI_DEVICE_ID_VIA_8378_0 0x3205 -#define PCI_DEVICE_ID_VIA_8783_0 0x3208 -#define PCI_DEVICE_ID_VIA_8237 0x3227 -#define PCI_DEVICE_ID_VIA_8251 0x3287 -#define PCI_DEVICE_ID_VIA_8261 0x3402 -#define PCI_DEVICE_ID_VIA_8237A 0x3337 -#define PCI_DEVICE_ID_VIA_8237S 0x3372 -#define PCI_DEVICE_ID_VIA_SATA_EIDE 0x5324 -#define PCI_DEVICE_ID_VIA_8231 0x8231 -#define PCI_DEVICE_ID_VIA_8231_4 0x8235 -#define PCI_DEVICE_ID_VIA_8365_1 0x8305 -#define PCI_DEVICE_ID_VIA_CX700 0x8324 -#define PCI_DEVICE_ID_VIA_CX700_IDE 0x0581 -#define PCI_DEVICE_ID_VIA_VX800 0x8353 -#define PCI_DEVICE_ID_VIA_VX855 0x8409 -#define PCI_DEVICE_ID_VIA_8371_1 0x8391 -#define PCI_DEVICE_ID_VIA_82C598_1 0x8598 -#define PCI_DEVICE_ID_VIA_838X_1 0xB188 -#define PCI_DEVICE_ID_VIA_83_87XX_1 0xB198 -#define PCI_DEVICE_ID_VIA_VX855_IDE 0xC409 -#define PCI_DEVICE_ID_VIA_ANON 0xFFFF - -#define PCI_VENDOR_ID_SIEMENS 0x110A -#define PCI_DEVICE_ID_SIEMENS_DSCC4 0x2102 - -#define PCI_VENDOR_ID_VORTEX 0x1119 -#define PCI_DEVICE_ID_VORTEX_GDT60x0 0x0000 -#define PCI_DEVICE_ID_VORTEX_GDT6000B 0x0001 -#define PCI_DEVICE_ID_VORTEX_GDT6x10 0x0002 -#define PCI_DEVICE_ID_VORTEX_GDT6x20 0x0003 -#define PCI_DEVICE_ID_VORTEX_GDT6530 0x0004 -#define PCI_DEVICE_ID_VORTEX_GDT6550 0x0005 -#define PCI_DEVICE_ID_VORTEX_GDT6x17 0x0006 -#define PCI_DEVICE_ID_VORTEX_GDT6x27 0x0007 -#define PCI_DEVICE_ID_VORTEX_GDT6537 0x0008 -#define PCI_DEVICE_ID_VORTEX_GDT6557 0x0009 -#define PCI_DEVICE_ID_VORTEX_GDT6x15 0x000a -#define PCI_DEVICE_ID_VORTEX_GDT6x25 0x000b -#define PCI_DEVICE_ID_VORTEX_GDT6535 0x000c -#define PCI_DEVICE_ID_VORTEX_GDT6555 0x000d -#define PCI_DEVICE_ID_VORTEX_GDT6x17RP 0x0100 -#define PCI_DEVICE_ID_VORTEX_GDT6x27RP 0x0101 -#define PCI_DEVICE_ID_VORTEX_GDT6537RP 0x0102 -#define PCI_DEVICE_ID_VORTEX_GDT6557RP 0x0103 -#define PCI_DEVICE_ID_VORTEX_GDT6x11RP 0x0104 -#define PCI_DEVICE_ID_VORTEX_GDT6x21RP 0x0105 - -#define PCI_VENDOR_ID_EF 0x111a -#define PCI_DEVICE_ID_EF_ATM_FPGA 0x0000 -#define PCI_DEVICE_ID_EF_ATM_ASIC 0x0002 -#define PCI_DEVICE_ID_EF_ATM_LANAI2 0x0003 -#define PCI_DEVICE_ID_EF_ATM_LANAIHB 0x0005 - -#define PCI_VENDOR_ID_IDT 0x111d -#define PCI_DEVICE_ID_IDT_IDT77201 0x0001 - -#define PCI_VENDOR_ID_FORE 0x1127 -#define PCI_DEVICE_ID_FORE_PCA200E 0x0300 - -#define PCI_VENDOR_ID_PHILIPS 0x1131 -#define PCI_DEVICE_ID_PHILIPS_SAA7146 0x7146 -#define PCI_DEVICE_ID_PHILIPS_SAA9730 0x9730 - -#define PCI_VENDOR_ID_EICON 0x1133 -#define PCI_DEVICE_ID_EICON_DIVA20 0xe002 -#define PCI_DEVICE_ID_EICON_DIVA20_U 0xe004 -#define PCI_DEVICE_ID_EICON_DIVA201 0xe005 -#define PCI_DEVICE_ID_EICON_DIVA202 0xe00b -#define PCI_DEVICE_ID_EICON_MAESTRA 0xe010 -#define PCI_DEVICE_ID_EICON_MAESTRAQ 0xe012 -#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 -#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 - -#define PCI_VENDOR_ID_CISCO 0x1137 - -#define PCI_VENDOR_ID_ZIATECH 0x1138 -#define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550 - - -#define PCI_VENDOR_ID_SYSKONNECT 0x1148 -#define PCI_DEVICE_ID_SYSKONNECT_TR 0x4200 -#define PCI_DEVICE_ID_SYSKONNECT_GE 0x4300 -#define PCI_DEVICE_ID_SYSKONNECT_YU 0x4320 -#define PCI_DEVICE_ID_SYSKONNECT_9DXX 0x4400 -#define PCI_DEVICE_ID_SYSKONNECT_9MXX 0x4500 - -#define PCI_VENDOR_ID_DIGI 0x114f -#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_E 0x0070 -#define PCI_DEVICE_ID_DIGI_DF_M_E 0x0071 -#define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072 -#define PCI_DEVICE_ID_DIGI_DF_M_A 0x0073 -#define PCI_DEVICE_ID_DIGI_NEO_8 0x00B1 -#define PCI_DEVICE_ID_NEO_2DB9 0x00C8 -#define PCI_DEVICE_ID_NEO_2DB9PRI 0x00C9 -#define PCI_DEVICE_ID_NEO_2RJ45 0x00CA -#define PCI_DEVICE_ID_NEO_2RJ45PRI 0x00CB -#define PCIE_DEVICE_ID_NEO_4_IBM 0x00F4 - -#define PCI_VENDOR_ID_XIRCOM 0x115d -#define PCI_DEVICE_ID_XIRCOM_RBM56G 0x0101 -#define PCI_DEVICE_ID_XIRCOM_X3201_MDM 0x0103 - -#define PCI_VENDOR_ID_SERVERWORKS 0x1166 -#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008 -#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 -#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 -#define PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB 0x0036 -#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 -#define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132 -#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 -#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 -#define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 -#define PCI_DEVICE_ID_SERVERWORKS_HT1000SB 0x0205 -#define PCI_DEVICE_ID_SERVERWORKS_OSB4IDE 0x0211 -#define PCI_DEVICE_ID_SERVERWORKS_CSB5IDE 0x0212 -#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE 0x0213 -#define PCI_DEVICE_ID_SERVERWORKS_HT1000IDE 0x0214 -#define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 -#define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227 -#define PCI_DEVICE_ID_SERVERWORKS_HT1100LD 0x0408 - -#define PCI_VENDOR_ID_SBE 0x1176 -#define PCI_DEVICE_ID_SBE_WANXL100 0x0301 -#define PCI_DEVICE_ID_SBE_WANXL200 0x0302 -#define PCI_DEVICE_ID_SBE_WANXL400 0x0104 -#define PCI_SUBDEVICE_ID_SBE_T3E3 0x0009 -#define PCI_SUBDEVICE_ID_SBE_2T3E3_P0 0x0901 -#define PCI_SUBDEVICE_ID_SBE_2T3E3_P1 0x0902 - -#define PCI_VENDOR_ID_TOSHIBA 0x1179 -#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_1 0x0101 -#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_2 0x0102 -#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_3 0x0103 -#define PCI_DEVICE_ID_TOSHIBA_PICCOLO_5 0x0105 -#define PCI_DEVICE_ID_TOSHIBA_TOPIC95 0x060a -#define PCI_DEVICE_ID_TOSHIBA_TOPIC97 0x060f -#define PCI_DEVICE_ID_TOSHIBA_TOPIC100 0x0617 - -#define PCI_VENDOR_ID_TOSHIBA_2 0x102f -#define PCI_DEVICE_ID_TOSHIBA_TC35815CF 0x0030 -#define PCI_DEVICE_ID_TOSHIBA_TC35815_NWU 0x0031 -#define PCI_DEVICE_ID_TOSHIBA_TC35815_TX4939 0x0032 -#define PCI_DEVICE_ID_TOSHIBA_TC86C001_IDE 0x0105 -#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108 -#define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3 - -#define PCI_VENDOR_ID_ATTO 0x117c - -#define PCI_VENDOR_ID_RICOH 0x1180 -#define PCI_DEVICE_ID_RICOH_RL5C465 0x0465 -#define PCI_DEVICE_ID_RICOH_RL5C466 0x0466 -#define PCI_DEVICE_ID_RICOH_RL5C475 0x0475 -#define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 -#define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 -#define PCI_DEVICE_ID_RICOH_R5C822 0x0822 -#define PCI_DEVICE_ID_RICOH_R5CE823 0xe823 -#define PCI_DEVICE_ID_RICOH_R5C832 0x0832 -#define PCI_DEVICE_ID_RICOH_R5C843 0x0843 - -#define PCI_VENDOR_ID_DLINK 0x1186 -#define PCI_DEVICE_ID_DLINK_DGE510T 0x4c00 - -#define PCI_VENDOR_ID_ARTOP 0x1191 -#define PCI_DEVICE_ID_ARTOP_ATP850UF 0x0005 -#define PCI_DEVICE_ID_ARTOP_ATP860 0x0006 -#define PCI_DEVICE_ID_ARTOP_ATP860R 0x0007 -#define PCI_DEVICE_ID_ARTOP_ATP865 0x0008 -#define PCI_DEVICE_ID_ARTOP_ATP865R 0x0009 -#define PCI_DEVICE_ID_ARTOP_ATP867A 0x000A -#define PCI_DEVICE_ID_ARTOP_ATP867B 0x000B -#define PCI_DEVICE_ID_ARTOP_AEC7610 0x8002 -#define PCI_DEVICE_ID_ARTOP_AEC7612UW 0x8010 -#define PCI_DEVICE_ID_ARTOP_AEC7612U 0x8020 -#define PCI_DEVICE_ID_ARTOP_AEC7612S 0x8030 -#define PCI_DEVICE_ID_ARTOP_AEC7612D 0x8040 -#define PCI_DEVICE_ID_ARTOP_AEC7612SUW 0x8050 -#define PCI_DEVICE_ID_ARTOP_8060 0x8060 - -#define PCI_VENDOR_ID_ZEITNET 0x1193 -#define PCI_DEVICE_ID_ZEITNET_1221 0x0001 -#define PCI_DEVICE_ID_ZEITNET_1225 0x0002 - -#define PCI_VENDOR_ID_FUJITSU_ME 0x119e -#define PCI_DEVICE_ID_FUJITSU_FS155 0x0001 -#define PCI_DEVICE_ID_FUJITSU_FS50 0x0003 - -#define PCI_SUBVENDOR_ID_KEYSPAN 0x11a9 -#define PCI_SUBDEVICE_ID_KEYSPAN_SX2 0x5334 - -#define PCI_VENDOR_ID_MARVELL 0x11ab -#define PCI_DEVICE_ID_MARVELL_GT64111 0x4146 -#define PCI_DEVICE_ID_MARVELL_GT64260 0x6430 -#define PCI_DEVICE_ID_MARVELL_MV64360 0x6460 -#define PCI_DEVICE_ID_MARVELL_MV64460 0x6480 -#define PCI_DEVICE_ID_MARVELL_88ALP01_NAND 0x4100 -#define PCI_DEVICE_ID_MARVELL_88ALP01_SD 0x4101 -#define PCI_DEVICE_ID_MARVELL_88ALP01_CCIC 0x4102 - -#define PCI_VENDOR_ID_V3 0x11b0 -#define PCI_DEVICE_ID_V3_V960 0x0001 -#define PCI_DEVICE_ID_V3_V351 0x0002 - -#define PCI_VENDOR_ID_ATT 0x11c1 -#define PCI_DEVICE_ID_ATT_VENUS_MODEM 0x480 - -#define PCI_VENDOR_ID_SPECIALIX 0x11cb -#define PCI_DEVICE_ID_SPECIALIX_IO8 0x2000 -#define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 -#define PCI_SUBDEVICE_ID_SPECIALIX_SPEED4 0xa004 - -#define PCI_VENDOR_ID_ANALOG_DEVICES 0x11d4 -#define PCI_DEVICE_ID_AD1889JS 0x1889 - -#define PCI_DEVICE_ID_SEGA_BBA 0x1234 - -#define PCI_VENDOR_ID_ZORAN 0x11de -#define PCI_DEVICE_ID_ZORAN_36057 0x6057 -#define PCI_DEVICE_ID_ZORAN_36120 0x6120 - -#define PCI_VENDOR_ID_COMPEX 0x11f6 -#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 - -#define PCI_VENDOR_ID_PMC_Sierra 0x11f8 - -#define PCI_VENDOR_ID_RP 0x11fe -#define PCI_DEVICE_ID_RP32INTF 0x0001 -#define PCI_DEVICE_ID_RP8INTF 0x0002 -#define PCI_DEVICE_ID_RP16INTF 0x0003 -#define PCI_DEVICE_ID_RP4QUAD 0x0004 -#define PCI_DEVICE_ID_RP8OCTA 0x0005 -#define PCI_DEVICE_ID_RP8J 0x0006 -#define PCI_DEVICE_ID_RP4J 0x0007 -#define PCI_DEVICE_ID_RP8SNI 0x0008 -#define PCI_DEVICE_ID_RP16SNI 0x0009 -#define PCI_DEVICE_ID_RPP4 0x000A -#define PCI_DEVICE_ID_RPP8 0x000B -#define PCI_DEVICE_ID_RP4M 0x000D -#define PCI_DEVICE_ID_RP2_232 0x000E -#define PCI_DEVICE_ID_RP2_422 0x000F -#define PCI_DEVICE_ID_URP32INTF 0x0801 -#define PCI_DEVICE_ID_URP8INTF 0x0802 -#define PCI_DEVICE_ID_URP16INTF 0x0803 -#define PCI_DEVICE_ID_URP8OCTA 0x0805 -#define PCI_DEVICE_ID_UPCI_RM3_8PORT 0x080C -#define PCI_DEVICE_ID_UPCI_RM3_4PORT 0x080D -#define PCI_DEVICE_ID_CRP16INTF 0x0903 - -#define PCI_VENDOR_ID_CYCLADES 0x120e -#define PCI_DEVICE_ID_CYCLOM_Y_Lo 0x0100 -#define PCI_DEVICE_ID_CYCLOM_Y_Hi 0x0101 -#define PCI_DEVICE_ID_CYCLOM_4Y_Lo 0x0102 -#define PCI_DEVICE_ID_CYCLOM_4Y_Hi 0x0103 -#define PCI_DEVICE_ID_CYCLOM_8Y_Lo 0x0104 -#define PCI_DEVICE_ID_CYCLOM_8Y_Hi 0x0105 -#define PCI_DEVICE_ID_CYCLOM_Z_Lo 0x0200 -#define PCI_DEVICE_ID_CYCLOM_Z_Hi 0x0201 -#define PCI_DEVICE_ID_PC300_RX_2 0x0300 -#define PCI_DEVICE_ID_PC300_RX_1 0x0301 -#define PCI_DEVICE_ID_PC300_TE_2 0x0310 -#define PCI_DEVICE_ID_PC300_TE_1 0x0311 -#define PCI_DEVICE_ID_PC300_TE_M_2 0x0320 -#define PCI_DEVICE_ID_PC300_TE_M_1 0x0321 - -#define PCI_VENDOR_ID_ESSENTIAL 0x120f -#define PCI_DEVICE_ID_ESSENTIAL_ROADRUNNER 0x0001 - -#define PCI_VENDOR_ID_O2 0x1217 -#define PCI_DEVICE_ID_O2_6729 0x6729 -#define PCI_DEVICE_ID_O2_6730 0x673a -#define PCI_DEVICE_ID_O2_6832 0x6832 -#define PCI_DEVICE_ID_O2_6836 0x6836 -#define PCI_DEVICE_ID_O2_6812 0x6872 -#define PCI_DEVICE_ID_O2_6933 0x6933 -#define PCI_DEVICE_ID_O2_8120 0x8120 -#define PCI_DEVICE_ID_O2_8220 0x8220 -#define PCI_DEVICE_ID_O2_8221 0x8221 -#define PCI_DEVICE_ID_O2_8320 0x8320 -#define PCI_DEVICE_ID_O2_8321 0x8321 - -#define PCI_VENDOR_ID_3DFX 0x121a -#define PCI_DEVICE_ID_3DFX_VOODOO 0x0001 -#define PCI_DEVICE_ID_3DFX_VOODOO2 0x0002 -#define PCI_DEVICE_ID_3DFX_BANSHEE 0x0003 -#define PCI_DEVICE_ID_3DFX_VOODOO3 0x0005 -#define PCI_DEVICE_ID_3DFX_VOODOO5 0x0009 - -#define PCI_VENDOR_ID_AVM 0x1244 -#define PCI_DEVICE_ID_AVM_B1 0x0700 -#define PCI_DEVICE_ID_AVM_C4 0x0800 -#define PCI_DEVICE_ID_AVM_A1 0x0a00 -#define PCI_DEVICE_ID_AVM_A1_V2 0x0e00 -#define PCI_DEVICE_ID_AVM_C2 0x1100 -#define PCI_DEVICE_ID_AVM_T1 0x1200 - -#define PCI_VENDOR_ID_STALLION 0x124d - -/* Allied Telesyn */ -#define PCI_VENDOR_ID_AT 0x1259 -#define PCI_SUBDEVICE_ID_AT_2700FX 0x2701 -#define PCI_SUBDEVICE_ID_AT_2701FX 0x2703 - -#define PCI_VENDOR_ID_ESS 0x125d -#define PCI_DEVICE_ID_ESS_ESS1968 0x1968 -#define PCI_DEVICE_ID_ESS_ESS1978 0x1978 -#define PCI_DEVICE_ID_ESS_ALLEGRO_1 0x1988 -#define PCI_DEVICE_ID_ESS_ALLEGRO 0x1989 -#define PCI_DEVICE_ID_ESS_CANYON3D_2LE 0x1990 -#define PCI_DEVICE_ID_ESS_CANYON3D_2 0x1992 -#define PCI_DEVICE_ID_ESS_MAESTRO3 0x1998 -#define PCI_DEVICE_ID_ESS_MAESTRO3_1 0x1999 -#define PCI_DEVICE_ID_ESS_MAESTRO3_HW 0x199a -#define PCI_DEVICE_ID_ESS_MAESTRO3_2 0x199b - -#define PCI_VENDOR_ID_SATSAGEM 0x1267 -#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016 - -#define PCI_VENDOR_ID_ENSONIQ 0x1274 -#define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880 -#define PCI_DEVICE_ID_ENSONIQ_ES1370 0x5000 -#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371 - -#define PCI_VENDOR_ID_TRANSMETA 0x1279 -#define PCI_DEVICE_ID_EFFICEON 0x0060 - -#define PCI_VENDOR_ID_ROCKWELL 0x127A - -#define PCI_VENDOR_ID_ITE 0x1283 -#define PCI_DEVICE_ID_ITE_8172 0x8172 -#define PCI_DEVICE_ID_ITE_8211 0x8211 -#define PCI_DEVICE_ID_ITE_8212 0x8212 -#define PCI_DEVICE_ID_ITE_8213 0x8213 -#define PCI_DEVICE_ID_ITE_8152 0x8152 -#define PCI_DEVICE_ID_ITE_8872 0x8872 -#define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886 - -/* formerly Platform Tech */ -#define PCI_DEVICE_ID_ESS_ESS0100 0x0100 - -#define PCI_VENDOR_ID_ALTEON 0x12ae - -#define PCI_SUBVENDOR_ID_CONNECT_TECH 0x12c4 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232 0x0001 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_232 0x0002 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_232 0x0003 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485 0x0004 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_4_4 0x0005 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485 0x0006 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH4_485_2_2 0x0007 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_485 0x0008 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_485_2_6 0x0009 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH081101V1 0x000A -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH041101V1 0x000B -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_20MHZ 0x000C -#define PCI_SUBDEVICE_ID_CONNECT_TECH_BH2_PTM 0x000D -#define PCI_SUBDEVICE_ID_CONNECT_TECH_NT960PCI 0x0100 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_2 0x0201 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_TITAN_4 0x0202 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_232 0x0300 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_232 0x0301 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_232 0x0302 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_1_1 0x0310 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_2 0x0311 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4 0x0312 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2 0x0320 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4 0x0321 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8 0x0322 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_485 0x0330 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_485 0x0331 -#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_485 0x0332 - -#define PCI_VENDOR_ID_NVIDIA_SGS 0x12d2 -#define PCI_DEVICE_ID_NVIDIA_SGS_RIVA128 0x0018 - -#define PCI_SUBVENDOR_ID_CHASE_PCIFAST 0x12E0 -#define PCI_SUBDEVICE_ID_CHASE_PCIFAST4 0x0031 -#define PCI_SUBDEVICE_ID_CHASE_PCIFAST8 0x0021 -#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16 0x0011 -#define PCI_SUBDEVICE_ID_CHASE_PCIFAST16FMC 0x0041 -#define PCI_SUBVENDOR_ID_CHASE_PCIRAS 0x124D -#define PCI_SUBDEVICE_ID_CHASE_PCIRAS4 0xF001 -#define PCI_SUBDEVICE_ID_CHASE_PCIRAS8 0xF010 - -#define PCI_VENDOR_ID_AUREAL 0x12eb -#define PCI_DEVICE_ID_AUREAL_VORTEX_1 0x0001 -#define PCI_DEVICE_ID_AUREAL_VORTEX_2 0x0002 -#define PCI_DEVICE_ID_AUREAL_ADVANTAGE 0x0003 - -#define PCI_VENDOR_ID_ELECTRONICDESIGNGMBH 0x12f8 -#define PCI_DEVICE_ID_LML_33R10 0x8a02 - -#define PCI_VENDOR_ID_ESDGMBH 0x12fe -#define PCI_DEVICE_ID_ESDGMBH_CPCIASIO4 0x0111 - -#define PCI_VENDOR_ID_SIIG 0x131f -#define PCI_SUBVENDOR_ID_SIIG 0x131f -#define PCI_DEVICE_ID_SIIG_1S_10x_550 0x1000 -#define PCI_DEVICE_ID_SIIG_1S_10x_650 0x1001 -#define PCI_DEVICE_ID_SIIG_1S_10x_850 0x1002 -#define PCI_DEVICE_ID_SIIG_1S1P_10x_550 0x1010 -#define PCI_DEVICE_ID_SIIG_1S1P_10x_650 0x1011 -#define PCI_DEVICE_ID_SIIG_1S1P_10x_850 0x1012 -#define PCI_DEVICE_ID_SIIG_1P_10x 0x1020 -#define PCI_DEVICE_ID_SIIG_2P_10x 0x1021 -#define PCI_DEVICE_ID_SIIG_2S_10x_550 0x1030 -#define PCI_DEVICE_ID_SIIG_2S_10x_650 0x1031 -#define PCI_DEVICE_ID_SIIG_2S_10x_850 0x1032 -#define PCI_DEVICE_ID_SIIG_2S1P_10x_550 0x1034 -#define PCI_DEVICE_ID_SIIG_2S1P_10x_650 0x1035 -#define PCI_DEVICE_ID_SIIG_2S1P_10x_850 0x1036 -#define PCI_DEVICE_ID_SIIG_4S_10x_550 0x1050 -#define PCI_DEVICE_ID_SIIG_4S_10x_650 0x1051 -#define PCI_DEVICE_ID_SIIG_4S_10x_850 0x1052 -#define PCI_DEVICE_ID_SIIG_1S_20x_550 0x2000 -#define PCI_DEVICE_ID_SIIG_1S_20x_650 0x2001 -#define PCI_DEVICE_ID_SIIG_1S_20x_850 0x2002 -#define PCI_DEVICE_ID_SIIG_1P_20x 0x2020 -#define PCI_DEVICE_ID_SIIG_2P_20x 0x2021 -#define PCI_DEVICE_ID_SIIG_2S_20x_550 0x2030 -#define PCI_DEVICE_ID_SIIG_2S_20x_650 0x2031 -#define PCI_DEVICE_ID_SIIG_2S_20x_850 0x2032 -#define PCI_DEVICE_ID_SIIG_2P1S_20x_550 0x2040 -#define PCI_DEVICE_ID_SIIG_2P1S_20x_650 0x2041 -#define PCI_DEVICE_ID_SIIG_2P1S_20x_850 0x2042 -#define PCI_DEVICE_ID_SIIG_1S1P_20x_550 0x2010 -#define PCI_DEVICE_ID_SIIG_1S1P_20x_650 0x2011 -#define PCI_DEVICE_ID_SIIG_1S1P_20x_850 0x2012 -#define PCI_DEVICE_ID_SIIG_4S_20x_550 0x2050 -#define PCI_DEVICE_ID_SIIG_4S_20x_650 0x2051 -#define PCI_DEVICE_ID_SIIG_4S_20x_850 0x2052 -#define PCI_DEVICE_ID_SIIG_2S1P_20x_550 0x2060 -#define PCI_DEVICE_ID_SIIG_2S1P_20x_650 0x2061 -#define PCI_DEVICE_ID_SIIG_2S1P_20x_850 0x2062 -#define PCI_DEVICE_ID_SIIG_8S_20x_550 0x2080 -#define PCI_DEVICE_ID_SIIG_8S_20x_650 0x2081 -#define PCI_DEVICE_ID_SIIG_8S_20x_850 0x2082 -#define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL 0x2050 -#define PCI_SUBDEVICE_ID_SIIG_DUAL_SERIAL 0x2530 - -#define PCI_VENDOR_ID_RADISYS 0x1331 - -#define PCI_VENDOR_ID_MICRO_MEMORY 0x1332 -#define PCI_DEVICE_ID_MICRO_MEMORY_5415CN 0x5415 -#define PCI_DEVICE_ID_MICRO_MEMORY_5425CN 0x5425 -#define PCI_DEVICE_ID_MICRO_MEMORY_6155 0x6155 - -#define PCI_VENDOR_ID_DOMEX 0x134a -#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001 - -#define PCI_VENDOR_ID_INTASHIELD 0x135a -#define PCI_DEVICE_ID_INTASHIELD_IS200 0x0d80 -#define PCI_DEVICE_ID_INTASHIELD_IS400 0x0dc0 - -#define PCI_VENDOR_ID_QUATECH 0x135C -#define PCI_DEVICE_ID_QUATECH_QSC100 0x0010 -#define PCI_DEVICE_ID_QUATECH_DSC100 0x0020 -#define PCI_DEVICE_ID_QUATECH_ESC100D 0x0050 -#define PCI_DEVICE_ID_QUATECH_ESC100M 0x0060 -#define PCI_DEVICE_ID_QUATECH_SPPXP_100 0x0278 - -#define PCI_VENDOR_ID_SEALEVEL 0x135e -#define PCI_DEVICE_ID_SEALEVEL_U530 0x7101 -#define PCI_DEVICE_ID_SEALEVEL_UCOMM2 0x7201 -#define PCI_DEVICE_ID_SEALEVEL_UCOMM422 0x7402 -#define PCI_DEVICE_ID_SEALEVEL_UCOMM232 0x7202 -#define PCI_DEVICE_ID_SEALEVEL_COMM4 0x7401 -#define PCI_DEVICE_ID_SEALEVEL_COMM8 0x7801 -#define PCI_DEVICE_ID_SEALEVEL_7803 0x7803 -#define PCI_DEVICE_ID_SEALEVEL_UCOMM8 0x7804 - -#define PCI_VENDOR_ID_HYPERCOPE 0x1365 -#define PCI_DEVICE_ID_HYPERCOPE_PLX 0x9050 -#define PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO 0x0104 -#define PCI_SUBDEVICE_ID_HYPERCOPE_ERGO 0x0106 -#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107 -#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108 - -#define PCI_VENDOR_ID_DIGIGRAM 0x1369 -#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_SERIAL_SUBSYSTEM 0xc001 -#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_CAE_SERIAL_SUBSYSTEM 0xc002 - -#define PCI_VENDOR_ID_KAWASAKI 0x136b -#define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01 - -#define PCI_VENDOR_ID_CNET 0x1371 -#define PCI_DEVICE_ID_CNET_GIGACARD 0x434e - -#define PCI_VENDOR_ID_LMC 0x1376 -#define PCI_DEVICE_ID_LMC_HSSI 0x0003 -#define PCI_DEVICE_ID_LMC_DS3 0x0004 -#define PCI_DEVICE_ID_LMC_SSI 0x0005 -#define PCI_DEVICE_ID_LMC_T1 0x0006 - -#define PCI_VENDOR_ID_NETGEAR 0x1385 -#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a - -#define PCI_VENDOR_ID_APPLICOM 0x1389 -#define PCI_DEVICE_ID_APPLICOM_PCIGENERIC 0x0001 -#define PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN 0x0002 -#define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003 - -#define PCI_VENDOR_ID_MOXA 0x1393 -#define PCI_DEVICE_ID_MOXA_RC7000 0x0001 -#define PCI_DEVICE_ID_MOXA_CP102 0x1020 -#define PCI_DEVICE_ID_MOXA_CP102UL 0x1021 -#define PCI_DEVICE_ID_MOXA_CP102U 0x1022 -#define PCI_DEVICE_ID_MOXA_C104 0x1040 -#define PCI_DEVICE_ID_MOXA_CP104U 0x1041 -#define PCI_DEVICE_ID_MOXA_CP104JU 0x1042 -#define PCI_DEVICE_ID_MOXA_CP104EL 0x1043 -#define PCI_DEVICE_ID_MOXA_CT114 0x1140 -#define PCI_DEVICE_ID_MOXA_CP114 0x1141 -#define PCI_DEVICE_ID_MOXA_CP118U 0x1180 -#define PCI_DEVICE_ID_MOXA_CP118EL 0x1181 -#define PCI_DEVICE_ID_MOXA_CP132 0x1320 -#define PCI_DEVICE_ID_MOXA_CP132U 0x1321 -#define PCI_DEVICE_ID_MOXA_CP134U 0x1340 -#define PCI_DEVICE_ID_MOXA_C168 0x1680 -#define PCI_DEVICE_ID_MOXA_CP168U 0x1681 -#define PCI_DEVICE_ID_MOXA_CP168EL 0x1682 -#define PCI_DEVICE_ID_MOXA_CP204J 0x2040 -#define PCI_DEVICE_ID_MOXA_C218 0x2180 -#define PCI_DEVICE_ID_MOXA_C320 0x3200 - -#define PCI_VENDOR_ID_CCD 0x1397 -#define PCI_DEVICE_ID_CCD_HFC4S 0x08B4 -#define PCI_SUBDEVICE_ID_CCD_PMX2S 0x1234 -#define PCI_DEVICE_ID_CCD_HFC8S 0x16B8 -#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0 -#define PCI_DEVICE_ID_CCD_HFCE1 0x30B1 -#define PCI_SUBDEVICE_ID_CCD_SPD4S 0x3136 -#define PCI_SUBDEVICE_ID_CCD_SPDE1 0x3137 -#define PCI_DEVICE_ID_CCD_B000 0xb000 -#define PCI_DEVICE_ID_CCD_B006 0xb006 -#define PCI_DEVICE_ID_CCD_B007 0xb007 -#define PCI_DEVICE_ID_CCD_B008 0xb008 -#define PCI_DEVICE_ID_CCD_B009 0xb009 -#define PCI_DEVICE_ID_CCD_B00A 0xb00a -#define PCI_DEVICE_ID_CCD_B00B 0xb00b -#define PCI_DEVICE_ID_CCD_B00C 0xb00c -#define PCI_DEVICE_ID_CCD_B100 0xb100 -#define PCI_SUBDEVICE_ID_CCD_IOB4ST 0xB520 -#define PCI_SUBDEVICE_ID_CCD_IOB8STR 0xB521 -#define PCI_SUBDEVICE_ID_CCD_IOB8ST 0xB522 -#define PCI_SUBDEVICE_ID_CCD_IOB1E1 0xB523 -#define PCI_SUBDEVICE_ID_CCD_SWYX4S 0xB540 -#define PCI_SUBDEVICE_ID_CCD_JH4S20 0xB550 -#define PCI_SUBDEVICE_ID_CCD_IOB8ST_1 0xB552 -#define PCI_SUBDEVICE_ID_CCD_JHSE1 0xB553 -#define PCI_SUBDEVICE_ID_CCD_JH8S 0xB55B -#define PCI_SUBDEVICE_ID_CCD_BN4S 0xB560 -#define PCI_SUBDEVICE_ID_CCD_BN8S 0xB562 -#define PCI_SUBDEVICE_ID_CCD_BNE1 0xB563 -#define PCI_SUBDEVICE_ID_CCD_BNE1D 0xB564 -#define PCI_SUBDEVICE_ID_CCD_BNE1DP 0xB565 -#define PCI_SUBDEVICE_ID_CCD_BN2S 0xB566 -#define PCI_SUBDEVICE_ID_CCD_BN1SM 0xB567 -#define PCI_SUBDEVICE_ID_CCD_BN4SM 0xB568 -#define PCI_SUBDEVICE_ID_CCD_BN2SM 0xB569 -#define PCI_SUBDEVICE_ID_CCD_BNE1M 0xB56A -#define PCI_SUBDEVICE_ID_CCD_BN8SP 0xB56B -#define PCI_SUBDEVICE_ID_CCD_HFC4S 0xB620 -#define PCI_SUBDEVICE_ID_CCD_HFC8S 0xB622 -#define PCI_DEVICE_ID_CCD_B700 0xb700 -#define PCI_DEVICE_ID_CCD_B701 0xb701 -#define PCI_SUBDEVICE_ID_CCD_HFCE1 0xC523 -#define PCI_SUBDEVICE_ID_CCD_OV2S 0xE884 -#define PCI_SUBDEVICE_ID_CCD_OV4S 0xE888 -#define PCI_SUBDEVICE_ID_CCD_OV8S 0xE998 - -#define PCI_VENDOR_ID_EXAR 0x13a8 -#define PCI_DEVICE_ID_EXAR_XR17C152 0x0152 -#define PCI_DEVICE_ID_EXAR_XR17C154 0x0154 -#define PCI_DEVICE_ID_EXAR_XR17C158 0x0158 - -#define PCI_VENDOR_ID_MICROGATE 0x13c0 -#define PCI_DEVICE_ID_MICROGATE_USC 0x0010 -#define PCI_DEVICE_ID_MICROGATE_SCA 0x0030 - -#define PCI_VENDOR_ID_3WARE 0x13C1 -#define PCI_DEVICE_ID_3WARE_1000 0x1000 -#define PCI_DEVICE_ID_3WARE_7000 0x1001 -#define PCI_DEVICE_ID_3WARE_9000 0x1002 - -#define PCI_VENDOR_ID_IOMEGA 0x13ca -#define PCI_DEVICE_ID_IOMEGA_BUZ 0x4231 - -#define PCI_VENDOR_ID_ABOCOM 0x13D1 -#define PCI_DEVICE_ID_ABOCOM_2BD1 0x2BD1 - -#define PCI_VENDOR_ID_SUNDANCE 0x13f0 - -#define PCI_VENDOR_ID_CMEDIA 0x13f6 -#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100 -#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101 -#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111 -#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112 - -#define PCI_VENDOR_ID_LAVA 0x1407 -#define PCI_DEVICE_ID_LAVA_DSERIAL 0x0100 /* 2x 16550 */ -#define PCI_DEVICE_ID_LAVA_QUATRO_A 0x0101 /* 2x 16550, half of 4 port */ -#define PCI_DEVICE_ID_LAVA_QUATRO_B 0x0102 /* 2x 16550, half of 4 port */ -#define PCI_DEVICE_ID_LAVA_QUATTRO_A 0x0120 /* 2x 16550A, half of 4 port */ -#define PCI_DEVICE_ID_LAVA_QUATTRO_B 0x0121 /* 2x 16550A, half of 4 port */ -#define PCI_DEVICE_ID_LAVA_OCTO_A 0x0180 /* 4x 16550A, half of 8 port */ -#define PCI_DEVICE_ID_LAVA_OCTO_B 0x0181 /* 4x 16550A, half of 8 port */ -#define PCI_DEVICE_ID_LAVA_PORT_PLUS 0x0200 /* 2x 16650 */ -#define PCI_DEVICE_ID_LAVA_QUAD_A 0x0201 /* 2x 16650, half of 4 port */ -#define PCI_DEVICE_ID_LAVA_QUAD_B 0x0202 /* 2x 16650, half of 4 port */ -#define PCI_DEVICE_ID_LAVA_SSERIAL 0x0500 /* 1x 16550 */ -#define PCI_DEVICE_ID_LAVA_PORT_650 0x0600 /* 1x 16650 */ -#define PCI_DEVICE_ID_LAVA_PARALLEL 0x8000 -#define PCI_DEVICE_ID_LAVA_DUAL_PAR_A 0x8002 /* The Lava Dual Parallel is */ -#define PCI_DEVICE_ID_LAVA_DUAL_PAR_B 0x8003 /* two PCI devices on a card */ -#define PCI_DEVICE_ID_LAVA_BOCA_IOPPAR 0x8800 - -#define PCI_VENDOR_ID_TIMEDIA 0x1409 -#define PCI_DEVICE_ID_TIMEDIA_1889 0x7168 - -#define PCI_VENDOR_ID_ICE 0x1412 -#define PCI_DEVICE_ID_ICE_1712 0x1712 -#define PCI_DEVICE_ID_VT1724 0x1724 - -#define PCI_VENDOR_ID_OXSEMI 0x1415 -#define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 -#define PCI_DEVICE_ID_OXSEMI_PCIe840 0xC000 -#define PCI_DEVICE_ID_OXSEMI_PCIe840_G 0xC004 -#define PCI_DEVICE_ID_OXSEMI_PCIe952_0 0xC100 -#define PCI_DEVICE_ID_OXSEMI_PCIe952_0_G 0xC104 -#define PCI_DEVICE_ID_OXSEMI_PCIe952_1 0xC110 -#define PCI_DEVICE_ID_OXSEMI_PCIe952_1_G 0xC114 -#define PCI_DEVICE_ID_OXSEMI_PCIe952_1_U 0xC118 -#define PCI_DEVICE_ID_OXSEMI_PCIe952_1_GU 0xC11C -#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 -#define PCI_DEVICE_ID_OXSEMI_C950 0x950B -#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 -#define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 -#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x9521 -#define PCI_DEVICE_ID_OXSEMI_16PCI952PP 0x9523 -#define PCI_SUBDEVICE_ID_OXSEMI_C950 0x0001 - -#define PCI_VENDOR_ID_CHELSIO 0x1425 - -#define PCI_VENDOR_ID_SAMSUNG 0x144d - -#define PCI_VENDOR_ID_GIGABYTE 0x1458 - -#define PCI_VENDOR_ID_AMBIT 0x1468 - -#define PCI_VENDOR_ID_MYRICOM 0x14c1 - -#define PCI_VENDOR_ID_TITAN 0x14D2 -#define PCI_DEVICE_ID_TITAN_010L 0x8001 -#define PCI_DEVICE_ID_TITAN_100L 0x8010 -#define PCI_DEVICE_ID_TITAN_110L 0x8011 -#define PCI_DEVICE_ID_TITAN_200L 0x8020 -#define PCI_DEVICE_ID_TITAN_210L 0x8021 -#define PCI_DEVICE_ID_TITAN_400L 0x8040 -#define PCI_DEVICE_ID_TITAN_800L 0x8080 -#define PCI_DEVICE_ID_TITAN_100 0xA001 -#define PCI_DEVICE_ID_TITAN_200 0xA005 -#define PCI_DEVICE_ID_TITAN_400 0xA003 -#define PCI_DEVICE_ID_TITAN_800B 0xA004 - -#define PCI_VENDOR_ID_PANACOM 0x14d4 -#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400 -#define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402 - -#define PCI_VENDOR_ID_SIPACKETS 0x14d9 -#define PCI_DEVICE_ID_SP1011 0x0010 - -#define PCI_VENDOR_ID_AFAVLAB 0x14db -#define PCI_DEVICE_ID_AFAVLAB_P028 0x2180 -#define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 -#define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150 - -#define PCI_VENDOR_ID_BCM_GVC 0x14a4 -#define PCI_VENDOR_ID_BROADCOM 0x14e4 -#define PCI_DEVICE_ID_TIGON3_5752 0x1600 -#define PCI_DEVICE_ID_TIGON3_5752M 0x1601 -#define PCI_DEVICE_ID_NX2_5709 0x1639 -#define PCI_DEVICE_ID_NX2_5709S 0x163a -#define PCI_DEVICE_ID_TIGON3_5700 0x1644 -#define PCI_DEVICE_ID_TIGON3_5701 0x1645 -#define PCI_DEVICE_ID_TIGON3_5702 0x1646 -#define PCI_DEVICE_ID_TIGON3_5703 0x1647 -#define PCI_DEVICE_ID_TIGON3_5704 0x1648 -#define PCI_DEVICE_ID_TIGON3_5704S_2 0x1649 -#define PCI_DEVICE_ID_NX2_5706 0x164a -#define PCI_DEVICE_ID_NX2_5708 0x164c -#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d -#define PCI_DEVICE_ID_NX2_57710 0x164e -#define PCI_DEVICE_ID_NX2_57711 0x164f -#define PCI_DEVICE_ID_NX2_57711E 0x1650 -#define PCI_DEVICE_ID_TIGON3_5705 0x1653 -#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 -#define PCI_DEVICE_ID_TIGON3_5719 0x1657 -#define PCI_DEVICE_ID_TIGON3_5721 0x1659 -#define PCI_DEVICE_ID_TIGON3_5722 0x165a -#define PCI_DEVICE_ID_TIGON3_5723 0x165b -#define PCI_DEVICE_ID_TIGON3_5705M 0x165d -#define PCI_DEVICE_ID_TIGON3_5705M_2 0x165e -#define PCI_DEVICE_ID_NX2_57712 0x1662 -#define PCI_DEVICE_ID_NX2_57712E 0x1663 -#define PCI_DEVICE_ID_TIGON3_5714 0x1668 -#define PCI_DEVICE_ID_TIGON3_5714S 0x1669 -#define PCI_DEVICE_ID_TIGON3_5780 0x166a -#define PCI_DEVICE_ID_TIGON3_5780S 0x166b -#define PCI_DEVICE_ID_TIGON3_5705F 0x166e -#define PCI_DEVICE_ID_TIGON3_5754M 0x1672 -#define PCI_DEVICE_ID_TIGON3_5755M 0x1673 -#define PCI_DEVICE_ID_TIGON3_5756 0x1674 -#define PCI_DEVICE_ID_TIGON3_5751 0x1677 -#define PCI_DEVICE_ID_TIGON3_5715 0x1678 -#define PCI_DEVICE_ID_TIGON3_5715S 0x1679 -#define PCI_DEVICE_ID_TIGON3_5754 0x167a -#define PCI_DEVICE_ID_TIGON3_5755 0x167b -#define PCI_DEVICE_ID_TIGON3_5751M 0x167d -#define PCI_DEVICE_ID_TIGON3_5751F 0x167e -#define PCI_DEVICE_ID_TIGON3_5787F 0x167f -#define PCI_DEVICE_ID_TIGON3_5761E 0x1680 -#define PCI_DEVICE_ID_TIGON3_5761 0x1681 -#define PCI_DEVICE_ID_TIGON3_5764 0x1684 -#define PCI_DEVICE_ID_NX2_57800 0x168a -#define PCI_DEVICE_ID_NX2_57840 0x168d -#define PCI_DEVICE_ID_NX2_57810 0x168e -#define PCI_DEVICE_ID_TIGON3_5787M 0x1693 -#define PCI_DEVICE_ID_TIGON3_5782 0x1696 -#define PCI_DEVICE_ID_TIGON3_5784 0x1698 -#define PCI_DEVICE_ID_TIGON3_5786 0x169a -#define PCI_DEVICE_ID_TIGON3_5787 0x169b -#define PCI_DEVICE_ID_TIGON3_5788 0x169c -#define PCI_DEVICE_ID_TIGON3_5789 0x169d -#define PCI_DEVICE_ID_NX2_57800_MF 0x16a5 -#define PCI_DEVICE_ID_TIGON3_5702X 0x16a6 -#define PCI_DEVICE_ID_TIGON3_5703X 0x16a7 -#define PCI_DEVICE_ID_TIGON3_5704S 0x16a8 -#define PCI_DEVICE_ID_NX2_57800_VF 0x16a9 -#define PCI_DEVICE_ID_NX2_5706S 0x16aa -#define PCI_DEVICE_ID_NX2_57840_MF 0x16ab -#define PCI_DEVICE_ID_NX2_5708S 0x16ac -#define PCI_DEVICE_ID_NX2_57840_VF 0x16ad -#define PCI_DEVICE_ID_NX2_57810_MF 0x16ae -#define PCI_DEVICE_ID_NX2_57810_VF 0x16af -#define PCI_DEVICE_ID_TIGON3_5702A3 0x16c6 -#define PCI_DEVICE_ID_TIGON3_5703A3 0x16c7 -#define PCI_DEVICE_ID_TIGON3_5781 0x16dd -#define PCI_DEVICE_ID_TIGON3_5753 0x16f7 -#define PCI_DEVICE_ID_TIGON3_5753M 0x16fd -#define PCI_DEVICE_ID_TIGON3_5753F 0x16fe -#define PCI_DEVICE_ID_TIGON3_5901 0x170d -#define PCI_DEVICE_ID_BCM4401B1 0x170c -#define PCI_DEVICE_ID_TIGON3_5901_2 0x170e -#define PCI_DEVICE_ID_TIGON3_5906 0x1712 -#define PCI_DEVICE_ID_TIGON3_5906M 0x1713 -#define PCI_DEVICE_ID_BCM4401 0x4401 -#define PCI_DEVICE_ID_BCM4401B0 0x4402 - -#define PCI_VENDOR_ID_TOPIC 0x151f -#define PCI_DEVICE_ID_TOPIC_TP560 0x0000 - -#define PCI_VENDOR_ID_MAINPINE 0x1522 -#define PCI_DEVICE_ID_MAINPINE_PBRIDGE 0x0100 -#define PCI_VENDOR_ID_ENE 0x1524 -#define PCI_DEVICE_ID_ENE_CB710_FLASH 0x0510 -#define PCI_DEVICE_ID_ENE_CB712_SD 0x0550 -#define PCI_DEVICE_ID_ENE_CB712_SD_2 0x0551 -#define PCI_DEVICE_ID_ENE_CB714_SD 0x0750 -#define PCI_DEVICE_ID_ENE_CB714_SD_2 0x0751 -#define PCI_DEVICE_ID_ENE_1211 0x1211 -#define PCI_DEVICE_ID_ENE_1225 0x1225 -#define PCI_DEVICE_ID_ENE_1410 0x1410 -#define PCI_DEVICE_ID_ENE_710 0x1411 -#define PCI_DEVICE_ID_ENE_712 0x1412 -#define PCI_DEVICE_ID_ENE_1420 0x1420 -#define PCI_DEVICE_ID_ENE_720 0x1421 -#define PCI_DEVICE_ID_ENE_722 0x1422 - -#define PCI_SUBVENDOR_ID_PERLE 0x155f -#define PCI_SUBDEVICE_ID_PCI_RAS4 0xf001 -#define PCI_SUBDEVICE_ID_PCI_RAS8 0xf010 - -#define PCI_VENDOR_ID_SYBA 0x1592 -#define PCI_DEVICE_ID_SYBA_2P_EPP 0x0782 -#define PCI_DEVICE_ID_SYBA_1P_ECP 0x0783 - -#define PCI_VENDOR_ID_MORETON 0x15aa -#define PCI_DEVICE_ID_RASTEL_2PORT 0x2000 - -#define PCI_VENDOR_ID_ZOLTRIX 0x15b0 -#define PCI_DEVICE_ID_ZOLTRIX_2BD0 0x2bd0 - -#define PCI_VENDOR_ID_MELLANOX 0x15b3 -#define PCI_DEVICE_ID_MELLANOX_TAVOR 0x5a44 -#define PCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE 0x5a46 -#define PCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278 -#define PCI_DEVICE_ID_MELLANOX_ARBEL 0x6282 -#define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c -#define PCI_DEVICE_ID_MELLANOX_SINAI 0x6274 - -#define PCI_VENDOR_ID_DFI 0x15bd - -#define PCI_VENDOR_ID_QUICKNET 0x15e2 -#define PCI_DEVICE_ID_QUICKNET_XJ 0x0500 - -/* - * ADDI-DATA GmbH communication cards <info@addi-data.com> - */ -#define PCI_VENDOR_ID_ADDIDATA_OLD 0x10E8 -#define PCI_VENDOR_ID_ADDIDATA 0x15B8 -#define PCI_DEVICE_ID_ADDIDATA_APCI7500 0x7000 -#define PCI_DEVICE_ID_ADDIDATA_APCI7420 0x7001 -#define PCI_DEVICE_ID_ADDIDATA_APCI7300 0x7002 -#define PCI_DEVICE_ID_ADDIDATA_APCI7800 0x818E -#define PCI_DEVICE_ID_ADDIDATA_APCI7500_2 0x7009 -#define PCI_DEVICE_ID_ADDIDATA_APCI7420_2 0x700A -#define PCI_DEVICE_ID_ADDIDATA_APCI7300_2 0x700B -#define PCI_DEVICE_ID_ADDIDATA_APCI7500_3 0x700C -#define PCI_DEVICE_ID_ADDIDATA_APCI7420_3 0x700D -#define PCI_DEVICE_ID_ADDIDATA_APCI7300_3 0x700E -#define PCI_DEVICE_ID_ADDIDATA_APCI7800_3 0x700F -#define PCI_DEVICE_ID_ADDIDATA_APCIe7300 0x7010 -#define PCI_DEVICE_ID_ADDIDATA_APCIe7420 0x7011 -#define PCI_DEVICE_ID_ADDIDATA_APCIe7500 0x7012 -#define PCI_DEVICE_ID_ADDIDATA_APCIe7800 0x7013 - -#define PCI_VENDOR_ID_PDC 0x15e9 - -#define PCI_VENDOR_ID_FARSITE 0x1619 -#define PCI_DEVICE_ID_FARSITE_T2P 0x0400 -#define PCI_DEVICE_ID_FARSITE_T4P 0x0440 -#define PCI_DEVICE_ID_FARSITE_T1U 0x0610 -#define PCI_DEVICE_ID_FARSITE_T2U 0x0620 -#define PCI_DEVICE_ID_FARSITE_T4U 0x0640 -#define PCI_DEVICE_ID_FARSITE_TE1 0x1610 -#define PCI_DEVICE_ID_FARSITE_TE1C 0x1612 - -#define PCI_VENDOR_ID_ARIMA 0x161f - -#define PCI_VENDOR_ID_BROCADE 0x1657 -#define PCI_DEVICE_ID_BROCADE_CT 0x0014 -#define PCI_DEVICE_ID_BROCADE_FC_8G1P 0x0017 -#define PCI_DEVICE_ID_BROCADE_CT_FC 0x0021 - -#define PCI_VENDOR_ID_SIBYTE 0x166d -#define PCI_DEVICE_ID_BCM1250_PCI 0x0001 -#define PCI_DEVICE_ID_BCM1250_HT 0x0002 - -#define PCI_VENDOR_ID_ATHEROS 0x168c - -#define PCI_VENDOR_ID_NETCELL 0x169c -#define PCI_DEVICE_ID_REVOLUTION 0x0044 - -#define PCI_VENDOR_ID_CENATEK 0x16CA -#define PCI_DEVICE_ID_CENATEK_IDE 0x0001 - -#define PCI_VENDOR_ID_VITESSE 0x1725 -#define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174 - -#define PCI_VENDOR_ID_LINKSYS 0x1737 -#define PCI_DEVICE_ID_LINKSYS_EG1064 0x1064 - -#define PCI_VENDOR_ID_ALTIMA 0x173b -#define PCI_DEVICE_ID_ALTIMA_AC1000 0x03e8 -#define PCI_DEVICE_ID_ALTIMA_AC1001 0x03e9 -#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea -#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb - -#define PCI_VENDOR_ID_BELKIN 0x1799 -#define PCI_DEVICE_ID_BELKIN_F5D7010V7 0x701f - -#define PCI_VENDOR_ID_RDC 0x17f3 -#define PCI_DEVICE_ID_RDC_R6020 0x6020 -#define PCI_DEVICE_ID_RDC_R6030 0x6030 -#define PCI_DEVICE_ID_RDC_R6040 0x6040 -#define PCI_DEVICE_ID_RDC_R6060 0x6060 -#define PCI_DEVICE_ID_RDC_R6061 0x6061 -#define PCI_DEVICE_ID_RDC_D1010 0x1010 - -#define PCI_VENDOR_ID_LENOVO 0x17aa - -#define PCI_VENDOR_ID_ARECA 0x17d3 -#define PCI_DEVICE_ID_ARECA_1110 0x1110 -#define PCI_DEVICE_ID_ARECA_1120 0x1120 -#define PCI_DEVICE_ID_ARECA_1130 0x1130 -#define PCI_DEVICE_ID_ARECA_1160 0x1160 -#define PCI_DEVICE_ID_ARECA_1170 0x1170 -#define PCI_DEVICE_ID_ARECA_1200 0x1200 -#define PCI_DEVICE_ID_ARECA_1201 0x1201 -#define PCI_DEVICE_ID_ARECA_1202 0x1202 -#define PCI_DEVICE_ID_ARECA_1210 0x1210 -#define PCI_DEVICE_ID_ARECA_1220 0x1220 -#define PCI_DEVICE_ID_ARECA_1230 0x1230 -#define PCI_DEVICE_ID_ARECA_1260 0x1260 -#define PCI_DEVICE_ID_ARECA_1270 0x1270 -#define PCI_DEVICE_ID_ARECA_1280 0x1280 -#define PCI_DEVICE_ID_ARECA_1380 0x1380 -#define PCI_DEVICE_ID_ARECA_1381 0x1381 -#define PCI_DEVICE_ID_ARECA_1680 0x1680 -#define PCI_DEVICE_ID_ARECA_1681 0x1681 - -#define PCI_VENDOR_ID_S2IO 0x17d5 -#define PCI_DEVICE_ID_S2IO_WIN 0x5731 -#define PCI_DEVICE_ID_S2IO_UNI 0x5831 -#define PCI_DEVICE_ID_HERC_WIN 0x5732 -#define PCI_DEVICE_ID_HERC_UNI 0x5832 - -#define PCI_VENDOR_ID_SITECOM 0x182d -#define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 - -#define PCI_VENDOR_ID_TOPSPIN 0x1867 - -#define PCI_VENDOR_ID_SILAN 0x1904 - -#define PCI_VENDOR_ID_RENESAS 0x1912 -#define PCI_DEVICE_ID_RENESAS_SH7781 0x0001 -#define PCI_DEVICE_ID_RENESAS_SH7780 0x0002 -#define PCI_DEVICE_ID_RENESAS_SH7763 0x0004 -#define PCI_DEVICE_ID_RENESAS_SH7785 0x0007 -#define PCI_DEVICE_ID_RENESAS_SH7786 0x0010 - -#define PCI_VENDOR_ID_SOLARFLARE 0x1924 -#define PCI_DEVICE_ID_SOLARFLARE_SFC4000A_0 0x0703 -#define PCI_DEVICE_ID_SOLARFLARE_SFC4000A_1 0x6703 -#define PCI_DEVICE_ID_SOLARFLARE_SFC4000B 0x0710 - -#define PCI_VENDOR_ID_TDI 0x192E -#define PCI_DEVICE_ID_TDI_EHCI 0x0101 - -#define PCI_VENDOR_ID_FREESCALE 0x1957 -#define PCI_DEVICE_ID_MPC8308 0xc006 -#define PCI_DEVICE_ID_MPC8315E 0x00b4 -#define PCI_DEVICE_ID_MPC8315 0x00b5 -#define PCI_DEVICE_ID_MPC8314E 0x00b6 -#define PCI_DEVICE_ID_MPC8314 0x00b7 -#define PCI_DEVICE_ID_MPC8378E 0x00c4 -#define PCI_DEVICE_ID_MPC8378 0x00c5 -#define PCI_DEVICE_ID_MPC8377E 0x00c6 -#define PCI_DEVICE_ID_MPC8377 0x00c7 -#define PCI_DEVICE_ID_MPC8548E 0x0012 -#define PCI_DEVICE_ID_MPC8548 0x0013 -#define PCI_DEVICE_ID_MPC8543E 0x0014 -#define PCI_DEVICE_ID_MPC8543 0x0015 -#define PCI_DEVICE_ID_MPC8547E 0x0018 -#define PCI_DEVICE_ID_MPC8545E 0x0019 -#define PCI_DEVICE_ID_MPC8545 0x001a -#define PCI_DEVICE_ID_MPC8569E 0x0061 -#define PCI_DEVICE_ID_MPC8569 0x0060 -#define PCI_DEVICE_ID_MPC8568E 0x0020 -#define PCI_DEVICE_ID_MPC8568 0x0021 -#define PCI_DEVICE_ID_MPC8567E 0x0022 -#define PCI_DEVICE_ID_MPC8567 0x0023 -#define PCI_DEVICE_ID_MPC8533E 0x0030 -#define PCI_DEVICE_ID_MPC8533 0x0031 -#define PCI_DEVICE_ID_MPC8544E 0x0032 -#define PCI_DEVICE_ID_MPC8544 0x0033 -#define PCI_DEVICE_ID_MPC8572E 0x0040 -#define PCI_DEVICE_ID_MPC8572 0x0041 -#define PCI_DEVICE_ID_MPC8536E 0x0050 -#define PCI_DEVICE_ID_MPC8536 0x0051 -#define PCI_DEVICE_ID_P2020E 0x0070 -#define PCI_DEVICE_ID_P2020 0x0071 -#define PCI_DEVICE_ID_P2010E 0x0078 -#define PCI_DEVICE_ID_P2010 0x0079 -#define PCI_DEVICE_ID_P1020E 0x0100 -#define PCI_DEVICE_ID_P1020 0x0101 -#define PCI_DEVICE_ID_P1021E 0x0102 -#define PCI_DEVICE_ID_P1021 0x0103 -#define PCI_DEVICE_ID_P1011E 0x0108 -#define PCI_DEVICE_ID_P1011 0x0109 -#define PCI_DEVICE_ID_P1022E 0x0110 -#define PCI_DEVICE_ID_P1022 0x0111 -#define PCI_DEVICE_ID_P1013E 0x0118 -#define PCI_DEVICE_ID_P1013 0x0119 -#define PCI_DEVICE_ID_P4080E 0x0400 -#define PCI_DEVICE_ID_P4080 0x0401 -#define PCI_DEVICE_ID_P4040E 0x0408 -#define PCI_DEVICE_ID_P4040 0x0409 -#define PCI_DEVICE_ID_P2040E 0x0410 -#define PCI_DEVICE_ID_P2040 0x0411 -#define PCI_DEVICE_ID_P3041E 0x041E -#define PCI_DEVICE_ID_P3041 0x041F -#define PCI_DEVICE_ID_P5020E 0x0420 -#define PCI_DEVICE_ID_P5020 0x0421 -#define PCI_DEVICE_ID_P5010E 0x0428 -#define PCI_DEVICE_ID_P5010 0x0429 -#define PCI_DEVICE_ID_MPC8641 0x7010 -#define PCI_DEVICE_ID_MPC8641D 0x7011 -#define PCI_DEVICE_ID_MPC8610 0x7018 - -#define PCI_VENDOR_ID_PASEMI 0x1959 - -#define PCI_VENDOR_ID_ATTANSIC 0x1969 -#define PCI_DEVICE_ID_ATTANSIC_L1 0x1048 -#define PCI_DEVICE_ID_ATTANSIC_L2 0x2048 - -#define PCI_VENDOR_ID_JMICRON 0x197B -#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 -#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361 -#define PCI_DEVICE_ID_JMICRON_JMB362 0x2362 -#define PCI_DEVICE_ID_JMICRON_JMB363 0x2363 -#define PCI_DEVICE_ID_JMICRON_JMB364 0x2364 -#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 -#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 -#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368 -#define PCI_DEVICE_ID_JMICRON_JMB369 0x2369 -#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381 -#define PCI_DEVICE_ID_JMICRON_JMB38X_MMC 0x2382 -#define PCI_DEVICE_ID_JMICRON_JMB38X_MS 0x2383 -#define PCI_DEVICE_ID_JMICRON_JMB385_MS 0x2388 -#define PCI_DEVICE_ID_JMICRON_JMB388_SD 0x2391 -#define PCI_DEVICE_ID_JMICRON_JMB388_ESD 0x2392 -#define PCI_DEVICE_ID_JMICRON_JMB390_MS 0x2393 - -#define PCI_VENDOR_ID_KORENIX 0x1982 -#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 -#define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff -#define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700 -#define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff - -#define PCI_VENDOR_ID_QMI 0x1a32 - -#define PCI_VENDOR_ID_AZWAVE 0x1a3b - -#define PCI_VENDOR_ID_ASMEDIA 0x1b21 - -#define PCI_VENDOR_ID_TEKRAM 0x1de1 -#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 - -#define PCI_VENDOR_ID_TEHUTI 0x1fc9 -#define PCI_DEVICE_ID_TEHUTI_3009 0x3009 -#define PCI_DEVICE_ID_TEHUTI_3010 0x3010 -#define PCI_DEVICE_ID_TEHUTI_3014 0x3014 - -#define PCI_VENDOR_ID_HINT 0x3388 -#define PCI_DEVICE_ID_HINT_VXPROII_IDE 0x8013 - -#define PCI_VENDOR_ID_3DLABS 0x3d3d -#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 -#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 - -#define PCI_VENDOR_ID_NETXEN 0x4040 -#define PCI_DEVICE_ID_NX2031_10GXSR 0x0001 -#define PCI_DEVICE_ID_NX2031_10GCX4 0x0002 -#define PCI_DEVICE_ID_NX2031_4GCU 0x0003 -#define PCI_DEVICE_ID_NX2031_IMEZ 0x0004 -#define PCI_DEVICE_ID_NX2031_HMEZ 0x0005 -#define PCI_DEVICE_ID_NX2031_XG_MGMT 0x0024 -#define PCI_DEVICE_ID_NX2031_XG_MGMT2 0x0025 -#define PCI_DEVICE_ID_NX3031 0x0100 - -#define PCI_VENDOR_ID_AKS 0x416c -#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 - -#define PCI_VENDOR_ID_ACCESSIO 0x494f -#define PCI_DEVICE_ID_ACCESSIO_WDG_CSM 0x22c0 - -#define PCI_VENDOR_ID_S3 0x5333 -#define PCI_DEVICE_ID_S3_TRIO 0x8811 -#define PCI_DEVICE_ID_S3_868 0x8880 -#define PCI_DEVICE_ID_S3_968 0x88f0 -#define PCI_DEVICE_ID_S3_SAVAGE4 0x8a25 -#define PCI_DEVICE_ID_S3_PROSAVAGE8 0x8d04 -#define PCI_DEVICE_ID_S3_SONICVIBES 0xca00 - -#define PCI_VENDOR_ID_DUNORD 0x5544 -#define PCI_DEVICE_ID_DUNORD_I3000 0x0001 - -#define PCI_VENDOR_ID_DCI 0x6666 -#define PCI_DEVICE_ID_DCI_PCCOM4 0x0001 -#define PCI_DEVICE_ID_DCI_PCCOM8 0x0002 -#define PCI_DEVICE_ID_DCI_PCCOM2 0x0004 - -#define PCI_VENDOR_ID_INTEL 0x8086 -#define PCI_DEVICE_ID_INTEL_EESSC 0x0008 -#define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320 -#define PCI_DEVICE_ID_INTEL_PXHD_1 0x0321 -#define PCI_DEVICE_ID_INTEL_PXH_0 0x0329 -#define PCI_DEVICE_ID_INTEL_PXH_1 0x032A -#define PCI_DEVICE_ID_INTEL_PXHV 0x032C -#define PCI_DEVICE_ID_INTEL_80332_0 0x0330 -#define PCI_DEVICE_ID_INTEL_80332_1 0x0332 -#define PCI_DEVICE_ID_INTEL_80333_0 0x0370 -#define PCI_DEVICE_ID_INTEL_80333_1 0x0372 -#define PCI_DEVICE_ID_INTEL_82375 0x0482 -#define PCI_DEVICE_ID_INTEL_82424 0x0483 -#define PCI_DEVICE_ID_INTEL_82378 0x0484 -#define PCI_DEVICE_ID_INTEL_MRST_SD0 0x0807 -#define PCI_DEVICE_ID_INTEL_MRST_SD1 0x0808 -#define PCI_DEVICE_ID_INTEL_MFD_SD 0x0820 -#define PCI_DEVICE_ID_INTEL_MFD_SDIO1 0x0821 -#define PCI_DEVICE_ID_INTEL_MFD_SDIO2 0x0822 -#define PCI_DEVICE_ID_INTEL_MFD_EMMC0 0x0823 -#define PCI_DEVICE_ID_INTEL_MFD_EMMC1 0x0824 -#define PCI_DEVICE_ID_INTEL_MRST_SD2 0x084F -#define PCI_DEVICE_ID_INTEL_I960 0x0960 -#define PCI_DEVICE_ID_INTEL_I960RM 0x0962 -#define PCI_DEVICE_ID_INTEL_8257X_SOL 0x1062 -#define PCI_DEVICE_ID_INTEL_82573E_SOL 0x1085 -#define PCI_DEVICE_ID_INTEL_82573L_SOL 0x108F -#define PCI_DEVICE_ID_INTEL_82815_MC 0x1130 -#define PCI_DEVICE_ID_INTEL_82815_CGC 0x1132 -#define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221 -#define PCI_DEVICE_ID_INTEL_7505_0 0x2550 -#define PCI_DEVICE_ID_INTEL_7205_0 0x255d -#define PCI_DEVICE_ID_INTEL_82437 0x122d -#define PCI_DEVICE_ID_INTEL_82371FB_0 0x122e -#define PCI_DEVICE_ID_INTEL_82371FB_1 0x1230 -#define PCI_DEVICE_ID_INTEL_82371MX 0x1234 -#define PCI_DEVICE_ID_INTEL_82441 0x1237 -#define PCI_DEVICE_ID_INTEL_82380FB 0x124b -#define PCI_DEVICE_ID_INTEL_82439 0x1250 -#define PCI_DEVICE_ID_INTEL_80960_RP 0x1960 -#define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 -#define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 -#define PCI_DEVICE_ID_INTEL_IOAT 0x1a38 -#define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MIN 0x1c41 -#define PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MAX 0x1c5f -#define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_0 0x1d40 -#define PCI_DEVICE_ID_INTEL_PATSBURG_LPC_1 0x1d41 -#define PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI 0x1e31 -#define PCI_DEVICE_ID_INTEL_PANTHERPOINT_LPC_MIN 0x1e40 -#define PCI_DEVICE_ID_INTEL_PANTHERPOINT_LPC_MAX 0x1e5f -#define PCI_DEVICE_ID_INTEL_DH89XXCC_LPC_MIN 0x2310 -#define PCI_DEVICE_ID_INTEL_DH89XXCC_LPC_MAX 0x231f -#define PCI_DEVICE_ID_INTEL_82801AA_0 0x2410 -#define PCI_DEVICE_ID_INTEL_82801AA_1 0x2411 -#define PCI_DEVICE_ID_INTEL_82801AA_3 0x2413 -#define PCI_DEVICE_ID_INTEL_82801AA_5 0x2415 -#define PCI_DEVICE_ID_INTEL_82801AA_6 0x2416 -#define PCI_DEVICE_ID_INTEL_82801AA_8 0x2418 -#define PCI_DEVICE_ID_INTEL_82801AB_0 0x2420 -#define PCI_DEVICE_ID_INTEL_82801AB_1 0x2421 -#define PCI_DEVICE_ID_INTEL_82801AB_3 0x2423 -#define PCI_DEVICE_ID_INTEL_82801AB_5 0x2425 -#define PCI_DEVICE_ID_INTEL_82801AB_6 0x2426 -#define PCI_DEVICE_ID_INTEL_82801AB_8 0x2428 -#define PCI_DEVICE_ID_INTEL_82801BA_0 0x2440 -#define PCI_DEVICE_ID_INTEL_82801BA_2 0x2443 -#define PCI_DEVICE_ID_INTEL_82801BA_4 0x2445 -#define PCI_DEVICE_ID_INTEL_82801BA_6 0x2448 -#define PCI_DEVICE_ID_INTEL_82801BA_8 0x244a -#define PCI_DEVICE_ID_INTEL_82801BA_9 0x244b -#define PCI_DEVICE_ID_INTEL_82801BA_10 0x244c -#define PCI_DEVICE_ID_INTEL_82801BA_11 0x244e -#define PCI_DEVICE_ID_INTEL_82801E_0 0x2450 -#define PCI_DEVICE_ID_INTEL_82801E_11 0x245b -#define PCI_DEVICE_ID_INTEL_82801CA_0 0x2480 -#define PCI_DEVICE_ID_INTEL_82801CA_3 0x2483 -#define PCI_DEVICE_ID_INTEL_82801CA_5 0x2485 -#define PCI_DEVICE_ID_INTEL_82801CA_6 0x2486 -#define PCI_DEVICE_ID_INTEL_82801CA_10 0x248a -#define PCI_DEVICE_ID_INTEL_82801CA_11 0x248b -#define PCI_DEVICE_ID_INTEL_82801CA_12 0x248c -#define PCI_DEVICE_ID_INTEL_82801DB_0 0x24c0 -#define PCI_DEVICE_ID_INTEL_82801DB_1 0x24c1 -#define PCI_DEVICE_ID_INTEL_82801DB_2 0x24c2 -#define PCI_DEVICE_ID_INTEL_82801DB_3 0x24c3 -#define PCI_DEVICE_ID_INTEL_82801DB_5 0x24c5 -#define PCI_DEVICE_ID_INTEL_82801DB_6 0x24c6 -#define PCI_DEVICE_ID_INTEL_82801DB_9 0x24c9 -#define PCI_DEVICE_ID_INTEL_82801DB_10 0x24ca -#define PCI_DEVICE_ID_INTEL_82801DB_11 0x24cb -#define PCI_DEVICE_ID_INTEL_82801DB_12 0x24cc -#define PCI_DEVICE_ID_INTEL_82801EB_0 0x24d0 -#define PCI_DEVICE_ID_INTEL_82801EB_1 0x24d1 -#define PCI_DEVICE_ID_INTEL_82801EB_3 0x24d3 -#define PCI_DEVICE_ID_INTEL_82801EB_5 0x24d5 -#define PCI_DEVICE_ID_INTEL_82801EB_6 0x24d6 -#define PCI_DEVICE_ID_INTEL_82801EB_11 0x24db -#define PCI_DEVICE_ID_INTEL_82801EB_12 0x24dc -#define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd -#define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1 -#define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2 -#define PCI_DEVICE_ID_INTEL_ESB_4 0x25a4 -#define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6 -#define PCI_DEVICE_ID_INTEL_ESB_9 0x25ab -#define PCI_DEVICE_ID_INTEL_ESB_10 0x25ac -#define PCI_DEVICE_ID_INTEL_82820_HB 0x2500 -#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501 -#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530 -#define PCI_DEVICE_ID_INTEL_82860_HB 0x2531 -#define PCI_DEVICE_ID_INTEL_E7501_MCH 0x254c -#define PCI_DEVICE_ID_INTEL_82845G_HB 0x2560 -#define PCI_DEVICE_ID_INTEL_82845G_IG 0x2562 -#define PCI_DEVICE_ID_INTEL_82865_HB 0x2570 -#define PCI_DEVICE_ID_INTEL_82865_IG 0x2572 -#define PCI_DEVICE_ID_INTEL_82875_HB 0x2578 -#define PCI_DEVICE_ID_INTEL_82915G_HB 0x2580 -#define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582 -#define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590 -#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 -#define PCI_DEVICE_ID_INTEL_5000_ERR 0x25F0 -#define PCI_DEVICE_ID_INTEL_5000_FBD0 0x25F5 -#define PCI_DEVICE_ID_INTEL_5000_FBD1 0x25F6 -#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770 -#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772 -#define PCI_DEVICE_ID_INTEL_3000_HB 0x2778 -#define PCI_DEVICE_ID_INTEL_82945GM_HB 0x27A0 -#define PCI_DEVICE_ID_INTEL_82945GM_IG 0x27A2 -#define PCI_DEVICE_ID_INTEL_ICH6_0 0x2640 -#define PCI_DEVICE_ID_INTEL_ICH6_1 0x2641 -#define PCI_DEVICE_ID_INTEL_ICH6_2 0x2642 -#define PCI_DEVICE_ID_INTEL_ICH6_16 0x266a -#define PCI_DEVICE_ID_INTEL_ICH6_17 0x266d -#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e -#define PCI_DEVICE_ID_INTEL_ICH6_19 0x266f -#define PCI_DEVICE_ID_INTEL_ESB2_0 0x2670 -#define PCI_DEVICE_ID_INTEL_ESB2_14 0x2698 -#define PCI_DEVICE_ID_INTEL_ESB2_17 0x269b -#define PCI_DEVICE_ID_INTEL_ESB2_18 0x269e -#define PCI_DEVICE_ID_INTEL_ICH7_0 0x27b8 -#define PCI_DEVICE_ID_INTEL_ICH7_1 0x27b9 -#define PCI_DEVICE_ID_INTEL_ICH7_30 0x27b0 -#define PCI_DEVICE_ID_INTEL_TGP_LPC 0x27bc -#define PCI_DEVICE_ID_INTEL_ICH7_31 0x27bd -#define PCI_DEVICE_ID_INTEL_ICH7_17 0x27da -#define PCI_DEVICE_ID_INTEL_ICH7_19 0x27dd -#define PCI_DEVICE_ID_INTEL_ICH7_20 0x27de -#define PCI_DEVICE_ID_INTEL_ICH7_21 0x27df -#define PCI_DEVICE_ID_INTEL_ICH8_0 0x2810 -#define PCI_DEVICE_ID_INTEL_ICH8_1 0x2811 -#define PCI_DEVICE_ID_INTEL_ICH8_2 0x2812 -#define PCI_DEVICE_ID_INTEL_ICH8_3 0x2814 -#define PCI_DEVICE_ID_INTEL_ICH8_4 0x2815 -#define PCI_DEVICE_ID_INTEL_ICH8_5 0x283e -#define PCI_DEVICE_ID_INTEL_ICH8_6 0x2850 -#define PCI_DEVICE_ID_INTEL_ICH9_0 0x2910 -#define PCI_DEVICE_ID_INTEL_ICH9_1 0x2917 -#define PCI_DEVICE_ID_INTEL_ICH9_2 0x2912 -#define PCI_DEVICE_ID_INTEL_ICH9_3 0x2913 -#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914 -#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919 -#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 -#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916 -#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918 -#define PCI_DEVICE_ID_INTEL_I7_MCR 0x2c18 -#define PCI_DEVICE_ID_INTEL_I7_MC_TAD 0x2c19 -#define PCI_DEVICE_ID_INTEL_I7_MC_RAS 0x2c1a -#define PCI_DEVICE_ID_INTEL_I7_MC_TEST 0x2c1c -#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_CTRL 0x2c20 -#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_ADDR 0x2c21 -#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_RANK 0x2c22 -#define PCI_DEVICE_ID_INTEL_I7_MC_CH0_TC 0x2c23 -#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_CTRL 0x2c28 -#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_ADDR 0x2c29 -#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_RANK 0x2c2a -#define PCI_DEVICE_ID_INTEL_I7_MC_CH1_TC 0x2c2b -#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_CTRL 0x2c30 -#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_ADDR 0x2c31 -#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_RANK 0x2c32 -#define PCI_DEVICE_ID_INTEL_I7_MC_CH2_TC 0x2c33 -#define PCI_DEVICE_ID_INTEL_I7_NONCORE 0x2c41 -#define PCI_DEVICE_ID_INTEL_I7_NONCORE_ALT 0x2c40 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE 0x2c50 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_ALT 0x2c51 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_NONCORE_REV2 0x2c70 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_SAD 0x2c81 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_QPI_LINK0 0x2c90 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_QPI_PHY0 0x2c91 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MCR 0x2c98 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TAD 0x2c99 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TEST 0x2c9C -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_CTRL 0x2ca0 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_ADDR 0x2ca1 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_RANK 0x2ca2 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_TC 0x2ca3 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_CTRL 0x2ca8 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_ADDR 0x2ca9 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_RANK 0x2caa -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_TC 0x2cab -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MCR_REV2 0x2d98 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TAD_REV2 0x2d99 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_RAS_REV2 0x2d9a -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_TEST_REV2 0x2d9c -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_CTRL_REV2 0x2da0 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_ADDR_REV2 0x2da1 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_RANK_REV2 0x2da2 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH0_TC_REV2 0x2da3 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_CTRL_REV2 0x2da8 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_ADDR_REV2 0x2da9 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_RANK_REV2 0x2daa -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH1_TC_REV2 0x2dab -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_CTRL_REV2 0x2db0 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_ADDR_REV2 0x2db1 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_RANK_REV2 0x2db2 -#define PCI_DEVICE_ID_INTEL_LYNNFIELD_MC_CH2_TC_REV2 0x2db3 -#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 -#define PCI_DEVICE_ID_INTEL_IOAT_TBG4 0x3429 -#define PCI_DEVICE_ID_INTEL_IOAT_TBG5 0x342a -#define PCI_DEVICE_ID_INTEL_IOAT_TBG6 0x342b -#define PCI_DEVICE_ID_INTEL_IOAT_TBG7 0x342c -#define PCI_DEVICE_ID_INTEL_X58_HUB_MGMT 0x342e -#define PCI_DEVICE_ID_INTEL_IOAT_TBG0 0x3430 -#define PCI_DEVICE_ID_INTEL_IOAT_TBG1 0x3431 -#define PCI_DEVICE_ID_INTEL_IOAT_TBG2 0x3432 -#define PCI_DEVICE_ID_INTEL_IOAT_TBG3 0x3433 -#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 -#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 -#define PCI_DEVICE_ID_INTEL_82854_HB 0x358c -#define PCI_DEVICE_ID_INTEL_82854_IG 0x358e -#define PCI_DEVICE_ID_INTEL_82855GM_HB 0x3580 -#define PCI_DEVICE_ID_INTEL_82855GM_IG 0x3582 -#define PCI_DEVICE_ID_INTEL_E7520_MCH 0x3590 -#define PCI_DEVICE_ID_INTEL_E7320_MCH 0x3592 -#define PCI_DEVICE_ID_INTEL_MCH_PA 0x3595 -#define PCI_DEVICE_ID_INTEL_MCH_PA1 0x3596 -#define PCI_DEVICE_ID_INTEL_MCH_PB 0x3597 -#define PCI_DEVICE_ID_INTEL_MCH_PB1 0x3598 -#define PCI_DEVICE_ID_INTEL_MCH_PC 0x3599 -#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a -#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e -#define PCI_DEVICE_ID_INTEL_I7300_MCH_ERR 0x360c -#define PCI_DEVICE_ID_INTEL_I7300_MCH_FB0 0x360f -#define PCI_DEVICE_ID_INTEL_I7300_MCH_FB1 0x3610 -#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b -#define PCI_DEVICE_ID_INTEL_FBD_CNB 0x360c -#define PCI_DEVICE_ID_INTEL_IOAT_JSF0 0x3710 -#define PCI_DEVICE_ID_INTEL_IOAT_JSF1 0x3711 -#define PCI_DEVICE_ID_INTEL_IOAT_JSF2 0x3712 -#define PCI_DEVICE_ID_INTEL_IOAT_JSF3 0x3713 -#define PCI_DEVICE_ID_INTEL_IOAT_JSF4 0x3714 -#define PCI_DEVICE_ID_INTEL_IOAT_JSF5 0x3715 -#define PCI_DEVICE_ID_INTEL_IOAT_JSF6 0x3716 -#define PCI_DEVICE_ID_INTEL_IOAT_JSF7 0x3717 -#define PCI_DEVICE_ID_INTEL_IOAT_JSF8 0x3718 -#define PCI_DEVICE_ID_INTEL_IOAT_JSF9 0x3719 -#define PCI_DEVICE_ID_INTEL_ICH10_0 0x3a14 -#define PCI_DEVICE_ID_INTEL_ICH10_1 0x3a16 -#define PCI_DEVICE_ID_INTEL_ICH10_2 0x3a18 -#define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a -#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 -#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 -#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MIN 0x3b00 -#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MAX 0x3b1f -#define PCI_DEVICE_ID_INTEL_IOAT_SNB0 0x3c20 -#define PCI_DEVICE_ID_INTEL_IOAT_SNB1 0x3c21 -#define PCI_DEVICE_ID_INTEL_IOAT_SNB2 0x3c22 -#define PCI_DEVICE_ID_INTEL_IOAT_SNB3 0x3c23 -#define PCI_DEVICE_ID_INTEL_IOAT_SNB4 0x3c24 -#define PCI_DEVICE_ID_INTEL_IOAT_SNB5 0x3c25 -#define PCI_DEVICE_ID_INTEL_IOAT_SNB6 0x3c26 -#define PCI_DEVICE_ID_INTEL_IOAT_SNB7 0x3c27 -#define PCI_DEVICE_ID_INTEL_IOAT_SNB8 0x3c2e -#define PCI_DEVICE_ID_INTEL_IOAT_SNB9 0x3c2f -#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f -#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 -#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 -#define PCI_DEVICE_ID_INTEL_5100_22 0x65f6 -#define PCI_DEVICE_ID_INTEL_5400_ERR 0x4030 -#define PCI_DEVICE_ID_INTEL_5400_FBD0 0x4035 -#define PCI_DEVICE_ID_INTEL_5400_FBD1 0x4036 -#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff -#define PCI_DEVICE_ID_INTEL_EP80579_0 0x5031 -#define PCI_DEVICE_ID_INTEL_EP80579_1 0x5032 -#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 -#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 -#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 -#define PCI_DEVICE_ID_INTEL_82437VX 0x7030 -#define PCI_DEVICE_ID_INTEL_82439TX 0x7100 -#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110 -#define PCI_DEVICE_ID_INTEL_82371AB 0x7111 -#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112 -#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 -#define PCI_DEVICE_ID_INTEL_82810_MC1 0x7120 -#define PCI_DEVICE_ID_INTEL_82810_IG1 0x7121 -#define PCI_DEVICE_ID_INTEL_82810_MC3 0x7122 -#define PCI_DEVICE_ID_INTEL_82810_IG3 0x7123 -#define PCI_DEVICE_ID_INTEL_82810E_MC 0x7124 -#define PCI_DEVICE_ID_INTEL_82810E_IG 0x7125 -#define PCI_DEVICE_ID_INTEL_82443LX_0 0x7180 -#define PCI_DEVICE_ID_INTEL_82443LX_1 0x7181 -#define PCI_DEVICE_ID_INTEL_82443BX_0 0x7190 -#define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191 -#define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192 -#define PCI_DEVICE_ID_INTEL_440MX 0x7195 -#define PCI_DEVICE_ID_INTEL_440MX_6 0x7196 -#define PCI_DEVICE_ID_INTEL_82443MX_0 0x7198 -#define PCI_DEVICE_ID_INTEL_82443MX_1 0x7199 -#define PCI_DEVICE_ID_INTEL_82443MX_3 0x719b -#define PCI_DEVICE_ID_INTEL_82443GX_0 0x71a0 -#define PCI_DEVICE_ID_INTEL_82443GX_2 0x71a2 -#define PCI_DEVICE_ID_INTEL_82372FB_1 0x7601 -#define PCI_DEVICE_ID_INTEL_SCH_LPC 0x8119 -#define PCI_DEVICE_ID_INTEL_SCH_IDE 0x811a -#define PCI_DEVICE_ID_INTEL_ITC_LPC 0x8186 -#define PCI_DEVICE_ID_INTEL_82454GX 0x84c4 -#define PCI_DEVICE_ID_INTEL_82450GX 0x84c5 -#define PCI_DEVICE_ID_INTEL_82451NX 0x84ca -#define PCI_DEVICE_ID_INTEL_82454NX 0x84cb -#define PCI_DEVICE_ID_INTEL_84460GX 0x84ea -#define PCI_DEVICE_ID_INTEL_IXP4XX 0x8500 -#define PCI_DEVICE_ID_INTEL_IXP2800 0x9004 -#define PCI_DEVICE_ID_INTEL_S21152BB 0xb152 - -#define PCI_VENDOR_ID_SCALEMP 0x8686 -#define PCI_DEVICE_ID_SCALEMP_VSMP_CTL 0x1010 - -#define PCI_VENDOR_ID_COMPUTONE 0x8e0e -#define PCI_DEVICE_ID_COMPUTONE_IP2EX 0x0291 -#define PCI_DEVICE_ID_COMPUTONE_PG 0x0302 -#define PCI_SUBVENDOR_ID_COMPUTONE 0x8e0e -#define PCI_SUBDEVICE_ID_COMPUTONE_PG4 0x0001 -#define PCI_SUBDEVICE_ID_COMPUTONE_PG8 0x0002 -#define PCI_SUBDEVICE_ID_COMPUTONE_PG6 0x0003 - -#define PCI_VENDOR_ID_KTI 0x8e2e - -#define PCI_VENDOR_ID_ADAPTEC 0x9004 -#define PCI_DEVICE_ID_ADAPTEC_7810 0x1078 -#define PCI_DEVICE_ID_ADAPTEC_7821 0x2178 -#define PCI_DEVICE_ID_ADAPTEC_38602 0x3860 -#define PCI_DEVICE_ID_ADAPTEC_7850 0x5078 -#define PCI_DEVICE_ID_ADAPTEC_7855 0x5578 -#define PCI_DEVICE_ID_ADAPTEC_3860 0x6038 -#define PCI_DEVICE_ID_ADAPTEC_1480A 0x6075 -#define PCI_DEVICE_ID_ADAPTEC_7860 0x6078 -#define PCI_DEVICE_ID_ADAPTEC_7861 0x6178 -#define PCI_DEVICE_ID_ADAPTEC_7870 0x7078 -#define PCI_DEVICE_ID_ADAPTEC_7871 0x7178 -#define PCI_DEVICE_ID_ADAPTEC_7872 0x7278 -#define PCI_DEVICE_ID_ADAPTEC_7873 0x7378 -#define PCI_DEVICE_ID_ADAPTEC_7874 0x7478 -#define PCI_DEVICE_ID_ADAPTEC_7895 0x7895 -#define PCI_DEVICE_ID_ADAPTEC_7880 0x8078 -#define PCI_DEVICE_ID_ADAPTEC_7881 0x8178 -#define PCI_DEVICE_ID_ADAPTEC_7882 0x8278 -#define PCI_DEVICE_ID_ADAPTEC_7883 0x8378 -#define PCI_DEVICE_ID_ADAPTEC_7884 0x8478 -#define PCI_DEVICE_ID_ADAPTEC_7885 0x8578 -#define PCI_DEVICE_ID_ADAPTEC_7886 0x8678 -#define PCI_DEVICE_ID_ADAPTEC_7887 0x8778 -#define PCI_DEVICE_ID_ADAPTEC_7888 0x8878 - -#define PCI_VENDOR_ID_ADAPTEC2 0x9005 -#define PCI_DEVICE_ID_ADAPTEC2_2940U2 0x0010 -#define PCI_DEVICE_ID_ADAPTEC2_2930U2 0x0011 -#define PCI_DEVICE_ID_ADAPTEC2_7890B 0x0013 -#define PCI_DEVICE_ID_ADAPTEC2_7890 0x001f -#define PCI_DEVICE_ID_ADAPTEC2_3940U2 0x0050 -#define PCI_DEVICE_ID_ADAPTEC2_3950U2D 0x0051 -#define PCI_DEVICE_ID_ADAPTEC2_7896 0x005f -#define PCI_DEVICE_ID_ADAPTEC2_7892A 0x0080 -#define PCI_DEVICE_ID_ADAPTEC2_7892B 0x0081 -#define PCI_DEVICE_ID_ADAPTEC2_7892D 0x0083 -#define PCI_DEVICE_ID_ADAPTEC2_7892P 0x008f -#define PCI_DEVICE_ID_ADAPTEC2_7899A 0x00c0 -#define PCI_DEVICE_ID_ADAPTEC2_7899B 0x00c1 -#define PCI_DEVICE_ID_ADAPTEC2_7899D 0x00c3 -#define PCI_DEVICE_ID_ADAPTEC2_7899P 0x00cf -#define PCI_DEVICE_ID_ADAPTEC2_OBSIDIAN 0x0500 -#define PCI_DEVICE_ID_ADAPTEC2_SCAMP 0x0503 - -#define PCI_VENDOR_ID_HOLTEK 0x9412 -#define PCI_DEVICE_ID_HOLTEK_6565 0x6565 - -#define PCI_VENDOR_ID_NETMOS 0x9710 -#define PCI_DEVICE_ID_NETMOS_9705 0x9705 -#define PCI_DEVICE_ID_NETMOS_9715 0x9715 -#define PCI_DEVICE_ID_NETMOS_9735 0x9735 -#define PCI_DEVICE_ID_NETMOS_9745 0x9745 -#define PCI_DEVICE_ID_NETMOS_9755 0x9755 -#define PCI_DEVICE_ID_NETMOS_9805 0x9805 -#define PCI_DEVICE_ID_NETMOS_9815 0x9815 -#define PCI_DEVICE_ID_NETMOS_9835 0x9835 -#define PCI_DEVICE_ID_NETMOS_9845 0x9845 -#define PCI_DEVICE_ID_NETMOS_9855 0x9855 -#define PCI_DEVICE_ID_NETMOS_9865 0x9865 -#define PCI_DEVICE_ID_NETMOS_9900 0x9900 -#define PCI_DEVICE_ID_NETMOS_9901 0x9901 -#define PCI_DEVICE_ID_NETMOS_9904 0x9904 -#define PCI_DEVICE_ID_NETMOS_9912 0x9912 -#define PCI_DEVICE_ID_NETMOS_9922 0x9922 - -#define PCI_VENDOR_ID_3COM_2 0xa727 - -#define PCI_VENDOR_ID_DIGIUM 0xd161 -#define PCI_DEVICE_ID_DIGIUM_HFC4S 0xb410 - -#define PCI_SUBVENDOR_ID_EXSYS 0xd84d -#define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014 -#define PCI_SUBDEVICE_ID_EXSYS_4055 0x4055 - -#define PCI_VENDOR_ID_TIGERJET 0xe159 -#define PCI_DEVICE_ID_TIGERJET_300 0x0001 -#define PCI_DEVICE_ID_TIGERJET_100 0x0002 - -#define PCI_VENDOR_ID_XILINX_RME 0xea60 -#define PCI_DEVICE_ID_RME_DIGI32 0x9896 -#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897 -#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898 - -#define PCI_VENDOR_ID_XEN 0x5853 -#define PCI_DEVICE_ID_XEN_PLATFORM 0x0001 - -#define PCI_VENDOR_ID_OCZ 0x1b85 diff --git a/openairITS/mac/DOT11/include/linux/pm_qos.h b/openairITS/mac/DOT11/include/linux/pm_qos.h deleted file mode 100644 index c58c1c1f016..00000000000 --- a/openairITS/mac/DOT11/include/linux/pm_qos.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _COMPAT_LINUX_PM_QOS_H -#define _COMPAT_LINUX_PM_QOS_H 1 - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) -#include_next <linux/pm_qos.h> -#else -#include <linux/pm_qos_params.h> -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */ - -#endif /* _COMPAT_LINUX_PM_QOS_H */ diff --git a/openairITS/mac/DOT11/include/linux/pm_qos_params.h b/openairITS/mac/DOT11/include/linux/pm_qos_params.h deleted file mode 100644 index d0e3ad863aa..00000000000 --- a/openairITS/mac/DOT11/include/linux/pm_qos_params.h +++ /dev/null @@ -1,36 +0,0 @@ -#include <linux/version.h> - -#ifndef __COMPAT_LINUX_PM_QOS_PARAMS_H -#define __COMPAT_LINUX_PM_QOS_PARAMS_H - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) -#include_next <linux/pm_qos_params.h> -#else -/* interface for the pm_qos_power infrastructure of the linux kernel. - * - * Mark Gross <mgross@linux.intel.com> - */ -#include <linux/list.h> -#include <linux/notifier.h> -#include <linux/miscdevice.h> - -#define PM_QOS_RESERVED 0 -#define PM_QOS_CPU_DMA_LATENCY 1 -#define PM_QOS_NETWORK_LATENCY 2 -#define PM_QOS_NETWORK_THROUGHPUT 3 -#define PM_QOS_SYSTEM_BUS_FREQ 4 - -#define PM_QOS_NUM_CLASSES 5 -#define PM_QOS_DEFAULT_VALUE -1 - -int pm_qos_add_requirement(int qos, char *name, s32 value); -int pm_qos_update_requirement(int qos, char *name, s32 new_value); -void pm_qos_remove_requirement(int qos, char *name); - -int pm_qos_requirement(int qos); - -int pm_qos_add_notifier(int qos, struct notifier_block *notifier); -int pm_qos_remove_notifier(int qos, struct notifier_block *notifier); -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) */ - -#endif diff --git a/openairITS/mac/DOT11/include/linux/pm_runtime.h b/openairITS/mac/DOT11/include/linux/pm_runtime.h deleted file mode 100644 index eec965ba0d7..00000000000 --- a/openairITS/mac/DOT11/include/linux/pm_runtime.h +++ /dev/null @@ -1,14 +0,0 @@ -#include <linux/version.h> - -#ifndef __COMPAT_LINUX_PM_RUNTIME_H -#define __COMPAT_LINUX_PM_RUNTIME_H - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) -#include_next <linux/pm_runtime.h> -#else - -static inline void pm_runtime_enable(struct device *dev) {} - -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) */ - -#endif diff --git a/openairITS/mac/DOT11/include/linux/printk.h b/openairITS/mac/DOT11/include/linux/printk.h deleted file mode 100644 index c0822ac488c..00000000000 --- a/openairITS/mac/DOT11/include/linux/printk.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _COMPAT_LINUX_PRINTK_H -#define _COMPAT_LINUX_PRINTK_H 1 - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,36)) -#include_next <linux/printk.h> -#else -#include <linux/kernel.h> -#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35)) */ - -#endif /* _COMPAT_LINUX_PRINTK_H */ diff --git a/openairITS/mac/DOT11/include/linux/rfkill.h b/openairITS/mac/DOT11/include/linux/rfkill.h deleted file mode 100644 index d615ac9f5b7..00000000000 --- a/openairITS/mac/DOT11/include/linux/rfkill.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __COMPAT_RFKILL_H -#define __COMPAT_RFKILL_H - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)) - -#include_next <linux/rfkill.h> - -#else - -#include <linux/compat-2.6.h> - -#undef CONFIG_RFKILL -#undef CONFIG_RFKILL_INPUT -#undef CONFIG_RFKILL_LEDS - -#ifdef CONFIG_RFKILL_BACKPORT -#define CONFIG_RFKILL 1 -#endif - -#ifdef CONFIG_RFKILL_BACKPORT_INPUT -#define CONFIG_RFKILL_INPUT -#endif - -#ifdef CONFIG_RFKILL_BACKPORT_LEDS -#define CONFIG_RFKILL_LEDS -#endif - -#include <linux/rfkill_backport.h> - -#endif - -#endif diff --git a/openairITS/mac/DOT11/include/linux/rfkill_backport.h b/openairITS/mac/DOT11/include/linux/rfkill_backport.h deleted file mode 100644 index 6fdf02737e9..00000000000 --- a/openairITS/mac/DOT11/include/linux/rfkill_backport.h +++ /dev/null @@ -1,359 +0,0 @@ -#ifndef __RFKILL_H -#define __RFKILL_H - -/* - * Copyright (C) 2006 - 2007 Ivo van Doorn - * Copyright (C) 2007 Dmitry Torokhov - * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <linux/types.h> - -/* define userspace visible states */ -#define RFKILL_STATE_SOFT_BLOCKED 0 -#define RFKILL_STATE_UNBLOCKED 1 -#define RFKILL_STATE_HARD_BLOCKED 2 - -/** - * enum rfkill_type - type of rfkill switch. - * - * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type) - * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. - * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. - * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. - * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device. - * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device. - * @RFKILL_TYPE_GPS: switch is on a GPS device. - * @RFKILL_TYPE_FM: switch is on a FM radio device. - * @NUM_RFKILL_TYPES: number of defined rfkill types - */ -enum rfkill_type { - RFKILL_TYPE_ALL = 0, - RFKILL_TYPE_WLAN, - RFKILL_TYPE_BLUETOOTH, - RFKILL_TYPE_UWB, - RFKILL_TYPE_WIMAX, - RFKILL_TYPE_WWAN, - RFKILL_TYPE_GPS, - RFKILL_TYPE_FM, - NUM_RFKILL_TYPES, -}; - -/** - * enum rfkill_operation - operation types - * @RFKILL_OP_ADD: a device was added - * @RFKILL_OP_DEL: a device was removed - * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device - * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all) - */ -enum rfkill_operation { - RFKILL_OP_ADD = 0, - RFKILL_OP_DEL, - RFKILL_OP_CHANGE, - RFKILL_OP_CHANGE_ALL, -}; - -/** - * struct rfkill_event - events for userspace on /dev/rfkill - * @idx: index of dev rfkill - * @type: type of the rfkill struct - * @op: operation code - * @hard: hard state (0/1) - * @soft: soft state (0/1) - * - * Structure used for userspace communication on /dev/rfkill, - * used for events from the kernel and control to the kernel. - */ -struct rfkill_event { - __u32 idx; - __u8 type; - __u8 op; - __u8 soft, hard; -} __attribute__((packed)); - -/* - * We are planning to be backward and forward compatible with changes - * to the event struct, by adding new, optional, members at the end. - * When reading an event (whether the kernel from userspace or vice - * versa) we need to accept anything that's at least as large as the - * version 1 event size, but might be able to accept other sizes in - * the future. - * - * One exception is the kernel -- we already have two event sizes in - * that we've made the 'hard' member optional since our only option - * is to ignore it anyway. - */ -#define RFKILL_EVENT_SIZE_V1 8 - -/* ioctl for turning off rfkill-input (if present) */ -#define RFKILL_IOC_MAGIC 'R' -#define RFKILL_IOC_NOINPUT 1 -#define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT) - -/* and that's all userspace gets */ -#ifdef __KERNEL__ -/* don't allow anyone to use these in the kernel */ -enum rfkill_user_states { - RFKILL_USER_STATE_SOFT_BLOCKED = RFKILL_STATE_SOFT_BLOCKED, - RFKILL_USER_STATE_UNBLOCKED = RFKILL_STATE_UNBLOCKED, - RFKILL_USER_STATE_HARD_BLOCKED = RFKILL_STATE_HARD_BLOCKED, -}; -#undef RFKILL_STATE_SOFT_BLOCKED -#undef RFKILL_STATE_UNBLOCKED -#undef RFKILL_STATE_HARD_BLOCKED - -#include <linux/kernel.h> -#include <linux/list.h> -#include <linux/mutex.h> -#include <linux/leds.h> -#include <linux/err.h> - -struct device; -/* this is opaque */ -struct rfkill; - -/** - * struct rfkill_ops - rfkill driver methods - * - * @poll: poll the rfkill block state(s) -- only assign this method - * when you need polling. When called, simply call one of the - * rfkill_set{,_hw,_sw}_state family of functions. If the hw - * is getting unblocked you need to take into account the return - * value of those functions to make sure the software block is - * properly used. - * @query: query the rfkill block state(s) and call exactly one of the - * rfkill_set{,_hw,_sw}_state family of functions. Assign this - * method if input events can cause hardware state changes to make - * the rfkill core query your driver before setting a requested - * block. - * @set_block: turn the transmitter on (blocked == false) or off - * (blocked == true) -- ignore and return 0 when hard blocked. - * This callback must be assigned. - */ -struct rfkill_ops { - void (*poll)(struct rfkill *rfkill, void *data); - void (*query)(struct rfkill *rfkill, void *data); - int (*set_block)(void *data, bool blocked); -}; - -#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE) -/** - * rfkill_alloc - allocate rfkill structure - * @name: name of the struct -- the string is not copied internally - * @parent: device that has rf switch on it - * @type: type of the switch (RFKILL_TYPE_*) - * @ops: rfkill methods - * @ops_data: data passed to each method - * - * This function should be called by the transmitter driver to allocate an - * rfkill structure. Returns %NULL on failure. - */ -struct rfkill * __must_check rfkill_alloc(const char *name, - struct device *parent, - const enum rfkill_type type, - const struct rfkill_ops *ops, - void *ops_data); - -/** - * rfkill_register - Register a rfkill structure. - * @rfkill: rfkill structure to be registered - * - * This function should be called by the transmitter driver to register - * the rfkill structure. Before calling this function the driver needs - * to be ready to service method calls from rfkill. - * - * If rfkill_init_sw_state() is not called before registration, - * set_block() will be called to initialize the software blocked state - * to a default value. - * - * If the hardware blocked state is not set before registration, - * it is assumed to be unblocked. - */ -int __must_check rfkill_register(struct rfkill *rfkill); - -/** - * rfkill_pause_polling(struct rfkill *rfkill) - * - * Pause polling -- say transmitter is off for other reasons. - * NOTE: not necessary for suspend/resume -- in that case the - * core stops polling anyway - */ -void rfkill_pause_polling(struct rfkill *rfkill); - -/** - * rfkill_resume_polling(struct rfkill *rfkill) - * - * Pause polling -- say transmitter is off for other reasons. - * NOTE: not necessary for suspend/resume -- in that case the - * core stops polling anyway - */ -void rfkill_resume_polling(struct rfkill *rfkill); - - -/** - * rfkill_unregister - Unregister a rfkill structure. - * @rfkill: rfkill structure to be unregistered - * - * This function should be called by the network driver during device - * teardown to destroy rfkill structure. Until it returns, the driver - * needs to be able to service method calls. - */ -void rfkill_unregister(struct rfkill *rfkill); - -/** - * rfkill_destroy - free rfkill structure - * @rfkill: rfkill structure to be destroyed - * - * Destroys the rfkill structure. - */ -void rfkill_destroy(struct rfkill *rfkill); - -/** - * rfkill_set_hw_state - Set the internal rfkill hardware block state - * @rfkill: pointer to the rfkill class to modify. - * @state: the current hardware block state to set - * - * rfkill drivers that get events when the hard-blocked state changes - * use this function to notify the rfkill core (and through that also - * userspace) of the current state. They should also use this after - * resume if the state could have changed. - * - * You need not (but may) call this function if poll_state is assigned. - * - * This function can be called in any context, even from within rfkill - * callbacks. - * - * The function returns the combined block state (true if transmitter - * should be blocked) so that drivers need not keep track of the soft - * block state -- which they might not be able to. - */ -bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked); - -/** - * rfkill_set_sw_state - Set the internal rfkill software block state - * @rfkill: pointer to the rfkill class to modify. - * @state: the current software block state to set - * - * rfkill drivers that get events when the soft-blocked state changes - * (yes, some platforms directly act on input but allow changing again) - * use this function to notify the rfkill core (and through that also - * userspace) of the current state. - * - * Drivers should also call this function after resume if the state has - * been changed by the user. This only makes sense for "persistent" - * devices (see rfkill_init_sw_state()). - * - * This function can be called in any context, even from within rfkill - * callbacks. - * - * The function returns the combined block state (true if transmitter - * should be blocked). - */ -bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked); - -/** - * rfkill_init_sw_state - Initialize persistent software block state - * @rfkill: pointer to the rfkill class to modify. - * @state: the current software block state to set - * - * rfkill drivers that preserve their software block state over power off - * use this function to notify the rfkill core (and through that also - * userspace) of their initial state. It should only be used before - * registration. - * - * In addition, it marks the device as "persistent", an attribute which - * can be read by userspace. Persistent devices are expected to preserve - * their own state when suspended. - */ -void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked); - -/** - * rfkill_set_states - Set the internal rfkill block states - * @rfkill: pointer to the rfkill class to modify. - * @sw: the current software block state to set - * @hw: the current hardware block state to set - * - * This function can be called in any context, even from within rfkill - * callbacks. - */ -void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw); - -/** - * rfkill_blocked - query rfkill block - * - * @rfkill: rfkill struct to query - */ -bool rfkill_blocked(struct rfkill *rfkill); -#else /* !RFKILL */ -static inline struct rfkill * __must_check -rfkill_alloc(const char *name, - struct device *parent, - const enum rfkill_type type, - const struct rfkill_ops *ops, - void *ops_data) -{ - return ERR_PTR(-ENODEV); -} - -static inline int __must_check rfkill_register(struct rfkill *rfkill) -{ - if (rfkill == ERR_PTR(-ENODEV)) - return 0; - return -EINVAL; -} - -static inline void rfkill_pause_polling(struct rfkill *rfkill) -{ -} - -static inline void rfkill_resume_polling(struct rfkill *rfkill) -{ -} - -static inline void rfkill_unregister(struct rfkill *rfkill) -{ -} - -static inline void rfkill_destroy(struct rfkill *rfkill) -{ -} - -static inline bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked) -{ - return blocked; -} - -static inline bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked) -{ - return blocked; -} - -static inline void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked) -{ -} - -static inline void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw) -{ -} - -static inline bool rfkill_blocked(struct rfkill *rfkill) -{ - return false; -} -#endif /* RFKILL || RFKILL_MODULE */ - -#endif /* __KERNEL__ */ - -#endif /* RFKILL_H */ diff --git a/openairITS/mac/DOT11/include/linux/semaphore.h b/openairITS/mac/DOT11/include/linux/semaphore.h deleted file mode 100644 index 78af4db376f..00000000000 --- a/openairITS/mac/DOT11/include/linux/semaphore.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _COMPAT_LINUX_SEMAPHORE_H -#define _COMPAT_LINUX_SEMAPHORE_H 1 - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)) -#include_next <linux/semaphore.h> -#else -#include <asm/semaphore.h> -#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,25)) */ - -#endif /* _COMPAT_LINUX_SEMAPHORE_H */ diff --git a/openairITS/mac/DOT11/include/linux/spi/libertas_spi.h b/openairITS/mac/DOT11/include/linux/spi/libertas_spi.h deleted file mode 100644 index 1b5d5384fcd..00000000000 --- a/openairITS/mac/DOT11/include/linux/spi/libertas_spi.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * board-specific data for the libertas_spi driver. - * - * Copyright 2008 Analog Devices Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - */ -#ifndef _LIBERTAS_SPI_H_ -#define _LIBERTAS_SPI_H_ - -struct spi_device; - -struct libertas_spi_platform_data { - /* There are two ways to read data from the WLAN module's SPI - * interface. Setting 0 or 1 here controls which one is used. - * - * Usually you want to set use_dummy_writes = 1. - * However, if that doesn't work or if you are using a slow SPI clock - * speed, you may want to use 0 here. */ - u16 use_dummy_writes; - - /* Board specific setup/teardown */ - int (*setup)(struct spi_device *spi); - int (*teardown)(struct spi_device *spi); -}; -#endif diff --git a/openairITS/mac/DOT11/include/linux/ssb/ssb.h b/openairITS/mac/DOT11/include/linux/ssb/ssb.h deleted file mode 100644 index d2768318002..00000000000 --- a/openairITS/mac/DOT11/include/linux/ssb/ssb.h +++ /dev/null @@ -1,625 +0,0 @@ -#ifndef LINUX_SSB_H_ -#define LINUX_SSB_H_ - -#include <linux/device.h> -#include <linux/list.h> -#include <linux/types.h> -#include <linux/spinlock.h> -#include <linux/pci.h> -#include <linux/mod_devicetable.h> -#include <linux/dma-mapping.h> - -#include <linux/ssb/ssb_regs.h> - - -struct pcmcia_device; -struct ssb_bus; -struct ssb_driver; - -struct ssb_sprom_core_pwr_info { - u8 itssi_2g, itssi_5g; - u8 maxpwr_2g, maxpwr_5gl, maxpwr_5g, maxpwr_5gh; - u16 pa_2g[4], pa_5gl[4], pa_5g[4], pa_5gh[4]; -}; - -struct ssb_sprom { - u8 revision; - u8 il0mac[6]; /* MAC address for 802.11b/g */ - u8 et0mac[6]; /* MAC address for Ethernet */ - u8 et1mac[6]; /* MAC address for 802.11a */ - u8 et0phyaddr; /* MII address for enet0 */ - u8 et1phyaddr; /* MII address for enet1 */ - u8 et0mdcport; /* MDIO for enet0 */ - u8 et1mdcport; /* MDIO for enet1 */ - u16 board_rev; /* Board revision number from SPROM. */ - u16 board_num; /* Board number from SPROM. */ - u16 board_type; /* Board type from SPROM. */ - u8 country_code; /* Country Code */ - char alpha2[2]; /* Country Code as two chars like EU or US */ - u8 leddc_on_time; /* LED Powersave Duty Cycle On Count */ - u8 leddc_off_time; /* LED Powersave Duty Cycle Off Count */ - u8 ant_available_a; /* 2GHz antenna available bits (up to 4) */ - u8 ant_available_bg; /* 5GHz antenna available bits (up to 4) */ - u16 pa0b0; - u16 pa0b1; - u16 pa0b2; - u16 pa1b0; - u16 pa1b1; - u16 pa1b2; - u16 pa1lob0; - u16 pa1lob1; - u16 pa1lob2; - u16 pa1hib0; - u16 pa1hib1; - u16 pa1hib2; - u8 gpio0; /* GPIO pin 0 */ - u8 gpio1; /* GPIO pin 1 */ - u8 gpio2; /* GPIO pin 2 */ - u8 gpio3; /* GPIO pin 3 */ - u8 maxpwr_bg; /* 2.4GHz Amplifier Max Power (in dBm Q5.2) */ - u8 maxpwr_al; /* 5.2GHz Amplifier Max Power (in dBm Q5.2) */ - u8 maxpwr_a; /* 5.3GHz Amplifier Max Power (in dBm Q5.2) */ - u8 maxpwr_ah; /* 5.8GHz Amplifier Max Power (in dBm Q5.2) */ - u8 itssi_a; /* Idle TSSI Target for A-PHY */ - u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ - u8 tri2g; /* 2.4GHz TX isolation */ - u8 tri5gl; /* 5.2GHz TX isolation */ - u8 tri5g; /* 5.3GHz TX isolation */ - u8 tri5gh; /* 5.8GHz TX isolation */ - u8 txpid2g[4]; /* 2GHz TX power index */ - u8 txpid5gl[4]; /* 4.9 - 5.1GHz TX power index */ - u8 txpid5g[4]; /* 5.1 - 5.5GHz TX power index */ - u8 txpid5gh[4]; /* 5.5 - ...GHz TX power index */ - s8 rxpo2g; /* 2GHz RX power offset */ - s8 rxpo5g; /* 5GHz RX power offset */ - u8 rssisav2g; /* 2GHz RSSI params */ - u8 rssismc2g; - u8 rssismf2g; - u8 bxa2g; /* 2GHz BX arch */ - u8 rssisav5g; /* 5GHz RSSI params */ - u8 rssismc5g; - u8 rssismf5g; - u8 bxa5g; /* 5GHz BX arch */ - u16 cck2gpo; /* CCK power offset */ - u32 ofdm2gpo; /* 2.4GHz OFDM power offset */ - u32 ofdm5glpo; /* 5.2GHz OFDM power offset */ - u32 ofdm5gpo; /* 5.3GHz OFDM power offset */ - u32 ofdm5ghpo; /* 5.8GHz OFDM power offset */ - u16 boardflags_lo; /* Board flags (bits 0-15) */ - u16 boardflags_hi; /* Board flags (bits 16-31) */ - u16 boardflags2_lo; /* Board flags (bits 32-47) */ - u16 boardflags2_hi; /* Board flags (bits 48-63) */ - /* TODO store board flags in a single u64 */ - - struct ssb_sprom_core_pwr_info core_pwr_info[4]; - - /* Antenna gain values for up to 4 antennas - * on each band. Values in dBm/4 (Q5.2). Negative gain means the - * loss in the connectors is bigger than the gain. */ - struct { - s8 a0, a1, a2, a3; - } antenna_gain; - - struct { - struct { - u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut; - } ghz2; - struct { - u8 tssipos, extpa_gain, pdet_range, tr_iso, antswlut; - } ghz5; - } fem; - - u16 mcs2gpo[8]; - u16 mcs5gpo[8]; - u16 mcs5glpo[8]; - u16 mcs5ghpo[8]; - u8 opo; - - u8 rxgainerr2ga[3]; - u8 rxgainerr5gla[3]; - u8 rxgainerr5gma[3]; - u8 rxgainerr5gha[3]; - u8 rxgainerr5gua[3]; - - u8 noiselvl2ga[3]; - u8 noiselvl5gla[3]; - u8 noiselvl5gma[3]; - u8 noiselvl5gha[3]; - u8 noiselvl5gua[3]; - - u8 regrev; - u8 txchain; - u8 rxchain; - u8 antswitch; - u16 cddpo; - u16 stbcpo; - u16 bw40po; - u16 bwduppo; - - u8 tempthresh; - u8 tempoffset; - u16 rawtempsense; - u8 measpower; - u8 tempsense_slope; - u8 tempcorrx; - u8 tempsense_option; - u8 freqoffset_corr; - u8 iqcal_swp_dis; - u8 hw_iqcal_en; - u8 elna2g; - u8 elna5g; - u8 phycal_tempdelta; - u8 temps_period; - u8 temps_hysteresis; - u8 measpower1; - u8 measpower2; - u8 pcieingress_war; - - /* power per rate from sromrev 9 */ - u16 cckbw202gpo; - u16 cckbw20ul2gpo; - u32 legofdmbw202gpo; - u32 legofdmbw20ul2gpo; - u32 legofdmbw205glpo; - u32 legofdmbw20ul5glpo; - u32 legofdmbw205gmpo; - u32 legofdmbw20ul5gmpo; - u32 legofdmbw205ghpo; - u32 legofdmbw20ul5ghpo; - u32 mcsbw202gpo; - u32 mcsbw20ul2gpo; - u32 mcsbw402gpo; - u32 mcsbw205glpo; - u32 mcsbw20ul5glpo; - u32 mcsbw405glpo; - u32 mcsbw205gmpo; - u32 mcsbw20ul5gmpo; - u32 mcsbw405gmpo; - u32 mcsbw205ghpo; - u32 mcsbw20ul5ghpo; - u32 mcsbw405ghpo; - u16 mcs32po; - u16 legofdm40duppo; - u8 sar2g; - u8 sar5g; -}; - -/* Information about the PCB the circuitry is soldered on. */ -struct ssb_boardinfo { - u16 vendor; - u16 type; - u8 rev; -}; - - -struct ssb_device; -/* Lowlevel read/write operations on the device MMIO. - * Internal, don't use that outside of ssb. */ -struct ssb_bus_ops { - u8 (*read8)(struct ssb_device *dev, u16 offset); - u16 (*read16)(struct ssb_device *dev, u16 offset); - u32 (*read32)(struct ssb_device *dev, u16 offset); - void (*write8)(struct ssb_device *dev, u16 offset, u8 value); - void (*write16)(struct ssb_device *dev, u16 offset, u16 value); - void (*write32)(struct ssb_device *dev, u16 offset, u32 value); -#ifdef CONFIG_SSB_BLOCKIO - void (*block_read)(struct ssb_device *dev, void *buffer, - size_t count, u16 offset, u8 reg_width); - void (*block_write)(struct ssb_device *dev, const void *buffer, - size_t count, u16 offset, u8 reg_width); -#endif -}; - - -/* Core-ID values. */ -#define SSB_DEV_CHIPCOMMON 0x800 -#define SSB_DEV_ILINE20 0x801 -#define SSB_DEV_SDRAM 0x803 -#define SSB_DEV_PCI 0x804 -#define SSB_DEV_MIPS 0x805 -#define SSB_DEV_ETHERNET 0x806 -#define SSB_DEV_V90 0x807 -#define SSB_DEV_USB11_HOSTDEV 0x808 -#define SSB_DEV_ADSL 0x809 -#define SSB_DEV_ILINE100 0x80A -#define SSB_DEV_IPSEC 0x80B -#define SSB_DEV_PCMCIA 0x80D -#define SSB_DEV_INTERNAL_MEM 0x80E -#define SSB_DEV_MEMC_SDRAM 0x80F -#define SSB_DEV_EXTIF 0x811 -#define SSB_DEV_80211 0x812 -#define SSB_DEV_MIPS_3302 0x816 -#define SSB_DEV_USB11_HOST 0x817 -#define SSB_DEV_USB11_DEV 0x818 -#define SSB_DEV_USB20_HOST 0x819 -#define SSB_DEV_USB20_DEV 0x81A -#define SSB_DEV_SDIO_HOST 0x81B -#define SSB_DEV_ROBOSWITCH 0x81C -#define SSB_DEV_PARA_ATA 0x81D -#define SSB_DEV_SATA_XORDMA 0x81E -#define SSB_DEV_ETHERNET_GBIT 0x81F -#define SSB_DEV_PCIE 0x820 -#define SSB_DEV_MIMO_PHY 0x821 -#define SSB_DEV_SRAM_CTRLR 0x822 -#define SSB_DEV_MINI_MACPHY 0x823 -#define SSB_DEV_ARM_1176 0x824 -#define SSB_DEV_ARM_7TDMI 0x825 - -/* Vendor-ID values */ -#define SSB_VENDOR_BROADCOM 0x4243 - -/* Some kernel subsystems poke with dev->drvdata, so we must use the - * following ugly workaround to get from struct device to struct ssb_device */ -struct __ssb_dev_wrapper { - struct device dev; - struct ssb_device *sdev; -}; - -struct ssb_device { - /* Having a copy of the ops pointer in each dev struct - * is an optimization. */ - const struct ssb_bus_ops *ops; - - struct device *dev, *dma_dev; - - struct ssb_bus *bus; - struct ssb_device_id id; - - u8 core_index; - unsigned int irq; - - /* Internal-only stuff follows. */ - void *drvdata; /* Per-device data */ - void *devtypedata; /* Per-devicetype (eg 802.11) data */ -}; - -/* Go from struct device to struct ssb_device. */ -static inline -struct ssb_device * dev_to_ssb_dev(struct device *dev) -{ - struct __ssb_dev_wrapper *wrap; - wrap = container_of(dev, struct __ssb_dev_wrapper, dev); - return wrap->sdev; -} - -/* Device specific user data */ -static inline -void ssb_set_drvdata(struct ssb_device *dev, void *data) -{ - dev->drvdata = data; -} -static inline -void * ssb_get_drvdata(struct ssb_device *dev) -{ - return dev->drvdata; -} - -/* Devicetype specific user data. This is per device-type (not per device) */ -void ssb_set_devtypedata(struct ssb_device *dev, void *data); -static inline -void * ssb_get_devtypedata(struct ssb_device *dev) -{ - return dev->devtypedata; -} - - -struct ssb_driver { - const char *name; - const struct ssb_device_id *id_table; - - int (*probe)(struct ssb_device *dev, const struct ssb_device_id *id); - void (*remove)(struct ssb_device *dev); - int (*suspend)(struct ssb_device *dev, pm_message_t state); - int (*resume)(struct ssb_device *dev); - void (*shutdown)(struct ssb_device *dev); - - struct device_driver drv; -}; -#define drv_to_ssb_drv(_drv) container_of(_drv, struct ssb_driver, drv) - -extern int __ssb_driver_register(struct ssb_driver *drv, struct module *owner); -#define ssb_driver_register(drv) \ - __ssb_driver_register(drv, THIS_MODULE) - -extern void ssb_driver_unregister(struct ssb_driver *drv); - - - - -enum ssb_bustype { - SSB_BUSTYPE_SSB, /* This SSB bus is the system bus */ - SSB_BUSTYPE_PCI, /* SSB is connected to PCI bus */ - SSB_BUSTYPE_PCMCIA, /* SSB is connected to PCMCIA bus */ - SSB_BUSTYPE_SDIO, /* SSB is connected to SDIO bus */ -}; - -/* board_vendor */ -#define SSB_BOARDVENDOR_BCM 0x14E4 /* Broadcom */ -#define SSB_BOARDVENDOR_DELL 0x1028 /* Dell */ -#define SSB_BOARDVENDOR_HP 0x0E11 /* HP */ -/* board_type */ -#define SSB_BOARD_BCM94306MP 0x0418 -#define SSB_BOARD_BCM4309G 0x0421 -#define SSB_BOARD_BCM4306CB 0x0417 -#define SSB_BOARD_BCM4309MP 0x040C -#define SSB_BOARD_MP4318 0x044A -#define SSB_BOARD_BU4306 0x0416 -#define SSB_BOARD_BU4309 0x040A -/* chip_package */ -#define SSB_CHIPPACK_BCM4712S 1 /* Small 200pin 4712 */ -#define SSB_CHIPPACK_BCM4712M 2 /* Medium 225pin 4712 */ -#define SSB_CHIPPACK_BCM4712L 0 /* Large 340pin 4712 */ - -#include <linux/ssb/ssb_driver_chipcommon.h> -#include <linux/ssb/ssb_driver_mips.h> -#include <linux/ssb/ssb_driver_extif.h> -#include <linux/ssb/ssb_driver_pci.h> - -struct ssb_bus { - /* The MMIO area. */ - void __iomem *mmio; - - const struct ssb_bus_ops *ops; - - /* The core currently mapped into the MMIO window. - * Not valid on all host-buses. So don't use outside of SSB. */ - struct ssb_device *mapped_device; - union { - /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ - u8 mapped_pcmcia_seg; - /* Current SSB base address window for SDIO. */ - u32 sdio_sbaddr; - }; - /* Lock for core and segment switching. - * On PCMCIA-host busses this is used to protect the whole MMIO access. */ - spinlock_t bar_lock; - - /* The host-bus this backplane is running on. */ - enum ssb_bustype bustype; - /* Pointers to the host-bus. Check bustype before using any of these pointers. */ - union { - /* Pointer to the PCI bus (only valid if bustype == SSB_BUSTYPE_PCI). */ - struct pci_dev *host_pci; - /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ - struct pcmcia_device *host_pcmcia; - /* Pointer to the SDIO device (only if bustype == SSB_BUSTYPE_SDIO). */ - struct sdio_func *host_sdio; - }; - - /* See enum ssb_quirks */ - unsigned int quirks; - -#ifdef CONFIG_SSB_SPROM - /* Mutex to protect the SPROM writing. */ - struct mutex sprom_mutex; -#endif - - /* ID information about the Chip. */ - u16 chip_id; - u8 chip_rev; - u16 sprom_offset; - u16 sprom_size; /* number of words in sprom */ - u8 chip_package; - - /* List of devices (cores) on the backplane. */ - struct ssb_device devices[SSB_MAX_NR_CORES]; - u8 nr_devices; - - /* Software ID number for this bus. */ - unsigned int busnumber; - - /* The ChipCommon device (if available). */ - struct ssb_chipcommon chipco; - /* The PCI-core device (if available). */ - struct ssb_pcicore pcicore; - /* The MIPS-core device (if available). */ - struct ssb_mipscore mipscore; - /* The EXTif-core device (if available). */ - struct ssb_extif extif; - - /* The following structure elements are not available in early - * SSB initialization. Though, they are available for regular - * registered drivers at any stage. So be careful when - * using them in the ssb core code. */ - - /* ID information about the PCB. */ - struct ssb_boardinfo boardinfo; - /* Contents of the SPROM. */ - struct ssb_sprom sprom; - /* If the board has a cardbus slot, this is set to true. */ - bool has_cardbus_slot; - -#ifdef CONFIG_SSB_EMBEDDED - /* Lock for GPIO register access. */ - spinlock_t gpio_lock; -#endif /* EMBEDDED */ - - /* Internal-only stuff follows. Do not touch. */ - struct list_head list; -#ifdef CONFIG_SSB_DEBUG - /* Is the bus already powered up? */ - bool powered_up; - int power_warn_count; -#endif /* DEBUG */ -}; - -enum ssb_quirks { - /* SDIO connected card requires performing a read after writing a 32-bit value */ - SSB_QUIRK_SDIO_READ_AFTER_WRITE32 = (1 << 0), -}; - -/* The initialization-invariants. */ -struct ssb_init_invariants { - /* Versioning information about the PCB. */ - struct ssb_boardinfo boardinfo; - /* The SPROM information. That's either stored in an - * EEPROM or NVRAM on the board. */ - struct ssb_sprom sprom; - /* If the board has a cardbus slot, this is set to true. */ - bool has_cardbus_slot; -}; -/* Type of function to fetch the invariants. */ -typedef int (*ssb_invariants_func_t)(struct ssb_bus *bus, - struct ssb_init_invariants *iv); - -/* Register a SSB system bus. get_invariants() is called after the - * basic system devices are initialized. - * The invariants are usually fetched from some NVRAM. - * Put the invariants into the struct pointed to by iv. */ -extern int ssb_bus_ssbbus_register(struct ssb_bus *bus, - unsigned long baseaddr, - ssb_invariants_func_t get_invariants); -#ifdef CONFIG_SSB_PCIHOST -extern int ssb_bus_pcibus_register(struct ssb_bus *bus, - struct pci_dev *host_pci); -#endif /* CONFIG_SSB_PCIHOST */ -#ifdef CONFIG_SSB_PCMCIAHOST -extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus, - struct pcmcia_device *pcmcia_dev, - unsigned long baseaddr); -#endif /* CONFIG_SSB_PCMCIAHOST */ -#ifdef CONFIG_SSB_SDIOHOST -extern int ssb_bus_sdiobus_register(struct ssb_bus *bus, - struct sdio_func *sdio_func, - unsigned int quirks); -#endif /* CONFIG_SSB_SDIOHOST */ - - -extern void ssb_bus_unregister(struct ssb_bus *bus); - -/* Does the device have an SPROM? */ -extern bool ssb_is_sprom_available(struct ssb_bus *bus); - -/* Set a fallback SPROM. - * See kdoc at the function definition for complete documentation. */ -extern int ssb_arch_register_fallback_sprom( - int (*sprom_callback)(struct ssb_bus *bus, - struct ssb_sprom *out)); - -/* Suspend a SSB bus. - * Call this from the parent bus suspend routine. */ -extern int ssb_bus_suspend(struct ssb_bus *bus); -/* Resume a SSB bus. - * Call this from the parent bus resume routine. */ -extern int ssb_bus_resume(struct ssb_bus *bus); - -extern u32 ssb_clockspeed(struct ssb_bus *bus); - -/* Is the device enabled in hardware? */ -int ssb_device_is_enabled(struct ssb_device *dev); -/* Enable a device and pass device-specific SSB_TMSLOW flags. - * If no device-specific flags are available, use 0. */ -void ssb_device_enable(struct ssb_device *dev, u32 core_specific_flags); -/* Disable a device in hardware and pass SSB_TMSLOW flags (if any). */ -void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags); - - -/* Device MMIO register read/write functions. */ -static inline u8 ssb_read8(struct ssb_device *dev, u16 offset) -{ - return dev->ops->read8(dev, offset); -} -static inline u16 ssb_read16(struct ssb_device *dev, u16 offset) -{ - return dev->ops->read16(dev, offset); -} -static inline u32 ssb_read32(struct ssb_device *dev, u16 offset) -{ - return dev->ops->read32(dev, offset); -} -static inline void ssb_write8(struct ssb_device *dev, u16 offset, u8 value) -{ - dev->ops->write8(dev, offset, value); -} -static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value) -{ - dev->ops->write16(dev, offset, value); -} -static inline void ssb_write32(struct ssb_device *dev, u16 offset, u32 value) -{ - dev->ops->write32(dev, offset, value); -} -#ifdef CONFIG_SSB_BLOCKIO -static inline void ssb_block_read(struct ssb_device *dev, void *buffer, - size_t count, u16 offset, u8 reg_width) -{ - dev->ops->block_read(dev, buffer, count, offset, reg_width); -} - -static inline void ssb_block_write(struct ssb_device *dev, const void *buffer, - size_t count, u16 offset, u8 reg_width) -{ - dev->ops->block_write(dev, buffer, count, offset, reg_width); -} -#endif /* CONFIG_SSB_BLOCKIO */ - - -/* The SSB DMA API. Use this API for any DMA operation on the device. - * This API basically is a wrapper that calls the correct DMA API for - * the host device type the SSB device is attached to. */ - -/* Translation (routing) bits that need to be ORed to DMA - * addresses before they are given to a device. */ -extern u32 ssb_dma_translation(struct ssb_device *dev); -#define SSB_DMA_TRANSLATION_MASK 0xC0000000 -#define SSB_DMA_TRANSLATION_SHIFT 30 - -static inline void __cold __ssb_dma_not_implemented(struct ssb_device *dev) -{ -#ifdef CONFIG_SSB_DEBUG - printk(KERN_ERR "SSB: BUG! Calling DMA API for " - "unsupported bustype %d\n", dev->bus->bustype); -#endif /* DEBUG */ -} - -#ifdef CONFIG_SSB_PCIHOST -/* PCI-host wrapper driver */ -extern int ssb_pcihost_register(struct pci_driver *driver); -static inline void ssb_pcihost_unregister(struct pci_driver *driver) -{ - pci_unregister_driver(driver); -} - -static inline -void ssb_pcihost_set_power_state(struct ssb_device *sdev, pci_power_t state) -{ - if (sdev->bus->bustype == SSB_BUSTYPE_PCI) - pci_set_power_state(sdev->bus->host_pci, state); -} -#else -static inline void ssb_pcihost_unregister(struct pci_driver *driver) -{ -} - -static inline -void ssb_pcihost_set_power_state(struct ssb_device *sdev, pci_power_t state) -{ -} -#endif /* CONFIG_SSB_PCIHOST */ - - -/* If a driver is shutdown or suspended, call this to signal - * that the bus may be completely powered down. SSB will decide, - * if it's really time to power down the bus, based on if there - * are other devices that want to run. */ -extern int ssb_bus_may_powerdown(struct ssb_bus *bus); -/* Before initializing and enabling a device, call this to power-up the bus. - * If you want to allow use of dynamic-power-control, pass the flag. - * Otherwise static always-on powercontrol will be used. */ -extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl); - -extern void ssb_commit_settings(struct ssb_bus *bus); - -/* Various helper functions */ -extern u32 ssb_admatch_base(u32 adm); -extern u32 ssb_admatch_size(u32 adm); - -/* PCI device mapping and fixup routines. - * Called from the architecture pcibios init code. - * These are only available on SSB_EMBEDDED configurations. */ -#ifdef CONFIG_SSB_EMBEDDED -int ssb_pcibios_plat_dev_init(struct pci_dev *dev); -int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); -#endif /* CONFIG_SSB_EMBEDDED */ - -#endif /* LINUX_SSB_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_chipcommon.h b/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_chipcommon.h deleted file mode 100644 index 1a6b0045b06..00000000000 --- a/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_chipcommon.h +++ /dev/null @@ -1,665 +0,0 @@ -#ifndef LINUX_SSB_CHIPCO_H_ -#define LINUX_SSB_CHIPCO_H_ - -/* SonicsSiliconBackplane CHIPCOMMON core hardware definitions - * - * The chipcommon core provides chip identification, SB control, - * jtag, 0/1/2 uarts, clock frequency control, a watchdog interrupt timer, - * gpio interface, extbus, and support for serial and parallel flashes. - * - * Copyright 2005, Broadcom Corporation - * Copyright 2006, Michael Buesch <m@bues.ch> - * - * Licensed under the GPL version 2. See COPYING for details. - */ - -/** ChipCommon core registers. **/ - -#define SSB_CHIPCO_CHIPID 0x0000 -#define SSB_CHIPCO_IDMASK 0x0000FFFF -#define SSB_CHIPCO_REVMASK 0x000F0000 -#define SSB_CHIPCO_REVSHIFT 16 -#define SSB_CHIPCO_PACKMASK 0x00F00000 -#define SSB_CHIPCO_PACKSHIFT 20 -#define SSB_CHIPCO_NRCORESMASK 0x0F000000 -#define SSB_CHIPCO_NRCORESSHIFT 24 -#define SSB_CHIPCO_CAP 0x0004 /* Capabilities */ -#define SSB_CHIPCO_CAP_NRUART 0x00000003 /* # of UARTs */ -#define SSB_CHIPCO_CAP_MIPSEB 0x00000004 /* MIPS in BigEndian Mode */ -#define SSB_CHIPCO_CAP_UARTCLK 0x00000018 /* UART clock select */ -#define SSB_CHIPCO_CAP_UARTCLK_INT 0x00000008 /* UARTs are driven by internal divided clock */ -#define SSB_CHIPCO_CAP_UARTGPIO 0x00000020 /* UARTs on GPIO 15-12 */ -#define SSB_CHIPCO_CAP_EXTBUS 0x000000C0 /* External buses present */ -#define SSB_CHIPCO_CAP_FLASHT 0x00000700 /* Flash Type */ -#define SSB_CHIPCO_FLASHT_NONE 0x00000000 /* No flash */ -#define SSB_CHIPCO_FLASHT_STSER 0x00000100 /* ST serial flash */ -#define SSB_CHIPCO_FLASHT_ATSER 0x00000200 /* Atmel serial flash */ -#define SSB_CHIPCO_FLASHT_PARA 0x00000700 /* Parallel flash */ -#define SSB_CHIPCO_CAP_PLLT 0x00038000 /* PLL Type */ -#define SSB_PLLTYPE_NONE 0x00000000 -#define SSB_PLLTYPE_1 0x00010000 /* 48Mhz base, 3 dividers */ -#define SSB_PLLTYPE_2 0x00020000 /* 48Mhz, 4 dividers */ -#define SSB_PLLTYPE_3 0x00030000 /* 25Mhz, 2 dividers */ -#define SSB_PLLTYPE_4 0x00008000 /* 48Mhz, 4 dividers */ -#define SSB_PLLTYPE_5 0x00018000 /* 25Mhz, 4 dividers */ -#define SSB_PLLTYPE_6 0x00028000 /* 100/200 or 120/240 only */ -#define SSB_PLLTYPE_7 0x00038000 /* 25Mhz, 4 dividers */ -#define SSB_CHIPCO_CAP_PCTL 0x00040000 /* Power Control */ -#define SSB_CHIPCO_CAP_OTPS 0x00380000 /* OTP size */ -#define SSB_CHIPCO_CAP_OTPS_SHIFT 19 -#define SSB_CHIPCO_CAP_OTPS_BASE 5 -#define SSB_CHIPCO_CAP_JTAGM 0x00400000 /* JTAG master present */ -#define SSB_CHIPCO_CAP_BROM 0x00800000 /* Internal boot ROM active */ -#define SSB_CHIPCO_CAP_64BIT 0x08000000 /* 64-bit Backplane */ -#define SSB_CHIPCO_CAP_PMU 0x10000000 /* PMU available (rev >= 20) */ -#define SSB_CHIPCO_CAP_ECI 0x20000000 /* ECI available (rev >= 20) */ -#define SSB_CHIPCO_CAP_SPROM 0x40000000 /* SPROM present */ -#define SSB_CHIPCO_CORECTL 0x0008 -#define SSB_CHIPCO_CORECTL_UARTCLK0 0x00000001 /* Drive UART with internal clock */ -#define SSB_CHIPCO_CORECTL_SE 0x00000002 /* sync clk out enable (corerev >= 3) */ -#define SSB_CHIPCO_CORECTL_UARTCLKEN 0x00000008 /* UART clock enable (rev >= 21) */ -#define SSB_CHIPCO_BIST 0x000C -#define SSB_CHIPCO_OTPS 0x0010 /* OTP status */ -#define SSB_CHIPCO_OTPS_PROGFAIL 0x80000000 -#define SSB_CHIPCO_OTPS_PROTECT 0x00000007 -#define SSB_CHIPCO_OTPS_HW_PROTECT 0x00000001 -#define SSB_CHIPCO_OTPS_SW_PROTECT 0x00000002 -#define SSB_CHIPCO_OTPS_CID_PROTECT 0x00000004 -#define SSB_CHIPCO_OTPC 0x0014 /* OTP control */ -#define SSB_CHIPCO_OTPC_RECWAIT 0xFF000000 -#define SSB_CHIPCO_OTPC_PROGWAIT 0x00FFFF00 -#define SSB_CHIPCO_OTPC_PRW_SHIFT 8 -#define SSB_CHIPCO_OTPC_MAXFAIL 0x00000038 -#define SSB_CHIPCO_OTPC_VSEL 0x00000006 -#define SSB_CHIPCO_OTPC_SELVL 0x00000001 -#define SSB_CHIPCO_OTPP 0x0018 /* OTP prog */ -#define SSB_CHIPCO_OTPP_COL 0x000000FF -#define SSB_CHIPCO_OTPP_ROW 0x0000FF00 -#define SSB_CHIPCO_OTPP_ROW_SHIFT 8 -#define SSB_CHIPCO_OTPP_READERR 0x10000000 -#define SSB_CHIPCO_OTPP_VALUE 0x20000000 -#define SSB_CHIPCO_OTPP_READ 0x40000000 -#define SSB_CHIPCO_OTPP_START 0x80000000 -#define SSB_CHIPCO_OTPP_BUSY 0x80000000 -#define SSB_CHIPCO_IRQSTAT 0x0020 -#define SSB_CHIPCO_IRQMASK 0x0024 -#define SSB_CHIPCO_IRQ_GPIO 0x00000001 /* gpio intr */ -#define SSB_CHIPCO_IRQ_EXT 0x00000002 /* ro: ext intr pin (corerev >= 3) */ -#define SSB_CHIPCO_IRQ_WDRESET 0x80000000 /* watchdog reset occurred */ -#define SSB_CHIPCO_CHIPCTL 0x0028 /* Rev >= 11 only */ -#define SSB_CHIPCO_CHIPSTAT 0x002C /* Rev >= 11 only */ -#define SSB_CHIPCO_JCMD 0x0030 /* Rev >= 10 only */ -#define SSB_CHIPCO_JCMD_START 0x80000000 -#define SSB_CHIPCO_JCMD_BUSY 0x80000000 -#define SSB_CHIPCO_JCMD_PAUSE 0x40000000 -#define SSB_CHIPCO_JCMD0_ACC_MASK 0x0000F000 -#define SSB_CHIPCO_JCMD0_ACC_IRDR 0x00000000 -#define SSB_CHIPCO_JCMD0_ACC_DR 0x00001000 -#define SSB_CHIPCO_JCMD0_ACC_IR 0x00002000 -#define SSB_CHIPCO_JCMD0_ACC_RESET 0x00003000 -#define SSB_CHIPCO_JCMD0_ACC_IRPDR 0x00004000 -#define SSB_CHIPCO_JCMD0_ACC_PDR 0x00005000 -#define SSB_CHIPCO_JCMD0_IRW_MASK 0x00000F00 -#define SSB_CHIPCO_JCMD_ACC_MASK 0x000F0000 /* Changes for corerev 11 */ -#define SSB_CHIPCO_JCMD_ACC_IRDR 0x00000000 -#define SSB_CHIPCO_JCMD_ACC_DR 0x00010000 -#define SSB_CHIPCO_JCMD_ACC_IR 0x00020000 -#define SSB_CHIPCO_JCMD_ACC_RESET 0x00030000 -#define SSB_CHIPCO_JCMD_ACC_IRPDR 0x00040000 -#define SSB_CHIPCO_JCMD_ACC_PDR 0x00050000 -#define SSB_CHIPCO_JCMD_IRW_MASK 0x00001F00 -#define SSB_CHIPCO_JCMD_IRW_SHIFT 8 -#define SSB_CHIPCO_JCMD_DRW_MASK 0x0000003F -#define SSB_CHIPCO_JIR 0x0034 /* Rev >= 10 only */ -#define SSB_CHIPCO_JDR 0x0038 /* Rev >= 10 only */ -#define SSB_CHIPCO_JCTL 0x003C /* Rev >= 10 only */ -#define SSB_CHIPCO_JCTL_FORCE_CLK 4 /* Force clock */ -#define SSB_CHIPCO_JCTL_EXT_EN 2 /* Enable external targets */ -#define SSB_CHIPCO_JCTL_EN 1 /* Enable Jtag master */ -#define SSB_CHIPCO_FLASHCTL 0x0040 -#define SSB_CHIPCO_FLASHCTL_START 0x80000000 -#define SSB_CHIPCO_FLASHCTL_BUSY SSB_CHIPCO_FLASHCTL_START -#define SSB_CHIPCO_FLASHADDR 0x0044 -#define SSB_CHIPCO_FLASHDATA 0x0048 -#define SSB_CHIPCO_BCAST_ADDR 0x0050 -#define SSB_CHIPCO_BCAST_DATA 0x0054 -#define SSB_CHIPCO_GPIOPULLUP 0x0058 /* Rev >= 20 only */ -#define SSB_CHIPCO_GPIOPULLDOWN 0x005C /* Rev >= 20 only */ -#define SSB_CHIPCO_GPIOIN 0x0060 -#define SSB_CHIPCO_GPIOOUT 0x0064 -#define SSB_CHIPCO_GPIOOUTEN 0x0068 -#define SSB_CHIPCO_GPIOCTL 0x006C -#define SSB_CHIPCO_GPIOPOL 0x0070 -#define SSB_CHIPCO_GPIOIRQ 0x0074 -#define SSB_CHIPCO_WATCHDOG 0x0080 -#define SSB_CHIPCO_GPIOTIMER 0x0088 /* LED powersave (corerev >= 16) */ -#define SSB_CHIPCO_GPIOTIMER_OFFTIME 0x0000FFFF -#define SSB_CHIPCO_GPIOTIMER_OFFTIME_SHIFT 0 -#define SSB_CHIPCO_GPIOTIMER_ONTIME 0xFFFF0000 -#define SSB_CHIPCO_GPIOTIMER_ONTIME_SHIFT 16 -#define SSB_CHIPCO_GPIOTOUTM 0x008C /* LED powersave (corerev >= 16) */ -#define SSB_CHIPCO_CLOCK_N 0x0090 -#define SSB_CHIPCO_CLOCK_SB 0x0094 -#define SSB_CHIPCO_CLOCK_PCI 0x0098 -#define SSB_CHIPCO_CLOCK_M2 0x009C -#define SSB_CHIPCO_CLOCK_MIPS 0x00A0 -#define SSB_CHIPCO_CLKDIV 0x00A4 /* Rev >= 3 only */ -#define SSB_CHIPCO_CLKDIV_SFLASH 0x0F000000 -#define SSB_CHIPCO_CLKDIV_SFLASH_SHIFT 24 -#define SSB_CHIPCO_CLKDIV_OTP 0x000F0000 -#define SSB_CHIPCO_CLKDIV_OTP_SHIFT 16 -#define SSB_CHIPCO_CLKDIV_JTAG 0x00000F00 -#define SSB_CHIPCO_CLKDIV_JTAG_SHIFT 8 -#define SSB_CHIPCO_CLKDIV_UART 0x000000FF -#define SSB_CHIPCO_PLLONDELAY 0x00B0 /* Rev >= 4 only */ -#define SSB_CHIPCO_FREFSELDELAY 0x00B4 /* Rev >= 4 only */ -#define SSB_CHIPCO_SLOWCLKCTL 0x00B8 /* 6 <= Rev <= 9 only */ -#define SSB_CHIPCO_SLOWCLKCTL_SRC 0x00000007 /* slow clock source mask */ -#define SSB_CHIPCO_SLOWCLKCTL_SRC_LPO 0x00000000 /* source of slow clock is LPO */ -#define SSB_CHIPCO_SLOWCLKCTL_SRC_XTAL 0x00000001 /* source of slow clock is crystal */ -#define SSB_CHIPCO_SLOECLKCTL_SRC_PCI 0x00000002 /* source of slow clock is PCI */ -#define SSB_CHIPCO_SLOWCLKCTL_LPOFREQ 0x00000200 /* LPOFreqSel, 1: 160Khz, 0: 32KHz */ -#define SSB_CHIPCO_SLOWCLKCTL_LPOPD 0x00000400 /* LPOPowerDown, 1: LPO is disabled, 0: LPO is enabled */ -#define SSB_CHIPCO_SLOWCLKCTL_FSLOW 0x00000800 /* ForceSlowClk, 1: sb/cores running on slow clock, 0: power logic control */ -#define SSB_CHIPCO_SLOWCLKCTL_IPLL 0x00001000 /* IgnorePllOffReq, 1/0: power logic ignores/honors PLL clock disable requests from core */ -#define SSB_CHIPCO_SLOWCLKCTL_ENXTAL 0x00002000 /* XtalControlEn, 1/0: power logic does/doesn't disable crystal when appropriate */ -#define SSB_CHIPCO_SLOWCLKCTL_XTALPU 0x00004000 /* XtalPU (RO), 1/0: crystal running/disabled */ -#define SSB_CHIPCO_SLOWCLKCTL_CLKDIV 0xFFFF0000 /* ClockDivider (SlowClk = 1/(4+divisor)) */ -#define SSB_CHIPCO_SLOWCLKCTL_CLKDIV_SHIFT 16 -#define SSB_CHIPCO_SYSCLKCTL 0x00C0 /* Rev >= 3 only */ -#define SSB_CHIPCO_SYSCLKCTL_IDLPEN 0x00000001 /* ILPen: Enable Idle Low Power */ -#define SSB_CHIPCO_SYSCLKCTL_ALPEN 0x00000002 /* ALPen: Enable Active Low Power */ -#define SSB_CHIPCO_SYSCLKCTL_PLLEN 0x00000004 /* ForcePLLOn */ -#define SSB_CHIPCO_SYSCLKCTL_FORCEALP 0x00000008 /* Force ALP (or HT if ALPen is not set */ -#define SSB_CHIPCO_SYSCLKCTL_FORCEHT 0x00000010 /* Force HT */ -#define SSB_CHIPCO_SYSCLKCTL_CLKDIV 0xFFFF0000 /* ClkDiv (ILP = 1/(4+divisor)) */ -#define SSB_CHIPCO_SYSCLKCTL_CLKDIV_SHIFT 16 -#define SSB_CHIPCO_CLKSTSTR 0x00C4 /* Rev >= 3 only */ -#define SSB_CHIPCO_PCMCIA_CFG 0x0100 -#define SSB_CHIPCO_PCMCIA_MEMWAIT 0x0104 -#define SSB_CHIPCO_PCMCIA_ATTRWAIT 0x0108 -#define SSB_CHIPCO_PCMCIA_IOWAIT 0x010C -#define SSB_CHIPCO_IDE_CFG 0x0110 -#define SSB_CHIPCO_IDE_MEMWAIT 0x0114 -#define SSB_CHIPCO_IDE_ATTRWAIT 0x0118 -#define SSB_CHIPCO_IDE_IOWAIT 0x011C -#define SSB_CHIPCO_PROG_CFG 0x0120 -#define SSB_CHIPCO_PROG_WAITCNT 0x0124 -#define SSB_CHIPCO_FLASH_CFG 0x0128 -#define SSB_CHIPCO_FLASH_WAITCNT 0x012C -#define SSB_CHIPCO_CLKCTLST 0x01E0 /* Clock control and status (rev >= 20) */ -#define SSB_CHIPCO_CLKCTLST_FORCEALP 0x00000001 /* Force ALP request */ -#define SSB_CHIPCO_CLKCTLST_FORCEHT 0x00000002 /* Force HT request */ -#define SSB_CHIPCO_CLKCTLST_FORCEILP 0x00000004 /* Force ILP request */ -#define SSB_CHIPCO_CLKCTLST_HAVEALPREQ 0x00000008 /* ALP available request */ -#define SSB_CHIPCO_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */ -#define SSB_CHIPCO_CLKCTLST_HWCROFF 0x00000020 /* Force HW clock request off */ -#define SSB_CHIPCO_CLKCTLST_HAVEALP 0x00010000 /* ALP available */ -#define SSB_CHIPCO_CLKCTLST_HAVEHT 0x00020000 /* HT available */ -#define SSB_CHIPCO_CLKCTLST_4328A0_HAVEHT 0x00010000 /* 4328a0 has reversed bits */ -#define SSB_CHIPCO_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */ -#define SSB_CHIPCO_HW_WORKAROUND 0x01E4 /* Hardware workaround (rev >= 20) */ -#define SSB_CHIPCO_UART0_DATA 0x0300 -#define SSB_CHIPCO_UART0_IMR 0x0304 -#define SSB_CHIPCO_UART0_FCR 0x0308 -#define SSB_CHIPCO_UART0_LCR 0x030C -#define SSB_CHIPCO_UART0_MCR 0x0310 -#define SSB_CHIPCO_UART0_LSR 0x0314 -#define SSB_CHIPCO_UART0_MSR 0x0318 -#define SSB_CHIPCO_UART0_SCRATCH 0x031C -#define SSB_CHIPCO_UART1_DATA 0x0400 -#define SSB_CHIPCO_UART1_IMR 0x0404 -#define SSB_CHIPCO_UART1_FCR 0x0408 -#define SSB_CHIPCO_UART1_LCR 0x040C -#define SSB_CHIPCO_UART1_MCR 0x0410 -#define SSB_CHIPCO_UART1_LSR 0x0414 -#define SSB_CHIPCO_UART1_MSR 0x0418 -#define SSB_CHIPCO_UART1_SCRATCH 0x041C -/* PMU registers (rev >= 20) */ -#define SSB_CHIPCO_PMU_CTL 0x0600 /* PMU control */ -#define SSB_CHIPCO_PMU_CTL_ILP_DIV 0xFFFF0000 /* ILP div mask */ -#define SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT 16 -#define SSB_CHIPCO_PMU_CTL_NOILPONW 0x00000200 /* No ILP on wait */ -#define SSB_CHIPCO_PMU_CTL_HTREQEN 0x00000100 /* HT req enable */ -#define SSB_CHIPCO_PMU_CTL_ALPREQEN 0x00000080 /* ALP req enable */ -#define SSB_CHIPCO_PMU_CTL_XTALFREQ 0x0000007C /* Crystal freq */ -#define SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT 2 -#define SSB_CHIPCO_PMU_CTL_ILPDIVEN 0x00000002 /* ILP div enable */ -#define SSB_CHIPCO_PMU_CTL_LPOSEL 0x00000001 /* LPO sel */ -#define SSB_CHIPCO_PMU_CAP 0x0604 /* PMU capabilities */ -#define SSB_CHIPCO_PMU_CAP_REVISION 0x000000FF /* Revision mask */ -#define SSB_CHIPCO_PMU_STAT 0x0608 /* PMU status */ -#define SSB_CHIPCO_PMU_STAT_INTPEND 0x00000040 /* Interrupt pending */ -#define SSB_CHIPCO_PMU_STAT_SBCLKST 0x00000030 /* Backplane clock status? */ -#define SSB_CHIPCO_PMU_STAT_HAVEALP 0x00000008 /* ALP available */ -#define SSB_CHIPCO_PMU_STAT_HAVEHT 0x00000004 /* HT available */ -#define SSB_CHIPCO_PMU_STAT_RESINIT 0x00000003 /* Res init */ -#define SSB_CHIPCO_PMU_RES_STAT 0x060C /* PMU res status */ -#define SSB_CHIPCO_PMU_RES_PEND 0x0610 /* PMU res pending */ -#define SSB_CHIPCO_PMU_TIMER 0x0614 /* PMU timer */ -#define SSB_CHIPCO_PMU_MINRES_MSK 0x0618 /* PMU min res mask */ -#define SSB_CHIPCO_PMU_MAXRES_MSK 0x061C /* PMU max res mask */ -#define SSB_CHIPCO_PMU_RES_TABSEL 0x0620 /* PMU res table sel */ -#define SSB_CHIPCO_PMU_RES_DEPMSK 0x0624 /* PMU res dep mask */ -#define SSB_CHIPCO_PMU_RES_UPDNTM 0x0628 /* PMU res updown timer */ -#define SSB_CHIPCO_PMU_RES_TIMER 0x062C /* PMU res timer */ -#define SSB_CHIPCO_PMU_CLKSTRETCH 0x0630 /* PMU clockstretch */ -#define SSB_CHIPCO_PMU_WATCHDOG 0x0634 /* PMU watchdog */ -#define SSB_CHIPCO_PMU_RES_REQTS 0x0640 /* PMU res req timer sel */ -#define SSB_CHIPCO_PMU_RES_REQT 0x0644 /* PMU res req timer */ -#define SSB_CHIPCO_PMU_RES_REQM 0x0648 /* PMU res req mask */ -#define SSB_CHIPCO_CHIPCTL_ADDR 0x0650 -#define SSB_CHIPCO_CHIPCTL_DATA 0x0654 -#define SSB_CHIPCO_REGCTL_ADDR 0x0658 -#define SSB_CHIPCO_REGCTL_DATA 0x065C -#define SSB_CHIPCO_PLLCTL_ADDR 0x0660 -#define SSB_CHIPCO_PLLCTL_DATA 0x0664 - - - -/** PMU PLL registers */ - -/* PMU rev 0 PLL registers */ -#define SSB_PMU0_PLLCTL0 0 -#define SSB_PMU0_PLLCTL0_PDIV_MSK 0x00000001 -#define SSB_PMU0_PLLCTL0_PDIV_FREQ 25000 /* kHz */ -#define SSB_PMU0_PLLCTL1 1 -#define SSB_PMU0_PLLCTL1_WILD_IMSK 0xF0000000 /* Wild int mask (low nibble) */ -#define SSB_PMU0_PLLCTL1_WILD_IMSK_SHIFT 28 -#define SSB_PMU0_PLLCTL1_WILD_FMSK 0x0FFFFF00 /* Wild frac mask */ -#define SSB_PMU0_PLLCTL1_WILD_FMSK_SHIFT 8 -#define SSB_PMU0_PLLCTL1_STOPMOD 0x00000040 /* Stop mod */ -#define SSB_PMU0_PLLCTL2 2 -#define SSB_PMU0_PLLCTL2_WILD_IMSKHI 0x0000000F /* Wild int mask (high nibble) */ -#define SSB_PMU0_PLLCTL2_WILD_IMSKHI_SHIFT 0 - -/* PMU rev 1 PLL registers */ -#define SSB_PMU1_PLLCTL0 0 -#define SSB_PMU1_PLLCTL0_P1DIV 0x00F00000 /* P1 div */ -#define SSB_PMU1_PLLCTL0_P1DIV_SHIFT 20 -#define SSB_PMU1_PLLCTL0_P2DIV 0x0F000000 /* P2 div */ -#define SSB_PMU1_PLLCTL0_P2DIV_SHIFT 24 -#define SSB_PMU1_PLLCTL1 1 -#define SSB_PMU1_PLLCTL1_M1DIV 0x000000FF /* M1 div */ -#define SSB_PMU1_PLLCTL1_M1DIV_SHIFT 0 -#define SSB_PMU1_PLLCTL1_M2DIV 0x0000FF00 /* M2 div */ -#define SSB_PMU1_PLLCTL1_M2DIV_SHIFT 8 -#define SSB_PMU1_PLLCTL1_M3DIV 0x00FF0000 /* M3 div */ -#define SSB_PMU1_PLLCTL1_M3DIV_SHIFT 16 -#define SSB_PMU1_PLLCTL1_M4DIV 0xFF000000 /* M4 div */ -#define SSB_PMU1_PLLCTL1_M4DIV_SHIFT 24 -#define SSB_PMU1_PLLCTL2 2 -#define SSB_PMU1_PLLCTL2_M5DIV 0x000000FF /* M5 div */ -#define SSB_PMU1_PLLCTL2_M5DIV_SHIFT 0 -#define SSB_PMU1_PLLCTL2_M6DIV 0x0000FF00 /* M6 div */ -#define SSB_PMU1_PLLCTL2_M6DIV_SHIFT 8 -#define SSB_PMU1_PLLCTL2_NDIVMODE 0x000E0000 /* NDIV mode */ -#define SSB_PMU1_PLLCTL2_NDIVMODE_SHIFT 17 -#define SSB_PMU1_PLLCTL2_NDIVINT 0x1FF00000 /* NDIV int */ -#define SSB_PMU1_PLLCTL2_NDIVINT_SHIFT 20 -#define SSB_PMU1_PLLCTL3 3 -#define SSB_PMU1_PLLCTL3_NDIVFRAC 0x00FFFFFF /* NDIV frac */ -#define SSB_PMU1_PLLCTL3_NDIVFRAC_SHIFT 0 -#define SSB_PMU1_PLLCTL4 4 -#define SSB_PMU1_PLLCTL5 5 -#define SSB_PMU1_PLLCTL5_CLKDRV 0xFFFFFF00 /* clk drv */ -#define SSB_PMU1_PLLCTL5_CLKDRV_SHIFT 8 - -/* BCM4312 PLL resource numbers. */ -#define SSB_PMURES_4312_SWITCHER_BURST 0 -#define SSB_PMURES_4312_SWITCHER_PWM 1 -#define SSB_PMURES_4312_PA_REF_LDO 2 -#define SSB_PMURES_4312_CORE_LDO_BURST 3 -#define SSB_PMURES_4312_CORE_LDO_PWM 4 -#define SSB_PMURES_4312_RADIO_LDO 5 -#define SSB_PMURES_4312_ILP_REQUEST 6 -#define SSB_PMURES_4312_BG_FILTBYP 7 -#define SSB_PMURES_4312_TX_FILTBYP 8 -#define SSB_PMURES_4312_RX_FILTBYP 9 -#define SSB_PMURES_4312_XTAL_PU 10 -#define SSB_PMURES_4312_ALP_AVAIL 11 -#define SSB_PMURES_4312_BB_PLL_FILTBYP 12 -#define SSB_PMURES_4312_RF_PLL_FILTBYP 13 -#define SSB_PMURES_4312_HT_AVAIL 14 - -/* BCM4325 PLL resource numbers. */ -#define SSB_PMURES_4325_BUCK_BOOST_BURST 0 -#define SSB_PMURES_4325_CBUCK_BURST 1 -#define SSB_PMURES_4325_CBUCK_PWM 2 -#define SSB_PMURES_4325_CLDO_CBUCK_BURST 3 -#define SSB_PMURES_4325_CLDO_CBUCK_PWM 4 -#define SSB_PMURES_4325_BUCK_BOOST_PWM 5 -#define SSB_PMURES_4325_ILP_REQUEST 6 -#define SSB_PMURES_4325_ABUCK_BURST 7 -#define SSB_PMURES_4325_ABUCK_PWM 8 -#define SSB_PMURES_4325_LNLDO1_PU 9 -#define SSB_PMURES_4325_LNLDO2_PU 10 -#define SSB_PMURES_4325_LNLDO3_PU 11 -#define SSB_PMURES_4325_LNLDO4_PU 12 -#define SSB_PMURES_4325_XTAL_PU 13 -#define SSB_PMURES_4325_ALP_AVAIL 14 -#define SSB_PMURES_4325_RX_PWRSW_PU 15 -#define SSB_PMURES_4325_TX_PWRSW_PU 16 -#define SSB_PMURES_4325_RFPLL_PWRSW_PU 17 -#define SSB_PMURES_4325_LOGEN_PWRSW_PU 18 -#define SSB_PMURES_4325_AFE_PWRSW_PU 19 -#define SSB_PMURES_4325_BBPLL_PWRSW_PU 20 -#define SSB_PMURES_4325_HT_AVAIL 21 - -/* BCM4328 PLL resource numbers. */ -#define SSB_PMURES_4328_EXT_SWITCHER_PWM 0 -#define SSB_PMURES_4328_BB_SWITCHER_PWM 1 -#define SSB_PMURES_4328_BB_SWITCHER_BURST 2 -#define SSB_PMURES_4328_BB_EXT_SWITCHER_BURST 3 -#define SSB_PMURES_4328_ILP_REQUEST 4 -#define SSB_PMURES_4328_RADIO_SWITCHER_PWM 5 -#define SSB_PMURES_4328_RADIO_SWITCHER_BURST 6 -#define SSB_PMURES_4328_ROM_SWITCH 7 -#define SSB_PMURES_4328_PA_REF_LDO 8 -#define SSB_PMURES_4328_RADIO_LDO 9 -#define SSB_PMURES_4328_AFE_LDO 10 -#define SSB_PMURES_4328_PLL_LDO 11 -#define SSB_PMURES_4328_BG_FILTBYP 12 -#define SSB_PMURES_4328_TX_FILTBYP 13 -#define SSB_PMURES_4328_RX_FILTBYP 14 -#define SSB_PMURES_4328_XTAL_PU 15 -#define SSB_PMURES_4328_XTAL_EN 16 -#define SSB_PMURES_4328_BB_PLL_FILTBYP 17 -#define SSB_PMURES_4328_RF_PLL_FILTBYP 18 -#define SSB_PMURES_4328_BB_PLL_PU 19 - -/* BCM5354 PLL resource numbers. */ -#define SSB_PMURES_5354_EXT_SWITCHER_PWM 0 -#define SSB_PMURES_5354_BB_SWITCHER_PWM 1 -#define SSB_PMURES_5354_BB_SWITCHER_BURST 2 -#define SSB_PMURES_5354_BB_EXT_SWITCHER_BURST 3 -#define SSB_PMURES_5354_ILP_REQUEST 4 -#define SSB_PMURES_5354_RADIO_SWITCHER_PWM 5 -#define SSB_PMURES_5354_RADIO_SWITCHER_BURST 6 -#define SSB_PMURES_5354_ROM_SWITCH 7 -#define SSB_PMURES_5354_PA_REF_LDO 8 -#define SSB_PMURES_5354_RADIO_LDO 9 -#define SSB_PMURES_5354_AFE_LDO 10 -#define SSB_PMURES_5354_PLL_LDO 11 -#define SSB_PMURES_5354_BG_FILTBYP 12 -#define SSB_PMURES_5354_TX_FILTBYP 13 -#define SSB_PMURES_5354_RX_FILTBYP 14 -#define SSB_PMURES_5354_XTAL_PU 15 -#define SSB_PMURES_5354_XTAL_EN 16 -#define SSB_PMURES_5354_BB_PLL_FILTBYP 17 -#define SSB_PMURES_5354_RF_PLL_FILTBYP 18 -#define SSB_PMURES_5354_BB_PLL_PU 19 - - - -/** Chip specific Chip-Status register contents. */ -#define SSB_CHIPCO_CHST_4322_SPROM_EXISTS 0x00000040 /* SPROM present */ -#define SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL 0x00000003 -#define SSB_CHIPCO_CHST_4325_DEFCIS_SEL 0 /* OTP is powered up, use def. CIS, no SPROM */ -#define SSB_CHIPCO_CHST_4325_SPROM_SEL 1 /* OTP is powered up, SPROM is present */ -#define SSB_CHIPCO_CHST_4325_OTP_SEL 2 /* OTP is powered up, no SPROM */ -#define SSB_CHIPCO_CHST_4325_OTP_PWRDN 3 /* OTP is powered down, SPROM is present */ -#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE 0x00000004 -#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE_SHIFT 2 -#define SSB_CHIPCO_CHST_4325_RCAL_VALID 0x00000008 -#define SSB_CHIPCO_CHST_4325_RCAL_VALID_SHIFT 3 -#define SSB_CHIPCO_CHST_4325_RCAL_VALUE 0x000001F0 -#define SSB_CHIPCO_CHST_4325_RCAL_VALUE_SHIFT 4 -#define SSB_CHIPCO_CHST_4325_PMUTOP_2B 0x00000200 /* 1 for 2b, 0 for to 2a */ - -/** Macros to determine SPROM presence based on Chip-Status register. */ -#define SSB_CHIPCO_CHST_4312_SPROM_PRESENT(status) \ - ((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \ - SSB_CHIPCO_CHST_4325_OTP_SEL) -#define SSB_CHIPCO_CHST_4322_SPROM_PRESENT(status) \ - (status & SSB_CHIPCO_CHST_4322_SPROM_EXISTS) -#define SSB_CHIPCO_CHST_4325_SPROM_PRESENT(status) \ - (((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \ - SSB_CHIPCO_CHST_4325_DEFCIS_SEL) && \ - ((status & SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL) != \ - SSB_CHIPCO_CHST_4325_OTP_SEL)) - - - -/** Clockcontrol masks and values **/ - -/* SSB_CHIPCO_CLOCK_N */ -#define SSB_CHIPCO_CLK_N1 0x0000003F /* n1 control */ -#define SSB_CHIPCO_CLK_N2 0x00003F00 /* n2 control */ -#define SSB_CHIPCO_CLK_N2_SHIFT 8 -#define SSB_CHIPCO_CLK_PLLC 0x000F0000 /* pll control */ -#define SSB_CHIPCO_CLK_PLLC_SHIFT 16 - -/* SSB_CHIPCO_CLOCK_SB/PCI/UART */ -#define SSB_CHIPCO_CLK_M1 0x0000003F /* m1 control */ -#define SSB_CHIPCO_CLK_M2 0x00003F00 /* m2 control */ -#define SSB_CHIPCO_CLK_M2_SHIFT 8 -#define SSB_CHIPCO_CLK_M3 0x003F0000 /* m3 control */ -#define SSB_CHIPCO_CLK_M3_SHIFT 16 -#define SSB_CHIPCO_CLK_MC 0x1F000000 /* mux control */ -#define SSB_CHIPCO_CLK_MC_SHIFT 24 - -/* N3M Clock control magic field values */ -#define SSB_CHIPCO_CLK_F6_2 0x02 /* A factor of 2 in */ -#define SSB_CHIPCO_CLK_F6_3 0x03 /* 6-bit fields like */ -#define SSB_CHIPCO_CLK_F6_4 0x05 /* N1, M1 or M3 */ -#define SSB_CHIPCO_CLK_F6_5 0x09 -#define SSB_CHIPCO_CLK_F6_6 0x11 -#define SSB_CHIPCO_CLK_F6_7 0x21 - -#define SSB_CHIPCO_CLK_F5_BIAS 5 /* 5-bit fields get this added */ - -#define SSB_CHIPCO_CLK_MC_BYPASS 0x08 -#define SSB_CHIPCO_CLK_MC_M1 0x04 -#define SSB_CHIPCO_CLK_MC_M1M2 0x02 -#define SSB_CHIPCO_CLK_MC_M1M2M3 0x01 -#define SSB_CHIPCO_CLK_MC_M1M3 0x11 - -/* Type 2 Clock control magic field values */ -#define SSB_CHIPCO_CLK_T2_BIAS 2 /* n1, n2, m1 & m3 bias */ -#define SSB_CHIPCO_CLK_T2M2_BIAS 3 /* m2 bias */ - -#define SSB_CHIPCO_CLK_T2MC_M1BYP 1 -#define SSB_CHIPCO_CLK_T2MC_M2BYP 2 -#define SSB_CHIPCO_CLK_T2MC_M3BYP 4 - -/* Type 6 Clock control magic field values */ -#define SSB_CHIPCO_CLK_T6_MMASK 1 /* bits of interest in m */ -#define SSB_CHIPCO_CLK_T6_M0 120000000 /* sb clock for m = 0 */ -#define SSB_CHIPCO_CLK_T6_M1 100000000 /* sb clock for m = 1 */ -#define SSB_CHIPCO_CLK_SB2MIPS_T6(sb) (2 * (sb)) - -/* Common clock base */ -#define SSB_CHIPCO_CLK_BASE1 24000000 /* Half the clock freq */ -#define SSB_CHIPCO_CLK_BASE2 12500000 /* Alternate crystal on some PLL's */ - -/* Clock control values for 200Mhz in 5350 */ -#define SSB_CHIPCO_CLK_5350_N 0x0311 -#define SSB_CHIPCO_CLK_5350_M 0x04020009 - - -/** Bits in the config registers **/ - -#define SSB_CHIPCO_CFG_EN 0x0001 /* Enable */ -#define SSB_CHIPCO_CFG_EXTM 0x000E /* Extif Mode */ -#define SSB_CHIPCO_CFG_EXTM_ASYNC 0x0002 /* Async/Parallel flash */ -#define SSB_CHIPCO_CFG_EXTM_SYNC 0x0004 /* Synchronous */ -#define SSB_CHIPCO_CFG_EXTM_PCMCIA 0x0008 /* PCMCIA */ -#define SSB_CHIPCO_CFG_EXTM_IDE 0x000A /* IDE */ -#define SSB_CHIPCO_CFG_DS16 0x0010 /* Data size, 0=8bit, 1=16bit */ -#define SSB_CHIPCO_CFG_CLKDIV 0x0060 /* Sync: Clock divisor */ -#define SSB_CHIPCO_CFG_CLKEN 0x0080 /* Sync: Clock enable */ -#define SSB_CHIPCO_CFG_BSTRO 0x0100 /* Sync: Size/Bytestrobe */ - - -/** Flash-specific control/status values */ - -/* flashcontrol opcodes for ST flashes */ -#define SSB_CHIPCO_FLASHCTL_ST_WREN 0x0006 /* Write Enable */ -#define SSB_CHIPCO_FLASHCTL_ST_WRDIS 0x0004 /* Write Disable */ -#define SSB_CHIPCO_FLASHCTL_ST_RDSR 0x0105 /* Read Status Register */ -#define SSB_CHIPCO_FLASHCTL_ST_WRSR 0x0101 /* Write Status Register */ -#define SSB_CHIPCO_FLASHCTL_ST_READ 0x0303 /* Read Data Bytes */ -#define SSB_CHIPCO_FLASHCTL_ST_PP 0x0302 /* Page Program */ -#define SSB_CHIPCO_FLASHCTL_ST_SE 0x02D8 /* Sector Erase */ -#define SSB_CHIPCO_FLASHCTL_ST_BE 0x00C7 /* Bulk Erase */ -#define SSB_CHIPCO_FLASHCTL_ST_DP 0x00B9 /* Deep Power-down */ -#define SSB_CHIPCO_FLASHCTL_ST_RSIG 0x03AB /* Read Electronic Signature */ - -/* Status register bits for ST flashes */ -#define SSB_CHIPCO_FLASHSTA_ST_WIP 0x01 /* Write In Progress */ -#define SSB_CHIPCO_FLASHSTA_ST_WEL 0x02 /* Write Enable Latch */ -#define SSB_CHIPCO_FLASHSTA_ST_BP 0x1C /* Block Protect */ -#define SSB_CHIPCO_FLASHSTA_ST_BP_SHIFT 2 -#define SSB_CHIPCO_FLASHSTA_ST_SRWD 0x80 /* Status Register Write Disable */ - -/* flashcontrol opcodes for Atmel flashes */ -#define SSB_CHIPCO_FLASHCTL_AT_READ 0x07E8 -#define SSB_CHIPCO_FLASHCTL_AT_PAGE_READ 0x07D2 -#define SSB_CHIPCO_FLASHCTL_AT_BUF1_READ /* FIXME */ -#define SSB_CHIPCO_FLASHCTL_AT_BUF2_READ /* FIXME */ -#define SSB_CHIPCO_FLASHCTL_AT_STATUS 0x01D7 -#define SSB_CHIPCO_FLASHCTL_AT_BUF1_WRITE 0x0384 -#define SSB_CHIPCO_FLASHCTL_AT_BUF2_WRITE 0x0387 -#define SSB_CHIPCO_FLASHCTL_AT_BUF1_ERASE_PRGM 0x0283 /* Erase program */ -#define SSB_CHIPCO_FLASHCTL_AT_BUF2_ERASE_PRGM 0x0286 /* Erase program */ -#define SSB_CHIPCO_FLASHCTL_AT_BUF1_PROGRAM 0x0288 -#define SSB_CHIPCO_FLASHCTL_AT_BUF2_PROGRAM 0x0289 -#define SSB_CHIPCO_FLASHCTL_AT_PAGE_ERASE 0x0281 -#define SSB_CHIPCO_FLASHCTL_AT_BLOCK_ERASE 0x0250 -#define SSB_CHIPCO_FLASHCTL_AT_BUF1_WRER_PRGM 0x0382 /* Write erase program */ -#define SSB_CHIPCO_FLASHCTL_AT_BUF2_WRER_PRGM 0x0385 /* Write erase program */ -#define SSB_CHIPCO_FLASHCTL_AT_BUF1_LOAD 0x0253 -#define SSB_CHIPCO_FLASHCTL_AT_BUF2_LOAD 0x0255 -#define SSB_CHIPCO_FLASHCTL_AT_BUF1_COMPARE 0x0260 -#define SSB_CHIPCO_FLASHCTL_AT_BUF2_COMPARE 0x0261 -#define SSB_CHIPCO_FLASHCTL_AT_BUF1_REPROGRAM 0x0258 -#define SSB_CHIPCO_FLASHCTL_AT_BUF2_REPROGRAM 0x0259 - -/* Status register bits for Atmel flashes */ -#define SSB_CHIPCO_FLASHSTA_AT_READY 0x80 -#define SSB_CHIPCO_FLASHSTA_AT_MISMATCH 0x40 -#define SSB_CHIPCO_FLASHSTA_AT_ID 0x38 -#define SSB_CHIPCO_FLASHSTA_AT_ID_SHIFT 3 - - -/** OTP **/ - -/* OTP regions */ -#define SSB_CHIPCO_OTP_HW_REGION SSB_CHIPCO_OTPS_HW_PROTECT -#define SSB_CHIPCO_OTP_SW_REGION SSB_CHIPCO_OTPS_SW_PROTECT -#define SSB_CHIPCO_OTP_CID_REGION SSB_CHIPCO_OTPS_CID_PROTECT - -/* OTP regions (Byte offsets from otp size) */ -#define SSB_CHIPCO_OTP_SWLIM_OFF (-8) -#define SSB_CHIPCO_OTP_CIDBASE_OFF 0 -#define SSB_CHIPCO_OTP_CIDLIM_OFF 8 - -/* Predefined OTP words (Word offset from otp size) */ -#define SSB_CHIPCO_OTP_BOUNDARY_OFF (-4) -#define SSB_CHIPCO_OTP_HWSIGN_OFF (-3) -#define SSB_CHIPCO_OTP_SWSIGN_OFF (-2) -#define SSB_CHIPCO_OTP_CIDSIGN_OFF (-1) - -#define SSB_CHIPCO_OTP_CID_OFF 0 -#define SSB_CHIPCO_OTP_PKG_OFF 1 -#define SSB_CHIPCO_OTP_FID_OFF 2 -#define SSB_CHIPCO_OTP_RSV_OFF 3 -#define SSB_CHIPCO_OTP_LIM_OFF 4 - -#define SSB_CHIPCO_OTP_SIGNATURE 0x578A -#define SSB_CHIPCO_OTP_MAGIC 0x4E56 - - -struct ssb_device; -struct ssb_serial_port; - -/* Data for the PMU, if available. - * Check availability with ((struct ssb_chipcommon)->capabilities & SSB_CHIPCO_CAP_PMU) - */ -struct ssb_chipcommon_pmu { - u8 rev; /* PMU revision */ - u32 crystalfreq; /* The active crystal frequency (in kHz) */ -}; - -struct ssb_chipcommon { - struct ssb_device *dev; - u32 capabilities; - u32 status; - /* Fast Powerup Delay constant */ - u16 fast_pwrup_delay; - struct ssb_chipcommon_pmu pmu; -}; - -static inline bool ssb_chipco_available(struct ssb_chipcommon *cc) -{ - return (cc->dev != NULL); -} - -/* Register access */ -#define chipco_read32(cc, offset) ssb_read32((cc)->dev, offset) -#define chipco_write32(cc, offset, val) ssb_write32((cc)->dev, offset, val) - -#define chipco_mask32(cc, offset, mask) \ - chipco_write32(cc, offset, chipco_read32(cc, offset) & (mask)) -#define chipco_set32(cc, offset, set) \ - chipco_write32(cc, offset, chipco_read32(cc, offset) | (set)) -#define chipco_maskset32(cc, offset, mask, set) \ - chipco_write32(cc, offset, (chipco_read32(cc, offset) & (mask)) | (set)) - -extern void ssb_chipcommon_init(struct ssb_chipcommon *cc); - -extern void ssb_chipco_suspend(struct ssb_chipcommon *cc); -extern void ssb_chipco_resume(struct ssb_chipcommon *cc); - -extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc, - u32 *plltype, u32 *n, u32 *m); -extern void ssb_chipco_get_clockcontrol(struct ssb_chipcommon *cc, - u32 *plltype, u32 *n, u32 *m); -extern void ssb_chipco_timing_init(struct ssb_chipcommon *cc, - unsigned long ns_per_cycle); - -enum ssb_clkmode { - SSB_CLKMODE_SLOW, - SSB_CLKMODE_FAST, - SSB_CLKMODE_DYNAMIC, -}; - -extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc, - enum ssb_clkmode mode); - -extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, - u32 ticks); - -void ssb_chipco_irq_mask(struct ssb_chipcommon *cc, u32 mask, u32 value); - -u32 ssb_chipco_irq_status(struct ssb_chipcommon *cc, u32 mask); - -/* Chipcommon GPIO pin access. */ -u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask); -u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value); -u32 ssb_chipco_gpio_outen(struct ssb_chipcommon *cc, u32 mask, u32 value); -u32 ssb_chipco_gpio_control(struct ssb_chipcommon *cc, u32 mask, u32 value); -u32 ssb_chipco_gpio_intmask(struct ssb_chipcommon *cc, u32 mask, u32 value); -u32 ssb_chipco_gpio_polarity(struct ssb_chipcommon *cc, u32 mask, u32 value); - -#ifdef CONFIG_SSB_SERIAL -extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc, - struct ssb_serial_port *ports); -#endif /* CONFIG_SSB_SERIAL */ - -/* PMU support */ -extern void ssb_pmu_init(struct ssb_chipcommon *cc); - -enum ssb_pmu_ldo_volt_id { - LDO_PAREF = 0, - LDO_VOLT1, - LDO_VOLT2, - LDO_VOLT3, -}; - -void ssb_pmu_set_ldo_voltage(struct ssb_chipcommon *cc, - enum ssb_pmu_ldo_volt_id id, u32 voltage); -void ssb_pmu_set_ldo_paref(struct ssb_chipcommon *cc, bool on); - -#endif /* LINUX_SSB_CHIPCO_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_extif.h b/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_extif.h deleted file mode 100644 index 91161f0aa22..00000000000 --- a/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_extif.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Hardware-specific External Interface I/O core definitions - * for the BCM47xx family of SiliconBackplane-based chips. - * - * The External Interface core supports a total of three external chip selects - * supporting external interfaces. One of the external chip selects is - * used for Flash, one is used for PCMCIA, and the other may be - * programmed to support either a synchronous interface or an - * asynchronous interface. The asynchronous interface can be used to - * support external devices such as UARTs and the BCM2019 Bluetooth - * baseband processor. - * The external interface core also contains 2 on-chip 16550 UARTs, clock - * frequency control, a watchdog interrupt timer, and a GPIO interface. - * - * Copyright 2005, Broadcom Corporation - * Copyright 2006, Michael Buesch - * - * Licensed under the GPL version 2. See COPYING for details. - */ -#ifndef LINUX_SSB_EXTIFCORE_H_ -#define LINUX_SSB_EXTIFCORE_H_ - -/* external interface address space */ -#define SSB_EXTIF_PCMCIA_MEMBASE(x) (x) -#define SSB_EXTIF_PCMCIA_IOBASE(x) ((x) + 0x100000) -#define SSB_EXTIF_PCMCIA_CFGBASE(x) ((x) + 0x200000) -#define SSB_EXTIF_CFGIF_BASE(x) ((x) + 0x800000) -#define SSB_EXTIF_FLASH_BASE(x) ((x) + 0xc00000) - -#define SSB_EXTIF_NR_GPIOOUT 5 -/* GPIO NOTE: - * The multiple instances of output and output enable registers - * are present to allow driver software for multiple cores to control - * gpio outputs without needing to share a single register pair. - * Use the following helper macro to get a register offset value. - */ -#define SSB_EXTIF_GPIO_OUT(index) ({ \ - BUILD_BUG_ON(index >= SSB_EXTIF_NR_GPIOOUT); \ - SSB_EXTIF_GPIO_OUT_BASE + ((index) * 8); \ - }) -#define SSB_EXTIF_GPIO_OUTEN(index) ({ \ - BUILD_BUG_ON(index >= SSB_EXTIF_NR_GPIOOUT); \ - SSB_EXTIF_GPIO_OUTEN_BASE + ((index) * 8); \ - }) - -/** EXTIF core registers **/ - -#define SSB_EXTIF_CTL 0x0000 -#define SSB_EXTIF_CTL_UARTEN (1 << 0) /* UART enable */ -#define SSB_EXTIF_EXTSTAT 0x0004 -#define SSB_EXTIF_EXTSTAT_EMODE (1 << 0) /* Endian mode (ro) */ -#define SSB_EXTIF_EXTSTAT_EIRQPIN (1 << 1) /* External interrupt pin (ro) */ -#define SSB_EXTIF_EXTSTAT_GPIOIRQPIN (1 << 2) /* GPIO interrupt pin (ro) */ -#define SSB_EXTIF_PCMCIA_CFG 0x0010 -#define SSB_EXTIF_PCMCIA_MEMWAIT 0x0014 -#define SSB_EXTIF_PCMCIA_ATTRWAIT 0x0018 -#define SSB_EXTIF_PCMCIA_IOWAIT 0x001C -#define SSB_EXTIF_PROG_CFG 0x0020 -#define SSB_EXTIF_PROG_WAITCNT 0x0024 -#define SSB_EXTIF_FLASH_CFG 0x0028 -#define SSB_EXTIF_FLASH_WAITCNT 0x002C -#define SSB_EXTIF_WATCHDOG 0x0040 -#define SSB_EXTIF_CLOCK_N 0x0044 -#define SSB_EXTIF_CLOCK_SB 0x0048 -#define SSB_EXTIF_CLOCK_PCI 0x004C -#define SSB_EXTIF_CLOCK_MII 0x0050 -#define SSB_EXTIF_GPIO_IN 0x0060 -#define SSB_EXTIF_GPIO_OUT_BASE 0x0064 -#define SSB_EXTIF_GPIO_OUTEN_BASE 0x0068 -#define SSB_EXTIF_EJTAG_OUTEN 0x0090 -#define SSB_EXTIF_GPIO_INTPOL 0x0094 -#define SSB_EXTIF_GPIO_INTMASK 0x0098 -#define SSB_EXTIF_UART_DATA 0x0300 -#define SSB_EXTIF_UART_TIMER 0x0310 -#define SSB_EXTIF_UART_FCR 0x0320 -#define SSB_EXTIF_UART_LCR 0x0330 -#define SSB_EXTIF_UART_MCR 0x0340 -#define SSB_EXTIF_UART_LSR 0x0350 -#define SSB_EXTIF_UART_MSR 0x0360 -#define SSB_EXTIF_UART_SCRATCH 0x0370 - - - - -/* pcmcia/prog/flash_config */ -#define SSB_EXTCFG_EN (1 << 0) /* enable */ -#define SSB_EXTCFG_MODE 0xE /* mode */ -#define SSB_EXTCFG_MODE_SHIFT 1 -#define SSB_EXTCFG_MODE_FLASH 0x0 /* flash/asynchronous mode */ -#define SSB_EXTCFG_MODE_SYNC 0x2 /* synchronous mode */ -#define SSB_EXTCFG_MODE_PCMCIA 0x4 /* pcmcia mode */ -#define SSB_EXTCFG_DS16 (1 << 4) /* destsize: 0=8bit, 1=16bit */ -#define SSB_EXTCFG_BSWAP (1 << 5) /* byteswap */ -#define SSB_EXTCFG_CLKDIV 0xC0 /* clock divider */ -#define SSB_EXTCFG_CLKDIV_SHIFT 6 -#define SSB_EXTCFG_CLKDIV_2 0x0 /* backplane/2 */ -#define SSB_EXTCFG_CLKDIV_3 0x40 /* backplane/3 */ -#define SSB_EXTCFG_CLKDIV_4 0x80 /* backplane/4 */ -#define SSB_EXTCFG_CLKEN (1 << 8) /* clock enable */ -#define SSB_EXTCFG_STROBE (1 << 9) /* size/bytestrobe (synch only) */ - -/* pcmcia_memwait */ -#define SSB_PCMCIA_MEMW_0 0x0000003F /* waitcount0 */ -#define SSB_PCMCIA_MEMW_1 0x00001F00 /* waitcount1 */ -#define SSB_PCMCIA_MEMW_1_SHIFT 8 -#define SSB_PCMCIA_MEMW_2 0x001F0000 /* waitcount2 */ -#define SSB_PCMCIA_MEMW_2_SHIFT 16 -#define SSB_PCMCIA_MEMW_3 0x1F000000 /* waitcount3 */ -#define SSB_PCMCIA_MEMW_3_SHIFT 24 - -/* pcmcia_attrwait */ -#define SSB_PCMCIA_ATTW_0 0x0000003F /* waitcount0 */ -#define SSB_PCMCIA_ATTW_1 0x00001F00 /* waitcount1 */ -#define SSB_PCMCIA_ATTW_1_SHIFT 8 -#define SSB_PCMCIA_ATTW_2 0x001F0000 /* waitcount2 */ -#define SSB_PCMCIA_ATTW_2_SHIFT 16 -#define SSB_PCMCIA_ATTW_3 0x1F000000 /* waitcount3 */ -#define SSB_PCMCIA_ATTW_3_SHIFT 24 - -/* pcmcia_iowait */ -#define SSB_PCMCIA_IOW_0 0x0000003F /* waitcount0 */ -#define SSB_PCMCIA_IOW_1 0x00001F00 /* waitcount1 */ -#define SSB_PCMCIA_IOW_1_SHIFT 8 -#define SSB_PCMCIA_IOW_2 0x001F0000 /* waitcount2 */ -#define SSB_PCMCIA_IOW_2_SHIFT 16 -#define SSB_PCMCIA_IOW_3 0x1F000000 /* waitcount3 */ -#define SSB_PCMCIA_IOW_3_SHIFT 24 - -/* prog_waitcount */ -#define SSB_PROG_WCNT_0 0x0000001F /* waitcount0 */ -#define SSB_PROG_WCNT_1 0x00001F00 /* waitcount1 */ -#define SSB_PROG_WCNT_1_SHIFT 8 -#define SSB_PROG_WCNT_2 0x001F0000 /* waitcount2 */ -#define SSB_PROG_WCNT_2_SHIFT 16 -#define SSB_PROG_WCNT_3 0x1F000000 /* waitcount3 */ -#define SSB_PROG_WCNT_3_SHIFT 24 - -#define SSB_PROG_W0 0x0000000C -#define SSB_PROG_W1 0x00000A00 -#define SSB_PROG_W2 0x00020000 -#define SSB_PROG_W3 0x01000000 - -/* flash_waitcount */ -#define SSB_FLASH_WCNT_0 0x0000001F /* waitcount0 */ -#define SSB_FLASH_WCNT_1 0x00001F00 /* waitcount1 */ -#define SSB_FLASH_WCNT_1_SHIFT 8 -#define SSB_FLASH_WCNT_2 0x001F0000 /* waitcount2 */ -#define SSB_FLASH_WCNT_2_SHIFT 16 -#define SSB_FLASH_WCNT_3 0x1F000000 /* waitcount3 */ -#define SSB_FLASH_WCNT_3_SHIFT 24 - -/* watchdog */ -#define SSB_EXTIF_WATCHDOG_CLK 48000000 /* Hz */ - - - -#ifdef CONFIG_SSB_DRIVER_EXTIF - -struct ssb_extif { - struct ssb_device *dev; -}; - -static inline bool ssb_extif_available(struct ssb_extif *extif) -{ - return (extif->dev != NULL); -} - -extern void ssb_extif_get_clockcontrol(struct ssb_extif *extif, - u32 *plltype, u32 *n, u32 *m); - -extern void ssb_extif_timing_init(struct ssb_extif *extif, - unsigned long ns); - -extern void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, - u32 ticks); - -/* Extif GPIO pin access */ -u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask); -u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value); -u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value); -u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value); -u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value); - -#ifdef CONFIG_SSB_SERIAL -extern int ssb_extif_serial_init(struct ssb_extif *extif, - struct ssb_serial_port *ports); -#endif /* CONFIG_SSB_SERIAL */ - - -#else /* CONFIG_SSB_DRIVER_EXTIF */ -/* extif disabled */ - -struct ssb_extif { -}; - -static inline bool ssb_extif_available(struct ssb_extif *extif) -{ - return 0; -} - -static inline -void ssb_extif_get_clockcontrol(struct ssb_extif *extif, - u32 *plltype, u32 *n, u32 *m) -{ -} - -static inline -void ssb_extif_watchdog_timer_set(struct ssb_extif *extif, - u32 ticks) -{ -} - -#endif /* CONFIG_SSB_DRIVER_EXTIF */ -#endif /* LINUX_SSB_EXTIFCORE_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_gige.h b/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_gige.h deleted file mode 100644 index 6b05dcd927f..00000000000 --- a/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_gige.h +++ /dev/null @@ -1,180 +0,0 @@ -#ifndef LINUX_SSB_DRIVER_GIGE_H_ -#define LINUX_SSB_DRIVER_GIGE_H_ - -#include <linux/ssb/ssb.h> -#include <linux/bug.h> -#include <linux/pci.h> -#include <linux/spinlock.h> - - -#ifdef CONFIG_SSB_DRIVER_GIGE - - -#define SSB_GIGE_PCIIO 0x0000 /* PCI I/O Registers (1024 bytes) */ -#define SSB_GIGE_RESERVED 0x0400 /* Reserved (1024 bytes) */ -#define SSB_GIGE_PCICFG 0x0800 /* PCI config space (256 bytes) */ -#define SSB_GIGE_SHIM_FLUSHSTAT 0x0C00 /* PCI to OCP: Flush status control (32bit) */ -#define SSB_GIGE_SHIM_FLUSHRDA 0x0C04 /* PCI to OCP: Flush read address (32bit) */ -#define SSB_GIGE_SHIM_FLUSHTO 0x0C08 /* PCI to OCP: Flush timeout counter (32bit) */ -#define SSB_GIGE_SHIM_BARRIER 0x0C0C /* PCI to OCP: Barrier register (32bit) */ -#define SSB_GIGE_SHIM_MAOCPSI 0x0C10 /* PCI to OCP: MaocpSI Control (32bit) */ -#define SSB_GIGE_SHIM_SIOCPMA 0x0C14 /* PCI to OCP: SiocpMa Control (32bit) */ - -/* TM Status High flags */ -#define SSB_GIGE_TMSHIGH_RGMII 0x00010000 /* Have an RGMII PHY-bus */ -/* TM Status Low flags */ -#define SSB_GIGE_TMSLOW_TXBYPASS 0x00080000 /* TX bypass (no delay) */ -#define SSB_GIGE_TMSLOW_RXBYPASS 0x00100000 /* RX bypass (no delay) */ -#define SSB_GIGE_TMSLOW_DLLEN 0x01000000 /* Enable DLL controls */ - -/* Boardflags (low) */ -#define SSB_GIGE_BFL_ROBOSWITCH 0x0010 - - -#define SSB_GIGE_MEM_RES_NAME "SSB Broadcom 47xx GigE memory" -#define SSB_GIGE_IO_RES_NAME "SSB Broadcom 47xx GigE I/O" - -struct ssb_gige { - struct ssb_device *dev; - - spinlock_t lock; - - /* True, if the device has an RGMII bus. - * False, if the device has a GMII bus. */ - bool has_rgmii; - - /* The PCI controller device. */ - struct pci_controller pci_controller; - struct pci_ops pci_ops; - struct resource mem_resource; - struct resource io_resource; -}; - -/* Check whether a PCI device is a SSB Gigabit Ethernet core. */ -extern bool pdev_is_ssb_gige_core(struct pci_dev *pdev); - -/* Convert a pci_dev pointer to a ssb_gige pointer. */ -static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev) -{ - if (!pdev_is_ssb_gige_core(pdev)) - return NULL; - return container_of(pdev->bus->ops, struct ssb_gige, pci_ops); -} - -/* Returns whether the PHY is connected by an RGMII bus. */ -static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev) -{ - struct ssb_gige *dev = pdev_to_ssb_gige(pdev); - return (dev ? dev->has_rgmii : 0); -} - -/* Returns whether we have a Roboswitch. */ -static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev) -{ - struct ssb_gige *dev = pdev_to_ssb_gige(pdev); - if (dev) - return !!(dev->dev->bus->sprom.boardflags_lo & - SSB_GIGE_BFL_ROBOSWITCH); - return 0; -} - -/* Returns whether we can only do one DMA at once. */ -static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev) -{ - struct ssb_gige *dev = pdev_to_ssb_gige(pdev); - if (dev) - return ((dev->dev->bus->chip_id == 0x4785) && - (dev->dev->bus->chip_rev < 2)); - return 0; -} - -/* Returns whether we must flush posted writes. */ -static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev) -{ - struct ssb_gige *dev = pdev_to_ssb_gige(pdev); - if (dev) - return (dev->dev->bus->chip_id == 0x4785); - return 0; -} - -#ifdef CONFIG_BCM47XX -#include <asm/mach-bcm47xx/nvram.h> -/* Get the device MAC address */ -static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) -{ - char buf[20]; - if (nvram_getenv("et0macaddr", buf, sizeof(buf)) < 0) - return; - nvram_parse_macaddr(buf, macaddr); -} -#else -static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr) -{ -} -#endif - -extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, - struct pci_dev *pdev); -extern int ssb_gige_map_irq(struct ssb_device *sdev, - const struct pci_dev *pdev); - -/* The GigE driver is not a standalone module, because we don't have support - * for unregistering the driver. So we could not unload the module anyway. */ -extern int ssb_gige_init(void); -static inline void ssb_gige_exit(void) -{ - /* Currently we can not unregister the GigE driver, - * because we can not unregister the PCI bridge. */ - BUG(); -} - - -#else /* CONFIG_SSB_DRIVER_GIGE */ -/* Gigabit Ethernet driver disabled */ - - -static inline int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev, - struct pci_dev *pdev) -{ - return -ENOSYS; -} -static inline int ssb_gige_map_irq(struct ssb_device *sdev, - const struct pci_dev *pdev) -{ - return -ENOSYS; -} -static inline int ssb_gige_init(void) -{ - return 0; -} -static inline void ssb_gige_exit(void) -{ -} - -static inline bool pdev_is_ssb_gige_core(struct pci_dev *pdev) -{ - return 0; -} -static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev) -{ - return NULL; -} -static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev) -{ - return 0; -} -static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev) -{ - return 0; -} -static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev) -{ - return 0; -} -static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev) -{ - return 0; -} - -#endif /* CONFIG_SSB_DRIVER_GIGE */ -#endif /* LINUX_SSB_DRIVER_GIGE_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_mips.h b/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_mips.h deleted file mode 100644 index 5f44e9740cd..00000000000 --- a/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_mips.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef LINUX_SSB_MIPSCORE_H_ -#define LINUX_SSB_MIPSCORE_H_ - -#ifdef CONFIG_SSB_DRIVER_MIPS - -struct ssb_device; - -struct ssb_serial_port { - void *regs; - unsigned long clockspeed; - unsigned int irq; - unsigned int baud_base; - unsigned int reg_shift; -}; - - -struct ssb_mipscore { - struct ssb_device *dev; - - int nr_serial_ports; - struct ssb_serial_port serial_ports[4]; - - u8 flash_buswidth; - u32 flash_window; - u32 flash_window_size; -}; - -extern void ssb_mipscore_init(struct ssb_mipscore *mcore); -extern u32 ssb_cpu_clock(struct ssb_mipscore *mcore); - -extern unsigned int ssb_mips_irq(struct ssb_device *dev); - - -#else /* CONFIG_SSB_DRIVER_MIPS */ - -struct ssb_mipscore { -}; - -static inline -void ssb_mipscore_init(struct ssb_mipscore *mcore) -{ -} - -#endif /* CONFIG_SSB_DRIVER_MIPS */ - -#endif /* LINUX_SSB_MIPSCORE_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_pci.h b/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_pci.h deleted file mode 100644 index 41e330e51c2..00000000000 --- a/openairITS/mac/DOT11/include/linux/ssb/ssb_driver_pci.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef LINUX_SSB_PCICORE_H_ -#define LINUX_SSB_PCICORE_H_ - -#include <linux/types.h> - -struct pci_dev; - - -#ifdef CONFIG_SSB_DRIVER_PCICORE - -/* PCI core registers. */ -#define SSB_PCICORE_CTL 0x0000 /* PCI Control */ -#define SSB_PCICORE_CTL_RST_OE 0x00000001 /* PCI_RESET Output Enable */ -#define SSB_PCICORE_CTL_RST 0x00000002 /* PCI_RESET driven out to pin */ -#define SSB_PCICORE_CTL_CLK_OE 0x00000004 /* Clock gate Output Enable */ -#define SSB_PCICORE_CTL_CLK 0x00000008 /* Gate for clock driven out to pin */ -#define SSB_PCICORE_ARBCTL 0x0010 /* PCI Arbiter Control */ -#define SSB_PCICORE_ARBCTL_INTERN 0x00000001 /* Use internal arbiter */ -#define SSB_PCICORE_ARBCTL_EXTERN 0x00000002 /* Use external arbiter */ -#define SSB_PCICORE_ARBCTL_PARKID 0x00000006 /* Mask, selects which agent is parked on an idle bus */ -#define SSB_PCICORE_ARBCTL_PARKID_LAST 0x00000000 /* Last requestor */ -#define SSB_PCICORE_ARBCTL_PARKID_4710 0x00000002 /* 4710 */ -#define SSB_PCICORE_ARBCTL_PARKID_EXT0 0x00000004 /* External requestor 0 */ -#define SSB_PCICORE_ARBCTL_PARKID_EXT1 0x00000006 /* External requestor 1 */ -#define SSB_PCICORE_ISTAT 0x0020 /* Interrupt status */ -#define SSB_PCICORE_ISTAT_INTA 0x00000001 /* PCI INTA# */ -#define SSB_PCICORE_ISTAT_INTB 0x00000002 /* PCI INTB# */ -#define SSB_PCICORE_ISTAT_SERR 0x00000004 /* PCI SERR# (write to clear) */ -#define SSB_PCICORE_ISTAT_PERR 0x00000008 /* PCI PERR# (write to clear) */ -#define SSB_PCICORE_ISTAT_PME 0x00000010 /* PCI PME# */ -#define SSB_PCICORE_IMASK 0x0024 /* Interrupt mask */ -#define SSB_PCICORE_IMASK_INTA 0x00000001 /* PCI INTA# */ -#define SSB_PCICORE_IMASK_INTB 0x00000002 /* PCI INTB# */ -#define SSB_PCICORE_IMASK_SERR 0x00000004 /* PCI SERR# */ -#define SSB_PCICORE_IMASK_PERR 0x00000008 /* PCI PERR# */ -#define SSB_PCICORE_IMASK_PME 0x00000010 /* PCI PME# */ -#define SSB_PCICORE_MBOX 0x0028 /* Backplane to PCI Mailbox */ -#define SSB_PCICORE_MBOX_F0_0 0x00000100 /* PCI function 0, INT 0 */ -#define SSB_PCICORE_MBOX_F0_1 0x00000200 /* PCI function 0, INT 1 */ -#define SSB_PCICORE_MBOX_F1_0 0x00000400 /* PCI function 1, INT 0 */ -#define SSB_PCICORE_MBOX_F1_1 0x00000800 /* PCI function 1, INT 1 */ -#define SSB_PCICORE_MBOX_F2_0 0x00001000 /* PCI function 2, INT 0 */ -#define SSB_PCICORE_MBOX_F2_1 0x00002000 /* PCI function 2, INT 1 */ -#define SSB_PCICORE_MBOX_F3_0 0x00004000 /* PCI function 3, INT 0 */ -#define SSB_PCICORE_MBOX_F3_1 0x00008000 /* PCI function 3, INT 1 */ -#define SSB_PCICORE_BCAST_ADDR 0x0050 /* Backplane Broadcast Address */ -#define SSB_PCICORE_BCAST_ADDR_MASK 0x000000FF -#define SSB_PCICORE_BCAST_DATA 0x0054 /* Backplane Broadcast Data */ -#define SSB_PCICORE_GPIO_IN 0x0060 /* rev >= 2 only */ -#define SSB_PCICORE_GPIO_OUT 0x0064 /* rev >= 2 only */ -#define SSB_PCICORE_GPIO_ENABLE 0x0068 /* rev >= 2 only */ -#define SSB_PCICORE_GPIO_CTL 0x006C /* rev >= 2 only */ -#define SSB_PCICORE_SBTOPCI0 0x0100 /* Backplane to PCI translation 0 (sbtopci0) */ -#define SSB_PCICORE_SBTOPCI0_MASK 0xFC000000 -#define SSB_PCICORE_SBTOPCI1 0x0104 /* Backplane to PCI translation 1 (sbtopci1) */ -#define SSB_PCICORE_SBTOPCI1_MASK 0xFC000000 -#define SSB_PCICORE_SBTOPCI2 0x0108 /* Backplane to PCI translation 2 (sbtopci2) */ -#define SSB_PCICORE_SBTOPCI2_MASK 0xC0000000 -#define SSB_PCICORE_PCICFG0 0x0400 /* PCI config space 0 (rev >= 8) */ -#define SSB_PCICORE_PCICFG1 0x0500 /* PCI config space 1 (rev >= 8) */ -#define SSB_PCICORE_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */ -#define SSB_PCICORE_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */ -#define SSB_PCICORE_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */ - -/* SBtoPCIx */ -#define SSB_PCICORE_SBTOPCI_MEM 0x00000000 -#define SSB_PCICORE_SBTOPCI_IO 0x00000001 -#define SSB_PCICORE_SBTOPCI_CFG0 0x00000002 -#define SSB_PCICORE_SBTOPCI_CFG1 0x00000003 -#define SSB_PCICORE_SBTOPCI_PREF 0x00000004 /* Prefetch enable */ -#define SSB_PCICORE_SBTOPCI_BURST 0x00000008 /* Burst enable */ -#define SSB_PCICORE_SBTOPCI_MRM 0x00000020 /* Memory Read Multiple */ -#define SSB_PCICORE_SBTOPCI_RC 0x00000030 /* Read Command mask (rev >= 11) */ -#define SSB_PCICORE_SBTOPCI_RC_READ 0x00000000 /* Memory read */ -#define SSB_PCICORE_SBTOPCI_RC_READL 0x00000010 /* Memory read line */ -#define SSB_PCICORE_SBTOPCI_RC_READM 0x00000020 /* Memory read multiple */ - - -/* PCIcore specific boardflags */ -#define SSB_PCICORE_BFL_NOPCI 0x00000400 /* Board leaves PCI floating */ - - -struct ssb_pcicore { - struct ssb_device *dev; - u8 setup_done:1; - u8 hostmode:1; - u8 cardbusmode:1; -}; - -extern void ssb_pcicore_init(struct ssb_pcicore *pc); - -/* Enable IRQ routing for a specific device */ -extern int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc, - struct ssb_device *dev); - -int ssb_pcicore_plat_dev_init(struct pci_dev *d); -int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); - - -#else /* CONFIG_SSB_DRIVER_PCICORE */ - - -struct ssb_pcicore { -}; - -static inline -void ssb_pcicore_init(struct ssb_pcicore *pc) -{ -} - -static inline -int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc, - struct ssb_device *dev) -{ - return 0; -} - -static inline -int ssb_pcicore_plat_dev_init(struct pci_dev *d) -{ - return -ENODEV; -} -static inline -int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) -{ - return -ENODEV; -} - -#endif /* CONFIG_SSB_DRIVER_PCICORE */ -#endif /* LINUX_SSB_PCICORE_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/ssb/ssb_embedded.h b/openairITS/mac/DOT11/include/linux/ssb/ssb_embedded.h deleted file mode 100644 index 8d8dedff059..00000000000 --- a/openairITS/mac/DOT11/include/linux/ssb/ssb_embedded.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LINUX_SSB_EMBEDDED_H_ -#define LINUX_SSB_EMBEDDED_H_ - -#include <linux/types.h> -#include <linux/ssb/ssb.h> - - -extern int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks); - -/* Generic GPIO API */ -u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask); -u32 ssb_gpio_out(struct ssb_bus *bus, u32 mask, u32 value); -u32 ssb_gpio_outen(struct ssb_bus *bus, u32 mask, u32 value); -u32 ssb_gpio_control(struct ssb_bus *bus, u32 mask, u32 value); -u32 ssb_gpio_intmask(struct ssb_bus *bus, u32 mask, u32 value); -u32 ssb_gpio_polarity(struct ssb_bus *bus, u32 mask, u32 value); - -#endif /* LINUX_SSB_EMBEDDED_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/ssb/ssb_regs.h b/openairITS/mac/DOT11/include/linux/ssb/ssb_regs.h deleted file mode 100644 index 40b1ef8595e..00000000000 --- a/openairITS/mac/DOT11/include/linux/ssb/ssb_regs.h +++ /dev/null @@ -1,594 +0,0 @@ -#ifndef LINUX_SSB_REGS_H_ -#define LINUX_SSB_REGS_H_ - - -/* SiliconBackplane Address Map. - * All regions may not exist on all chips. - */ -#define SSB_SDRAM_BASE 0x00000000U /* Physical SDRAM */ -#define SSB_PCI_MEM 0x08000000U /* Host Mode sb2pcitranslation0 (64 MB) */ -#define SSB_PCI_CFG 0x0c000000U /* Host Mode sb2pcitranslation1 (64 MB) */ -#define SSB_SDRAM_SWAPPED 0x10000000U /* Byteswapped Physical SDRAM */ -#define SSB_ENUM_BASE 0x18000000U /* Enumeration space base */ -#define SSB_ENUM_LIMIT 0x18010000U /* Enumeration space limit */ - -#define SSB_FLASH2 0x1c000000U /* Flash Region 2 (region 1 shadowed here) */ -#define SSB_FLASH2_SZ 0x02000000U /* Size of Flash Region 2 */ - -#define SSB_EXTIF_BASE 0x1f000000U /* External Interface region base address */ -#define SSB_FLASH1 0x1fc00000U /* Flash Region 1 */ -#define SSB_FLASH1_SZ 0x00400000U /* Size of Flash Region 1 */ - -#define SSB_PCI_DMA 0x40000000U /* Client Mode sb2pcitranslation2 (1 GB) */ -#define SSB_PCI_DMA_SZ 0x40000000U /* Client Mode sb2pcitranslation2 size in bytes */ -#define SSB_PCIE_DMA_L32 0x00000000U /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), low 32 bits */ -#define SSB_PCIE_DMA_H32 0x80000000U /* PCIE Client Mode sb2pcitranslation2 (2 ZettaBytes), high 32 bits */ -#define SSB_EUART (SSB_EXTIF_BASE + 0x00800000) -#define SSB_LED (SSB_EXTIF_BASE + 0x00900000) - - -/* Enumeration space constants */ -#define SSB_CORE_SIZE 0x1000 /* Size of a core MMIO area */ -#define SSB_MAX_NR_CORES ((SSB_ENUM_LIMIT - SSB_ENUM_BASE) / SSB_CORE_SIZE) - - -/* mips address */ -#define SSB_EJTAG 0xff200000 /* MIPS EJTAG space (2M) */ - - -/* SSB PCI config space registers. */ -#define SSB_PMCSR 0x44 -#define SSB_PE 0x100 -#define SSB_BAR0_WIN 0x80 /* Backplane address space 0 */ -#define SSB_BAR1_WIN 0x84 /* Backplane address space 1 */ -#define SSB_SPROMCTL 0x88 /* SPROM control */ -#define SSB_SPROMCTL_WE 0x10 /* SPROM write enable */ -#define SSB_BAR1_CONTROL 0x8c /* Address space 1 burst control */ -#define SSB_PCI_IRQS 0x90 /* PCI interrupts */ -#define SSB_PCI_IRQMASK 0x94 /* PCI IRQ control and mask (pcirev >= 6 only) */ -#define SSB_BACKPLANE_IRQS 0x98 /* Backplane Interrupts */ -#define SSB_GPIO_IN 0xB0 /* GPIO Input (pcirev >= 3 only) */ -#define SSB_GPIO_OUT 0xB4 /* GPIO Output (pcirev >= 3 only) */ -#define SSB_GPIO_OUT_ENABLE 0xB8 /* GPIO Output Enable/Disable (pcirev >= 3 only) */ -#define SSB_GPIO_SCS 0x10 /* PCI config space bit 4 for 4306c0 slow clock source */ -#define SSB_GPIO_HWRAD 0x20 /* PCI config space GPIO 13 for hw radio disable */ -#define SSB_GPIO_XTAL 0x40 /* PCI config space GPIO 14 for Xtal powerup */ -#define SSB_GPIO_PLL 0x80 /* PCI config space GPIO 15 for PLL powerdown */ - - -#define SSB_BAR0_MAX_RETRIES 50 - -/* Silicon backplane configuration register definitions */ -#define SSB_IPSFLAG 0x0F08 -#define SSB_IPSFLAG_IRQ1 0x0000003F /* which sbflags get routed to mips interrupt 1 */ -#define SSB_IPSFLAG_IRQ1_SHIFT 0 -#define SSB_IPSFLAG_IRQ2 0x00003F00 /* which sbflags get routed to mips interrupt 2 */ -#define SSB_IPSFLAG_IRQ2_SHIFT 8 -#define SSB_IPSFLAG_IRQ3 0x003F0000 /* which sbflags get routed to mips interrupt 3 */ -#define SSB_IPSFLAG_IRQ3_SHIFT 16 -#define SSB_IPSFLAG_IRQ4 0x3F000000 /* which sbflags get routed to mips interrupt 4 */ -#define SSB_IPSFLAG_IRQ4_SHIFT 24 -#define SSB_TPSFLAG 0x0F18 -#define SSB_TPSFLAG_BPFLAG 0x0000003F /* Backplane flag # */ -#define SSB_TPSFLAG_ALWAYSIRQ 0x00000040 /* IRQ is always sent on the Backplane */ -#define SSB_TMERRLOGA 0x0F48 -#define SSB_TMERRLOG 0x0F50 -#define SSB_ADMATCH3 0x0F60 -#define SSB_ADMATCH2 0x0F68 -#define SSB_ADMATCH1 0x0F70 -#define SSB_IMSTATE 0x0F90 /* SB Initiator Agent State */ -#define SSB_IMSTATE_PC 0x0000000f /* Pipe Count */ -#define SSB_IMSTATE_AP_MASK 0x00000030 /* Arbitration Priority */ -#define SSB_IMSTATE_AP_BOTH 0x00000000 /* Use both timeslices and token */ -#define SSB_IMSTATE_AP_TS 0x00000010 /* Use timeslices only */ -#define SSB_IMSTATE_AP_TK 0x00000020 /* Use token only */ -#define SSB_IMSTATE_AP_RSV 0x00000030 /* Reserved */ -#define SSB_IMSTATE_IBE 0x00020000 /* In Band Error */ -#define SSB_IMSTATE_TO 0x00040000 /* Timeout */ -#define SSB_IMSTATE_BUSY 0x01800000 /* Busy (Backplane rev >= 2.3 only) */ -#define SSB_IMSTATE_REJECT 0x02000000 /* Reject (Backplane rev >= 2.3 only) */ -#define SSB_INTVEC 0x0F94 /* SB Interrupt Mask */ -#define SSB_INTVEC_PCI 0x00000001 /* Enable interrupts for PCI */ -#define SSB_INTVEC_ENET0 0x00000002 /* Enable interrupts for enet 0 */ -#define SSB_INTVEC_ILINE20 0x00000004 /* Enable interrupts for iline20 */ -#define SSB_INTVEC_CODEC 0x00000008 /* Enable interrupts for v90 codec */ -#define SSB_INTVEC_USB 0x00000010 /* Enable interrupts for usb */ -#define SSB_INTVEC_EXTIF 0x00000020 /* Enable interrupts for external i/f */ -#define SSB_INTVEC_ENET1 0x00000040 /* Enable interrupts for enet 1 */ -#define SSB_TMSLOW 0x0F98 /* SB Target State Low */ -#define SSB_TMSLOW_RESET 0x00000001 /* Reset */ -#define SSB_TMSLOW_REJECT 0x00000002 /* Reject (Standard Backplane) */ -#define SSB_TMSLOW_REJECT_23 0x00000004 /* Reject (Backplane rev 2.3) */ -#define SSB_TMSLOW_CLOCK 0x00010000 /* Clock Enable */ -#define SSB_TMSLOW_FGC 0x00020000 /* Force Gated Clocks On */ -#define SSB_TMSLOW_PE 0x40000000 /* Power Management Enable */ -#define SSB_TMSLOW_BE 0x80000000 /* BIST Enable */ -#define SSB_TMSHIGH 0x0F9C /* SB Target State High */ -#define SSB_TMSHIGH_SERR 0x00000001 /* S-error */ -#define SSB_TMSHIGH_INT 0x00000002 /* Interrupt */ -#define SSB_TMSHIGH_BUSY 0x00000004 /* Busy */ -#define SSB_TMSHIGH_TO 0x00000020 /* Timeout. Backplane rev >= 2.3 only */ -#define SSB_TMSHIGH_COREFL 0x1FFF0000 /* Core specific flags */ -#define SSB_TMSHIGH_COREFL_SHIFT 16 -#define SSB_TMSHIGH_DMA64 0x10000000 /* 64bit DMA supported */ -#define SSB_TMSHIGH_GCR 0x20000000 /* Gated Clock Request */ -#define SSB_TMSHIGH_BISTF 0x40000000 /* BIST Failed */ -#define SSB_TMSHIGH_BISTD 0x80000000 /* BIST Done */ -#define SSB_BWA0 0x0FA0 -#define SSB_IMCFGLO 0x0FA8 -#define SSB_IMCFGLO_SERTO 0x00000007 /* Service timeout */ -#define SSB_IMCFGLO_REQTO 0x00000070 /* Request timeout */ -#define SSB_IMCFGLO_REQTO_SHIFT 4 -#define SSB_IMCFGLO_CONNID 0x00FF0000 /* Connection ID */ -#define SSB_IMCFGLO_CONNID_SHIFT 16 -#define SSB_IMCFGHI 0x0FAC -#define SSB_ADMATCH0 0x0FB0 -#define SSB_TMCFGLO 0x0FB8 -#define SSB_TMCFGHI 0x0FBC -#define SSB_BCONFIG 0x0FC0 -#define SSB_BSTATE 0x0FC8 -#define SSB_ACTCFG 0x0FD8 -#define SSB_FLAGST 0x0FE8 -#define SSB_IDLOW 0x0FF8 -#define SSB_IDLOW_CFGSP 0x00000003 /* Config Space */ -#define SSB_IDLOW_ADDRNGE 0x00000038 /* Address Ranges supported */ -#define SSB_IDLOW_ADDRNGE_SHIFT 3 -#define SSB_IDLOW_SYNC 0x00000040 -#define SSB_IDLOW_INITIATOR 0x00000080 -#define SSB_IDLOW_MIBL 0x00000F00 /* Minimum Backplane latency */ -#define SSB_IDLOW_MIBL_SHIFT 8 -#define SSB_IDLOW_MABL 0x0000F000 /* Maximum Backplane latency */ -#define SSB_IDLOW_MABL_SHIFT 12 -#define SSB_IDLOW_TIF 0x00010000 /* This Initiator is first */ -#define SSB_IDLOW_CCW 0x000C0000 /* Cycle counter width */ -#define SSB_IDLOW_CCW_SHIFT 18 -#define SSB_IDLOW_TPT 0x00F00000 /* Target ports */ -#define SSB_IDLOW_TPT_SHIFT 20 -#define SSB_IDLOW_INITP 0x0F000000 /* Initiator ports */ -#define SSB_IDLOW_INITP_SHIFT 24 -#define SSB_IDLOW_SSBREV 0xF0000000 /* Sonics Backplane Revision code */ -#define SSB_IDLOW_SSBREV_22 0x00000000 /* <= 2.2 */ -#define SSB_IDLOW_SSBREV_23 0x10000000 /* 2.3 */ -#define SSB_IDLOW_SSBREV_24 0x40000000 /* ?? Found in BCM4328 */ -#define SSB_IDLOW_SSBREV_25 0x50000000 /* ?? Not Found yet */ -#define SSB_IDLOW_SSBREV_26 0x60000000 /* ?? Found in some BCM4311/2 */ -#define SSB_IDLOW_SSBREV_27 0x70000000 /* ?? Found in some BCM4311/2 */ -#define SSB_IDHIGH 0x0FFC /* SB Identification High */ -#define SSB_IDHIGH_RCLO 0x0000000F /* Revision Code (low part) */ -#define SSB_IDHIGH_CC 0x00008FF0 /* Core Code */ -#define SSB_IDHIGH_CC_SHIFT 4 -#define SSB_IDHIGH_RCHI 0x00007000 /* Revision Code (high part) */ -#define SSB_IDHIGH_RCHI_SHIFT 8 /* yes, shift 8 is right */ -#define SSB_IDHIGH_VC 0xFFFF0000 /* Vendor Code */ -#define SSB_IDHIGH_VC_SHIFT 16 - -/* SPROM shadow area. If not otherwise noted, fields are - * two bytes wide. Note that the SPROM can _only_ be read - * in two-byte quantities. - */ -#define SSB_SPROMSIZE_WORDS 64 -#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16)) -#define SSB_SPROMSIZE_WORDS_R123 64 -#define SSB_SPROMSIZE_WORDS_R4 220 -#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) -#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) -#define SSB_SPROM_BASE1 0x1000 -#define SSB_SPROM_BASE31 0x0800 -#define SSB_SPROM_REVISION 0x007E -#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */ -#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */ -#define SSB_SPROM_REVISION_CRC_SHIFT 8 - -/* SPROM Revision 1 */ -#define SSB_SPROM1_SPID 0x0004 /* Subsystem Product ID for PCI */ -#define SSB_SPROM1_SVID 0x0006 /* Subsystem Vendor ID for PCI */ -#define SSB_SPROM1_PID 0x0008 /* Product ID for PCI */ -#define SSB_SPROM1_IL0MAC 0x0048 /* 6 bytes MAC address for 802.11b/g */ -#define SSB_SPROM1_ET0MAC 0x004E /* 6 bytes MAC address for Ethernet */ -#define SSB_SPROM1_ET1MAC 0x0054 /* 6 bytes MAC address for 802.11a */ -#define SSB_SPROM1_ETHPHY 0x005A /* Ethernet PHY settings */ -#define SSB_SPROM1_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ -#define SSB_SPROM1_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ -#define SSB_SPROM1_ETHPHY_ET1A_SHIFT 5 -#define SSB_SPROM1_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ -#define SSB_SPROM1_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ -#define SSB_SPROM1_BINF 0x005C /* Board info */ -#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */ -#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */ -#define SSB_SPROM1_BINF_CCODE_SHIFT 8 -#define SSB_SPROM1_BINF_ANTBG 0x3000 /* Available B-PHY and G-PHY antennas */ -#define SSB_SPROM1_BINF_ANTBG_SHIFT 12 -#define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */ -#define SSB_SPROM1_BINF_ANTA_SHIFT 14 -#define SSB_SPROM1_PA0B0 0x005E -#define SSB_SPROM1_PA0B1 0x0060 -#define SSB_SPROM1_PA0B2 0x0062 -#define SSB_SPROM1_GPIOA 0x0064 /* General Purpose IO pins 0 and 1 */ -#define SSB_SPROM1_GPIOA_P0 0x00FF /* Pin 0 */ -#define SSB_SPROM1_GPIOA_P1 0xFF00 /* Pin 1 */ -#define SSB_SPROM1_GPIOA_P1_SHIFT 8 -#define SSB_SPROM1_GPIOB 0x0066 /* General Purpuse IO pins 2 and 3 */ -#define SSB_SPROM1_GPIOB_P2 0x00FF /* Pin 2 */ -#define SSB_SPROM1_GPIOB_P3 0xFF00 /* Pin 3 */ -#define SSB_SPROM1_GPIOB_P3_SHIFT 8 -#define SSB_SPROM1_MAXPWR 0x0068 /* Power Amplifier Max Power */ -#define SSB_SPROM1_MAXPWR_BG 0x00FF /* B-PHY and G-PHY (in dBm Q5.2) */ -#define SSB_SPROM1_MAXPWR_A 0xFF00 /* A-PHY (in dBm Q5.2) */ -#define SSB_SPROM1_MAXPWR_A_SHIFT 8 -#define SSB_SPROM1_PA1B0 0x006A -#define SSB_SPROM1_PA1B1 0x006C -#define SSB_SPROM1_PA1B2 0x006E -#define SSB_SPROM1_ITSSI 0x0070 /* Idle TSSI Target */ -#define SSB_SPROM1_ITSSI_BG 0x00FF /* B-PHY and G-PHY*/ -#define SSB_SPROM1_ITSSI_A 0xFF00 /* A-PHY */ -#define SSB_SPROM1_ITSSI_A_SHIFT 8 -#define SSB_SPROM1_BFLLO 0x0072 /* Boardflags (low 16 bits) */ -#define SSB_SPROM1_AGAIN 0x0074 /* Antenna Gain (in dBm Q5.2) */ -#define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */ -#define SSB_SPROM1_AGAIN_BG_SHIFT 0 -#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */ -#define SSB_SPROM1_AGAIN_A_SHIFT 8 - -/* SPROM Revision 2 (inherits from rev 1) */ -#define SSB_SPROM2_BFLHI 0x0038 /* Boardflags (high 16 bits) */ -#define SSB_SPROM2_MAXP_A 0x003A /* A-PHY Max Power */ -#define SSB_SPROM2_MAXP_A_HI 0x00FF /* Max Power High */ -#define SSB_SPROM2_MAXP_A_LO 0xFF00 /* Max Power Low */ -#define SSB_SPROM2_MAXP_A_LO_SHIFT 8 -#define SSB_SPROM2_PA1LOB0 0x003C /* A-PHY PowerAmplifier Low Settings */ -#define SSB_SPROM2_PA1LOB1 0x003E /* A-PHY PowerAmplifier Low Settings */ -#define SSB_SPROM2_PA1LOB2 0x0040 /* A-PHY PowerAmplifier Low Settings */ -#define SSB_SPROM2_PA1HIB0 0x0042 /* A-PHY PowerAmplifier High Settings */ -#define SSB_SPROM2_PA1HIB1 0x0044 /* A-PHY PowerAmplifier High Settings */ -#define SSB_SPROM2_PA1HIB2 0x0046 /* A-PHY PowerAmplifier High Settings */ -#define SSB_SPROM2_OPO 0x0078 /* OFDM Power Offset from CCK Level */ -#define SSB_SPROM2_OPO_VALUE 0x00FF -#define SSB_SPROM2_OPO_UNUSED 0xFF00 -#define SSB_SPROM2_CCODE 0x007C /* Two char Country Code */ - -/* SPROM Revision 3 (inherits most data from rev 2) */ -#define SSB_SPROM3_OFDMAPO 0x002C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ -#define SSB_SPROM3_OFDMALPO 0x0030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ -#define SSB_SPROM3_OFDMAHPO 0x0034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ -#define SSB_SPROM3_GPIOLDC 0x0042 /* GPIO LED Powersave Duty Cycle (4 bytes, BigEndian) */ -#define SSB_SPROM3_GPIOLDC_OFF 0x0000FF00 /* Off Count */ -#define SSB_SPROM3_GPIOLDC_OFF_SHIFT 8 -#define SSB_SPROM3_GPIOLDC_ON 0x00FF0000 /* On Count */ -#define SSB_SPROM3_GPIOLDC_ON_SHIFT 16 -#define SSB_SPROM3_IL0MAC 0x004A /* 6 bytes MAC address for 802.11b/g */ -#define SSB_SPROM3_CCKPO 0x0078 /* CCK Power Offset */ -#define SSB_SPROM3_CCKPO_1M 0x000F /* 1M Rate PO */ -#define SSB_SPROM3_CCKPO_2M 0x00F0 /* 2M Rate PO */ -#define SSB_SPROM3_CCKPO_2M_SHIFT 4 -#define SSB_SPROM3_CCKPO_55M 0x0F00 /* 5.5M Rate PO */ -#define SSB_SPROM3_CCKPO_55M_SHIFT 8 -#define SSB_SPROM3_CCKPO_11M 0xF000 /* 11M Rate PO */ -#define SSB_SPROM3_CCKPO_11M_SHIFT 12 -#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ - -/* SPROM Revision 4 */ -#define SSB_SPROM4_BFLLO 0x0044 /* Boardflags (low 16 bits) */ -#define SSB_SPROM4_BFLHI 0x0046 /* Board Flags Hi */ -#define SSB_SPROM4_BFL2LO 0x0048 /* Board flags 2 (low 16 bits) */ -#define SSB_SPROM4_BFL2HI 0x004A /* Board flags 2 Hi */ -#define SSB_SPROM4_IL0MAC 0x004C /* 6 byte MAC address for a/b/g/n */ -#define SSB_SPROM4_CCODE 0x0052 /* Country Code (2 bytes) */ -#define SSB_SPROM4_GPIOA 0x0056 /* Gen. Purpose IO # 0 and 1 */ -#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */ -#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */ -#define SSB_SPROM4_GPIOA_P1_SHIFT 8 -#define SSB_SPROM4_GPIOB 0x0058 /* Gen. Purpose IO # 2 and 3 */ -#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */ -#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */ -#define SSB_SPROM4_GPIOB_P3_SHIFT 8 -#define SSB_SPROM4_ETHPHY 0x005A /* Ethernet PHY settings ?? */ -#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ -#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ -#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5 -#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ -#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ -#define SSB_SPROM4_ANTAVAIL 0x005D /* Antenna available bitfields */ -#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */ -#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0 -#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */ -#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8 -#define SSB_SPROM4_AGAIN01 0x005E /* Antenna Gain (in dBm Q5.2) */ -#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */ -#define SSB_SPROM4_AGAIN0_SHIFT 0 -#define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */ -#define SSB_SPROM4_AGAIN1_SHIFT 8 -#define SSB_SPROM4_AGAIN23 0x0060 -#define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */ -#define SSB_SPROM4_AGAIN2_SHIFT 0 -#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */ -#define SSB_SPROM4_AGAIN3_SHIFT 8 -#define SSB_SPROM4_TXPID2G01 0x0062 /* TX Power Index 2GHz */ -#define SSB_SPROM4_TXPID2G0 0x00FF -#define SSB_SPROM4_TXPID2G0_SHIFT 0 -#define SSB_SPROM4_TXPID2G1 0xFF00 -#define SSB_SPROM4_TXPID2G1_SHIFT 8 -#define SSB_SPROM4_TXPID2G23 0x0064 /* TX Power Index 2GHz */ -#define SSB_SPROM4_TXPID2G2 0x00FF -#define SSB_SPROM4_TXPID2G2_SHIFT 0 -#define SSB_SPROM4_TXPID2G3 0xFF00 -#define SSB_SPROM4_TXPID2G3_SHIFT 8 -#define SSB_SPROM4_TXPID5G01 0x0066 /* TX Power Index 5GHz middle subband */ -#define SSB_SPROM4_TXPID5G0 0x00FF -#define SSB_SPROM4_TXPID5G0_SHIFT 0 -#define SSB_SPROM4_TXPID5G1 0xFF00 -#define SSB_SPROM4_TXPID5G1_SHIFT 8 -#define SSB_SPROM4_TXPID5G23 0x0068 /* TX Power Index 5GHz middle subband */ -#define SSB_SPROM4_TXPID5G2 0x00FF -#define SSB_SPROM4_TXPID5G2_SHIFT 0 -#define SSB_SPROM4_TXPID5G3 0xFF00 -#define SSB_SPROM4_TXPID5G3_SHIFT 8 -#define SSB_SPROM4_TXPID5GL01 0x006A /* TX Power Index 5GHz low subband */ -#define SSB_SPROM4_TXPID5GL0 0x00FF -#define SSB_SPROM4_TXPID5GL0_SHIFT 0 -#define SSB_SPROM4_TXPID5GL1 0xFF00 -#define SSB_SPROM4_TXPID5GL1_SHIFT 8 -#define SSB_SPROM4_TXPID5GL23 0x006C /* TX Power Index 5GHz low subband */ -#define SSB_SPROM4_TXPID5GL2 0x00FF -#define SSB_SPROM4_TXPID5GL2_SHIFT 0 -#define SSB_SPROM4_TXPID5GL3 0xFF00 -#define SSB_SPROM4_TXPID5GL3_SHIFT 8 -#define SSB_SPROM4_TXPID5GH01 0x006E /* TX Power Index 5GHz high subband */ -#define SSB_SPROM4_TXPID5GH0 0x00FF -#define SSB_SPROM4_TXPID5GH0_SHIFT 0 -#define SSB_SPROM4_TXPID5GH1 0xFF00 -#define SSB_SPROM4_TXPID5GH1_SHIFT 8 -#define SSB_SPROM4_TXPID5GH23 0x0070 /* TX Power Index 5GHz high subband */ -#define SSB_SPROM4_TXPID5GH2 0x00FF -#define SSB_SPROM4_TXPID5GH2_SHIFT 0 -#define SSB_SPROM4_TXPID5GH3 0xFF00 -#define SSB_SPROM4_TXPID5GH3_SHIFT 8 -#define SSB_SPROM4_MAXP_BG 0x0080 /* Max Power BG in path 1 */ -#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ -#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ -#define SSB_SPROM4_ITSSI_BG_SHIFT 8 -#define SSB_SPROM4_MAXP_A 0x008A /* Max Power A in path 1 */ -#define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */ -#define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ -#define SSB_SPROM4_ITSSI_A_SHIFT 8 -#define SSB_SPROM4_PA0B0 0x0082 /* The paXbY locations are */ -#define SSB_SPROM4_PA0B1 0x0084 /* only guesses */ -#define SSB_SPROM4_PA0B2 0x0086 -#define SSB_SPROM4_PA1B0 0x008E -#define SSB_SPROM4_PA1B1 0x0090 -#define SSB_SPROM4_PA1B2 0x0092 - -/* SPROM Revision 5 (inherits most data from rev 4) */ -#define SSB_SPROM5_CCODE 0x0044 /* Country Code (2 bytes) */ -#define SSB_SPROM5_BFLLO 0x004A /* Boardflags (low 16 bits) */ -#define SSB_SPROM5_BFLHI 0x004C /* Board Flags Hi */ -#define SSB_SPROM5_BFL2LO 0x004E /* Board flags 2 (low 16 bits) */ -#define SSB_SPROM5_BFL2HI 0x0050 /* Board flags 2 Hi */ -#define SSB_SPROM5_IL0MAC 0x0052 /* 6 byte MAC address for a/b/g/n */ -#define SSB_SPROM5_GPIOA 0x0076 /* Gen. Purpose IO # 0 and 1 */ -#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */ -#define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */ -#define SSB_SPROM5_GPIOA_P1_SHIFT 8 -#define SSB_SPROM5_GPIOB 0x0078 /* Gen. Purpose IO # 2 and 3 */ -#define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */ -#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */ -#define SSB_SPROM5_GPIOB_P3_SHIFT 8 - -/* SPROM Revision 8 */ -#define SSB_SPROM8_BOARDREV 0x0082 /* Board revision */ -#define SSB_SPROM8_BFLLO 0x0084 /* Board flags (bits 0-15) */ -#define SSB_SPROM8_BFLHI 0x0086 /* Board flags (bits 16-31) */ -#define SSB_SPROM8_BFL2LO 0x0088 /* Board flags (bits 32-47) */ -#define SSB_SPROM8_BFL2HI 0x008A /* Board flags (bits 48-63) */ -#define SSB_SPROM8_IL0MAC 0x008C /* 6 byte MAC address */ -#define SSB_SPROM8_CCODE 0x0092 /* 2 byte country code */ -#define SSB_SPROM8_GPIOA 0x0096 /*Gen. Purpose IO # 0 and 1 */ -#define SSB_SPROM8_GPIOA_P0 0x00FF /* Pin 0 */ -#define SSB_SPROM8_GPIOA_P1 0xFF00 /* Pin 1 */ -#define SSB_SPROM8_GPIOA_P1_SHIFT 8 -#define SSB_SPROM8_GPIOB 0x0098 /* Gen. Purpose IO # 2 and 3 */ -#define SSB_SPROM8_GPIOB_P2 0x00FF /* Pin 2 */ -#define SSB_SPROM8_GPIOB_P3 0xFF00 /* Pin 3 */ -#define SSB_SPROM8_GPIOB_P3_SHIFT 8 -#define SSB_SPROM8_ANTAVAIL 0x009C /* Antenna available bitfields*/ -#define SSB_SPROM8_ANTAVAIL_A 0xFF00 /* A-PHY bitfield */ -#define SSB_SPROM8_ANTAVAIL_A_SHIFT 8 -#define SSB_SPROM8_ANTAVAIL_BG 0x00FF /* B-PHY and G-PHY bitfield */ -#define SSB_SPROM8_ANTAVAIL_BG_SHIFT 0 -#define SSB_SPROM8_AGAIN01 0x009E /* Antenna Gain (in dBm Q5.2) */ -#define SSB_SPROM8_AGAIN0 0x00FF /* Antenna 0 */ -#define SSB_SPROM8_AGAIN0_SHIFT 0 -#define SSB_SPROM8_AGAIN1 0xFF00 /* Antenna 1 */ -#define SSB_SPROM8_AGAIN1_SHIFT 8 -#define SSB_SPROM8_AGAIN23 0x00A0 -#define SSB_SPROM8_AGAIN2 0x00FF /* Antenna 2 */ -#define SSB_SPROM8_AGAIN2_SHIFT 0 -#define SSB_SPROM8_AGAIN3 0xFF00 /* Antenna 3 */ -#define SSB_SPROM8_AGAIN3_SHIFT 8 -#define SSB_SPROM8_RSSIPARM2G 0x00A4 /* RSSI params for 2GHz */ -#define SSB_SPROM8_RSSISMF2G 0x000F -#define SSB_SPROM8_RSSISMC2G 0x00F0 -#define SSB_SPROM8_RSSISMC2G_SHIFT 4 -#define SSB_SPROM8_RSSISAV2G 0x0700 -#define SSB_SPROM8_RSSISAV2G_SHIFT 8 -#define SSB_SPROM8_BXA2G 0x1800 -#define SSB_SPROM8_BXA2G_SHIFT 11 -#define SSB_SPROM8_RSSIPARM5G 0x00A6 /* RSSI params for 5GHz */ -#define SSB_SPROM8_RSSISMF5G 0x000F -#define SSB_SPROM8_RSSISMC5G 0x00F0 -#define SSB_SPROM8_RSSISMC5G_SHIFT 4 -#define SSB_SPROM8_RSSISAV5G 0x0700 -#define SSB_SPROM8_RSSISAV5G_SHIFT 8 -#define SSB_SPROM8_BXA5G 0x1800 -#define SSB_SPROM8_BXA5G_SHIFT 11 -#define SSB_SPROM8_TRI25G 0x00A8 /* TX isolation 2.4&5.3GHz */ -#define SSB_SPROM8_TRI2G 0x00FF /* TX isolation 2.4GHz */ -#define SSB_SPROM8_TRI5G 0xFF00 /* TX isolation 5.3GHz */ -#define SSB_SPROM8_TRI5G_SHIFT 8 -#define SSB_SPROM8_TRI5GHL 0x00AA /* TX isolation 5.2/5.8GHz */ -#define SSB_SPROM8_TRI5GL 0x00FF /* TX isolation 5.2GHz */ -#define SSB_SPROM8_TRI5GH 0xFF00 /* TX isolation 5.8GHz */ -#define SSB_SPROM8_TRI5GH_SHIFT 8 -#define SSB_SPROM8_RXPO 0x00AC /* RX power offsets */ -#define SSB_SPROM8_RXPO2G 0x00FF /* 2GHz RX power offset */ -#define SSB_SPROM8_RXPO5G 0xFF00 /* 5GHz RX power offset */ -#define SSB_SPROM8_RXPO5G_SHIFT 8 -#define SSB_SPROM8_FEM2G 0x00AE -#define SSB_SPROM8_FEM5G 0x00B0 -#define SSB_SROM8_FEM_TSSIPOS 0x0001 -#define SSB_SROM8_FEM_TSSIPOS_SHIFT 0 -#define SSB_SROM8_FEM_EXTPA_GAIN 0x0006 -#define SSB_SROM8_FEM_EXTPA_GAIN_SHIFT 1 -#define SSB_SROM8_FEM_PDET_RANGE 0x00F8 -#define SSB_SROM8_FEM_PDET_RANGE_SHIFT 3 -#define SSB_SROM8_FEM_TR_ISO 0x0700 -#define SSB_SROM8_FEM_TR_ISO_SHIFT 8 -#define SSB_SROM8_FEM_ANTSWLUT 0xF800 -#define SSB_SROM8_FEM_ANTSWLUT_SHIFT 11 -#define SSB_SPROM8_THERMAL 0x00B2 -#define SSB_SPROM8_MPWR_RAWTS 0x00B4 -#define SSB_SPROM8_TS_SLP_OPT_CORRX 0x00B6 -#define SSB_SPROM8_FOC_HWIQ_IQSWP 0x00B8 -#define SSB_SPROM8_PHYCAL_TEMPDELTA 0x00BA - -/* There are 4 blocks with power info sharing the same layout */ -#define SSB_SROM8_PWR_INFO_CORE0 0x00C0 -#define SSB_SROM8_PWR_INFO_CORE1 0x00E0 -#define SSB_SROM8_PWR_INFO_CORE2 0x0100 -#define SSB_SROM8_PWR_INFO_CORE3 0x0120 - -#define SSB_SROM8_2G_MAXP_ITSSI 0x00 -#define SSB_SPROM8_2G_MAXP 0x00FF -#define SSB_SPROM8_2G_ITSSI 0xFF00 -#define SSB_SPROM8_2G_ITSSI_SHIFT 8 -#define SSB_SROM8_2G_PA_0 0x02 /* 2GHz power amp settings */ -#define SSB_SROM8_2G_PA_1 0x04 -#define SSB_SROM8_2G_PA_2 0x06 -#define SSB_SROM8_5G_MAXP_ITSSI 0x08 /* 5GHz ITSSI and 5.3GHz Max Power */ -#define SSB_SPROM8_5G_MAXP 0x00FF -#define SSB_SPROM8_5G_ITSSI 0xFF00 -#define SSB_SPROM8_5G_ITSSI_SHIFT 8 -#define SSB_SPROM8_5GHL_MAXP 0x0A /* 5.2GHz and 5.8GHz Max Power */ -#define SSB_SPROM8_5GH_MAXP 0x00FF -#define SSB_SPROM8_5GL_MAXP 0xFF00 -#define SSB_SPROM8_5GL_MAXP_SHIFT 8 -#define SSB_SROM8_5G_PA_0 0x0C /* 5.3GHz power amp settings */ -#define SSB_SROM8_5G_PA_1 0x0E -#define SSB_SROM8_5G_PA_2 0x10 -#define SSB_SROM8_5GL_PA_0 0x12 /* 5.2GHz power amp settings */ -#define SSB_SROM8_5GL_PA_1 0x14 -#define SSB_SROM8_5GL_PA_2 0x16 -#define SSB_SROM8_5GH_PA_0 0x18 /* 5.8GHz power amp settings */ -#define SSB_SROM8_5GH_PA_1 0x1A -#define SSB_SROM8_5GH_PA_2 0x1C - -/* TODO: Make it deprecated */ -#define SSB_SPROM8_MAXP_BG 0x00C0 /* Max Power 2GHz in path 1 */ -#define SSB_SPROM8_MAXP_BG_MASK 0x00FF /* Mask for Max Power 2GHz */ -#define SSB_SPROM8_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ -#define SSB_SPROM8_ITSSI_BG_SHIFT 8 -#define SSB_SPROM8_PA0B0 0x00C2 /* 2GHz power amp settings */ -#define SSB_SPROM8_PA0B1 0x00C4 -#define SSB_SPROM8_PA0B2 0x00C6 -#define SSB_SPROM8_MAXP_A 0x00C8 /* Max Power 5.3GHz */ -#define SSB_SPROM8_MAXP_A_MASK 0x00FF /* Mask for Max Power 5.3GHz */ -#define SSB_SPROM8_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ -#define SSB_SPROM8_ITSSI_A_SHIFT 8 -#define SSB_SPROM8_MAXP_AHL 0x00CA /* Max Power 5.2/5.8GHz */ -#define SSB_SPROM8_MAXP_AH_MASK 0x00FF /* Mask for Max Power 5.8GHz */ -#define SSB_SPROM8_MAXP_AL_MASK 0xFF00 /* Mask for Max Power 5.2GHz */ -#define SSB_SPROM8_MAXP_AL_SHIFT 8 -#define SSB_SPROM8_PA1B0 0x00CC /* 5.3GHz power amp settings */ -#define SSB_SPROM8_PA1B1 0x00CE -#define SSB_SPROM8_PA1B2 0x00D0 -#define SSB_SPROM8_PA1LOB0 0x00D2 /* 5.2GHz power amp settings */ -#define SSB_SPROM8_PA1LOB1 0x00D4 -#define SSB_SPROM8_PA1LOB2 0x00D6 -#define SSB_SPROM8_PA1HIB0 0x00D8 /* 5.8GHz power amp settings */ -#define SSB_SPROM8_PA1HIB1 0x00DA -#define SSB_SPROM8_PA1HIB2 0x00DC - -#define SSB_SPROM8_CCK2GPO 0x0140 /* CCK power offset */ -#define SSB_SPROM8_OFDM2GPO 0x0142 /* 2.4GHz OFDM power offset */ -#define SSB_SPROM8_OFDM5GPO 0x0146 /* 5.3GHz OFDM power offset */ -#define SSB_SPROM8_OFDM5GLPO 0x014A /* 5.2GHz OFDM power offset */ -#define SSB_SPROM8_OFDM5GHPO 0x014E /* 5.8GHz OFDM power offset */ - -/* Values for boardflags_lo read from SPROM */ -#define SSB_BFL_BTCOEXIST 0x0001 /* implements Bluetooth coexistance */ -#define SSB_BFL_PACTRL 0x0002 /* GPIO 9 controlling the PA */ -#define SSB_BFL_AIRLINEMODE 0x0004 /* implements GPIO 13 radio disable indication */ -#define SSB_BFL_RSSI 0x0008 /* software calculates nrssi slope. */ -#define SSB_BFL_ENETSPI 0x0010 /* has ephy roboswitch spi */ -#define SSB_BFL_XTAL_NOSLOW 0x0020 /* no slow clock available */ -#define SSB_BFL_CCKHIPWR 0x0040 /* can do high power CCK transmission */ -#define SSB_BFL_ENETADM 0x0080 /* has ADMtek switch */ -#define SSB_BFL_ENETVLAN 0x0100 /* can do vlan */ -#define SSB_BFL_AFTERBURNER 0x0200 /* supports Afterburner mode */ -#define SSB_BFL_NOPCI 0x0400 /* board leaves PCI floating */ -#define SSB_BFL_FEM 0x0800 /* supports the Front End Module */ -#define SSB_BFL_EXTLNA 0x1000 /* has an external LNA */ -#define SSB_BFL_HGPA 0x2000 /* had high gain PA */ -#define SSB_BFL_BTCMOD 0x4000 /* BFL_BTCOEXIST is given in alternate GPIOs */ -#define SSB_BFL_ALTIQ 0x8000 /* alternate I/Q settings */ - -/* Values for boardflags_hi read from SPROM */ -#define SSB_BFH_NOPA 0x0001 /* has no PA */ -#define SSB_BFH_RSSIINV 0x0002 /* RSSI uses positive slope (not TSSI) */ -#define SSB_BFH_PAREF 0x0004 /* uses the PARef LDO */ -#define SSB_BFH_3TSWITCH 0x0008 /* uses a triple throw switch shared with bluetooth */ -#define SSB_BFH_PHASESHIFT 0x0010 /* can support phase shifter */ -#define SSB_BFH_BUCKBOOST 0x0020 /* has buck/booster */ -#define SSB_BFH_FEM_BT 0x0040 /* has FEM and switch to share antenna with bluetooth */ - -/* Values for boardflags2_lo read from SPROM */ -#define SSB_BFL2_RXBB_INT_REG_DIS 0x0001 /* external RX BB regulator present */ -#define SSB_BFL2_APLL_WAR 0x0002 /* alternative A-band PLL settings implemented */ -#define SSB_BFL2_TXPWRCTRL_EN 0x0004 /* permits enabling TX Power Control */ -#define SSB_BFL2_2X4_DIV 0x0008 /* 2x4 diversity switch */ -#define SSB_BFL2_5G_PWRGAIN 0x0010 /* supports 5G band power gain */ -#define SSB_BFL2_PCIEWAR_OVR 0x0020 /* overrides ASPM and Clkreq settings */ -#define SSB_BFL2_CAESERS_BRD 0x0040 /* is Caesers board (unused) */ -#define SSB_BFL2_BTC3WIRE 0x0080 /* used 3-wire bluetooth coexist */ -#define SSB_BFL2_SKWRKFEM_BRD 0x0100 /* 4321mcm93 uses Skyworks FEM */ -#define SSB_BFL2_SPUR_WAR 0x0200 /* has a workaround for clock-harmonic spurs */ -#define SSB_BFL2_GPLL_WAR 0x0400 /* altenative G-band PLL settings implemented */ - -/* Values for SSB_SPROM1_BINF_CCODE */ -enum { - SSB_SPROM1CCODE_WORLD = 0, - SSB_SPROM1CCODE_THAILAND, - SSB_SPROM1CCODE_ISRAEL, - SSB_SPROM1CCODE_JORDAN, - SSB_SPROM1CCODE_CHINA, - SSB_SPROM1CCODE_JAPAN, - SSB_SPROM1CCODE_USA_CANADA_ANZ, - SSB_SPROM1CCODE_EUROPE, - SSB_SPROM1CCODE_USA_LOW, - SSB_SPROM1CCODE_JAPAN_HIGH, - SSB_SPROM1CCODE_ALL, - SSB_SPROM1CCODE_NONE, -}; - -/* Address-Match values and masks (SSB_ADMATCHxxx) */ -#define SSB_ADM_TYPE 0x00000003 /* Address type */ -#define SSB_ADM_TYPE0 0 -#define SSB_ADM_TYPE1 1 -#define SSB_ADM_TYPE2 2 -#define SSB_ADM_AD64 0x00000004 -#define SSB_ADM_SZ0 0x000000F8 /* Type0 size */ -#define SSB_ADM_SZ0_SHIFT 3 -#define SSB_ADM_SZ1 0x000001F8 /* Type1 size */ -#define SSB_ADM_SZ1_SHIFT 3 -#define SSB_ADM_SZ2 0x000001F8 /* Type2 size */ -#define SSB_ADM_SZ2_SHIFT 3 -#define SSB_ADM_EN 0x00000400 /* Enable */ -#define SSB_ADM_NEG 0x00000800 /* Negative decode */ -#define SSB_ADM_BASE0 0xFFFFFF00 /* Type0 base address */ -#define SSB_ADM_BASE0_SHIFT 8 -#define SSB_ADM_BASE1 0xFFFFF000 /* Type1 base address for the core */ -#define SSB_ADM_BASE1_SHIFT 12 -#define SSB_ADM_BASE2 0xFFFF0000 /* Type2 base address for the core */ -#define SSB_ADM_BASE2_SHIFT 16 - - -#endif /* LINUX_SSB_REGS_H_ */ diff --git a/openairITS/mac/DOT11/include/linux/tracepoint.h b/openairITS/mac/DOT11/include/linux/tracepoint.h deleted file mode 100644 index fc44692a1d6..00000000000 --- a/openairITS/mac/DOT11/include/linux/tracepoint.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _COMPAT_LINUX_TRACEPOINT_H -#define _COMPAT_LINUX_TRACEPOINT_H 1 - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)) -/* - * Disable all tracing for older kernels - * < 2.6.27 had no tracing - * 2.6.27 had broken tracing - * 2.6.28-2.6.32 didn't have anything like DECLARE_EVENT_CLASS - * and faking it would be extremely difficult - */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) -/* - * For 2.6.28+ include the original tracepoint.h but override - * the defines new code uses to disable tracing completely. - */ -#include_next <linux/tracepoint.h> -#endif - -#undef TRACE_EVENT -#define TRACE_EVENT(name, proto, ...) \ -static inline void trace_ ## name(proto) {} -#undef DECLARE_EVENT_CLASS -#define DECLARE_EVENT_CLASS(...) -#undef DEFINE_EVENT -#define DEFINE_EVENT(evt_class, name, proto, ...) \ -static inline void trace_ ## name(proto) {} - -#define TP_PROTO(args...) args -#define TP_ARGS(args...) args -#define TP_CONDITION(args...) args - -#else -/* since 2.6.33, tracing hasn't changed, so just include the kernel's file */ -#include_next <linux/tracepoint.h> - -#endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)) */ - -#endif /* _COMPAT_LINUX_TRACEPOINT_H */ diff --git a/openairITS/mac/DOT11/include/linux/unaligned/access_ok.h b/openairITS/mac/DOT11/include/linux/unaligned/access_ok.h deleted file mode 100644 index 99c1b4d20b0..00000000000 --- a/openairITS/mac/DOT11/include/linux/unaligned/access_ok.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef _LINUX_UNALIGNED_ACCESS_OK_H -#define _LINUX_UNALIGNED_ACCESS_OK_H - -#include <linux/kernel.h> -#include <asm/byteorder.h> - -static inline u16 get_unaligned_le16(const void *p) -{ - return le16_to_cpup((__le16 *)p); -} - -static inline u32 get_unaligned_le32(const void *p) -{ - return le32_to_cpup((__le32 *)p); -} - -static inline u64 get_unaligned_le64(const void *p) -{ - return le64_to_cpup((__le64 *)p); -} - -static inline u16 get_unaligned_be16(const void *p) -{ - return be16_to_cpup((__be16 *)p); -} - -static inline u32 get_unaligned_be32(const void *p) -{ - return be32_to_cpup((__be32 *)p); -} - -static inline u64 get_unaligned_be64(const void *p) -{ - return be64_to_cpup((__be64 *)p); -} - -static inline void put_unaligned_le16(u16 val, void *p) -{ - *((__le16 *)p) = cpu_to_le16(val); -} - -static inline void put_unaligned_le32(u32 val, void *p) -{ - *((__le32 *)p) = cpu_to_le32(val); -} - -static inline void put_unaligned_le64(u64 val, void *p) -{ - *((__le64 *)p) = cpu_to_le64(val); -} - -static inline void put_unaligned_be16(u16 val, void *p) -{ - *((__be16 *)p) = cpu_to_be16(val); -} - -static inline void put_unaligned_be32(u32 val, void *p) -{ - *((__be32 *)p) = cpu_to_be32(val); -} - -static inline void put_unaligned_be64(u64 val, void *p) -{ - *((__be64 *)p) = cpu_to_be64(val); -} - -#endif /* _LINUX_UNALIGNED_ACCESS_OK_H */ diff --git a/openairITS/mac/DOT11/include/linux/unaligned/be_byteshift.h b/openairITS/mac/DOT11/include/linux/unaligned/be_byteshift.h deleted file mode 100644 index 9356b24223a..00000000000 --- a/openairITS/mac/DOT11/include/linux/unaligned/be_byteshift.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H -#define _LINUX_UNALIGNED_BE_BYTESHIFT_H - -#include <linux/types.h> - -static inline u16 __get_unaligned_be16(const u8 *p) -{ - return p[0] << 8 | p[1]; -} - -static inline u32 __get_unaligned_be32(const u8 *p) -{ - return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; -} - -static inline u64 __get_unaligned_be64(const u8 *p) -{ - return (u64)__get_unaligned_be32(p) << 32 | - __get_unaligned_be32(p + 4); -} - -static inline void __put_unaligned_be16(u16 val, u8 *p) -{ - *p++ = val >> 8; - *p++ = val; -} - -static inline void __put_unaligned_be32(u32 val, u8 *p) -{ - __put_unaligned_be16(val >> 16, p); - __put_unaligned_be16(val, p + 2); -} - -static inline void __put_unaligned_be64(u64 val, u8 *p) -{ - __put_unaligned_be32(val >> 32, p); - __put_unaligned_be32(val, p + 4); -} - -static inline u16 get_unaligned_be16(const void *p) -{ - return __get_unaligned_be16((const u8 *)p); -} - -static inline u32 get_unaligned_be32(const void *p) -{ - return __get_unaligned_be32((const u8 *)p); -} - -static inline u64 get_unaligned_be64(const void *p) -{ - return __get_unaligned_be64((const u8 *)p); -} - -static inline void put_unaligned_be16(u16 val, void *p) -{ - __put_unaligned_be16(val, p); -} - -static inline void put_unaligned_be32(u32 val, void *p) -{ - __put_unaligned_be32(val, p); -} - -static inline void put_unaligned_be64(u64 val, void *p) -{ - __put_unaligned_be64(val, p); -} - -#endif /* _LINUX_UNALIGNED_BE_BYTESHIFT_H */ diff --git a/openairITS/mac/DOT11/include/linux/unaligned/be_memmove.h b/openairITS/mac/DOT11/include/linux/unaligned/be_memmove.h deleted file mode 100644 index c2a76c5c9ed..00000000000 --- a/openairITS/mac/DOT11/include/linux/unaligned/be_memmove.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _LINUX_UNALIGNED_BE_MEMMOVE_H -#define _LINUX_UNALIGNED_BE_MEMMOVE_H - -#include <linux/unaligned/memmove.h> - -static inline u16 get_unaligned_be16(const void *p) -{ - return __get_unaligned_memmove16((const u8 *)p); -} - -static inline u32 get_unaligned_be32(const void *p) -{ - return __get_unaligned_memmove32((const u8 *)p); -} - -static inline u64 get_unaligned_be64(const void *p) -{ - return __get_unaligned_memmove64((const u8 *)p); -} - -static inline void put_unaligned_be16(u16 val, void *p) -{ - __put_unaligned_memmove16(val, p); -} - -static inline void put_unaligned_be32(u32 val, void *p) -{ - __put_unaligned_memmove32(val, p); -} - -static inline void put_unaligned_be64(u64 val, void *p) -{ - __put_unaligned_memmove64(val, p); -} - -#endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */ diff --git a/openairITS/mac/DOT11/include/linux/unaligned/be_struct.h b/openairITS/mac/DOT11/include/linux/unaligned/be_struct.h deleted file mode 100644 index 132415836c5..00000000000 --- a/openairITS/mac/DOT11/include/linux/unaligned/be_struct.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _LINUX_UNALIGNED_BE_STRUCT_H -#define _LINUX_UNALIGNED_BE_STRUCT_H - -#include <linux/unaligned/packed_struct.h> - -static inline u16 get_unaligned_be16(const void *p) -{ - return __get_unaligned_cpu16((const u8 *)p); -} - -static inline u32 get_unaligned_be32(const void *p) -{ - return __get_unaligned_cpu32((const u8 *)p); -} - -static inline u64 get_unaligned_be64(const void *p) -{ - return __get_unaligned_cpu64((const u8 *)p); -} - -static inline void put_unaligned_be16(u16 val, void *p) -{ - __put_unaligned_cpu16(val, p); -} - -static inline void put_unaligned_be32(u32 val, void *p) -{ - __put_unaligned_cpu32(val, p); -} - -static inline void put_unaligned_be64(u64 val, void *p) -{ - __put_unaligned_cpu64(val, p); -} - -#endif /* _LINUX_UNALIGNED_BE_STRUCT_H */ diff --git a/openairITS/mac/DOT11/include/linux/unaligned/generic.h b/openairITS/mac/DOT11/include/linux/unaligned/generic.h deleted file mode 100644 index 02d97ff3df7..00000000000 --- a/openairITS/mac/DOT11/include/linux/unaligned/generic.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef _LINUX_UNALIGNED_GENERIC_H -#define _LINUX_UNALIGNED_GENERIC_H - -/* - * Cause a link-time error if we try an unaligned access other than - * 1,2,4 or 8 bytes long - */ -extern void __bad_unaligned_access_size(void); - -#define __get_unaligned_le(ptr) ((__force typeof(*(ptr)))({ \ - __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \ - __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_le16((ptr)), \ - __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_le32((ptr)), \ - __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_le64((ptr)), \ - __bad_unaligned_access_size())))); \ - })) - -#define __get_unaligned_be(ptr) ((__force typeof(*(ptr)))({ \ - __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \ - __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_be16((ptr)), \ - __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_be32((ptr)), \ - __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_be64((ptr)), \ - __bad_unaligned_access_size())))); \ - })) - -#define __put_unaligned_le(val, ptr) ({ \ - void *__gu_p = (ptr); \ - switch (sizeof(*(ptr))) { \ - case 1: \ - *(u8 *)__gu_p = (__force u8)(val); \ - break; \ - case 2: \ - put_unaligned_le16((__force u16)(val), __gu_p); \ - break; \ - case 4: \ - put_unaligned_le32((__force u32)(val), __gu_p); \ - break; \ - case 8: \ - put_unaligned_le64((__force u64)(val), __gu_p); \ - break; \ - default: \ - __bad_unaligned_access_size(); \ - break; \ - } \ - (void)0; }) - -#define __put_unaligned_be(val, ptr) ({ \ - void *__gu_p = (ptr); \ - switch (sizeof(*(ptr))) { \ - case 1: \ - *(u8 *)__gu_p = (__force u8)(val); \ - break; \ - case 2: \ - put_unaligned_be16((__force u16)(val), __gu_p); \ - break; \ - case 4: \ - put_unaligned_be32((__force u32)(val), __gu_p); \ - break; \ - case 8: \ - put_unaligned_be64((__force u64)(val), __gu_p); \ - break; \ - default: \ - __bad_unaligned_access_size(); \ - break; \ - } \ - (void)0; }) - -#endif /* _LINUX_UNALIGNED_GENERIC_H */ diff --git a/openairITS/mac/DOT11/include/linux/unaligned/le_byteshift.h b/openairITS/mac/DOT11/include/linux/unaligned/le_byteshift.h deleted file mode 100644 index be376fb79b6..00000000000 --- a/openairITS/mac/DOT11/include/linux/unaligned/le_byteshift.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H -#define _LINUX_UNALIGNED_LE_BYTESHIFT_H - -#include <linux/types.h> - -static inline u16 __get_unaligned_le16(const u8 *p) -{ - return p[0] | p[1] << 8; -} - -static inline u32 __get_unaligned_le32(const u8 *p) -{ - return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24; -} - -static inline u64 __get_unaligned_le64(const u8 *p) -{ - return (u64)__get_unaligned_le32(p + 4) << 32 | - __get_unaligned_le32(p); -} - -static inline void __put_unaligned_le16(u16 val, u8 *p) -{ - *p++ = val; - *p++ = val >> 8; -} - -static inline void __put_unaligned_le32(u32 val, u8 *p) -{ - __put_unaligned_le16(val >> 16, p + 2); - __put_unaligned_le16(val, p); -} - -static inline void __put_unaligned_le64(u64 val, u8 *p) -{ - __put_unaligned_le32(val >> 32, p + 4); - __put_unaligned_le32(val, p); -} - -static inline u16 get_unaligned_le16(const void *p) -{ - return __get_unaligned_le16((const u8 *)p); -} - -static inline u32 get_unaligned_le32(const void *p) -{ - return __get_unaligned_le32((const u8 *)p); -} - -static inline u64 get_unaligned_le64(const void *p) -{ - return __get_unaligned_le64((const u8 *)p); -} - -static inline void put_unaligned_le16(u16 val, void *p) -{ - __put_unaligned_le16(val, p); -} - -static inline void put_unaligned_le32(u32 val, void *p) -{ - __put_unaligned_le32(val, p); -} - -static inline void put_unaligned_le64(u64 val, void *p) -{ - __put_unaligned_le64(val, p); -} - -#endif /* _LINUX_UNALIGNED_LE_BYTESHIFT_H */ diff --git a/openairITS/mac/DOT11/include/linux/unaligned/le_memmove.h b/openairITS/mac/DOT11/include/linux/unaligned/le_memmove.h deleted file mode 100644 index 269849bee4e..00000000000 --- a/openairITS/mac/DOT11/include/linux/unaligned/le_memmove.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _LINUX_UNALIGNED_LE_MEMMOVE_H -#define _LINUX_UNALIGNED_LE_MEMMOVE_H - -#include <linux/unaligned/memmove.h> - -static inline u16 get_unaligned_le16(const void *p) -{ - return __get_unaligned_memmove16((const u8 *)p); -} - -static inline u32 get_unaligned_le32(const void *p) -{ - return __get_unaligned_memmove32((const u8 *)p); -} - -static inline u64 get_unaligned_le64(const void *p) -{ - return __get_unaligned_memmove64((const u8 *)p); -} - -static inline void put_unaligned_le16(u16 val, void *p) -{ - __put_unaligned_memmove16(val, p); -} - -static inline void put_unaligned_le32(u32 val, void *p) -{ - __put_unaligned_memmove32(val, p); -} - -static inline void put_unaligned_le64(u64 val, void *p) -{ - __put_unaligned_memmove64(val, p); -} - -#endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */ diff --git a/openairITS/mac/DOT11/include/linux/unaligned/le_struct.h b/openairITS/mac/DOT11/include/linux/unaligned/le_struct.h deleted file mode 100644 index 088c4572faa..00000000000 --- a/openairITS/mac/DOT11/include/linux/unaligned/le_struct.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _LINUX_UNALIGNED_LE_STRUCT_H -#define _LINUX_UNALIGNED_LE_STRUCT_H - -#include <linux/unaligned/packed_struct.h> - -static inline u16 get_unaligned_le16(const void *p) -{ - return __get_unaligned_cpu16((const u8 *)p); -} - -static inline u32 get_unaligned_le32(const void *p) -{ - return __get_unaligned_cpu32((const u8 *)p); -} - -static inline u64 get_unaligned_le64(const void *p) -{ - return __get_unaligned_cpu64((const u8 *)p); -} - -static inline void put_unaligned_le16(u16 val, void *p) -{ - __put_unaligned_cpu16(val, p); -} - -static inline void put_unaligned_le32(u32 val, void *p) -{ - __put_unaligned_cpu32(val, p); -} - -static inline void put_unaligned_le64(u64 val, void *p) -{ - __put_unaligned_cpu64(val, p); -} - -#endif /* _LINUX_UNALIGNED_LE_STRUCT_H */ diff --git a/openairITS/mac/DOT11/include/linux/unaligned/memmove.h b/openairITS/mac/DOT11/include/linux/unaligned/memmove.h deleted file mode 100644 index eeb5a779a4f..00000000000 --- a/openairITS/mac/DOT11/include/linux/unaligned/memmove.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _LINUX_UNALIGNED_MEMMOVE_H -#define _LINUX_UNALIGNED_MEMMOVE_H - -#include <linux/kernel.h> -#include <linux/string.h> - -/* Use memmove here, so gcc does not insert a __builtin_memcpy. */ - -static inline u16 __get_unaligned_memmove16(const void *p) -{ - u16 tmp; - memmove(&tmp, p, 2); - return tmp; -} - -static inline u32 __get_unaligned_memmove32(const void *p) -{ - u32 tmp; - memmove(&tmp, p, 4); - return tmp; -} - -static inline u64 __get_unaligned_memmove64(const void *p) -{ - u64 tmp; - memmove(&tmp, p, 8); - return tmp; -} - -static inline void __put_unaligned_memmove16(u16 val, void *p) -{ - memmove(p, &val, 2); -} - -static inline void __put_unaligned_memmove32(u32 val, void *p) -{ - memmove(p, &val, 4); -} - -static inline void __put_unaligned_memmove64(u64 val, void *p) -{ - memmove(p, &val, 8); -} - -#endif /* _LINUX_UNALIGNED_MEMMOVE_H */ diff --git a/openairITS/mac/DOT11/include/linux/unaligned/packed_struct.h b/openairITS/mac/DOT11/include/linux/unaligned/packed_struct.h deleted file mode 100644 index 2498bb9fe00..00000000000 --- a/openairITS/mac/DOT11/include/linux/unaligned/packed_struct.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _LINUX_UNALIGNED_PACKED_STRUCT_H -#define _LINUX_UNALIGNED_PACKED_STRUCT_H - -#include <linux/kernel.h> - -struct __una_u16 { u16 x __attribute__((packed)); }; -struct __una_u32 { u32 x __attribute__((packed)); }; -struct __una_u64 { u64 x __attribute__((packed)); }; - -static inline u16 __get_unaligned_cpu16(const void *p) -{ - const struct __una_u16 *ptr = (const struct __una_u16 *)p; - return ptr->x; -} - -static inline u32 __get_unaligned_cpu32(const void *p) -{ - const struct __una_u32 *ptr = (const struct __una_u32 *)p; - return ptr->x; -} - -static inline u64 __get_unaligned_cpu64(const void *p) -{ - const struct __una_u64 *ptr = (const struct __una_u64 *)p; - return ptr->x; -} - -static inline void __put_unaligned_cpu16(u16 val, void *p) -{ - struct __una_u16 *ptr = (struct __una_u16 *)p; - ptr->x = val; -} - -static inline void __put_unaligned_cpu32(u32 val, void *p) -{ - struct __una_u32 *ptr = (struct __una_u32 *)p; - ptr->x = val; -} - -static inline void __put_unaligned_cpu64(u64 val, void *p) -{ - struct __una_u64 *ptr = (struct __una_u64 *)p; - ptr->x = val; -} - -#endif /* _LINUX_UNALIGNED_PACKED_STRUCT_H */ diff --git a/openairITS/mac/DOT11/include/linux/usb/rndis_host.h b/openairITS/mac/DOT11/include/linux/usb/rndis_host.h deleted file mode 100644 index 88fceb718c7..00000000000 --- a/openairITS/mac/DOT11/include/linux/usb/rndis_host.h +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Host Side support for RNDIS Networking Links - * Copyright (C) 2005 by David Brownell - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LINUX_USB_RNDIS_HOST_H -#define __LINUX_USB_RNDIS_HOST_H - -/* - * CONTROL uses CDC "encapsulated commands" with funky notifications. - * - control-out: SEND_ENCAPSULATED - * - interrupt-in: RESPONSE_AVAILABLE - * - control-in: GET_ENCAPSULATED - * - * We'll try to ignore the RESPONSE_AVAILABLE notifications. - * - * REVISIT some RNDIS implementations seem to have curious issues still - * to be resolved. - */ -struct rndis_msg_hdr { - __le32 msg_type; /* RNDIS_MSG_* */ - __le32 msg_len; - /* followed by data that varies between messages */ - __le32 request_id; - __le32 status; - /* ... and more */ -} __attribute__ ((packed)); - -/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */ -#define CONTROL_BUFFER_SIZE 1025 - -/* RNDIS defines an (absurdly huge) 10 second control timeout, - * but ActiveSync seems to use a more usual 5 second timeout - * (which matches the USB 2.0 spec). - */ -#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000) - -#define RNDIS_MSG_COMPLETION cpu_to_le32(0x80000000) - -/* codes for "msg_type" field of rndis messages; - * only the data channel uses packet messages (maybe batched); - * everything else goes on the control channel. - */ -#define RNDIS_MSG_PACKET cpu_to_le32(0x00000001) /* 1-N packets */ -#define RNDIS_MSG_INIT cpu_to_le32(0x00000002) -#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION) -#define RNDIS_MSG_HALT cpu_to_le32(0x00000003) -#define RNDIS_MSG_QUERY cpu_to_le32(0x00000004) -#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION) -#define RNDIS_MSG_SET cpu_to_le32(0x00000005) -#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION) -#define RNDIS_MSG_RESET cpu_to_le32(0x00000006) -#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION) -#define RNDIS_MSG_INDICATE cpu_to_le32(0x00000007) -#define RNDIS_MSG_KEEPALIVE cpu_to_le32(0x00000008) -#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) - -/* codes for "status" field of completion messages */ -#define RNDIS_STATUS_SUCCESS cpu_to_le32(0x00000000) -#define RNDIS_STATUS_FAILURE cpu_to_le32(0xc0000001) -#define RNDIS_STATUS_INVALID_DATA cpu_to_le32(0xc0010015) -#define RNDIS_STATUS_NOT_SUPPORTED cpu_to_le32(0xc00000bb) -#define RNDIS_STATUS_MEDIA_CONNECT cpu_to_le32(0x4001000b) -#define RNDIS_STATUS_MEDIA_DISCONNECT cpu_to_le32(0x4001000c) -#define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION cpu_to_le32(0x40010012) - -/* codes for OID_GEN_PHYSICAL_MEDIUM */ -#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED cpu_to_le32(0x00000000) -#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN cpu_to_le32(0x00000001) -#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM cpu_to_le32(0x00000002) -#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE cpu_to_le32(0x00000003) -#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE cpu_to_le32(0x00000004) -#define RNDIS_PHYSICAL_MEDIUM_DSL cpu_to_le32(0x00000005) -#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL cpu_to_le32(0x00000006) -#define RNDIS_PHYSICAL_MEDIUM_1394 cpu_to_le32(0x00000007) -#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN cpu_to_le32(0x00000008) -#define RNDIS_PHYSICAL_MEDIUM_MAX cpu_to_le32(0x00000009) - -struct rndis_data_hdr { - __le32 msg_type; /* RNDIS_MSG_PACKET */ - __le32 msg_len; /* rndis_data_hdr + data_len + pad */ - __le32 data_offset; /* 36 -- right after header */ - __le32 data_len; /* ... real packet size */ - - __le32 oob_data_offset; /* zero */ - __le32 oob_data_len; /* zero */ - __le32 num_oob; /* zero */ - __le32 packet_data_offset; /* zero */ - - __le32 packet_data_len; /* zero */ - __le32 vc_handle; /* zero */ - __le32 reserved; /* zero */ -} __attribute__ ((packed)); - -struct rndis_init { /* OUT */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_INIT */ - __le32 msg_len; /* 24 */ - __le32 request_id; - __le32 major_version; /* of rndis (1.0) */ - __le32 minor_version; - __le32 max_transfer_size; -} __attribute__ ((packed)); - -struct rndis_init_c { /* IN */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_INIT_C */ - __le32 msg_len; - __le32 request_id; - __le32 status; - __le32 major_version; /* of rndis (1.0) */ - __le32 minor_version; - __le32 device_flags; - __le32 medium; /* zero == 802.3 */ - __le32 max_packets_per_message; - __le32 max_transfer_size; - __le32 packet_alignment; /* max 7; (1<<n) bytes */ - __le32 af_list_offset; /* zero */ - __le32 af_list_size; /* zero */ -} __attribute__ ((packed)); - -struct rndis_halt { /* OUT (no reply) */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_HALT */ - __le32 msg_len; - __le32 request_id; -} __attribute__ ((packed)); - -struct rndis_query { /* OUT */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_QUERY */ - __le32 msg_len; - __le32 request_id; - __le32 oid; - __le32 len; - __le32 offset; -/*?*/ __le32 handle; /* zero */ -} __attribute__ ((packed)); - -struct rndis_query_c { /* IN */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_QUERY_C */ - __le32 msg_len; - __le32 request_id; - __le32 status; - __le32 len; - __le32 offset; -} __attribute__ ((packed)); - -struct rndis_set { /* OUT */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_SET */ - __le32 msg_len; - __le32 request_id; - __le32 oid; - __le32 len; - __le32 offset; -/*?*/ __le32 handle; /* zero */ -} __attribute__ ((packed)); - -struct rndis_set_c { /* IN */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_SET_C */ - __le32 msg_len; - __le32 request_id; - __le32 status; -} __attribute__ ((packed)); - -struct rndis_reset { /* IN */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_RESET */ - __le32 msg_len; - __le32 reserved; -} __attribute__ ((packed)); - -struct rndis_reset_c { /* OUT */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_RESET_C */ - __le32 msg_len; - __le32 status; - __le32 addressing_lost; -} __attribute__ ((packed)); - -struct rndis_indicate { /* IN (unrequested) */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_INDICATE */ - __le32 msg_len; - __le32 status; - __le32 length; - __le32 offset; -/**/ __le32 diag_status; - __le32 error_offset; -/**/ __le32 message; -} __attribute__ ((packed)); - -struct rndis_keepalive { /* OUT (optionally IN) */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */ - __le32 msg_len; - __le32 request_id; -} __attribute__ ((packed)); - -struct rndis_keepalive_c { /* IN (optionally OUT) */ - /* header and: */ - __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */ - __le32 msg_len; - __le32 request_id; - __le32 status; -} __attribute__ ((packed)); - -/* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and - * there are gobs more that may optionally be supported. We'll avoid as much - * of that mess as possible. - */ -#define OID_802_3_PERMANENT_ADDRESS cpu_to_le32(0x01010101) -#define OID_GEN_MAXIMUM_FRAME_SIZE cpu_to_le32(0x00010106) -#define OID_GEN_CURRENT_PACKET_FILTER cpu_to_le32(0x0001010e) -#define OID_GEN_PHYSICAL_MEDIUM cpu_to_le32(0x00010202) - -/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ -#define RNDIS_PACKET_TYPE_DIRECTED cpu_to_le32(0x00000001) -#define RNDIS_PACKET_TYPE_MULTICAST cpu_to_le32(0x00000002) -#define RNDIS_PACKET_TYPE_ALL_MULTICAST cpu_to_le32(0x00000004) -#define RNDIS_PACKET_TYPE_BROADCAST cpu_to_le32(0x00000008) -#define RNDIS_PACKET_TYPE_SOURCE_ROUTING cpu_to_le32(0x00000010) -#define RNDIS_PACKET_TYPE_PROMISCUOUS cpu_to_le32(0x00000020) -#define RNDIS_PACKET_TYPE_SMT cpu_to_le32(0x00000040) -#define RNDIS_PACKET_TYPE_ALL_LOCAL cpu_to_le32(0x00000080) -#define RNDIS_PACKET_TYPE_GROUP cpu_to_le32(0x00001000) -#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL cpu_to_le32(0x00002000) -#define RNDIS_PACKET_TYPE_FUNCTIONAL cpu_to_le32(0x00004000) -#define RNDIS_PACKET_TYPE_MAC_FRAME cpu_to_le32(0x00008000) - -/* default filter used with RNDIS devices */ -#define RNDIS_DEFAULT_FILTER ( \ - RNDIS_PACKET_TYPE_DIRECTED | \ - RNDIS_PACKET_TYPE_BROADCAST | \ - RNDIS_PACKET_TYPE_ALL_MULTICAST | \ - RNDIS_PACKET_TYPE_PROMISCUOUS) - -/* Flags to require specific physical medium type for generic_rndis_bind() */ -#define FLAG_RNDIS_PHYM_NOT_WIRELESS 0x0001 -#define FLAG_RNDIS_PHYM_WIRELESS 0x0002 - -/* Flags for driver_info::data */ -#define RNDIS_DRIVER_DATA_POLL_STATUS 1 /* poll status before control */ - -extern void rndis_status(struct usbnet *dev, struct urb *urb); -extern int -rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen); -extern int -generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags); -extern void rndis_unbind(struct usbnet *dev, struct usb_interface *intf); -extern int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb); -extern struct sk_buff * -rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags); - -#endif /* __LINUX_USB_RNDIS_HOST_H */ diff --git a/openairITS/mac/DOT11/include/linux/usb/usbnet.h b/openairITS/mac/DOT11/include/linux/usb/usbnet.h deleted file mode 100644 index 605b0aa8d85..00000000000 --- a/openairITS/mac/DOT11/include/linux/usb/usbnet.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * USB Networking Link Interface - * - * Copyright (C) 2000-2005 by David Brownell <dbrownell@users.sourceforge.net> - * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __LINUX_USB_USBNET_H -#define __LINUX_USB_USBNET_H - -/* interface from usbnet core to each USB networking link we handle */ -struct usbnet { - /* housekeeping */ - struct usb_device *udev; - struct usb_interface *intf; - struct driver_info *driver_info; - const char *driver_name; - void *driver_priv; - wait_queue_head_t *wait; - struct mutex phy_mutex; - unsigned char suspend_count; - - /* i/o info: pipes etc */ - unsigned in, out; - struct usb_host_endpoint *status; - unsigned maxpacket; - struct timer_list delay; - - /* protocol/interface state */ - struct net_device *net; - int msg_enable; - unsigned long data[5]; - u32 xid; - u32 hard_mtu; /* count any extra framing */ - size_t rx_urb_size; /* size for rx urbs */ - struct mii_if_info mii; - - /* various kinds of pending driver work */ - struct sk_buff_head rxq; - struct sk_buff_head txq; - struct sk_buff_head done; - struct sk_buff_head rxq_pause; - struct urb *interrupt; - struct usb_anchor deferred; - struct tasklet_struct bh; - - struct work_struct kevent; - unsigned long flags; -# define EVENT_TX_HALT 0 -# define EVENT_RX_HALT 1 -# define EVENT_RX_MEMORY 2 -# define EVENT_STS_SPLIT 3 -# define EVENT_LINK_RESET 4 -# define EVENT_RX_PAUSED 5 -# define EVENT_DEV_WAKING 6 -# define EVENT_DEV_ASLEEP 7 -# define EVENT_DEV_OPEN 8 -}; - -static inline struct usb_driver *driver_of(struct usb_interface *intf) -{ - return to_usb_driver(intf->dev.driver); -} - -/* interface from the device/framing level "minidriver" to core */ -struct driver_info { - char *description; - - int flags; -/* framing is CDC Ethernet, not writing ZLPs (hw issues), or optionally: */ -#define FLAG_FRAMING_NC 0x0001 /* guard against device dropouts */ -#define FLAG_FRAMING_GL 0x0002 /* genelink batches packets */ -#define FLAG_FRAMING_Z 0x0004 /* zaurus adds a trailer */ -#define FLAG_FRAMING_RN 0x0008 /* RNDIS batches, plus huge header */ - -#define FLAG_NO_SETINT 0x0010 /* device can't set_interface() */ -#define FLAG_ETHER 0x0020 /* maybe use "eth%d" names */ - -#define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */ -#define FLAG_WLAN 0x0080 /* use "wlan%d" names */ -#define FLAG_AVOID_UNLINK_URBS 0x0100 /* don't unlink urbs at usbnet_stop() */ -#define FLAG_SEND_ZLP 0x0200 /* hw requires ZLPs are sent */ -#define FLAG_WWAN 0x0400 /* use "wwan%d" names */ - -#define FLAG_LINK_INTR 0x0800 /* updates link (carrier) status */ - -#define FLAG_POINTTOPOINT 0x1000 /* possibly use "usb%d" names */ - -/* - * Indicates to usbnet, that USB driver accumulates multiple IP packets. - * Affects statistic (counters) and short packet handling. - */ -#define FLAG_MULTI_PACKET 0x2000 -#define FLAG_RX_ASSEMBLE 0x4000 /* rx packets may span >1 frames */ - - /* init device ... can sleep, or cause probe() failure */ - int (*bind)(struct usbnet *, struct usb_interface *); - - /* cleanup device ... can sleep, but can't fail */ - void (*unbind)(struct usbnet *, struct usb_interface *); - - /* reset device ... can sleep */ - int (*reset)(struct usbnet *); - - /* stop device ... can sleep */ - int (*stop)(struct usbnet *); - - /* see if peer is connected ... can sleep */ - int (*check_connect)(struct usbnet *); - - /* (dis)activate runtime power management */ - int (*manage_power)(struct usbnet *, int); - - /* for status polling */ - void (*status)(struct usbnet *, struct urb *); - - /* link reset handling, called from defer_kevent */ - int (*link_reset)(struct usbnet *); - - /* fixup rx packet (strip framing) */ - int (*rx_fixup)(struct usbnet *dev, struct sk_buff *skb); - - /* fixup tx packet (add framing) */ - struct sk_buff *(*tx_fixup)(struct usbnet *dev, - struct sk_buff *skb, gfp_t flags); - - /* early initialization code, can sleep. This is for minidrivers - * having 'subminidrivers' that need to do extra initialization - * right after minidriver have initialized hardware. */ - int (*early_init)(struct usbnet *dev); - - /* called by minidriver when receiving indication */ - void (*indication)(struct usbnet *dev, void *ind, int indlen); - - /* for new devices, use the descriptor-reading code instead */ - int in; /* rx endpoint */ - int out; /* tx endpoint */ - - unsigned long data; /* Misc driver specific data */ -}; - -/* Minidrivers are just drivers using the "usbnet" core as a powerful - * network-specific subroutine library ... that happens to do pretty - * much everything except custom framing and chip-specific stuff. - */ -extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *); -extern int usbnet_suspend(struct usb_interface *, pm_message_t); -extern int usbnet_resume(struct usb_interface *); -extern void usbnet_disconnect(struct usb_interface *); - - -/* Drivers that reuse some of the standard USB CDC infrastructure - * (notably, using multiple interfaces according to the CDC - * union descriptor) get some helper code. - */ -struct cdc_state { - struct usb_cdc_header_desc *header; - struct usb_cdc_union_desc *u; - struct usb_cdc_ether_desc *ether; - struct usb_interface *control; - struct usb_interface *data; -}; - -extern int usbnet_generic_cdc_bind(struct usbnet *, struct usb_interface *); -extern int usbnet_cdc_bind(struct usbnet *, struct usb_interface *); -extern void usbnet_cdc_unbind(struct usbnet *, struct usb_interface *); -extern void usbnet_cdc_status(struct usbnet *, struct urb *); - -/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */ -#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \ - |USB_CDC_PACKET_TYPE_ALL_MULTICAST \ - |USB_CDC_PACKET_TYPE_PROMISCUOUS \ - |USB_CDC_PACKET_TYPE_DIRECTED) - - -/* we record the state for each of our queued skbs */ -enum skb_state { - illegal = 0, - tx_start, tx_done, - rx_start, rx_done, rx_cleanup -}; - -struct skb_data { /* skb->cb is one of these */ - struct urb *urb; - struct usbnet *dev; - enum skb_state state; - size_t length; -}; - -extern int usbnet_open(struct net_device *net); -extern int usbnet_stop(struct net_device *net); -extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb, - struct net_device *net); -extern void usbnet_tx_timeout(struct net_device *net); -extern int usbnet_change_mtu(struct net_device *net, int new_mtu); - -extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); -extern int usbnet_get_ethernet_addr(struct usbnet *, int); -extern void usbnet_defer_kevent(struct usbnet *, int); -extern void usbnet_skb_return(struct usbnet *, struct sk_buff *); -extern void usbnet_unlink_rx_urbs(struct usbnet *); - -extern void usbnet_pause_rx(struct usbnet *); -extern void usbnet_resume_rx(struct usbnet *); -extern void usbnet_purge_paused_rxq(struct usbnet *); - -extern int usbnet_get_settings(struct net_device *net, - struct ethtool_cmd *cmd); -extern int usbnet_set_settings(struct net_device *net, - struct ethtool_cmd *cmd); -extern u32 usbnet_get_link(struct net_device *net); -extern u32 usbnet_get_msglevel(struct net_device *); -extern void usbnet_set_msglevel(struct net_device *, u32); -extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); -extern int usbnet_nway_reset(struct net_device *net); - -#endif /* __LINUX_USB_USBNET_H */ diff --git a/openairITS/mac/DOT11/include/linux/wireless.h b/openairITS/mac/DOT11/include/linux/wireless.h deleted file mode 100644 index 4395b28bb86..00000000000 --- a/openairITS/mac/DOT11/include/linux/wireless.h +++ /dev/null @@ -1,1162 +0,0 @@ -/* - * This file define a set of standard wireless extensions - * - * Version : 22 16.3.07 - * - * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> - * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. - */ - -#ifndef _LINUX_WIRELESS_H -#define _LINUX_WIRELESS_H - -/************************** DOCUMENTATION **************************/ -/* - * Initial APIs (1996 -> onward) : - * ----------------------------- - * Basically, the wireless extensions are for now a set of standard ioctl - * call + /proc/net/wireless - * - * The entry /proc/net/wireless give statistics and information on the - * driver. - * This is better than having each driver having its entry because - * its centralised and we may remove the driver module safely. - * - * Ioctl are used to configure the driver and issue commands. This is - * better than command line options of insmod because we may want to - * change dynamically (while the driver is running) some parameters. - * - * The ioctl mechanimsm are copied from standard devices ioctl. - * We have the list of command plus a structure descibing the - * data exchanged... - * Note that to add these ioctl, I was obliged to modify : - * # net/core/dev.c (two place + add include) - * # net/ipv4/af_inet.c (one place + add include) - * - * /proc/net/wireless is a copy of /proc/net/dev. - * We have a structure for data passed from the driver to /proc/net/wireless - * Too add this, I've modified : - * # net/core/dev.c (two other places) - * # include/linux/netdevice.h (one place) - * # include/linux/proc_fs.h (one place) - * - * New driver API (2002 -> onward) : - * ------------------------------- - * This file is only concerned with the user space API and common definitions. - * The new driver API is defined and documented in : - * # include/net/iw_handler.h - * - * Note as well that /proc/net/wireless implementation has now moved in : - * # net/core/wireless.c - * - * Wireless Events (2002 -> onward) : - * -------------------------------- - * Events are defined at the end of this file, and implemented in : - * # net/core/wireless.c - * - * Other comments : - * -------------- - * Do not add here things that are redundant with other mechanisms - * (drivers init, ifconfig, /proc/net/dev, ...) and with are not - * wireless specific. - * - * These wireless extensions are not magic : each driver has to provide - * support for them... - * - * IMPORTANT NOTE : As everything in the kernel, this is very much a - * work in progress. Contact me if you have ideas of improvements... - */ - -/***************************** INCLUDES *****************************/ - -#include <linux/types.h> /* for __u* and __s* typedefs */ -#include <linux/socket.h> /* for "struct sockaddr" et al */ -#include <linux/if.h> /* for IFNAMSIZ and co... */ - -/***************************** VERSION *****************************/ -/* - * This constant is used to know the availability of the wireless - * extensions and to know which version of wireless extensions it is - * (there is some stuff that will be added in the future...) - * I just plan to increment with each new version. - */ -#define WIRELESS_EXT 22 - -/* - * Changes : - * - * V2 to V3 - * -------- - * Alan Cox start some incompatibles changes. I've integrated a bit more. - * - Encryption renamed to Encode to avoid US regulation problems - * - Frequency changed from float to struct to avoid problems on old 386 - * - * V3 to V4 - * -------- - * - Add sensitivity - * - * V4 to V5 - * -------- - * - Missing encoding definitions in range - * - Access points stuff - * - * V5 to V6 - * -------- - * - 802.11 support (ESSID ioctls) - * - * V6 to V7 - * -------- - * - define IW_ESSID_MAX_SIZE and IW_MAX_AP - * - * V7 to V8 - * -------- - * - Changed my e-mail address - * - More 802.11 support (nickname, rate, rts, frag) - * - List index in frequencies - * - * V8 to V9 - * -------- - * - Support for 'mode of operation' (ad-hoc, managed...) - * - Support for unicast and multicast power saving - * - Change encoding to support larger tokens (>64 bits) - * - Updated iw_params (disable, flags) and use it for NWID - * - Extracted iw_point from iwreq for clarity - * - * V9 to V10 - * --------- - * - Add PM capability to range structure - * - Add PM modifier : MAX/MIN/RELATIVE - * - Add encoding option : IW_ENCODE_NOKEY - * - Add TxPower ioctls (work like TxRate) - * - * V10 to V11 - * ---------- - * - Add WE version in range (help backward/forward compatibility) - * - Add retry ioctls (work like PM) - * - * V11 to V12 - * ---------- - * - Add SIOCSIWSTATS to get /proc/net/wireless programatically - * - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space - * - Add new statistics (frag, retry, beacon) - * - Add average quality (for user space calibration) - * - * V12 to V13 - * ---------- - * - Document creation of new driver API. - * - Extract union iwreq_data from struct iwreq (for new driver API). - * - Rename SIOCSIWNAME as SIOCSIWCOMMIT - * - * V13 to V14 - * ---------- - * - Wireless Events support : define struct iw_event - * - Define additional specific event numbers - * - Add "addr" and "param" fields in union iwreq_data - * - AP scanning stuff (SIOCSIWSCAN and friends) - * - * V14 to V15 - * ---------- - * - Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg - * - Make struct iw_freq signed (both m & e), add explicit padding - * - Add IWEVCUSTOM for driver specific event/scanning token - * - Add IW_MAX_GET_SPY for driver returning a lot of addresses - * - Add IW_TXPOW_RANGE for range of Tx Powers - * - Add IWEVREGISTERED & IWEVEXPIRED events for Access Points - * - Add IW_MODE_MONITOR for passive monitor - * - * V15 to V16 - * ---------- - * - Increase the number of bitrates in iw_range to 32 (for 802.11g) - * - Increase the number of frequencies in iw_range to 32 (for 802.11b+a) - * - Reshuffle struct iw_range for increases, add filler - * - Increase IW_MAX_AP to 64 for driver returning a lot of addresses - * - Remove IW_MAX_GET_SPY because conflict with enhanced spy support - * - Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy" - * - Add IW_ENCODE_TEMP and iw_range->encoding_login_index - * - * V16 to V17 - * ---------- - * - Add flags to frequency -> auto/fixed - * - Document (struct iw_quality *)->updated, add new flags (INVALID) - * - Wireless Event capability in struct iw_range - * - Add support for relative TxPower (yick !) - * - * V17 to V18 (From Jouni Malinen <j@w1.fi>) - * ---------- - * - Add support for WPA/WPA2 - * - Add extended encoding configuration (SIOCSIWENCODEEXT and - * SIOCGIWENCODEEXT) - * - Add SIOCSIWGENIE/SIOCGIWGENIE - * - Add SIOCSIWMLME - * - Add SIOCSIWPMKSA - * - Add struct iw_range bit field for supported encoding capabilities - * - Add optional scan request parameters for SIOCSIWSCAN - * - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA - * related parameters (extensible up to 4096 parameter values) - * - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE, - * IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND - * - * V18 to V19 - * ---------- - * - Remove (struct iw_point *)->pointer from events and streams - * - Remove header includes to help user space - * - Increase IW_ENCODING_TOKEN_MAX from 32 to 64 - * - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros - * - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM - * - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros - * - * V19 to V20 - * ---------- - * - RtNetlink requests support (SET/GET) - * - * V20 to V21 - * ---------- - * - Remove (struct net_device *)->get_wireless_stats() - * - Change length in ESSID and NICK to strlen() instead of strlen()+1 - * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers - * - Power/Retry relative values no longer * 100000 - * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI - * - * V21 to V22 - * ---------- - * - Prevent leaking of kernel space in stream on 64 bits. - */ - -/**************************** CONSTANTS ****************************/ - -/* -------------------------- IOCTL LIST -------------------------- */ - -/* Wireless Identification */ -#define SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */ -#define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */ -/* SIOCGIWNAME is used to verify the presence of Wireless Extensions. - * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"... - * Don't put the name of your driver there, it's useless. */ - -/* Basic operations */ -#define SIOCSIWNWID 0x8B02 /* set network id (pre-802.11) */ -#define SIOCGIWNWID 0x8B03 /* get network id (the cell) */ -#define SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */ -#define SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */ -#define SIOCSIWMODE 0x8B06 /* set operation mode */ -#define SIOCGIWMODE 0x8B07 /* get operation mode */ -#define SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */ -#define SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */ - -/* Informative stuff */ -#define SIOCSIWRANGE 0x8B0A /* Unused */ -#define SIOCGIWRANGE 0x8B0B /* Get range of parameters */ -#define SIOCSIWPRIV 0x8B0C /* Unused */ -#define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */ -#define SIOCSIWSTATS 0x8B0E /* Unused */ -#define SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats */ -/* SIOCGIWSTATS is strictly used between user space and the kernel, and - * is never passed to the driver (i.e. the driver will never see it). */ - -/* Spy support (statistics per MAC address - used for Mobile IP support) */ -#define SIOCSIWSPY 0x8B10 /* set spy addresses */ -#define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */ -#define SIOCSIWTHRSPY 0x8B12 /* set spy threshold (spy event) */ -#define SIOCGIWTHRSPY 0x8B13 /* get spy threshold */ - -/* Access Point manipulation */ -#define SIOCSIWAP 0x8B14 /* set access point MAC addresses */ -#define SIOCGIWAP 0x8B15 /* get access point MAC addresses */ -#define SIOCGIWAPLIST 0x8B17 /* Deprecated in favor of scanning */ -#define SIOCSIWSCAN 0x8B18 /* trigger scanning (list cells) */ -#define SIOCGIWSCAN 0x8B19 /* get scanning results */ - -/* 802.11 specific support */ -#define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */ -#define SIOCGIWESSID 0x8B1B /* get ESSID */ -#define SIOCSIWNICKN 0x8B1C /* set node name/nickname */ -#define SIOCGIWNICKN 0x8B1D /* get node name/nickname */ -/* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit - * within the 'iwreq' structure, so we need to use the 'data' member to - * point to a string in user space, like it is done for RANGE... */ - -/* Other parameters useful in 802.11 and some other devices */ -#define SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */ -#define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */ -#define SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */ -#define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */ -#define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */ -#define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */ -#define SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */ -#define SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */ -#define SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */ -#define SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime */ - -/* Encoding stuff (scrambling, hardware security, WEP...) */ -#define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */ -#define SIOCGIWENCODE 0x8B2B /* get encoding token & mode */ -/* Power saving stuff (power management, unicast and multicast) */ -#define SIOCSIWPOWER 0x8B2C /* set Power Management settings */ -#define SIOCGIWPOWER 0x8B2D /* get Power Management settings */ - -/* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM). - * This ioctl uses struct iw_point and data buffer that includes IE id and len - * fields. More than one IE may be included in the request. Setting the generic - * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers - * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers - * are required to report the used IE as a wireless event, e.g., when - * associating with an AP. */ -#define SIOCSIWGENIE 0x8B30 /* set generic IE */ -#define SIOCGIWGENIE 0x8B31 /* get generic IE */ - -/* WPA : IEEE 802.11 MLME requests */ -#define SIOCSIWMLME 0x8B16 /* request MLME operation; uses - * struct iw_mlme */ -/* WPA : Authentication mode parameters */ -#define SIOCSIWAUTH 0x8B32 /* set authentication mode params */ -#define SIOCGIWAUTH 0x8B33 /* get authentication mode params */ - -/* WPA : Extended version of encoding configuration */ -#define SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */ -#define SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */ - -/* WPA2 : PMKSA cache management */ -#define SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */ - -/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */ - -/* These 32 ioctl are wireless device private, for 16 commands. - * Each driver is free to use them for whatever purpose it chooses, - * however the driver *must* export the description of those ioctls - * with SIOCGIWPRIV and *must* use arguments as defined below. - * If you don't follow those rules, DaveM is going to hate you (reason : - * it make mixed 32/64bit operation impossible). - */ -#define SIOCIWFIRSTPRIV 0x8BE0 -#define SIOCIWLASTPRIV 0x8BFF -/* Previously, we were using SIOCDEVPRIVATE, but we now have our - * separate range because of collisions with other tools such as - * 'mii-tool'. - * We now have 32 commands, so a bit more space ;-). - * Also, all 'even' commands are only usable by root and don't return the - * content of ifr/iwr to user (but you are not obliged to use the set/get - * convention, just use every other two command). More details in iwpriv.c. - * And I repeat : you are not forced to use them with iwpriv, but you - * must be compliant with it. - */ - -/* ------------------------- IOCTL STUFF ------------------------- */ - -/* The first and the last (range) */ -#define SIOCIWFIRST 0x8B00 -#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */ -#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST) -#define IW_HANDLER(id, func) \ - [IW_IOCTL_IDX(id)] = func - -/* Odd : get (world access), even : set (root access) */ -#define IW_IS_SET(cmd) (!((cmd) & 0x1)) -#define IW_IS_GET(cmd) ((cmd) & 0x1) - -/* ----------------------- WIRELESS EVENTS ----------------------- */ -/* Those are *NOT* ioctls, do not issue request on them !!! */ -/* Most events use the same identifier as ioctl requests */ - -#define IWEVTXDROP 0x8C00 /* Packet dropped to excessive retry */ -#define IWEVQUAL 0x8C01 /* Quality part of statistics (scan) */ -#define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */ -#define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */ -#define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */ -#define IWEVGENIE 0x8C05 /* Generic IE (WPA, RSN, WMM, ..) - * (scan results); This includes id and - * length fields. One IWEVGENIE may - * contain more than one IE. Scan - * results may contain one or more - * IWEVGENIE events. */ -#define IWEVMICHAELMICFAILURE 0x8C06 /* Michael MIC failure - * (struct iw_michaelmicfailure) - */ -#define IWEVASSOCREQIE 0x8C07 /* IEs used in (Re)Association Request. - * The data includes id and length - * fields and may contain more than one - * IE. This event is required in - * Managed mode if the driver - * generates its own WPA/RSN IE. This - * should be sent just before - * IWEVREGISTERED event for the - * association. */ -#define IWEVASSOCRESPIE 0x8C08 /* IEs used in (Re)Association - * Response. The data includes id and - * length fields and may contain more - * than one IE. This may be sent - * between IWEVASSOCREQIE and - * IWEVREGISTERED events for the - * association. */ -#define IWEVPMKIDCAND 0x8C09 /* PMKID candidate for RSN - * pre-authentication - * (struct iw_pmkid_cand) */ - -#define IWEVFIRST 0x8C00 -#define IW_EVENT_IDX(cmd) ((cmd) - IWEVFIRST) - -/* ------------------------- PRIVATE INFO ------------------------- */ -/* - * The following is used with SIOCGIWPRIV. It allow a driver to define - * the interface (name, type of data) for its private ioctl. - * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV - */ - -#define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */ -#define IW_PRIV_TYPE_NONE 0x0000 -#define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */ -#define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */ -#define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */ -#define IW_PRIV_TYPE_FLOAT 0x5000 /* struct iw_freq */ -#define IW_PRIV_TYPE_ADDR 0x6000 /* struct sockaddr */ - -#define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed number of args */ - -#define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */ - -/* - * Note : if the number of args is fixed and the size < 16 octets, - * instead of passing a pointer we will put args in the iwreq struct... - */ - -/* ----------------------- OTHER CONSTANTS ----------------------- */ - -/* Maximum frequencies in the range struct */ -#define IW_MAX_FREQUENCIES 32 -/* Note : if you have something like 80 frequencies, - * don't increase this constant and don't fill the frequency list. - * The user will be able to set by channel anyway... */ - -/* Maximum bit rates in the range struct */ -#define IW_MAX_BITRATES 32 - -/* Maximum tx powers in the range struct */ -#define IW_MAX_TXPOWER 8 -/* Note : if you more than 8 TXPowers, just set the max and min or - * a few of them in the struct iw_range. */ - -/* Maximum of address that you may set with SPY */ -#define IW_MAX_SPY 8 - -/* Maximum of address that you may get in the - list of access points in range */ -#define IW_MAX_AP 64 - -/* Maximum size of the ESSID and NICKN strings */ -#define IW_ESSID_MAX_SIZE 32 - -/* Modes of operation */ -#define IW_MODE_AUTO 0 /* Let the driver decides */ -#define IW_MODE_ADHOC 1 /* Single cell network */ -#define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */ -#define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */ -#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ -#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ -#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ -#define IW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */ - -/* Statistics flags (bitmask in updated) */ -#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */ -#define IW_QUAL_LEVEL_UPDATED 0x02 -#define IW_QUAL_NOISE_UPDATED 0x04 -#define IW_QUAL_ALL_UPDATED 0x07 -#define IW_QUAL_DBM 0x08 /* Level + Noise are dBm */ -#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */ -#define IW_QUAL_LEVEL_INVALID 0x20 -#define IW_QUAL_NOISE_INVALID 0x40 -#define IW_QUAL_RCPI 0x80 /* Level + Noise are 802.11k RCPI */ -#define IW_QUAL_ALL_INVALID 0x70 - -/* Frequency flags */ -#define IW_FREQ_AUTO 0x00 /* Let the driver decides */ -#define IW_FREQ_FIXED 0x01 /* Force a specific value */ - -/* Maximum number of size of encoding token available - * they are listed in the range structure */ -#define IW_MAX_ENCODING_SIZES 8 - -/* Maximum size of the encoding token in bytes */ -#define IW_ENCODING_TOKEN_MAX 64 /* 512 bits (for now) */ - -/* Flags for encoding (along with the token) */ -#define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */ -#define IW_ENCODE_FLAGS 0xFF00 /* Flags defined below */ -#define IW_ENCODE_MODE 0xF000 /* Modes defined below */ -#define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */ -#define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */ -#define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */ -#define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */ -#define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not present */ -#define IW_ENCODE_TEMP 0x0400 /* Temporary key */ - -/* Power management flags available (along with the value, if any) */ -#define IW_POWER_ON 0x0000 /* No details... */ -#define IW_POWER_TYPE 0xF000 /* Type of parameter */ -#define IW_POWER_PERIOD 0x1000 /* Value is a period/duration of */ -#define IW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */ -#define IW_POWER_MODE 0x0F00 /* Power Management mode */ -#define IW_POWER_UNICAST_R 0x0100 /* Receive only unicast messages */ -#define IW_POWER_MULTICAST_R 0x0200 /* Receive only multicast messages */ -#define IW_POWER_ALL_R 0x0300 /* Receive all messages though PM */ -#define IW_POWER_FORCE_S 0x0400 /* Force PM procedure for sending unicast */ -#define IW_POWER_REPEATER 0x0800 /* Repeat broadcast messages in PM period */ -#define IW_POWER_MODIFIER 0x000F /* Modify a parameter */ -#define IW_POWER_MIN 0x0001 /* Value is a minimum */ -#define IW_POWER_MAX 0x0002 /* Value is a maximum */ -#define IW_POWER_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ - -/* Transmit Power flags available */ -#define IW_TXPOW_TYPE 0x00FF /* Type of value */ -#define IW_TXPOW_DBM 0x0000 /* Value is in dBm */ -#define IW_TXPOW_MWATT 0x0001 /* Value is in mW */ -#define IW_TXPOW_RELATIVE 0x0002 /* Value is in arbitrary units */ -#define IW_TXPOW_RANGE 0x1000 /* Range of value between min/max */ - -/* Retry limits and lifetime flags available */ -#define IW_RETRY_ON 0x0000 /* No details... */ -#define IW_RETRY_TYPE 0xF000 /* Type of parameter */ -#define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/ -#define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */ -#define IW_RETRY_MODIFIER 0x00FF /* Modify a parameter */ -#define IW_RETRY_MIN 0x0001 /* Value is a minimum */ -#define IW_RETRY_MAX 0x0002 /* Value is a maximum */ -#define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */ -#define IW_RETRY_SHORT 0x0010 /* Value is for short packets */ -#define IW_RETRY_LONG 0x0020 /* Value is for long packets */ - -/* Scanning request flags */ -#define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */ -#define IW_SCAN_ALL_ESSID 0x0001 /* Scan all ESSIDs */ -#define IW_SCAN_THIS_ESSID 0x0002 /* Scan only this ESSID */ -#define IW_SCAN_ALL_FREQ 0x0004 /* Scan all Frequencies */ -#define IW_SCAN_THIS_FREQ 0x0008 /* Scan only this Frequency */ -#define IW_SCAN_ALL_MODE 0x0010 /* Scan all Modes */ -#define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */ -#define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */ -#define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */ -/* struct iw_scan_req scan_type */ -#define IW_SCAN_TYPE_ACTIVE 0 -#define IW_SCAN_TYPE_PASSIVE 1 -/* Maximum size of returned data */ -#define IW_SCAN_MAX_DATA 4096 /* In bytes */ - -/* Scan capability flags - in (struct iw_range *)->scan_capa */ -#define IW_SCAN_CAPA_NONE 0x00 -#define IW_SCAN_CAPA_ESSID 0x01 -#define IW_SCAN_CAPA_BSSID 0x02 -#define IW_SCAN_CAPA_CHANNEL 0x04 -#define IW_SCAN_CAPA_MODE 0x08 -#define IW_SCAN_CAPA_RATE 0x10 -#define IW_SCAN_CAPA_TYPE 0x20 -#define IW_SCAN_CAPA_TIME 0x40 - -/* Max number of char in custom event - use multiple of them if needed */ -#define IW_CUSTOM_MAX 256 /* In bytes */ - -/* Generic information element */ -#define IW_GENERIC_IE_MAX 1024 - -/* MLME requests (SIOCSIWMLME / struct iw_mlme) */ -#define IW_MLME_DEAUTH 0 -#define IW_MLME_DISASSOC 1 -#define IW_MLME_AUTH 2 -#define IW_MLME_ASSOC 3 - -/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */ -#define IW_AUTH_INDEX 0x0FFF -#define IW_AUTH_FLAGS 0xF000 -/* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095) - * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the - * parameter that is being set/get to; value will be read/written to - * struct iw_param value field) */ -#define IW_AUTH_WPA_VERSION 0 -#define IW_AUTH_CIPHER_PAIRWISE 1 -#define IW_AUTH_CIPHER_GROUP 2 -#define IW_AUTH_KEY_MGMT 3 -#define IW_AUTH_TKIP_COUNTERMEASURES 4 -#define IW_AUTH_DROP_UNENCRYPTED 5 -#define IW_AUTH_80211_AUTH_ALG 6 -#define IW_AUTH_WPA_ENABLED 7 -#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8 -#define IW_AUTH_ROAMING_CONTROL 9 -#define IW_AUTH_PRIVACY_INVOKED 10 -#define IW_AUTH_CIPHER_GROUP_MGMT 11 -#define IW_AUTH_MFP 12 - -/* IW_AUTH_WPA_VERSION values (bit field) */ -#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001 -#define IW_AUTH_WPA_VERSION_WPA 0x00000002 -#define IW_AUTH_WPA_VERSION_WPA2 0x00000004 - -/* IW_AUTH_PAIRWISE_CIPHER, IW_AUTH_GROUP_CIPHER, and IW_AUTH_CIPHER_GROUP_MGMT - * values (bit field) */ -#define IW_AUTH_CIPHER_NONE 0x00000001 -#define IW_AUTH_CIPHER_WEP40 0x00000002 -#define IW_AUTH_CIPHER_TKIP 0x00000004 -#define IW_AUTH_CIPHER_CCMP 0x00000008 -#define IW_AUTH_CIPHER_WEP104 0x00000010 -#define IW_AUTH_CIPHER_AES_CMAC 0x00000020 - -/* IW_AUTH_KEY_MGMT values (bit field) */ -#define IW_AUTH_KEY_MGMT_802_1X 1 -#define IW_AUTH_KEY_MGMT_PSK 2 - -/* IW_AUTH_80211_AUTH_ALG values (bit field) */ -#define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001 -#define IW_AUTH_ALG_SHARED_KEY 0x00000002 -#define IW_AUTH_ALG_LEAP 0x00000004 - -/* IW_AUTH_ROAMING_CONTROL values */ -#define IW_AUTH_ROAMING_ENABLE 0 /* driver/firmware based roaming */ -#define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming - * control */ - -/* IW_AUTH_MFP (management frame protection) values */ -#define IW_AUTH_MFP_DISABLED 0 /* MFP disabled */ -#define IW_AUTH_MFP_OPTIONAL 1 /* MFP optional */ -#define IW_AUTH_MFP_REQUIRED 2 /* MFP required */ - -/* SIOCSIWENCODEEXT definitions */ -#define IW_ENCODE_SEQ_MAX_SIZE 8 -/* struct iw_encode_ext ->alg */ -#define IW_ENCODE_ALG_NONE 0 -#define IW_ENCODE_ALG_WEP 1 -#define IW_ENCODE_ALG_TKIP 2 -#define IW_ENCODE_ALG_CCMP 3 -#define IW_ENCODE_ALG_PMK 4 -#define IW_ENCODE_ALG_AES_CMAC 5 -/* struct iw_encode_ext ->ext_flags */ -#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001 -#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002 -#define IW_ENCODE_EXT_GROUP_KEY 0x00000004 -#define IW_ENCODE_EXT_SET_TX_KEY 0x00000008 - -/* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */ -#define IW_MICFAILURE_KEY_ID 0x00000003 /* Key ID 0..3 */ -#define IW_MICFAILURE_GROUP 0x00000004 -#define IW_MICFAILURE_PAIRWISE 0x00000008 -#define IW_MICFAILURE_STAKEY 0x00000010 -#define IW_MICFAILURE_COUNT 0x00000060 /* 1 or 2 (0 = count not supported) - */ - -/* Bit field values for enc_capa in struct iw_range */ -#define IW_ENC_CAPA_WPA 0x00000001 -#define IW_ENC_CAPA_WPA2 0x00000002 -#define IW_ENC_CAPA_CIPHER_TKIP 0x00000004 -#define IW_ENC_CAPA_CIPHER_CCMP 0x00000008 -#define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010 - -/* Event capability macros - in (struct iw_range *)->event_capa - * Because we have more than 32 possible events, we use an array of - * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */ -#define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \ - (cmd - SIOCIWFIRSTPRIV + 0x60) : \ - (cmd - SIOCIWFIRST)) -#define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5) -#define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F)) -/* Event capability constants - event autogenerated by the kernel - * This list is valid for most 802.11 devices, customise as needed... */ -#define IW_EVENT_CAPA_K_0 (IW_EVENT_CAPA_MASK(0x8B04) | \ - IW_EVENT_CAPA_MASK(0x8B06) | \ - IW_EVENT_CAPA_MASK(0x8B1A)) -#define IW_EVENT_CAPA_K_1 (IW_EVENT_CAPA_MASK(0x8B2A)) -/* "Easy" macro to set events in iw_range (less efficient) */ -#define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd)) -#define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; } - - -/****************************** TYPES ******************************/ - -/* --------------------------- SUBTYPES --------------------------- */ -/* - * Generic format for most parameters that fit in an int - */ -struct iw_param -{ - __s32 value; /* The value of the parameter itself */ - __u8 fixed; /* Hardware should not use auto select */ - __u8 disabled; /* Disable the feature */ - __u16 flags; /* Various specifc flags (if any) */ -}; - -/* - * For all data larger than 16 octets, we need to use a - * pointer to memory allocated in user space. - */ -struct iw_point -{ - void __user *pointer; /* Pointer to the data (in user space) */ - __u16 length; /* number of fields or size in bytes */ - __u16 flags; /* Optional params */ -}; - -#ifdef __KERNEL__ -#ifdef CONFIG_COMPAT - -#include <linux/compat.h> - -struct compat_iw_point { - compat_caddr_t pointer; - __u16 length; - __u16 flags; -}; -#endif -#endif - -/* - * A frequency - * For numbers lower than 10^9, we encode the number in 'm' and - * set 'e' to 0 - * For number greater than 10^9, we divide it by the lowest power - * of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')... - * The power of 10 is in 'e', the result of the division is in 'm'. - */ -struct iw_freq -{ - __s32 m; /* Mantissa */ - __s16 e; /* Exponent */ - __u8 i; /* List index (when in range struct) */ - __u8 flags; /* Flags (fixed/auto) */ -}; - -/* - * Quality of the link - */ -struct iw_quality -{ - __u8 qual; /* link quality (%retries, SNR, - %missed beacons or better...) */ - __u8 level; /* signal level (dBm) */ - __u8 noise; /* noise level (dBm) */ - __u8 updated; /* Flags to know if updated */ -}; - -/* - * Packet discarded in the wireless adapter due to - * "wireless" specific problems... - * Note : the list of counter and statistics in net_device_stats - * is already pretty exhaustive, and you should use that first. - * This is only additional stats... - */ -struct iw_discarded -{ - __u32 nwid; /* Rx : Wrong nwid/essid */ - __u32 code; /* Rx : Unable to code/decode (WEP) */ - __u32 fragment; /* Rx : Can't perform MAC reassembly */ - __u32 retries; /* Tx : Max MAC retries num reached */ - __u32 misc; /* Others cases */ -}; - -/* - * Packet/Time period missed in the wireless adapter due to - * "wireless" specific problems... - */ -struct iw_missed -{ - __u32 beacon; /* Missed beacons/superframe */ -}; - -/* - * Quality range (for spy threshold) - */ -struct iw_thrspy -{ - struct sockaddr addr; /* Source address (hw/mac) */ - struct iw_quality qual; /* Quality of the link */ - struct iw_quality low; /* Low threshold */ - struct iw_quality high; /* High threshold */ -}; - -/* - * Optional data for scan request - * - * Note: these optional parameters are controlling parameters for the - * scanning behavior, these do not apply to getting scan results - * (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and - * provide a merged results with all BSSes even if the previous scan - * request limited scanning to a subset, e.g., by specifying an SSID. - * Especially, scan results are required to include an entry for the - * current BSS if the driver is in Managed mode and associated with an AP. - */ -struct iw_scan_req -{ - __u8 scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */ - __u8 essid_len; - __u8 num_channels; /* num entries in channel_list; - * 0 = scan all allowed channels */ - __u8 flags; /* reserved as padding; use zero, this may - * be used in the future for adding flags - * to request different scan behavior */ - struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or - * individual address of a specific BSS */ - - /* - * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using - * the current ESSID. This allows scan requests for specific ESSID - * without having to change the current ESSID and potentially breaking - * the current association. - */ - __u8 essid[IW_ESSID_MAX_SIZE]; - - /* - * Optional parameters for changing the default scanning behavior. - * These are based on the MLME-SCAN.request from IEEE Std 802.11. - * TU is 1.024 ms. If these are set to 0, driver is expected to use - * reasonable default values. min_channel_time defines the time that - * will be used to wait for the first reply on each channel. If no - * replies are received, next channel will be scanned after this. If - * replies are received, total time waited on the channel is defined by - * max_channel_time. - */ - __u32 min_channel_time; /* in TU */ - __u32 max_channel_time; /* in TU */ - - struct iw_freq channel_list[IW_MAX_FREQUENCIES]; -}; - -/* ------------------------- WPA SUPPORT ------------------------- */ - -/* - * Extended data structure for get/set encoding (this is used with - * SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_* - * flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and - * only the data contents changes (key data -> this structure, including - * key data). - * - * If the new key is the first group key, it will be set as the default - * TX key. Otherwise, default TX key index is only changed if - * IW_ENCODE_EXT_SET_TX_KEY flag is set. - * - * Key will be changed with SIOCSIWENCODEEXT in all cases except for - * special "change TX key index" operation which is indicated by setting - * key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY. - * - * tx_seq/rx_seq are only used when respective - * IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal - * TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start - * TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally - * used only by an Authenticator (AP or an IBSS station) to get the - * current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and - * RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for - * debugging/testing. - */ -struct iw_encode_ext -{ - __u32 ext_flags; /* IW_ENCODE_EXT_* */ - __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ - __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ - struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast - * (group) keys or unicast address for - * individual keys */ - __u16 alg; /* IW_ENCODE_ALG_* */ - __u16 key_len; - __u8 key[0]; -}; - -/* SIOCSIWMLME data */ -struct iw_mlme -{ - __u16 cmd; /* IW_MLME_* */ - __u16 reason_code; - struct sockaddr addr; -}; - -/* SIOCSIWPMKSA data */ -#define IW_PMKSA_ADD 1 -#define IW_PMKSA_REMOVE 2 -#define IW_PMKSA_FLUSH 3 - -#define IW_PMKID_LEN 16 - -struct iw_pmksa -{ - __u32 cmd; /* IW_PMKSA_* */ - struct sockaddr bssid; - __u8 pmkid[IW_PMKID_LEN]; -}; - -/* IWEVMICHAELMICFAILURE data */ -struct iw_michaelmicfailure -{ - __u32 flags; - struct sockaddr src_addr; - __u8 tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */ -}; - -/* IWEVPMKIDCAND data */ -#define IW_PMKID_CAND_PREAUTH 0x00000001 /* RNS pre-authentication enabled */ -struct iw_pmkid_cand -{ - __u32 flags; /* IW_PMKID_CAND_* */ - __u32 index; /* the smaller the index, the higher the - * priority */ - struct sockaddr bssid; -}; - -/* ------------------------ WIRELESS STATS ------------------------ */ -/* - * Wireless statistics (used for /proc/net/wireless) - */ -struct iw_statistics -{ - __u16 status; /* Status - * - device dependent for now */ - - struct iw_quality qual; /* Quality of the link - * (instant/mean/max) */ - struct iw_discarded discard; /* Packet discarded counts */ - struct iw_missed miss; /* Packet missed counts */ -}; - -/* ------------------------ IOCTL REQUEST ------------------------ */ -/* - * This structure defines the payload of an ioctl, and is used - * below. - * - * Note that this structure should fit on the memory footprint - * of iwreq (which is the same as ifreq), which mean a max size of - * 16 octets = 128 bits. Warning, pointers might be 64 bits wide... - * You should check this when increasing the structures defined - * above in this file... - */ -union iwreq_data -{ - /* Config - generic */ - char name[IFNAMSIZ]; - /* Name : used to verify the presence of wireless extensions. - * Name of the protocol/provider... */ - - struct iw_point essid; /* Extended network name */ - struct iw_param nwid; /* network id (or domain - the cell) */ - struct iw_freq freq; /* frequency or channel : - * 0-1000 = channel - * > 1000 = frequency in Hz */ - - struct iw_param sens; /* signal level threshold */ - struct iw_param bitrate; /* default bit rate */ - struct iw_param txpower; /* default transmit power */ - struct iw_param rts; /* RTS threshold threshold */ - struct iw_param frag; /* Fragmentation threshold */ - __u32 mode; /* Operation mode */ - struct iw_param retry; /* Retry limits & lifetime */ - - struct iw_point encoding; /* Encoding stuff : tokens */ - struct iw_param power; /* PM duration/timeout */ - struct iw_quality qual; /* Quality part of statistics */ - - struct sockaddr ap_addr; /* Access point address */ - struct sockaddr addr; /* Destination address (hw/mac) */ - - struct iw_param param; /* Other small parameters */ - struct iw_point data; /* Other large parameters */ -}; - -/* - * The structure to exchange data for ioctl. - * This structure is the same as 'struct ifreq', but (re)defined for - * convenience... - * Do I need to remind you about structure size (32 octets) ? - */ -struct iwreq -{ - union - { - char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */ - } ifr_ifrn; - - /* Data part (defined just above) */ - union iwreq_data u; -}; - -/* -------------------------- IOCTL DATA -------------------------- */ -/* - * For those ioctl which want to exchange mode data that what could - * fit in the above structure... - */ - -/* - * Range of parameters - */ - -struct iw_range -{ - /* Informative stuff (to choose between different interface) */ - __u32 throughput; /* To give an idea... */ - /* In theory this value should be the maximum benchmarked - * TCP/IP throughput, because with most of these devices the - * bit rate is meaningless (overhead an co) to estimate how - * fast the connection will go and pick the fastest one. - * I suggest people to play with Netperf or any benchmark... - */ - - /* NWID (or domain id) */ - __u32 min_nwid; /* Minimal NWID we are able to set */ - __u32 max_nwid; /* Maximal NWID we are able to set */ - - /* Old Frequency (backward compat - moved lower ) */ - __u16 old_num_channels; - __u8 old_num_frequency; - - /* Scan capabilities */ - __u8 scan_capa; /* IW_SCAN_CAPA_* bit field */ - - /* Wireless event capability bitmasks */ - __u32 event_capa[6]; - - /* signal level threshold range */ - __s32 sensitivity; - - /* Quality of link & SNR stuff */ - /* Quality range (link, level, noise) - * If the quality is absolute, it will be in the range [0 ; max_qual], - * if the quality is dBm, it will be in the range [max_qual ; 0]. - * Don't forget that we use 8 bit arithmetics... */ - struct iw_quality max_qual; /* Quality of the link */ - /* This should contain the average/typical values of the quality - * indicator. This should be the threshold between a "good" and - * a "bad" link (example : monitor going from green to orange). - * Currently, user space apps like quality monitors don't have any - * way to calibrate the measurement. With this, they can split - * the range between 0 and max_qual in different quality level - * (using a geometric subdivision centered on the average). - * I expect that people doing the user space apps will feedback - * us on which value we need to put in each driver... */ - struct iw_quality avg_qual; /* Quality of the link */ - - /* Rates */ - __u8 num_bitrates; /* Number of entries in the list */ - __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */ - - /* RTS threshold */ - __s32 min_rts; /* Minimal RTS threshold */ - __s32 max_rts; /* Maximal RTS threshold */ - - /* Frag threshold */ - __s32 min_frag; /* Minimal frag threshold */ - __s32 max_frag; /* Maximal frag threshold */ - - /* Power Management duration & timeout */ - __s32 min_pmp; /* Minimal PM period */ - __s32 max_pmp; /* Maximal PM period */ - __s32 min_pmt; /* Minimal PM timeout */ - __s32 max_pmt; /* Maximal PM timeout */ - __u16 pmp_flags; /* How to decode max/min PM period */ - __u16 pmt_flags; /* How to decode max/min PM timeout */ - __u16 pm_capa; /* What PM options are supported */ - - /* Encoder stuff */ - __u16 encoding_size[IW_MAX_ENCODING_SIZES]; /* Different token sizes */ - __u8 num_encoding_sizes; /* Number of entry in the list */ - __u8 max_encoding_tokens; /* Max number of tokens */ - /* For drivers that need a "login/passwd" form */ - __u8 encoding_login_index; /* token index for login token */ - - /* Transmit power */ - __u16 txpower_capa; /* What options are supported */ - __u8 num_txpower; /* Number of entries in the list */ - __s32 txpower[IW_MAX_TXPOWER]; /* list, in bps */ - - /* Wireless Extension version info */ - __u8 we_version_compiled; /* Must be WIRELESS_EXT */ - __u8 we_version_source; /* Last update of source */ - - /* Retry limits and lifetime */ - __u16 retry_capa; /* What retry options are supported */ - __u16 retry_flags; /* How to decode max/min retry limit */ - __u16 r_time_flags; /* How to decode max/min retry life */ - __s32 min_retry; /* Minimal number of retries */ - __s32 max_retry; /* Maximal number of retries */ - __s32 min_r_time; /* Minimal retry lifetime */ - __s32 max_r_time; /* Maximal retry lifetime */ - - /* Frequency */ - __u16 num_channels; /* Number of channels [0; num - 1] */ - __u8 num_frequency; /* Number of entry in the list */ - struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */ - /* Note : this frequency list doesn't need to fit channel numbers, - * because each entry contain its channel index */ - - __u32 enc_capa; /* IW_ENC_CAPA_* bit field */ -}; - -/* - * Private ioctl interface information - */ - -struct iw_priv_args -{ - __u32 cmd; /* Number of the ioctl to issue */ - __u16 set_args; /* Type and number of args */ - __u16 get_args; /* Type and number of args */ - char name[IFNAMSIZ]; /* Name of the extension */ -}; - -/* ----------------------- WIRELESS EVENTS ----------------------- */ -/* - * Wireless events are carried through the rtnetlink socket to user - * space. They are encapsulated in the IFLA_WIRELESS field of - * a RTM_NEWLINK message. - */ - -/* - * A Wireless Event. Contains basically the same data as the ioctl... - */ -struct iw_event -{ - __u16 len; /* Real length of this stuff */ - __u16 cmd; /* Wireless IOCTL */ - union iwreq_data u; /* IOCTL fixed payload */ -}; - -/* Size of the Event prefix (including padding and alignement junk) */ -#define IW_EV_LCP_LEN (sizeof(struct iw_event) - sizeof(union iwreq_data)) -/* Size of the various events */ -#define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ) -#define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32)) -#define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq)) -#define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param)) -#define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr)) -#define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality)) - -/* iw_point events are special. First, the payload (extra data) come at - * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second, - * we omit the pointer, so start at an offset. */ -#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \ - (char *) NULL) -#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \ - IW_EV_POINT_OFF) - -#ifdef __KERNEL__ -#ifdef CONFIG_COMPAT -struct __compat_iw_event { - __u16 len; /* Real length of this stuff */ - __u16 cmd; /* Wireless IOCTL */ - compat_caddr_t pointer; -}; -#define IW_EV_COMPAT_LCP_LEN offsetof(struct __compat_iw_event, pointer) -#define IW_EV_COMPAT_POINT_OFF offsetof(struct compat_iw_point, length) - -/* Size of the various events for compat */ -#define IW_EV_COMPAT_CHAR_LEN (IW_EV_COMPAT_LCP_LEN + IFNAMSIZ) -#define IW_EV_COMPAT_UINT_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(__u32)) -#define IW_EV_COMPAT_FREQ_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct iw_freq)) -#define IW_EV_COMPAT_PARAM_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct iw_param)) -#define IW_EV_COMPAT_ADDR_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct sockaddr)) -#define IW_EV_COMPAT_QUAL_LEN (IW_EV_COMPAT_LCP_LEN + sizeof(struct iw_quality)) -#define IW_EV_COMPAT_POINT_LEN \ - (IW_EV_COMPAT_LCP_LEN + sizeof(struct compat_iw_point) - \ - IW_EV_COMPAT_POINT_OFF) -#endif -#endif - -/* Size of the Event prefix when packed in stream */ -#define IW_EV_LCP_PK_LEN (4) -/* Size of the various events when packed in stream */ -#define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ) -#define IW_EV_UINT_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(__u32)) -#define IW_EV_FREQ_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq)) -#define IW_EV_PARAM_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_param)) -#define IW_EV_ADDR_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr)) -#define IW_EV_QUAL_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality)) -#define IW_EV_POINT_PK_LEN (IW_EV_LCP_PK_LEN + 4) - -#endif /* _LINUX_WIRELESS_H */ diff --git a/openairITS/mac/DOT11/include/linux/wl12xx.h b/openairITS/mac/DOT11/include/linux/wl12xx.h deleted file mode 100644 index 0d6373195d3..00000000000 --- a/openairITS/mac/DOT11/include/linux/wl12xx.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file is part of wl12xx - * - * Copyright (C) 2009 Nokia Corporation - * - * Contact: Luciano Coelho <luciano.coelho@nokia.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#ifndef _LINUX_WL12XX_H -#define _LINUX_WL12XX_H - -/* Reference clock values */ -enum { - WL12XX_REFCLOCK_19 = 0, /* 19.2 MHz */ - WL12XX_REFCLOCK_26 = 1, /* 26 MHz */ - WL12XX_REFCLOCK_38 = 2, /* 38.4 MHz */ - WL12XX_REFCLOCK_52 = 3, /* 52 MHz */ - WL12XX_REFCLOCK_38_XTAL = 4, /* 38.4 MHz, XTAL */ - WL12XX_REFCLOCK_26_XTAL = 5, /* 26 MHz, XTAL */ -}; - -/* TCXO clock values */ -enum { - WL12XX_TCXOCLOCK_19_2 = 0, /* 19.2MHz */ - WL12XX_TCXOCLOCK_26 = 1, /* 26 MHz */ - WL12XX_TCXOCLOCK_38_4 = 2, /* 38.4MHz */ - WL12XX_TCXOCLOCK_52 = 3, /* 52 MHz */ - WL12XX_TCXOCLOCK_16_368 = 4, /* 16.368 MHz */ - WL12XX_TCXOCLOCK_32_736 = 5, /* 32.736 MHz */ - WL12XX_TCXOCLOCK_16_8 = 6, /* 16.8 MHz */ - WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */ -}; - -struct wl12xx_platform_data { - void (*set_power)(bool enable); - /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ - int irq; - bool use_eeprom; - int board_ref_clock; - int board_tcxo_clock; - unsigned long platform_quirks; - bool pwr_in_suspend; - - struct wl1271_if_operations *ops; -}; - -/* Platform does not support level trigger interrupts */ -#define WL12XX_PLATFORM_QUIRK_EDGE_IRQ BIT(0) - -#ifdef CONFIG_WL12XX_PLATFORM_DATA - -int wl12xx_set_platform_data(const struct wl12xx_platform_data *data); - -#else - -static inline -int wl12xx_set_platform_data(const struct wl12xx_platform_data *data) -{ - return -ENOSYS; -} - -#endif - -struct wl12xx_platform_data *wl12xx_get_platform_data(void); - -#endif diff --git a/openairITS/mac/DOT11/include/net/cfg80211-wext.h b/openairITS/mac/DOT11/include/net/cfg80211-wext.h deleted file mode 100644 index 25baddc4fbe..00000000000 --- a/openairITS/mac/DOT11/include/net/cfg80211-wext.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __NET_CFG80211_WEXT_H -#define __NET_CFG80211_WEXT_H -/* - * 802.11 device and configuration interface -- wext handlers - * - * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/netdevice.h> -#include <linux/wireless.h> -#include <net/iw_handler.h> - -/* - * Temporary wext handlers & helper functions - * - * These are used only by drivers that aren't yet fully - * converted to cfg80211. - */ -int cfg80211_wext_giwname(struct net_device *dev, - struct iw_request_info *info, - char *name, char *extra); -int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, - u32 *mode, char *extra); -int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, - u32 *mode, char *extra); -int cfg80211_wext_siwscan(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra); -int cfg80211_wext_giwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra); -int cfg80211_wext_giwrange(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra); -int cfg80211_wext_siwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra); -int cfg80211_wext_giwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra); -int cfg80211_wext_siwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *frag, char *extra); -int cfg80211_wext_giwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *frag, char *extra); -int cfg80211_wext_giwretry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *retry, char *extra); - -#endif /* __NET_CFG80211_WEXT_H */ diff --git a/openairITS/mac/DOT11/include/net/cfg80211.h b/openairITS/mac/DOT11/include/net/cfg80211.h deleted file mode 100644 index d597dcaa5e4..00000000000 --- a/openairITS/mac/DOT11/include/net/cfg80211.h +++ /dev/null @@ -1,3419 +0,0 @@ -#ifndef __NET_CFG80211_H -#define __NET_CFG80211_H -/* - * 802.11 device and configuration interface - * - * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/netdevice.h> -#include <linux/debugfs.h> -#include <linux/list.h> -#include <linux/bug.h> -#include <linux/netlink.h> -#include <linux/skbuff.h> -#include <linux/nl80211.h> -#include <linux/if_ether.h> -#include <linux/ieee80211.h> -#include <net/regulatory.h> - -/** - * DOC: Introduction - * - * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges - * userspace and drivers, and offers some utility functionality associated - * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used - * by all modern wireless drivers in Linux, so that they offer a consistent - * API through nl80211. For backward compatibility, cfg80211 also offers - * wireless extensions to userspace, but hides them from drivers completely. - * - * Additionally, cfg80211 contains code to help enforce regulatory spectrum - * use restrictions. - */ - - -/** - * DOC: Device registration - * - * In order for a driver to use cfg80211, it must register the hardware device - * with cfg80211. This happens through a number of hardware capability structs - * described below. - * - * The fundamental structure for each device is the 'wiphy', of which each - * instance describes a physical wireless device connected to the system. Each - * such wiphy can have zero, one, or many virtual interfaces associated with - * it, which need to be identified as such by pointing the network interface's - * @ieee80211_ptr pointer to a &struct wireless_dev which further describes - * the wireless part of the interface, normally this struct is embedded in the - * network interface's private data area. Drivers can optionally allow creating - * or destroying virtual interfaces on the fly, but without at least one or the - * ability to create some the wireless device isn't useful. - * - * Each wiphy structure contains device capability information, and also has - * a pointer to the various operations the driver offers. The definitions and - * structures here describe these capabilities in detail. - */ - -/* - * wireless hardware capability structures - */ - -/** - * enum ieee80211_band - supported frequency bands - * - * The bands are assigned this way because the supported - * bitrates differ in these bands. - * - * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band - * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7) - * @IEEE80211_BAND_5_9GHZ: around the ITS 5.9GHz band (5.875GHz - 5.905GHz) - * @IEEE80211_BAND_0_8GHZ: around 800MHz band - * @IEEE80211_NUM_BANDS: number of defined bands - */ -enum ieee80211_band { - IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, - IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, - IEEE80211_BAND_5_9GHZ = NL80211_BAND_5_9GHZ, - IEEE80211_BAND_0_8GHZ = NL80211_BAND_0_8GHZ, - - /* keep last */ - IEEE80211_NUM_BANDS -}; - -/** - * enum ieee80211_channel_flags - channel flags - * - * Channel flags set by the regulatory control code. - * - * @IEEE80211_CHAN_DISABLED: This channel is disabled. - * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted - * on this channel. - * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel. - * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel. - * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel - * is not permitted. - * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel - * is not permitted. - */ -enum ieee80211_channel_flags { - IEEE80211_CHAN_DISABLED = 1<<0, - IEEE80211_CHAN_PASSIVE_SCAN = 1<<1, - IEEE80211_CHAN_NO_IBSS = 1<<2, - IEEE80211_CHAN_RADAR = 1<<3, - IEEE80211_CHAN_NO_HT40PLUS = 1<<4, - IEEE80211_CHAN_NO_HT40MINUS = 1<<5, -}; - -#define IEEE80211_CHAN_NO_HT40 \ - (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) - -/** - * struct ieee80211_channel - channel definition - * - * This structure describes a single channel for use - * with cfg80211. - * - * @center_freq: center frequency in MHz - * @hw_value: hardware-specific value for the channel - * @flags: channel flags from &enum ieee80211_channel_flags. - * @orig_flags: channel flags at registration time, used by regulatory - * code to support devices with additional restrictions - * @band: band this channel belongs to. - * @max_antenna_gain: maximum antenna gain in dBi - * @max_power: maximum transmission power (in dBm) - * @max_reg_power: maximum regulatory transmission power (in dBm) - * @beacon_found: helper to regulatory code to indicate when a beacon - * has been found on this channel. Use regulatory_hint_found_beacon() - * to enable this, this is useful only on 5 GHz band. - * @orig_mag: internal use - * @orig_mpwr: internal use - */ -struct ieee80211_channel { - enum ieee80211_band band; - u16 center_freq; - u16 hw_value; - u32 flags; - int max_antenna_gain; - int max_power; - int max_reg_power; - bool beacon_found; - u32 orig_flags; - int orig_mag, orig_mpwr; -}; - -/** - * enum ieee80211_rate_flags - rate flags - * - * Hardware/specification flags for rates. These are structured - * in a way that allows using the same bitrate structure for - * different bands/PHY modes. - * - * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short - * preamble on this bitrate; only relevant in 2.4GHz band and - * with CCK rates. - * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate - * when used with 802.11a (on the 5 GHz band); filled by the - * core code when registering the wiphy. - * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate - * when used with 802.11b (on the 2.4 GHz band); filled by the - * core code when registering the wiphy. - * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate - * when used with 802.11g (on the 2.4 GHz band); filled by the - * core code when registering the wiphy. - * @IEEE80211_RATE_MANDATORY_P: This bitrate is a mandatory rate - * when used with 802.11p (on the 5.9 GHz and 800MHz bands); filled by the - * core code when registering the wiphy. - * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode. - * @IEEE80211_RATE_MANDATORY_P: This bitrate is a mandatory rate - * when used with 802.11p (on the 5.9 GHz and 800MHz bands); filled by the - * core code when registering the wiphy. - */ -/* - * [PLATA] added a new mandatory rate for 802.11p mode - */ -enum ieee80211_rate_flags { - IEEE80211_RATE_SHORT_PREAMBLE = 1<<0, - IEEE80211_RATE_MANDATORY_A = 1<<1, - IEEE80211_RATE_MANDATORY_B = 1<<2, - IEEE80211_RATE_MANDATORY_G = 1<<3, - IEEE80211_RATE_ERP_G = 1<<4, - IEEE80211_RATE_MANDATORY_P = 1<<5, -}; - -/** - * struct ieee80211_rate - bitrate definition - * - * This structure describes a bitrate that an 802.11 PHY can - * operate with. The two values @hw_value and @hw_value_short - * are only for driver use when pointers to this structure are - * passed around. - * - * @flags: rate-specific flags - * @bitrate: bitrate in units of 100 Kbps - * @hw_value: driver/hardware value for this rate - * @hw_value_short: driver/hardware value for this rate when - * short preamble is used - */ -struct ieee80211_rate { - u32 flags; - u16 bitrate; - u16 hw_value, hw_value_short; -}; - -/** - * struct ieee80211_sta_ht_cap - STA's HT capabilities - * - * This structure describes most essential parameters needed - * to describe 802.11n HT capabilities for an STA. - * - * @ht_supported: is HT supported by the STA - * @cap: HT capabilities map as described in 802.11n spec - * @ampdu_factor: Maximum A-MPDU length factor - * @ampdu_density: Minimum A-MPDU spacing - * @mcs: Supported MCS rates - */ -struct ieee80211_sta_ht_cap { - u16 cap; /* use IEEE80211_HT_CAP_ */ - bool ht_supported; - u8 ampdu_factor; - u8 ampdu_density; - struct ieee80211_mcs_info mcs; -}; - -/** - * struct ieee80211_supported_band - frequency band definition - * - * This structure describes a frequency band a wiphy - * is able to operate in. - * - * @channels: Array of channels the hardware can operate in - * in this band. - * @band: the band this structure represents - * @n_channels: Number of channels in @channels - * @bitrates: Array of bitrates the hardware can operate with - * in this band. Must be sorted to give a valid "supported - * rates" IE, i.e. CCK rates first, then OFDM. - * @n_bitrates: Number of bitrates in @bitrates - * @ht_cap: HT capabilities in this band - */ -struct ieee80211_supported_band { - struct ieee80211_channel *channels; - struct ieee80211_rate *bitrates; - enum ieee80211_band band; - int n_channels; - int n_bitrates; - struct ieee80211_sta_ht_cap ht_cap; -}; - -/* - * Wireless hardware/device configuration structures and methods - */ - -/** - * DOC: Actions and configuration - * - * Each wireless device and each virtual interface offer a set of configuration - * operations and other actions that are invoked by userspace. Each of these - * actions is described in the operations structure, and the parameters these - * operations use are described separately. - * - * Additionally, some operations are asynchronous and expect to get status - * information via some functions that drivers need to call. - * - * Scanning and BSS list handling with its associated functionality is described - * in a separate chapter. - */ - -/** - * struct vif_params - describes virtual interface parameters - * @use_4addr: use 4-address frames - */ -struct vif_params { - int use_4addr; -}; - -/** - * struct key_params - key information - * - * Information about a key - * - * @key: key material - * @key_len: length of key material - * @cipher: cipher suite selector - * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used - * with the get_key() callback, must be in little endian, - * length given by @seq_len. - * @seq_len: length of @seq. - */ -struct key_params { - u8 *key; - u8 *seq; - int key_len; - int seq_len; - u32 cipher; -}; - -/** - * enum survey_info_flags - survey information flags - * - * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in - * @SURVEY_INFO_IN_USE: channel is currently being used - * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in - * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in - * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in - * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in - * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in - * - * Used by the driver to indicate which info in &struct survey_info - * it has filled in during the get_survey(). - */ -enum survey_info_flags { - SURVEY_INFO_NOISE_DBM = 1<<0, - SURVEY_INFO_IN_USE = 1<<1, - SURVEY_INFO_CHANNEL_TIME = 1<<2, - SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3, - SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4, - SURVEY_INFO_CHANNEL_TIME_RX = 1<<5, - SURVEY_INFO_CHANNEL_TIME_TX = 1<<6, -}; - -/** - * struct survey_info - channel survey response - * - * @channel: the channel this survey record reports, mandatory - * @filled: bitflag of flags from &enum survey_info_flags - * @noise: channel noise in dBm. This and all following fields are - * optional - * @channel_time: amount of time in ms the radio spent on the channel - * @channel_time_busy: amount of time the primary channel was sensed busy - * @channel_time_ext_busy: amount of time the extension channel was sensed busy - * @channel_time_rx: amount of time the radio spent receiving data - * @channel_time_tx: amount of time the radio spent transmitting data - * - * Used by dump_survey() to report back per-channel survey information. - * - * This structure can later be expanded with things like - * channel duty cycle etc. - */ -struct survey_info { - struct ieee80211_channel *channel; - u64 channel_time; - u64 channel_time_busy; - u64 channel_time_ext_busy; - u64 channel_time_rx; - u64 channel_time_tx; - u32 filled; - s8 noise; -}; - -/** - * struct cfg80211_crypto_settings - Crypto settings - * @wpa_versions: indicates which, if any, WPA versions are enabled - * (from enum nl80211_wpa_versions) - * @cipher_group: group key cipher suite (or 0 if unset) - * @n_ciphers_pairwise: number of AP supported unicast ciphers - * @ciphers_pairwise: unicast key cipher suites - * @n_akm_suites: number of AKM suites - * @akm_suites: AKM suites - * @control_port: Whether user space controls IEEE 802.1X port, i.e., - * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is - * required to assume that the port is unauthorized until authorized by - * user space. Otherwise, port is marked authorized by default. - * @control_port_ethertype: the control port protocol that should be - * allowed through even on unauthorized ports - * @control_port_no_encrypt: TRUE to prevent encryption of control port - * protocol frames. - */ -struct cfg80211_crypto_settings { - u32 wpa_versions; - u32 cipher_group; - int n_ciphers_pairwise; - u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; - int n_akm_suites; - u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; - bool control_port; - __be16 control_port_ethertype; - bool control_port_no_encrypt; -}; - -/** - * struct cfg80211_beacon_data - beacon data - * @head: head portion of beacon (before TIM IE) - * or %NULL if not changed - * @tail: tail portion of beacon (after TIM IE) - * or %NULL if not changed - * @head_len: length of @head - * @tail_len: length of @tail - * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL - * @beacon_ies_len: length of beacon_ies in octets - * @proberesp_ies: extra information element(s) to add into Probe Response - * frames or %NULL - * @proberesp_ies_len: length of proberesp_ies in octets - * @assocresp_ies: extra information element(s) to add into (Re)Association - * Response frames or %NULL - * @assocresp_ies_len: length of assocresp_ies in octets - * @probe_resp_len: length of probe response template (@probe_resp) - * @probe_resp: probe response template (AP mode only) - */ -struct cfg80211_beacon_data { - const u8 *head, *tail; - const u8 *beacon_ies; - const u8 *proberesp_ies; - const u8 *assocresp_ies; - const u8 *probe_resp; - - size_t head_len, tail_len; - size_t beacon_ies_len; - size_t proberesp_ies_len; - size_t assocresp_ies_len; - size_t probe_resp_len; -}; - -/** - * struct cfg80211_ap_settings - AP configuration - * - * Used to configure an AP interface. - * - * @beacon: beacon data - * @beacon_interval: beacon interval - * @dtim_period: DTIM period - * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from - * user space) - * @ssid_len: length of @ssid - * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames - * @crypto: crypto settings - * @privacy: the BSS uses privacy - * @auth_type: Authentication type (algorithm) - * @inactivity_timeout: time in seconds to determine station's inactivity. - */ -struct cfg80211_ap_settings { - struct cfg80211_beacon_data beacon; - - int beacon_interval, dtim_period; - const u8 *ssid; - size_t ssid_len; - enum nl80211_hidden_ssid hidden_ssid; - struct cfg80211_crypto_settings crypto; - bool privacy; - enum nl80211_auth_type auth_type; - int inactivity_timeout; -}; - -/** - * enum plink_action - actions to perform in mesh peers - * - * @PLINK_ACTION_INVALID: action 0 is reserved - * @PLINK_ACTION_OPEN: start mesh peer link establishment - * @PLINK_ACTION_BLOCK: block traffic from this mesh peer - */ -enum plink_actions { - PLINK_ACTION_INVALID, - PLINK_ACTION_OPEN, - PLINK_ACTION_BLOCK, -}; - -/** - * enum station_parameters_apply_mask - station parameter values to apply - * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp) - * - * Not all station parameters have in-band "no change" signalling, - * for those that don't these flags will are used. - */ -enum station_parameters_apply_mask { - STATION_PARAM_APPLY_UAPSD = BIT(0), -}; - -/** - * struct station_parameters - station parameters - * - * Used to change and create a new station. - * - * @vlan: vlan interface station should belong to - * @supported_rates: supported rates in IEEE 802.11 format - * (or NULL for no change) - * @supported_rates_len: number of supported rates - * @sta_flags_mask: station flags that changed - * (bitmask of BIT(NL80211_STA_FLAG_...)) - * @sta_flags_set: station flags values - * (bitmask of BIT(NL80211_STA_FLAG_...)) - * @listen_interval: listen interval or -1 for no change - * @aid: AID or zero for no change - * @plink_action: plink action to take - * @plink_state: set the peer link state for a station - * @ht_capa: HT capabilities of station - * @uapsd_queues: bitmap of queues configured for uapsd. same format - * as the AC bitmap in the QoS info field - * @max_sp: max Service Period. same format as the MAX_SP in the - * QoS info field (but already shifted down) - * @sta_modify_mask: bitmap indicating which parameters changed - * (for those that don't have a natural "no change" value), - * see &enum station_parameters_apply_mask - */ -struct station_parameters { - u8 *supported_rates; - struct net_device *vlan; - u32 sta_flags_mask, sta_flags_set; - u32 sta_modify_mask; - int listen_interval; - u16 aid; - u8 supported_rates_len; - u8 plink_action; - u8 plink_state; - struct ieee80211_ht_cap *ht_capa; - u8 uapsd_queues; - u8 max_sp; -}; - -/** - * enum station_info_flags - station information flags - * - * Used by the driver to indicate which info in &struct station_info - * it has filled in during get_station() or dump_station(). - * - * @STATION_INFO_INACTIVE_TIME: @inactive_time filled - * @STATION_INFO_RX_BYTES: @rx_bytes filled - * @STATION_INFO_TX_BYTES: @tx_bytes filled - * @STATION_INFO_LLID: @llid filled - * @STATION_INFO_PLID: @plid filled - * @STATION_INFO_PLINK_STATE: @plink_state filled - * @STATION_INFO_SIGNAL: @signal filled - * @STATION_INFO_TX_BITRATE: @txrate fields are filled - * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) - * @STATION_INFO_RX_PACKETS: @rx_packets filled - * @STATION_INFO_TX_PACKETS: @tx_packets filled - * @STATION_INFO_TX_RETRIES: @tx_retries filled - * @STATION_INFO_TX_FAILED: @tx_failed filled - * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled - * @STATION_INFO_SIGNAL_AVG: @signal_avg filled - * @STATION_INFO_RX_BITRATE: @rxrate fields are filled - * @STATION_INFO_BSS_PARAM: @bss_param filled - * @STATION_INFO_CONNECTED_TIME: @connected_time filled - * @STATION_INFO_ASSOC_REQ_IES: @assoc_req_ies filled - * @STATION_INFO_STA_FLAGS: @sta_flags filled - * @STATION_INFO_BEACON_LOSS_COUNT: @beacon_loss_count filled - */ -enum station_info_flags { - STATION_INFO_INACTIVE_TIME = 1<<0, - STATION_INFO_RX_BYTES = 1<<1, - STATION_INFO_TX_BYTES = 1<<2, - STATION_INFO_LLID = 1<<3, - STATION_INFO_PLID = 1<<4, - STATION_INFO_PLINK_STATE = 1<<5, - STATION_INFO_SIGNAL = 1<<6, - STATION_INFO_TX_BITRATE = 1<<7, - STATION_INFO_RX_PACKETS = 1<<8, - STATION_INFO_TX_PACKETS = 1<<9, - STATION_INFO_TX_RETRIES = 1<<10, - STATION_INFO_TX_FAILED = 1<<11, - STATION_INFO_RX_DROP_MISC = 1<<12, - STATION_INFO_SIGNAL_AVG = 1<<13, - STATION_INFO_RX_BITRATE = 1<<14, - STATION_INFO_BSS_PARAM = 1<<15, - STATION_INFO_CONNECTED_TIME = 1<<16, - STATION_INFO_ASSOC_REQ_IES = 1<<17, - STATION_INFO_STA_FLAGS = 1<<18, - STATION_INFO_BEACON_LOSS_COUNT = 1<<19 -}; - -/** - * enum station_info_rate_flags - bitrate info flags - * - * Used by the driver to indicate the specific rate transmission - * type for 802.11n transmissions. - * - * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled - * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission - * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval - */ -enum rate_info_flags { - RATE_INFO_FLAGS_MCS = 1<<0, - RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1, - RATE_INFO_FLAGS_SHORT_GI = 1<<2, -}; - -/** - * struct rate_info - bitrate information - * - * Information about a receiving or transmitting bitrate - * - * @flags: bitflag of flags from &enum rate_info_flags - * @mcs: mcs index if struct describes a 802.11n bitrate - * @legacy: bitrate in 100kbit/s for 802.11abg - */ -struct rate_info { - u8 flags; - u8 mcs; - u16 legacy; -}; - -/** - * enum station_info_rate_flags - bitrate info flags - * - * Used by the driver to indicate the specific rate transmission - * type for 802.11n transmissions. - * - * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled - * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled - * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled - */ -enum bss_param_flags { - BSS_PARAM_FLAGS_CTS_PROT = 1<<0, - BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, - BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, -}; - -/** - * struct sta_bss_parameters - BSS parameters for the attached station - * - * Information about the currently associated BSS - * - * @flags: bitflag of flags from &enum bss_param_flags - * @dtim_period: DTIM period for the BSS - * @beacon_interval: beacon interval - */ -struct sta_bss_parameters { - u8 flags; - u8 dtim_period; - u16 beacon_interval; -}; - -/** - * struct station_info - station information - * - * Station information filled by driver for get_station() and dump_station. - * - * @filled: bitflag of flags from &enum station_info_flags - * @connected_time: time(in secs) since a station is last connected - * @inactive_time: time since last station activity (tx/rx) in milliseconds - * @rx_bytes: bytes received from this station - * @tx_bytes: bytes transmitted to this station - * @llid: mesh local link id - * @plid: mesh peer link id - * @plink_state: mesh peer link state - * @signal: the signal strength, type depends on the wiphy's signal_type - NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. - * @signal_avg: avg signal strength, type depends on the wiphy's signal_type - NOTE: For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_. - * @txrate: current unicast bitrate from this station - * @rxrate: current unicast bitrate to this station - * @rx_packets: packets received from this station - * @tx_packets: packets transmitted to this station - * @tx_retries: cumulative retry counts - * @tx_failed: number of failed transmissions (retries exceeded, no ACK) - * @rx_dropped_misc: Dropped for un-specified reason. - * @bss_param: current BSS parameters - * @generation: generation number for nl80211 dumps. - * This number should increase every time the list of stations - * changes, i.e. when a station is added or removed, so that - * userspace can tell whether it got a consistent snapshot. - * @assoc_req_ies: IEs from (Re)Association Request. - * This is used only when in AP mode with drivers that do not use - * user space MLME/SME implementation. The information is provided for - * the cfg80211_new_sta() calls to notify user space of the IEs. - * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets. - * @sta_flags: station flags mask & values - * @beacon_loss_count: Number of times beacon loss event has triggered. - */ -struct station_info { - u32 filled; - u32 connected_time; - u32 inactive_time; - u32 rx_bytes; - u32 tx_bytes; - u16 llid; - u16 plid; - u8 plink_state; - s8 signal; - s8 signal_avg; - struct rate_info txrate; - struct rate_info rxrate; - u32 rx_packets; - u32 tx_packets; - u32 tx_retries; - u32 tx_failed; - u32 rx_dropped_misc; - struct sta_bss_parameters bss_param; - struct nl80211_sta_flag_update sta_flags; - - int generation; - - const u8 *assoc_req_ies; - size_t assoc_req_ies_len; - - u32 beacon_loss_count; - - /* - * Note: Add a new enum station_info_flags value for each new field and - * use it to check which fields are initialized. - */ -}; - -/** - * enum monitor_flags - monitor flags - * - * Monitor interface configuration flags. Note that these must be the bits - * according to the nl80211 flags. - * - * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS - * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP - * @MONITOR_FLAG_CONTROL: pass control frames - * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering - * @MONITOR_FLAG_COOK_FRAMES: report frames after processing - */ -enum monitor_flags { - MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL, - MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL, - MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL, - MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS, - MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES, -}; - -/** - * enum mpath_info_flags - mesh path information flags - * - * Used by the driver to indicate which info in &struct mpath_info it has filled - * in during get_station() or dump_station(). - * - * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled - * @MPATH_INFO_SN: @sn filled - * @MPATH_INFO_METRIC: @metric filled - * @MPATH_INFO_EXPTIME: @exptime filled - * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled - * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled - * @MPATH_INFO_FLAGS: @flags filled - */ -enum mpath_info_flags { - MPATH_INFO_FRAME_QLEN = BIT(0), - MPATH_INFO_SN = BIT(1), - MPATH_INFO_METRIC = BIT(2), - MPATH_INFO_EXPTIME = BIT(3), - MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4), - MPATH_INFO_DISCOVERY_RETRIES = BIT(5), - MPATH_INFO_FLAGS = BIT(6), -}; - -/** - * struct mpath_info - mesh path information - * - * Mesh path information filled by driver for get_mpath() and dump_mpath(). - * - * @filled: bitfield of flags from &enum mpath_info_flags - * @frame_qlen: number of queued frames for this destination - * @sn: target sequence number - * @metric: metric (cost) of this mesh path - * @exptime: expiration time for the mesh path from now, in msecs - * @flags: mesh path flags - * @discovery_timeout: total mesh path discovery timeout, in msecs - * @discovery_retries: mesh path discovery retries - * @generation: generation number for nl80211 dumps. - * This number should increase every time the list of mesh paths - * changes, i.e. when a station is added or removed, so that - * userspace can tell whether it got a consistent snapshot. - */ -struct mpath_info { - u32 filled; - u32 frame_qlen; - u32 sn; - u32 metric; - u32 exptime; - u32 discovery_timeout; - u8 discovery_retries; - u8 flags; - - int generation; -}; - -/** - * struct bss_parameters - BSS parameters - * - * Used to change BSS parameters (mainly for AP mode). - * - * @use_cts_prot: Whether to use CTS protection - * (0 = no, 1 = yes, -1 = do not change) - * @use_short_preamble: Whether the use of short preambles is allowed - * (0 = no, 1 = yes, -1 = do not change) - * @use_short_slot_time: Whether the use of short slot time is allowed - * (0 = no, 1 = yes, -1 = do not change) - * @basic_rates: basic rates in IEEE 802.11 format - * (or NULL for no change) - * @basic_rates_len: number of basic rates - * @ap_isolate: do not forward packets between connected stations - * @ht_opmode: HT Operation mode - * (u16 = opmode, -1 = do not change) - */ -struct bss_parameters { - int use_cts_prot; - int use_short_preamble; - int use_short_slot_time; - u8 *basic_rates; - u8 basic_rates_len; - int ap_isolate; - int ht_opmode; -}; - -/* - * struct mesh_config - 802.11s mesh configuration - * - * These parameters can be changed while the mesh is active. - */ -struct mesh_config { - /* Timeouts in ms */ - /* Mesh plink management parameters */ - u16 dot11MeshRetryTimeout; - u16 dot11MeshConfirmTimeout; - u16 dot11MeshHoldingTimeout; - u16 dot11MeshMaxPeerLinks; - u8 dot11MeshMaxRetries; - u8 dot11MeshTTL; - /* ttl used in path selection information elements */ - u8 element_ttl; - bool auto_open_plinks; - /* HWMP parameters */ - u8 dot11MeshHWMPmaxPREQretries; - u32 path_refresh_time; - u16 min_discovery_timeout; - u32 dot11MeshHWMPactivePathTimeout; - u16 dot11MeshHWMPpreqMinInterval; - u16 dot11MeshHWMPperrMinInterval; - u16 dot11MeshHWMPnetDiameterTraversalTime; - u8 dot11MeshHWMPRootMode; - u16 dot11MeshHWMPRannInterval; - /* This is missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol - * set to true only means that the station will announce others it's a - * mesh gate, but not necessarily using the gate announcement protocol. - * Still keeping the same nomenclature to be in sync with the spec. */ - bool dot11MeshGateAnnouncementProtocol; - bool dot11MeshForwarding; - s32 rssi_threshold; -}; - -/** - * struct mesh_setup - 802.11s mesh setup configuration - * @mesh_id: the mesh ID - * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes - * @path_sel_proto: which path selection protocol to use - * @path_metric: which metric to use - * @ie: vendor information elements (optional) - * @ie_len: length of vendor information elements - * @is_authenticated: this mesh requires authentication - * @is_secure: this mesh uses security - * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a] - * - * These parameters are fixed when the mesh is created. - */ -struct mesh_setup { - const u8 *mesh_id; - u8 mesh_id_len; - u8 path_sel_proto; - u8 path_metric; - const u8 *ie; - u8 ie_len; - bool is_authenticated; - bool is_secure; - int mcast_rate[IEEE80211_NUM_BANDS]; -}; - -/** - * struct ieee80211_txq_params - TX queue parameters - * @queue: TX queue identifier (NL80211_TXQ_Q_*) - * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled - * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range - * 1..32767] - * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range - * 1..32767] - * @aifs: Arbitration interframe space [0..255] - */ -struct ieee80211_txq_params { - enum nl80211_txq_q queue; - u16 txop; - u16 cwmin; - u16 cwmax; - u8 aifs; -}; - -/* from net/wireless.h */ -struct wiphy; - -/** - * DOC: Scanning and BSS list handling - * - * The scanning process itself is fairly simple, but cfg80211 offers quite - * a bit of helper functionality. To start a scan, the scan operation will - * be invoked with a scan definition. This scan definition contains the - * channels to scan, and the SSIDs to send probe requests for (including the - * wildcard, if desired). A passive scan is indicated by having no SSIDs to - * probe. Additionally, a scan request may contain extra information elements - * that should be added to the probe request. The IEs are guaranteed to be - * well-formed, and will not exceed the maximum length the driver advertised - * in the wiphy structure. - * - * When scanning finds a BSS, cfg80211 needs to be notified of that, because - * it is responsible for maintaining the BSS list; the driver should not - * maintain a list itself. For this notification, various functions exist. - * - * Since drivers do not maintain a BSS list, there are also a number of - * functions to search for a BSS and obtain information about it from the - * BSS structure cfg80211 maintains. The BSS list is also made available - * to userspace. - */ - -/** - * struct cfg80211_ssid - SSID description - * @ssid: the SSID - * @ssid_len: length of the ssid - */ -struct cfg80211_ssid { - u8 ssid[IEEE80211_MAX_SSID_LEN]; - u8 ssid_len; -}; - -/** - * struct cfg80211_scan_request - scan request description - * - * @ssids: SSIDs to scan for (active scan only) - * @n_ssids: number of SSIDs - * @channels: channels to scan on. - * @n_channels: total number of channels to scan - * @ie: optional information element(s) to add into Probe Request or %NULL - * @ie_len: length of ie in octets - * @rates: bitmap of rates to advertise for each band - * @wiphy: the wiphy this was for - * @dev: the interface - * @aborted: (internal) scan request was notified as aborted - * @no_cck: used to send probe requests at non CCK rate in 2GHz band - */ -struct cfg80211_scan_request { - struct cfg80211_ssid *ssids; - int n_ssids; - u32 n_channels; - const u8 *ie; - size_t ie_len; - - u32 rates[IEEE80211_NUM_BANDS]; - - /* internal */ - struct wiphy *wiphy; - struct net_device *dev; - bool aborted; - bool no_cck; - - /* keep last */ - struct ieee80211_channel *channels[0]; -}; - -/** - * struct cfg80211_match_set - sets of attributes to match - * - * @ssid: SSID to be matched - */ -struct cfg80211_match_set { - struct cfg80211_ssid ssid; -}; - -/** - * struct cfg80211_sched_scan_request - scheduled scan request description - * - * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) - * @n_ssids: number of SSIDs - * @n_channels: total number of channels to scan - * @interval: interval between each scheduled scan cycle - * @ie: optional information element(s) to add into Probe Request or %NULL - * @ie_len: length of ie in octets - * @match_sets: sets of parameters to be matched for a scan result - * entry to be considered valid and to be passed to the host - * (others are filtered out). - * If ommited, all results are passed. - * @n_match_sets: number of match sets - * @wiphy: the wiphy this was for - * @dev: the interface - * @channels: channels to scan - */ -struct cfg80211_sched_scan_request { - struct cfg80211_ssid *ssids; - int n_ssids; - u32 n_channels; - u32 interval; - const u8 *ie; - size_t ie_len; - struct cfg80211_match_set *match_sets; - int n_match_sets; - - /* internal */ - struct wiphy *wiphy; - struct net_device *dev; - - /* keep last */ - struct ieee80211_channel *channels[0]; -}; - -/** - * enum cfg80211_signal_type - signal type - * - * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available - * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) - * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 - */ -enum cfg80211_signal_type { - CFG80211_SIGNAL_TYPE_NONE, - CFG80211_SIGNAL_TYPE_MBM, - CFG80211_SIGNAL_TYPE_UNSPEC, -}; - -/** - * struct cfg80211_bss - BSS description - * - * This structure describes a BSS (which may also be a mesh network) - * for use in scan results and similar. - * - * @channel: channel this BSS is on - * @bssid: BSSID of the BSS - * @tsf: timestamp of last received update - * @beacon_interval: the beacon interval as from the frame - * @capability: the capability field in host byte order - * @information_elements: the information elements (Note that there - * is no guarantee that these are well-formed!); this is a pointer to - * either the beacon_ies or proberesp_ies depending on whether Probe - * Response frame has been received - * @len_information_elements: total length of the information elements - * @beacon_ies: the information elements from the last Beacon frame - * @len_beacon_ies: total length of the beacon_ies - * @proberesp_ies: the information elements from the last Probe Response frame - * @len_proberesp_ies: total length of the proberesp_ies - * @signal: signal strength value (type depends on the wiphy's signal_type) - * @free_priv: function pointer to free private data - * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes - */ -struct cfg80211_bss { - struct ieee80211_channel *channel; - - u8 bssid[ETH_ALEN]; - u64 tsf; - u16 beacon_interval; - u16 capability; - u8 *information_elements; - size_t len_information_elements; - u8 *beacon_ies; - size_t len_beacon_ies; - u8 *proberesp_ies; - size_t len_proberesp_ies; - - s32 signal; - - void (*free_priv)(struct cfg80211_bss *bss); - u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); -}; - -/** - * ieee80211_bss_get_ie - find IE with given ID - * @bss: the bss to search - * @ie: the IE ID - * Returns %NULL if not found. - */ -const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); - - -/** - * struct cfg80211_auth_request - Authentication request data - * - * This structure provides information needed to complete IEEE 802.11 - * authentication. - * - * @bss: The BSS to authenticate with. - * @auth_type: Authentication type (algorithm) - * @ie: Extra IEs to add to Authentication frame or %NULL - * @ie_len: Length of ie buffer in octets - * @key_len: length of WEP key for shared key authentication - * @key_idx: index of WEP key for shared key authentication - * @key: WEP key for shared key authentication - */ -struct cfg80211_auth_request { - struct cfg80211_bss *bss; - const u8 *ie; - size_t ie_len; - enum nl80211_auth_type auth_type; - const u8 *key; - u8 key_len, key_idx; -}; - -/** - * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association. - * - * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n) - */ -enum cfg80211_assoc_req_flags { - ASSOC_REQ_DISABLE_HT = BIT(0), -}; - -/** - * struct cfg80211_assoc_request - (Re)Association request data - * - * This structure provides information needed to complete IEEE 802.11 - * (re)association. - * @bss: The BSS to associate with. If the call is successful the driver - * is given a reference that it must release, normally via a call to - * cfg80211_send_rx_assoc(), or, if association timed out, with a - * call to cfg80211_put_bss() (in addition to calling - * cfg80211_send_assoc_timeout()) - * @ie: Extra IEs to add to (Re)Association Request frame or %NULL - * @ie_len: Length of ie buffer in octets - * @use_mfp: Use management frame protection (IEEE 802.11w) in this association - * @crypto: crypto settings - * @prev_bssid: previous BSSID, if not %NULL use reassociate frame - * @flags: See &enum cfg80211_assoc_req_flags - * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask - * will be used in ht_capa. Un-supported values will be ignored. - * @ht_capa_mask: The bits of ht_capa which are to be used. - */ -struct cfg80211_assoc_request { - struct cfg80211_bss *bss; - const u8 *ie, *prev_bssid; - size_t ie_len; - struct cfg80211_crypto_settings crypto; - bool use_mfp; - u32 flags; - struct ieee80211_ht_cap ht_capa; - struct ieee80211_ht_cap ht_capa_mask; -}; - -/** - * struct cfg80211_deauth_request - Deauthentication request data - * - * This structure provides information needed to complete IEEE 802.11 - * deauthentication. - * - * @bssid: the BSSID of the BSS to deauthenticate from - * @ie: Extra IEs to add to Deauthentication frame or %NULL - * @ie_len: Length of ie buffer in octets - * @reason_code: The reason code for the deauthentication - */ -struct cfg80211_deauth_request { - const u8 *bssid; - const u8 *ie; - size_t ie_len; - u16 reason_code; -}; - -/** - * struct cfg80211_disassoc_request - Disassociation request data - * - * This structure provides information needed to complete IEEE 802.11 - * disassocation. - * - * @bss: the BSS to disassociate from - * @ie: Extra IEs to add to Disassociation frame or %NULL - * @ie_len: Length of ie buffer in octets - * @reason_code: The reason code for the disassociation - * @local_state_change: This is a request for a local state only, i.e., no - * Disassociation frame is to be transmitted. - */ -struct cfg80211_disassoc_request { - struct cfg80211_bss *bss; - const u8 *ie; - size_t ie_len; - u16 reason_code; - bool local_state_change; -}; - -/** - * struct cfg80211_ibss_params - IBSS parameters - * - * This structure defines the IBSS parameters for the join_ibss() - * method. - * - * @ssid: The SSID, will always be non-null. - * @ssid_len: The length of the SSID, will always be non-zero. - * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not - * search for IBSSs with a different BSSID. - * @channel: The channel to use if no IBSS can be found to join. - * @channel_type: channel type (HT mode) - * @channel_fixed: The channel should be fixed -- do not search for - * IBSSs to join on other channels. - * @ie: information element(s) to include in the beacon - * @ie_len: length of that - * @beacon_interval: beacon interval to use - * @privacy: this is a protected network, keys will be configured - * after joining - * @control_port: whether user space controls IEEE 802.1X port, i.e., - * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is - * required to assume that the port is unauthorized until authorized by - * user space. Otherwise, port is marked authorized by default. - * @basic_rates: bitmap of basic rates to use when creating the IBSS - * @mcast_rate: per-band multicast rate index + 1 (0: disabled) - */ -struct cfg80211_ibss_params { - u8 *ssid; - u8 *bssid; - struct ieee80211_channel *channel; - enum nl80211_channel_type channel_type; - u8 *ie; - u8 ssid_len, ie_len; - u16 beacon_interval; - u32 basic_rates; - bool channel_fixed; - bool privacy; - bool control_port; - int mcast_rate[IEEE80211_NUM_BANDS]; -}; - -/** - * struct cfg80211_connect_params - Connection parameters - * - * This structure provides information needed to complete IEEE 802.11 - * authentication and association. - * - * @channel: The channel to use or %NULL if not specified (auto-select based - * on scan results) - * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan - * results) - * @ssid: SSID - * @ssid_len: Length of ssid in octets - * @auth_type: Authentication type (algorithm) - * @ie: IEs for association request - * @ie_len: Length of assoc_ie in octets - * @privacy: indicates whether privacy-enabled APs should be used - * @crypto: crypto settings - * @key_len: length of WEP key for shared key authentication - * @key_idx: index of WEP key for shared key authentication - * @key: WEP key for shared key authentication - * @flags: See &enum cfg80211_assoc_req_flags - * @bg_scan_period: Background scan period in seconds - * or -1 to indicate that default value is to be used. - * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask - * will be used in ht_capa. Un-supported values will be ignored. - * @ht_capa_mask: The bits of ht_capa which are to be used. - */ -struct cfg80211_connect_params { - struct ieee80211_channel *channel; - u8 *bssid; - u8 *ssid; - size_t ssid_len; - enum nl80211_auth_type auth_type; - u8 *ie; - size_t ie_len; - bool privacy; - struct cfg80211_crypto_settings crypto; - const u8 *key; - u8 key_len, key_idx; - u32 flags; - int bg_scan_period; - struct ieee80211_ht_cap ht_capa; - struct ieee80211_ht_cap ht_capa_mask; -}; - -/** - * enum wiphy_params_flags - set_wiphy_params bitfield values - * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed - * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed - * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed - * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed - * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed - */ -enum wiphy_params_flags { - WIPHY_PARAM_RETRY_SHORT = 1 << 0, - WIPHY_PARAM_RETRY_LONG = 1 << 1, - WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2, - WIPHY_PARAM_RTS_THRESHOLD = 1 << 3, - WIPHY_PARAM_COVERAGE_CLASS = 1 << 4, -}; - -/* - * cfg80211_bitrate_mask - masks for bitrate control - */ -struct cfg80211_bitrate_mask { - struct { - u32 legacy; - u8 mcs[IEEE80211_HT_MCS_MASK_LEN]; - } control[IEEE80211_NUM_BANDS]; -}; -/** - * struct cfg80211_pmksa - PMK Security Association - * - * This structure is passed to the set/del_pmksa() method for PMKSA - * caching. - * - * @bssid: The AP's BSSID. - * @pmkid: The PMK material itself. - */ -struct cfg80211_pmksa { - u8 *bssid; - u8 *pmkid; -}; - -/** - * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern - * @mask: bitmask where to match pattern and where to ignore bytes, - * one bit per byte, in same format as nl80211 - * @pattern: bytes to match where bitmask is 1 - * @pattern_len: length of pattern (in bytes) - * - * Internal note: @mask and @pattern are allocated in one chunk of - * memory, free @mask only! - */ -struct cfg80211_wowlan_trig_pkt_pattern { - u8 *mask, *pattern; - int pattern_len; -}; - -/** - * struct cfg80211_wowlan - Wake on Wireless-LAN support info - * - * This structure defines the enabled WoWLAN triggers for the device. - * @any: wake up on any activity -- special trigger if device continues - * operating as normal during suspend - * @disconnect: wake up if getting disconnected - * @magic_pkt: wake up on receiving magic packet - * @patterns: wake up on receiving packet matching a pattern - * @n_patterns: number of patterns - * @gtk_rekey_failure: wake up on GTK rekey failure - * @eap_identity_req: wake up on EAP identity request packet - * @four_way_handshake: wake up on 4-way handshake - * @rfkill_release: wake up when rfkill is released - */ -struct cfg80211_wowlan { - bool any, disconnect, magic_pkt, gtk_rekey_failure, - eap_identity_req, four_way_handshake, - rfkill_release; - struct cfg80211_wowlan_trig_pkt_pattern *patterns; - int n_patterns; -}; - -/** - * struct cfg80211_gtk_rekey_data - rekey data - * @kek: key encryption key - * @kck: key confirmation key - * @replay_ctr: replay counter - */ -struct cfg80211_gtk_rekey_data { - u8 kek[NL80211_KEK_LEN]; - u8 kck[NL80211_KCK_LEN]; - u8 replay_ctr[NL80211_REPLAY_CTR_LEN]; -}; - -/** - * struct cfg80211_ops - backend description for wireless configuration - * - * This struct is registered by fullmac card drivers and/or wireless stacks - * in order to handle configuration requests on their interfaces. - * - * All callbacks except where otherwise noted should return 0 - * on success or a negative error code. - * - * All operations are currently invoked under rtnl for consistency with the - * wireless extensions but this is subject to reevaluation as soon as this - * code is used more widely and we have a first user without wext. - * - * @suspend: wiphy device needs to be suspended. The variable @wow will - * be %NULL or contain the enabled Wake-on-Wireless triggers that are - * configured for the device. - * @resume: wiphy device needs to be resumed - * - * @add_virtual_intf: create a new virtual interface with the given name, - * must set the struct wireless_dev's iftype. Beware: You must create - * the new netdev in the wiphy's network namespace! Returns the netdev, - * or an ERR_PTR. - * - * @del_virtual_intf: remove the virtual interface determined by ifindex. - * - * @change_virtual_intf: change type/configuration of virtual interface, - * keep the struct wireless_dev's iftype updated. - * - * @add_key: add a key with the given parameters. @mac_addr will be %NULL - * when adding a group key. - * - * @get_key: get information about the key with the given parameters. - * @mac_addr will be %NULL when requesting information for a group - * key. All pointers given to the @callback function need not be valid - * after it returns. This function should return an error if it is - * not possible to retrieve the key, -ENOENT if it doesn't exist. - * - * @del_key: remove a key given the @mac_addr (%NULL for a group key) - * and @key_index, return -ENOENT if the key doesn't exist. - * - * @set_default_key: set the default key on an interface - * - * @set_default_mgmt_key: set the default management frame key on an interface - * - * @set_rekey_data: give the data necessary for GTK rekeying to the driver - * - * @start_ap: Start acting in AP mode defined by the parameters. - * @change_beacon: Change the beacon parameters for an access point mode - * interface. This should reject the call when AP mode wasn't started. - * @stop_ap: Stop being an AP, including stopping beaconing. - * - * @add_station: Add a new station. - * @del_station: Remove a station; @mac may be NULL to remove all stations. - * @change_station: Modify a given station. Note that flags changes are not much - * validated in cfg80211, in particular the auth/assoc/authorized flags - * might come to the driver in invalid combinations -- make sure to check - * them, also against the existing state! Also, supported_rates changes are - * not checked in station mode -- drivers need to reject (or ignore) them - * for anything but TDLS peers. - * @get_station: get station information for the station identified by @mac - * @dump_station: dump station callback -- resume dump at index @idx - * - * @add_mpath: add a fixed mesh path - * @del_mpath: delete a given mesh path - * @change_mpath: change a given mesh path - * @get_mpath: get a mesh path for the given parameters - * @dump_mpath: dump mesh path callback -- resume dump at index @idx - * @join_mesh: join the mesh network with the specified parameters - * @leave_mesh: leave the current mesh network - * - * @get_mesh_config: Get the current mesh configuration - * - * @update_mesh_config: Update mesh parameters on a running mesh. - * The mask is a bitfield which tells us which parameters to - * set, and which to leave alone. - * - * @change_bss: Modify parameters for a given BSS. - * - * @set_txq_params: Set TX queue parameters - * - * @set_channel: Set channel for a given wireless interface. Some devices - * may support multi-channel operation (by channel hopping) so cfg80211 - * doesn't verify much. Note, however, that the passed netdev may be - * %NULL as well if the user requested changing the channel for the - * device itself, or for a monitor interface. - * @get_channel: Get the current operating channel, should return %NULL if - * there's no single defined operating channel if for example the - * device implements channel hopping for multi-channel virtual interfaces. - * - * @scan: Request to do a scan. If returning zero, the scan request is given - * the driver, and will be valid until passed to cfg80211_scan_done(). - * For scan results, call cfg80211_inform_bss(); you can call this outside - * the scan/scan_done bracket too. - * - * @auth: Request to authenticate with the specified peer - * @assoc: Request to (re)associate with the specified peer - * @deauth: Request to deauthenticate from the specified peer - * @disassoc: Request to disassociate from the specified peer - * - * @connect: Connect to the ESS with the specified parameters. When connected, - * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. - * If the connection fails for some reason, call cfg80211_connect_result() - * with the status from the AP. - * @disconnect: Disconnect from the BSS/ESS. - * - * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call - * cfg80211_ibss_joined(), also call that function when changing BSSID due - * to a merge. - * @leave_ibss: Leave the IBSS. - * - * @set_wiphy_params: Notify that wiphy parameters have changed; - * @changed bitfield (see &enum wiphy_params_flags) describes which values - * have changed. The actual parameter values are available in - * struct wiphy. If returning an error, no value should be changed. - * - * @set_tx_power: set the transmit power according to the parameters, - * the power passed is in mBm, to get dBm use MBM_TO_DBM(). - * @get_tx_power: store the current TX power into the dbm variable; - * return 0 if successful - * - * @set_wds_peer: set the WDS peer for a WDS interface - * - * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting - * functions to adjust rfkill hw state - * - * @dump_survey: get site survey information. - * - * @remain_on_channel: Request the driver to remain awake on the specified - * channel for the specified duration to complete an off-channel - * operation (e.g., public action frame exchange). When the driver is - * ready on the requested channel, it must indicate this with an event - * notification by calling cfg80211_ready_on_channel(). - * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. - * This allows the operation to be terminated prior to timeout based on - * the duration value. - * @mgmt_tx: Transmit a management frame. - * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management - * frame on another channel - * - * @testmode_cmd: run a test mode command - * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be - * used by the function, but 0 and 1 must not be touched. Additionally, - * return error codes other than -ENOBUFS and -ENOENT will terminate the - * dump and return to userspace with an error, so be careful. If any data - * was passed in from userspace then the data/len arguments will be present - * and point to the data contained in %NL80211_ATTR_TESTDATA. - * - * @set_bitrate_mask: set the bitrate mask configuration - * - * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac - * devices running firmwares capable of generating the (re) association - * RSN IE. It allows for faster roaming between WPA2 BSSIDs. - * @del_pmksa: Delete a cached PMKID. - * @flush_pmksa: Flush all cached PMKIDs. - * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 - * allows the driver to adjust the dynamic ps timeout value. - * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. - * @sched_scan_start: Tell the driver to start a scheduled scan. - * @sched_scan_stop: Tell the driver to stop an ongoing scheduled - * scan. The driver_initiated flag specifies whether the driver - * itself has informed that the scan has stopped. - * - * @mgmt_frame_register: Notify driver that a management frame type was - * registered. Note that this callback may not sleep, and cannot run - * concurrently with itself. - * - * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. - * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may - * reject TX/RX mask combinations they cannot support by returning -EINVAL - * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). - * - * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). - * - * @set_ringparam: Set tx and rx ring sizes. - * - * @get_ringparam: Get tx and rx ring current and maximum sizes. - * - * @tdls_mgmt: Transmit a TDLS management frame. - * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup). - * - * @probe_client: probe an associated client, must return a cookie that it - * later passes to cfg80211_probe_status(). - * - * @set_noack_map: Set the NoAck Map for the TIDs. - */ -struct cfg80211_ops { - int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); - int (*resume)(struct wiphy *wiphy); - - struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, - char *name, - enum nl80211_iftype type, - u32 *flags, - struct vif_params *params); - int (*del_virtual_intf)(struct wiphy *wiphy, struct net_device *dev); - int (*change_virtual_intf)(struct wiphy *wiphy, - struct net_device *dev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params); - - int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool pairwise, const u8 *mac_addr, - struct key_params *params); - int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool pairwise, const u8 *mac_addr, - void *cookie, - void (*callback)(void *cookie, struct key_params*)); - int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, - u8 key_index, bool pairwise, const u8 *mac_addr); - int (*set_default_key)(struct wiphy *wiphy, - struct net_device *netdev, - u8 key_index, bool unicast, bool multicast); - int (*set_default_mgmt_key)(struct wiphy *wiphy, - struct net_device *netdev, - u8 key_index); - - int (*start_ap)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ap_settings *settings); - int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_beacon_data *info); - int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev); - - - int (*add_station)(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_parameters *params); - int (*del_station)(struct wiphy *wiphy, struct net_device *dev, - u8 *mac); - int (*change_station)(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_parameters *params); - int (*get_station)(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_info *sinfo); - int (*dump_station)(struct wiphy *wiphy, struct net_device *dev, - int idx, u8 *mac, struct station_info *sinfo); - - int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev, - u8 *dst, u8 *next_hop); - int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev, - u8 *dst); - int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev, - u8 *dst, u8 *next_hop); - int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev, - u8 *dst, u8 *next_hop, - struct mpath_info *pinfo); - int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev, - int idx, u8 *dst, u8 *next_hop, - struct mpath_info *pinfo); - int (*get_mesh_config)(struct wiphy *wiphy, - struct net_device *dev, - struct mesh_config *conf); - int (*update_mesh_config)(struct wiphy *wiphy, - struct net_device *dev, u32 mask, - const struct mesh_config *nconf); - int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev, - const struct mesh_config *conf, - const struct mesh_setup *setup); - int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev); - - int (*change_bss)(struct wiphy *wiphy, struct net_device *dev, - struct bss_parameters *params); - - int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev, - struct ieee80211_txq_params *params); - - int (*set_channel)(struct wiphy *wiphy, struct net_device *dev, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type); - - int (*scan)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_scan_request *request); - - int (*auth)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_auth_request *req); - int (*assoc)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_assoc_request *req); - int (*deauth)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_deauth_request *req); - int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_disassoc_request *req); - - int (*connect)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_connect_params *sme); - int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, - u16 reason_code); - - int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ibss_params *params); - int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); - - int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed); - - int (*set_tx_power)(struct wiphy *wiphy, - enum nl80211_tx_power_setting type, int mbm); - int (*get_tx_power)(struct wiphy *wiphy, int *dbm); - - int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, - const u8 *addr); - - void (*rfkill_poll)(struct wiphy *wiphy); - -#ifdef CONFIG_NL80211_TESTMODE - int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len); - int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb, - struct netlink_callback *cb, - void *data, int len); -#endif - - int (*set_bitrate_mask)(struct wiphy *wiphy, - struct net_device *dev, - const u8 *peer, - const struct cfg80211_bitrate_mask *mask); - - int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev, - int idx, struct survey_info *info); - - int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev, - struct cfg80211_pmksa *pmksa); - int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev, - struct cfg80211_pmksa *pmksa); - int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); - - int (*remain_on_channel)(struct wiphy *wiphy, - struct net_device *dev, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, - u64 *cookie); - int (*cancel_remain_on_channel)(struct wiphy *wiphy, - struct net_device *dev, - u64 cookie); - - int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev, - struct ieee80211_channel *chan, bool offchan, - enum nl80211_channel_type channel_type, - bool channel_type_valid, unsigned int wait, - const u8 *buf, size_t len, bool no_cck, - bool dont_wait_for_ack, u64 *cookie); - int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, - struct net_device *dev, - u64 cookie); - - int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, - bool enabled, int timeout); - - int (*set_cqm_rssi_config)(struct wiphy *wiphy, - struct net_device *dev, - s32 rssi_thold, u32 rssi_hyst); - - void (*mgmt_frame_register)(struct wiphy *wiphy, - struct net_device *dev, - u16 frame_type, bool reg); - - int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); - int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant); - - int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); - void (*get_ringparam)(struct wiphy *wiphy, - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); - - int (*sched_scan_start)(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_sched_scan_request *request); - int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); - - int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_gtk_rekey_data *data); - - int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev, - u8 *peer, u8 action_code, u8 dialog_token, - u16 status_code, const u8 *buf, size_t len); - int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev, - u8 *peer, enum nl80211_tdls_operation oper); - - int (*probe_client)(struct wiphy *wiphy, struct net_device *dev, - const u8 *peer, u64 *cookie); - - int (*set_noack_map)(struct wiphy *wiphy, - struct net_device *dev, - u16 noack_map); - - struct ieee80211_channel *(*get_channel)(struct wiphy *wiphy); -}; - -/* - * wireless hardware and networking interfaces structures - * and registration/helper functions - */ - -/** - * enum wiphy_flags - wiphy capability flags - * - * @WIPHY_FLAG_CUSTOM_REGULATORY: tells us the driver for this device - * has its own custom regulatory domain and cannot identify the - * ISO / IEC 3166 alpha2 it belongs to. When this is enabled - * we will disregard the first regulatory hint (when the - * initiator is %REGDOM_SET_BY_CORE). - * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will - * ignore regulatory domain settings until it gets its own regulatory - * domain via its regulatory_hint() unless the regulatory hint is - * from a country IE. After its gets its own regulatory domain it will - * only allow further regulatory domain settings to further enhance - * compliance. For example if channel 13 and 14 are disabled by this - * regulatory domain no user regulatory domain can enable these channels - * at a later time. This can be used for devices which do not have - * calibration information guaranteed for frequencies or settings - * outside of its regulatory domain. If used in combination with - * WIPHY_FLAG_CUSTOM_REGULATORY the inspected country IE power settings - * will be followed. - * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure - * that passive scan flags and beaconing flags may not be lifted by - * cfg80211 due to regulatory beacon hints. For more information on beacon - * hints read the documenation for regulatory_hint_found_beacon() - * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this - * wiphy at all - * @WIPHY_FLAG_ENFORCE_COMBINATIONS: Set this flag to enforce interface - * combinations for this device. This flag is used for backward - * compatibility only until all drivers advertise combinations and - * they will always be enforced. - * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled - * by default -- this flag will be set depending on the kernel's default - * on wiphy_new(), but can be changed by the driver if it has a good - * reason to override the default - * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station - * on a VLAN interface) - * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station - * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the - * control port protocol ethertype. The device also honours the - * control_port_no_encrypt flag. - * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. - * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing - * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. - * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans. - * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the - * firmware. - * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP. - * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation. - * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z) - * link setup/discovery operations internally. Setup, discovery and - * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT - * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be - * used for asking the driver/firmware to perform a TDLS operation. - * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME - * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes - * when there are virtual interfaces in AP mode by calling - * cfg80211_report_obss_beacon(). - * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device - * responds to probe-requests in hardware. - * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. - * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. - */ -enum wiphy_flags { - WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), - WIPHY_FLAG_STRICT_REGULATORY = BIT(1), - WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), - WIPHY_FLAG_NETNS_OK = BIT(3), - WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), - WIPHY_FLAG_4ADDR_AP = BIT(5), - WIPHY_FLAG_4ADDR_STATION = BIT(6), - WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), - WIPHY_FLAG_IBSS_RSN = BIT(8), - WIPHY_FLAG_MESH_AUTH = BIT(10), - WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), - WIPHY_FLAG_ENFORCE_COMBINATIONS = BIT(12), - WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13), - WIPHY_FLAG_AP_UAPSD = BIT(14), - WIPHY_FLAG_SUPPORTS_TDLS = BIT(15), - WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16), - WIPHY_FLAG_HAVE_AP_SME = BIT(17), - WIPHY_FLAG_REPORTS_OBSS = BIT(18), - WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), - WIPHY_FLAG_OFFCHAN_TX = BIT(20), - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), -}; - -/** - * struct ieee80211_iface_limit - limit on certain interface types - * @max: maximum number of interfaces of these types - * @types: interface types (bits) - */ -struct ieee80211_iface_limit { - u16 max; - u16 types; -}; - -/** - * struct ieee80211_iface_combination - possible interface combination - * @limits: limits for the given interface types - * @n_limits: number of limitations - * @num_different_channels: can use up to this many different channels - * @max_interfaces: maximum number of interfaces in total allowed in this - * group - * @beacon_int_infra_match: In this combination, the beacon intervals - * between infrastructure and AP types must match. This is required - * only in special cases. - * - * These examples can be expressed as follows: - * - * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: - * - * struct ieee80211_iface_limit limits1[] = { - * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, - * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, - * }; - * struct ieee80211_iface_combination combination1 = { - * .limits = limits1, - * .n_limits = ARRAY_SIZE(limits1), - * .max_interfaces = 2, - * .beacon_int_infra_match = true, - * }; - * - * - * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: - * - * struct ieee80211_iface_limit limits2[] = { - * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | - * BIT(NL80211_IFTYPE_P2P_GO), }, - * }; - * struct ieee80211_iface_combination combination2 = { - * .limits = limits2, - * .n_limits = ARRAY_SIZE(limits2), - * .max_interfaces = 8, - * .num_different_channels = 1, - * }; - * - * - * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. - * This allows for an infrastructure connection and three P2P connections. - * - * struct ieee80211_iface_limit limits3[] = { - * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, - * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | - * BIT(NL80211_IFTYPE_P2P_CLIENT), }, - * }; - * struct ieee80211_iface_combination combination3 = { - * .limits = limits3, - * .n_limits = ARRAY_SIZE(limits3), - * .max_interfaces = 4, - * .num_different_channels = 2, - * }; - */ -struct ieee80211_iface_combination { - const struct ieee80211_iface_limit *limits; - u32 num_different_channels; - u16 max_interfaces; - u8 n_limits; - bool beacon_int_infra_match; -}; - -struct mac_address { - u8 addr[ETH_ALEN]; -}; - -struct ieee80211_txrx_stypes { - u16 tx, rx; -}; - -/** - * enum wiphy_wowlan_support_flags - WoWLAN support flags - * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" - * trigger that keeps the device operating as-is and - * wakes up the host on any activity, for example a - * received packet that passed filtering; note that the - * packet should be preserved in that case - * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet - * (see nl80211.h) - * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect - * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep - * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure - * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request - * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure - * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release - */ -enum wiphy_wowlan_support_flags { - WIPHY_WOWLAN_ANY = BIT(0), - WIPHY_WOWLAN_MAGIC_PKT = BIT(1), - WIPHY_WOWLAN_DISCONNECT = BIT(2), - WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3), - WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4), - WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5), - WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6), - WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7), -}; - -/** - * struct wiphy_wowlan_support - WoWLAN support data - * @flags: see &enum wiphy_wowlan_support_flags - * @n_patterns: number of supported wakeup patterns - * (see nl80211.h for the pattern definition) - * @pattern_max_len: maximum length of each pattern - * @pattern_min_len: minimum length of each pattern - */ -struct wiphy_wowlan_support { - u32 flags; - int n_patterns; - int pattern_max_len; - int pattern_min_len; -}; - -/** - * struct wiphy - wireless hardware description - * @reg_notifier: the driver's regulatory notification callback, - * note that if your driver uses wiphy_apply_custom_regulatory() - * the reg_notifier's request can be passed as NULL - * @regd: the driver's regulatory domain, if one was requested via - * the regulatory_hint() API. This can be used by the driver - * on the reg_notifier() if it chooses to ignore future - * regulatory domain changes caused by other drivers. - * @signal_type: signal type reported in &struct cfg80211_bss. - * @cipher_suites: supported cipher suites - * @n_cipher_suites: number of supported cipher suites - * @retry_short: Retry limit for short frames (dot11ShortRetryLimit) - * @retry_long: Retry limit for long frames (dot11LongRetryLimit) - * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold); - * -1 = fragmentation disabled, only odd values >= 256 used - * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled - * @dot11OCBActivated: the OCB mode is activated or not (IEEE 802.11p mode) [1 - dot11p ; 0 - not dot11p] - * @_net: the network namespace this wiphy currently lives in - * @perm_addr: permanent MAC address of this device - * @addr_mask: If the device supports multiple MAC addresses by masking, - * set this to a mask with variable bits set to 1, e.g. if the last - * four bits are variable then set it to 00:...:00:0f. The actual - * variable bits shall be determined by the interfaces added, with - * interfaces not matching the mask being rejected to be brought up. - * @n_addresses: number of addresses in @addresses. - * @addresses: If the device has more than one address, set this pointer - * to a list of addresses (6 bytes each). The first one will be used - * by default for perm_addr. In this case, the mask should be set to - * all-zeroes. In this case it is assumed that the device can handle - * the same number of arbitrary MAC addresses. - * @registered: protects ->resume and ->suspend sysfs callbacks against - * unregister hardware - * @debugfsdir: debugfs directory used for this wiphy, will be renamed - * automatically on wiphy renames - * @dev: (virtual) struct device for this wiphy - * @registered: helps synchronize suspend/resume with wiphy unregister - * @wext: wireless extension handlers - * @priv: driver private data (sized according to wiphy_new() parameter) - * @interface_modes: bitmask of interfaces types valid for this wiphy, - * must be set by driver - * @iface_combinations: Valid interface combinations array, should not - * list single interface types. - * @n_iface_combinations: number of entries in @iface_combinations array. - * @software_iftypes: bitmask of software interface types, these are not - * subject to any restrictions since they are purely managed in SW. - * @flags: wiphy flags, see &enum wiphy_flags - * @features: features advertised to nl80211, see &enum nl80211_feature_flags. - * @bss_priv_size: each BSS struct has private data allocated with it, - * this variable determines its size - * @max_scan_ssids: maximum number of SSIDs the device can scan for in - * any given scan - * @max_sched_scan_ssids: maximum number of SSIDs the device can scan - * for in any given scheduled scan - * @max_match_sets: maximum number of match sets the device can handle - * when performing a scheduled scan, 0 if filtering is not - * supported. - * @max_scan_ie_len: maximum length of user-controlled IEs device can - * add to probe request frames transmitted during a scan, must not - * include fixed IEs like supported rates - * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled - * scans - * @coverage_class: current coverage class - * @fw_version: firmware version for ethtool reporting - * @hw_version: hardware version for ethtool reporting - * @max_num_pmkids: maximum number of PMKIDs supported by device - * @privid: a pointer that drivers can use to identify if an arbitrary - * wiphy is theirs, e.g. in global notifiers - * @bands: information about bands/channels supported by this device - * - * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or - * transmitted through nl80211, points to an array indexed by interface - * type - * - * @available_antennas_tx: bitmap of antennas which are available to be - * configured as TX antennas. Antenna configuration commands will be - * rejected unless this or @available_antennas_rx is set. - * - * @available_antennas_rx: bitmap of antennas which are available to be - * configured as RX antennas. Antenna configuration commands will be - * rejected unless this or @available_antennas_tx is set. - * - * @probe_resp_offload: - * Bitmap of supported protocols for probe response offloading. - * See &enum nl80211_probe_resp_offload_support_attr. Only valid - * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. - * - * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation - * may request, if implemented. - * - * @wowlan: WoWLAN support information - * - * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features. - * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden. - * If null, then none can be over-ridden. - */ -struct wiphy { - /* assign these fields before you register the wiphy */ - -#define WIPHY_COMPAT_PAD_SIZE 2048 - u8 padding[WIPHY_COMPAT_PAD_SIZE]; - - /* permanent MAC address(es) */ - u8 perm_addr[ETH_ALEN]; - u8 addr_mask[ETH_ALEN]; - - struct mac_address *addresses; - - const struct ieee80211_txrx_stypes *mgmt_stypes; - - const struct ieee80211_iface_combination *iface_combinations; - int n_iface_combinations; - u16 software_iftypes; - - u16 n_addresses; - - /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ - u16 interface_modes; - - u32 flags, features; - - u32 ap_sme_capa; - - enum cfg80211_signal_type signal_type; - - int bss_priv_size; - u8 max_scan_ssids; - u8 max_sched_scan_ssids; - u8 max_match_sets; - u16 max_scan_ie_len; - u16 max_sched_scan_ie_len; - - int n_cipher_suites; - const u32 *cipher_suites; - - u8 retry_short; - u8 retry_long; - u32 frag_threshold; - u32 rts_threshold; - u8 coverage_class; - - bool dot11OCBActivated; // [1 - dot11p ; 0 - not dot11p] - - char fw_version[ETHTOOL_BUSINFO_LEN]; - u32 hw_version; - - struct wiphy_wowlan_support wowlan; - - u16 max_remain_on_channel_duration; - - u8 max_num_pmkids; - - u32 available_antennas_tx; - u32 available_antennas_rx; - - /* - * Bitmap of supported protocols for probe response offloading - * see &enum nl80211_probe_resp_offload_support_attr. Only valid - * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set. - */ - u32 probe_resp_offload; - - /* If multiple wiphys are registered and you're handed e.g. - * a regular netdev with assigned ieee80211_ptr, you won't - * know whether it points to a wiphy your driver has registered - * or not. Assign this to something global to your driver to - * help determine whether you own this wiphy or not. */ - const void *privid; - - struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS]; - - /* Lets us get back the wiphy on the callback */ - int (*reg_notifier)(struct wiphy *wiphy, - struct regulatory_request *request); - - /* fields below are read-only, assigned by cfg80211 */ - - const struct ieee80211_regdomain *regd; - - /* the item in /sys/class/ieee80211/ points to this, - * you need use set_wiphy_dev() (see below) */ - struct device dev; - - /* protects ->resume, ->suspend sysfs callbacks against unregister hw */ - bool registered; - - /* dir in debugfs: ieee80211/<wiphyname> */ - struct dentry *debugfsdir; - - const struct ieee80211_ht_cap *ht_capa_mod_mask; - -#ifdef CONFIG_NET_NS - /* the network namespace this phy lives in currently */ - struct net *_net; -#endif - -#ifdef CONFIG_CFG80211_WEXT - const struct iw_handler_def *wext; -#endif - - char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); -}; - -static inline struct net *wiphy_net(struct wiphy *wiphy) -{ - return read_pnet(&wiphy->_net); -} - -static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net) -{ - write_pnet(&wiphy->_net, net); -} - -/** - * wiphy_priv - return priv from wiphy - * - * @wiphy: the wiphy whose priv pointer to return - */ -static inline void *wiphy_priv(struct wiphy *wiphy) -{ - BUG_ON(!wiphy); - return &wiphy->priv; -} - -/** - * priv_to_wiphy - return the wiphy containing the priv - * - * @priv: a pointer previously returned by wiphy_priv - */ -static inline struct wiphy *priv_to_wiphy(void *priv) -{ - BUG_ON(!priv); - return container_of(priv, struct wiphy, priv); -} - -/** - * set_wiphy_dev - set device pointer for wiphy - * - * @wiphy: The wiphy whose device to bind - * @dev: The device to parent it to - */ -static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev) -{ - wiphy->dev.parent = dev; -} - -/** - * wiphy_dev - get wiphy dev pointer - * - * @wiphy: The wiphy whose device struct to look up - */ -static inline struct device *wiphy_dev(struct wiphy *wiphy) -{ - return wiphy->dev.parent; -} - -/** - * wiphy_name - get wiphy name - * - * @wiphy: The wiphy whose name to return - */ -static inline const char *wiphy_name(const struct wiphy *wiphy) -{ - return dev_name(&wiphy->dev); -} - -/** - * wiphy_new - create a new wiphy for use with cfg80211 - * - * @ops: The configuration operations for this device - * @sizeof_priv: The size of the private area to allocate - * - * Create a new wiphy and associate the given operations with it. - * @sizeof_priv bytes are allocated for private use. - * - * The returned pointer must be assigned to each netdev's - * ieee80211_ptr for proper operation. - */ -struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv); - -/** - * wiphy_register - register a wiphy with cfg80211 - * - * @wiphy: The wiphy to register. - * - * Returns a non-negative wiphy index or a negative error code. - */ -extern int wiphy_register(struct wiphy *wiphy); - -/** - * wiphy_unregister - deregister a wiphy from cfg80211 - * - * @wiphy: The wiphy to unregister. - * - * After this call, no more requests can be made with this priv - * pointer, but the call may sleep to wait for an outstanding - * request that is being handled. - */ -extern void wiphy_unregister(struct wiphy *wiphy); - -/** - * wiphy_free - free wiphy - * - * @wiphy: The wiphy to free - */ -extern void wiphy_free(struct wiphy *wiphy); - -/* internal structs */ -struct cfg80211_conn; -struct cfg80211_internal_bss; -struct cfg80211_cached_keys; - -/** - * struct wireless_dev - wireless per-netdev state - * - * This structure must be allocated by the driver/stack - * that uses the ieee80211_ptr field in struct net_device - * (this is intentional so it can be allocated along with - * the netdev.) - * - * @wiphy: pointer to hardware description - * @iftype: interface type - * @list: (private) Used to collect the interfaces - * @netdev: (private) Used to reference back to the netdev - * @current_bss: (private) Used by the internal configuration code - * @channel: (private) Used by the internal configuration code to track - * user-set AP, monitor and WDS channels for wireless extensions - * @bssid: (private) Used by the internal configuration code - * @ssid: (private) Used by the internal configuration code - * @ssid_len: (private) Used by the internal configuration code - * @mesh_id_len: (private) Used by the internal configuration code - * @mesh_id_up_len: (private) Used by the internal configuration code - * @wext: (private) Used by the internal wireless extensions compat code - * @use_4addr: indicates 4addr mode is used on this interface, must be - * set by driver (if supported) on add_interface BEFORE registering the - * netdev and may otherwise be used by driver read-only, will be update - * by cfg80211 on change_interface - * @mgmt_registrations: list of registrations for management frames - * @mgmt_registrations_lock: lock for the list - * @mtx: mutex used to lock data in this struct - * @cleanup_work: work struct used for cleanup that can't be done directly - * @beacon_interval: beacon interval used on this device for transmitting - * beacons, 0 when not valid - */ -struct wireless_dev { - struct wiphy *wiphy; - enum nl80211_iftype iftype; - - /* the remainder of this struct should be private to cfg80211 */ - struct list_head list; - struct net_device *netdev; - - struct list_head mgmt_registrations; - spinlock_t mgmt_registrations_lock; - - struct mutex mtx; - - struct work_struct cleanup_work; - - bool use_4addr; - - /* currently used for IBSS and SME - might be rearranged later */ - u8 ssid[IEEE80211_MAX_SSID_LEN]; - u8 ssid_len, mesh_id_len, mesh_id_up_len; - enum { - CFG80211_SME_IDLE, - CFG80211_SME_CONNECTING, - CFG80211_SME_CONNECTED, - } sme_state; - struct cfg80211_conn *conn; - struct cfg80211_cached_keys *connect_keys; - - struct list_head event_list; - spinlock_t event_lock; - - struct cfg80211_internal_bss *current_bss; /* associated / joined */ - struct ieee80211_channel *channel; - - bool ps; - int ps_timeout; - - int beacon_interval; - - u32 ap_unexpected_nlpid; - -#ifdef CONFIG_CFG80211_WEXT - /* wext data */ - struct { - struct cfg80211_ibss_params ibss; - struct cfg80211_connect_params connect; - struct cfg80211_cached_keys *keys; - u8 *ie; - size_t ie_len; - u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - s8 default_key, default_mgmt_key; - bool prev_bssid_valid; - } wext; -#endif -}; - -/** - * wdev_priv - return wiphy priv from wireless_dev - * - * @wdev: The wireless device whose wiphy's priv pointer to return - */ -static inline void *wdev_priv(struct wireless_dev *wdev) -{ - BUG_ON(!wdev); - return wiphy_priv(wdev->wiphy); -} - -/** - * DOC: Utility functions - * - * cfg80211 offers a number of utility functions that can be useful. - */ - -/** - * ieee80211_channel_to_frequency - convert channel number to frequency - * @chan: channel number - * @band: band, necessary due to channel number overlap - */ -extern int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band); - -/** - * ieee80211_frequency_to_channel - convert frequency to channel number - * @freq: center frequency - */ -extern int ieee80211_frequency_to_channel(int freq); - -/* - * Name indirection necessary because the ieee80211 code also has - * a function named "ieee80211_get_channel", so if you include - * cfg80211's header file you get cfg80211's version, if you try - * to include both header files you'll (rightfully!) get a symbol - * clash. - */ -extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, - int freq); -/** - * ieee80211_get_channel - get channel struct from wiphy for specified frequency - * @wiphy: the struct wiphy to get the channel for - * @freq: the center frequency of the channel - */ -static inline struct ieee80211_channel * -ieee80211_get_channel(struct wiphy *wiphy, int freq) -{ - return __ieee80211_get_channel(wiphy, freq); -} - -/** - * ieee80211_get_response_rate - get basic rate for a given rate - * - * @sband: the band to look for rates in - * @basic_rates: bitmap of basic rates - * @bitrate: the bitrate for which to find the basic rate - * - * This function returns the basic rate corresponding to a given - * bitrate, that is the next lower bitrate contained in the basic - * rate map, which is, for this function, given as a bitmap of - * indices of rates in the band's bitrate table. - */ -struct ieee80211_rate * -ieee80211_get_response_rate(struct ieee80211_supported_band *sband, - u32 basic_rates, int bitrate); - -/* - * Radiotap parsing functions -- for controlled injection support - * - * Implemented in net/wireless/radiotap.c - * Documentation in Documentation/networking/radiotap-headers.txt - */ - -struct radiotap_align_size { - uint8_t align:4, size:4; -}; - -struct ieee80211_radiotap_namespace { - const struct radiotap_align_size *align_size; - int n_bits; - uint32_t oui; - uint8_t subns; -}; - -struct ieee80211_radiotap_vendor_namespaces { - const struct ieee80211_radiotap_namespace *ns; - int n_ns; -}; - -/** - * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args - * @this_arg_index: index of current arg, valid after each successful call - * to ieee80211_radiotap_iterator_next() - * @this_arg: pointer to current radiotap arg; it is valid after each - * call to ieee80211_radiotap_iterator_next() but also after - * ieee80211_radiotap_iterator_init() where it will point to - * the beginning of the actual data portion - * @this_arg_size: length of the current arg, for convenience - * @current_namespace: pointer to the current namespace definition - * (or internally %NULL if the current namespace is unknown) - * @is_radiotap_ns: indicates whether the current namespace is the default - * radiotap namespace or not - * - * @_rtheader: pointer to the radiotap header we are walking through - * @_max_length: length of radiotap header in cpu byte ordering - * @_arg_index: next argument index - * @_arg: next argument pointer - * @_next_bitmap: internal pointer to next present u32 - * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present - * @_vns: vendor namespace definitions - * @_next_ns_data: beginning of the next namespace's data - * @_reset_on_ext: internal; reset the arg index to 0 when going to the - * next bitmap word - * - * Describes the radiotap parser state. Fields prefixed with an underscore - * must not be used by users of the parser, only by the parser internally. - */ - -struct ieee80211_radiotap_iterator { - struct ieee80211_radiotap_header *_rtheader; - const struct ieee80211_radiotap_vendor_namespaces *_vns; - const struct ieee80211_radiotap_namespace *current_namespace; - - unsigned char *_arg, *_next_ns_data; - __le32 *_next_bitmap; - - unsigned char *this_arg; - int this_arg_index; - int this_arg_size; - - int is_radiotap_ns; - - int _max_length; - int _arg_index; - uint32_t _bitmap_shifter; - int _reset_on_ext; -}; - -extern int ieee80211_radiotap_iterator_init( - struct ieee80211_radiotap_iterator *iterator, - struct ieee80211_radiotap_header *radiotap_header, - int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns); - -extern int ieee80211_radiotap_iterator_next( - struct ieee80211_radiotap_iterator *iterator); - - -extern const unsigned char rfc1042_header[6]; -extern const unsigned char bridge_tunnel_header[6]; - -/** - * ieee80211_get_hdrlen_from_skb - get header length from data - * - * Given an skb with a raw 802.11 header at the data pointer this function - * returns the 802.11 header length in bytes (not including encryption - * headers). If the data in the sk_buff is too short to contain a valid 802.11 - * header the function returns 0. - * - * @skb: the frame - */ -unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); - -/** - * ieee80211_hdrlen - get header length in bytes from frame control - * @fc: frame control field in little-endian format - */ -unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); - -/** - * DOC: Data path helpers - * - * In addition to generic utilities, cfg80211 also offers - * functions that help implement the data path for devices - * that do not do the 802.11/802.3 conversion on the device. - */ - -/** - * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 - * @skb: the 802.11 data frame - * @addr: the device MAC address - * @iftype: the virtual interface type - */ -int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, - enum nl80211_iftype iftype); - -/** - * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11 - * @skb: the 802.3 frame - * @addr: the device MAC address - * @iftype: the virtual interface type - * @bssid: the network bssid (used only for iftype STATION and ADHOC) - * @qos: build 802.11 QoS data frame - */ -int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, - enum nl80211_iftype iftype, u8 *bssid, bool qos); - -/** - * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame - * - * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of - * 802.3 frames. The @list will be empty if the decode fails. The - * @skb is consumed after the function returns. - * - * @skb: The input IEEE 802.11n A-MSDU frame. - * @list: The output list of 802.3 frames. It must be allocated and - * initialized by by the caller. - * @addr: The device MAC address. - * @iftype: The device interface type. - * @extra_headroom: The hardware extra headroom for SKBs in the @list. - * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. - */ -void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, - const u8 *addr, enum nl80211_iftype iftype, - const unsigned int extra_headroom, - bool has_80211_header); - -/** - * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame - * @skb: the data frame - */ -unsigned int cfg80211_classify8021d(struct sk_buff *skb); - -/** - * cfg80211_find_ie - find information element in data - * - * @eid: element ID - * @ies: data consisting of IEs - * @len: length of data - * - * This function will return %NULL if the element ID could - * not be found or if the element is invalid (claims to be - * longer than the given data), or a pointer to the first byte - * of the requested element, that is the byte containing the - * element ID. There are no checks on the element length - * other than having to fit into the given data. - */ -const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); - -/** - * cfg80211_find_vendor_ie - find vendor specific information element in data - * - * @oui: vendor OUI - * @oui_type: vendor-specific OUI type - * @ies: data consisting of IEs - * @len: length of data - * - * This function will return %NULL if the vendor specific element ID - * could not be found or if the element is invalid (claims to be - * longer than the given data), or a pointer to the first byte - * of the requested element, that is the byte containing the - * element ID. There are no checks on the element length - * other than having to fit into the given data. - */ -const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, - const u8 *ies, int len); - -/** - * DOC: Regulatory enforcement infrastructure - * - * TODO - */ - -/** - * regulatory_hint - driver hint to the wireless core a regulatory domain - * @wiphy: the wireless device giving the hint (used only for reporting - * conflicts) - * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain - * should be in. If @rd is set this should be NULL. Note that if you - * set this to NULL you should still set rd->alpha2 to some accepted - * alpha2. - * - * Wireless drivers can use this function to hint to the wireless core - * what it believes should be the current regulatory domain by - * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory - * domain should be in or by providing a completely build regulatory domain. - * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried - * for a regulatory domain structure for the respective country. - * - * The wiphy must have been registered to cfg80211 prior to this call. - * For cfg80211 drivers this means you must first use wiphy_register(), - * for mac80211 drivers you must first use ieee80211_register_hw(). - * - * Drivers should check the return value, its possible you can get - * an -ENOMEM. - */ -extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); - -/** - * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain - * @wiphy: the wireless device we want to process the regulatory domain on - * @regd: the custom regulatory domain to use for this wiphy - * - * Drivers can sometimes have custom regulatory domains which do not apply - * to a specific country. Drivers can use this to apply such custom regulatory - * domains. This routine must be called prior to wiphy registration. The - * custom regulatory domain will be trusted completely and as such previous - * default channel settings will be disregarded. If no rule is found for a - * channel on the regulatory domain the channel will be disabled. - */ -extern void wiphy_apply_custom_regulatory( - struct wiphy *wiphy, - const struct ieee80211_regdomain *regd); - -/** - * freq_reg_info - get regulatory information for the given frequency - * @wiphy: the wiphy for which we want to process this rule for - * @center_freq: Frequency in KHz for which we want regulatory information for - * @desired_bw_khz: the desired max bandwidth you want to use per - * channel. Note that this is still 20 MHz if you want to use HT40 - * as HT40 makes use of two channels for its 40 MHz width bandwidth. - * If set to 0 we'll assume you want the standard 20 MHz. - * @reg_rule: the regulatory rule which we have for this frequency - * - * Use this function to get the regulatory rule for a specific frequency on - * a given wireless device. If the device has a specific regulatory domain - * it wants to follow we respect that unless a country IE has been received - * and processed already. - * - * Returns 0 if it was able to find a valid regulatory rule which does - * apply to the given center_freq otherwise it returns non-zero. It will - * also return -ERANGE if we determine the given center_freq does not even have - * a regulatory rule for a frequency range in the center_freq's band. See - * freq_in_rule_band() for our current definition of a band -- this is purely - * subjective and right now its 802.11 specific. - */ -extern int freq_reg_info(struct wiphy *wiphy, - u32 center_freq, - u32 desired_bw_khz, - const struct ieee80211_reg_rule **reg_rule); - -/* - * callbacks for asynchronous cfg80211 methods, notification - * functions and BSS handling helpers - */ - -/** - * cfg80211_scan_done - notify that scan finished - * - * @request: the corresponding scan request - * @aborted: set to true if the scan was aborted for any reason, - * userspace will be notified of that - */ -void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); - -/** - * cfg80211_sched_scan_results - notify that new scan results are available - * - * @wiphy: the wiphy which got scheduled scan results - */ -void cfg80211_sched_scan_results(struct wiphy *wiphy); - -/** - * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped - * - * @wiphy: the wiphy on which the scheduled scan stopped - * - * The driver can call this function to inform cfg80211 that the - * scheduled scan had to be stopped, for whatever reason. The driver - * is then called back via the sched_scan_stop operation when done. - */ -void cfg80211_sched_scan_stopped(struct wiphy *wiphy); - -/** - * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame - * - * @wiphy: the wiphy reporting the BSS - * @channel: The channel the frame was received on - * @mgmt: the management frame (probe response or beacon) - * @len: length of the management frame - * @signal: the signal strength, type depends on the wiphy's signal_type - * @gfp: context flags - * - * This informs cfg80211 that BSS information was found and - * the BSS should be updated/added. - * - * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()! - */ -struct cfg80211_bss * __must_check -cfg80211_inform_bss_frame(struct wiphy *wiphy, - struct ieee80211_channel *channel, - struct ieee80211_mgmt *mgmt, size_t len, - s32 signal, gfp_t gfp); - -/** - * cfg80211_inform_bss - inform cfg80211 of a new BSS - * - * @wiphy: the wiphy reporting the BSS - * @channel: The channel the frame was received on - * @bssid: the BSSID of the BSS - * @tsf: the TSF sent by the peer in the beacon/probe response (or 0) - * @capability: the capability field sent by the peer - * @beacon_interval: the beacon interval announced by the peer - * @ie: additional IEs sent by the peer - * @ielen: length of the additional IEs - * @signal: the signal strength, type depends on the wiphy's signal_type - * @gfp: context flags - * - * This informs cfg80211 that BSS information was found and - * the BSS should be updated/added. - * - * NOTE: Returns a referenced struct, must be released with cfg80211_put_bss()! - */ -struct cfg80211_bss * __must_check -cfg80211_inform_bss(struct wiphy *wiphy, - struct ieee80211_channel *channel, - const u8 *bssid, u64 tsf, u16 capability, - u16 beacon_interval, const u8 *ie, size_t ielen, - s32 signal, gfp_t gfp); - -struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, - struct ieee80211_channel *channel, - const u8 *bssid, - const u8 *ssid, size_t ssid_len, - u16 capa_mask, u16 capa_val); -static inline struct cfg80211_bss * -cfg80211_get_ibss(struct wiphy *wiphy, - struct ieee80211_channel *channel, - const u8 *ssid, size_t ssid_len) -{ - return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len, - WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); -} - -struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, - struct ieee80211_channel *channel, - const u8 *meshid, size_t meshidlen, - const u8 *meshcfg); -/** - * cfg80211_ref_bss - reference BSS struct - * @bss: the BSS struct to reference - * - * Increments the refcount of the given BSS struct. - */ -void cfg80211_ref_bss(struct cfg80211_bss *bss); - -/** - * cfg80211_put_bss - unref BSS struct - * @bss: the BSS struct - * - * Decrements the refcount of the given BSS struct. - */ -void cfg80211_put_bss(struct cfg80211_bss *bss); - -/** - * cfg80211_unlink_bss - unlink BSS from internal data structures - * @wiphy: the wiphy - * @bss: the bss to remove - * - * This function removes the given BSS from the internal data structures - * thereby making it no longer show up in scan results etc. Use this - * function when you detect a BSS is gone. Normally BSSes will also time - * out, so it is not necessary to use this function at all. - */ -void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss); - -/** - * cfg80211_send_rx_auth - notification of processed authentication - * @dev: network device - * @buf: authentication frame (header + body) - * @len: length of the frame data - * - * This function is called whenever an authentication has been processed in - * station mode. The driver is required to call either this function or - * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth() - * call. This function may sleep. - */ -void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); - -/** - * cfg80211_send_auth_timeout - notification of timed out authentication - * @dev: network device - * @addr: The MAC address of the device with which the authentication timed out - * - * This function may sleep. - */ -void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr); - -/** - * cfg80211_send_rx_assoc - notification of processed association - * @dev: network device - * @bss: the BSS struct association was requested for, the struct reference - * is owned by cfg80211 after this call - * @buf: (re)association response frame (header + body) - * @len: length of the frame data - * - * This function is called whenever a (re)association response has been - * processed in station mode. The driver is required to call either this - * function or cfg80211_send_assoc_timeout() to indicate the result of - * cfg80211_ops::assoc() call. This function may sleep. - */ -void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss, - const u8 *buf, size_t len); - -/** - * cfg80211_send_assoc_timeout - notification of timed out association - * @dev: network device - * @addr: The MAC address of the device with which the association timed out - * - * This function may sleep. - */ -void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr); - -/** - * cfg80211_send_deauth - notification of processed deauthentication - * @dev: network device - * @buf: deauthentication frame (header + body) - * @len: length of the frame data - * - * This function is called whenever deauthentication has been processed in - * station mode. This includes both received deauthentication frames and - * locally generated ones. This function may sleep. - */ -void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); - -/** - * __cfg80211_send_deauth - notification of processed deauthentication - * @dev: network device - * @buf: deauthentication frame (header + body) - * @len: length of the frame data - * - * Like cfg80211_send_deauth(), but doesn't take the wdev lock. - */ -void __cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len); - -/** - * cfg80211_send_disassoc - notification of processed disassociation - * @dev: network device - * @buf: disassociation response frame (header + body) - * @len: length of the frame data - * - * This function is called whenever disassociation has been processed in - * station mode. This includes both received disassociation frames and locally - * generated ones. This function may sleep. - */ -void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len); - -/** - * __cfg80211_send_disassoc - notification of processed disassociation - * @dev: network device - * @buf: disassociation response frame (header + body) - * @len: length of the frame data - * - * Like cfg80211_send_disassoc(), but doesn't take the wdev lock. - */ -void __cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, - size_t len); - -/** - * cfg80211_send_unprot_deauth - notification of unprotected deauthentication - * @dev: network device - * @buf: deauthentication frame (header + body) - * @len: length of the frame data - * - * This function is called whenever a received Deauthentication frame has been - * dropped in station mode because of MFP being used but the Deauthentication - * frame was not protected. This function may sleep. - */ -void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf, - size_t len); - -/** - * cfg80211_send_unprot_disassoc - notification of unprotected disassociation - * @dev: network device - * @buf: disassociation frame (header + body) - * @len: length of the frame data - * - * This function is called whenever a received Disassociation frame has been - * dropped in station mode because of MFP being used but the Disassociation - * frame was not protected. This function may sleep. - */ -void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf, - size_t len); - -/** - * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP) - * @dev: network device - * @addr: The source MAC address of the frame - * @key_type: The key type that the received frame used - * @key_id: Key identifier (0..3). Can be -1 if missing. - * @tsc: The TSC value of the frame that generated the MIC failure (6 octets) - * @gfp: allocation flags - * - * This function is called whenever the local MAC detects a MIC failure in a - * received frame. This matches with MLME-MICHAELMICFAILURE.indication() - * primitive. - */ -void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, - enum nl80211_key_type key_type, int key_id, - const u8 *tsc, gfp_t gfp); - -/** - * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS - * - * @dev: network device - * @bssid: the BSSID of the IBSS joined - * @gfp: allocation flags - * - * This function notifies cfg80211 that the device joined an IBSS or - * switched to a different BSSID. Before this function can be called, - * either a beacon has to have been received from the IBSS, or one of - * the cfg80211_inform_bss{,_frame} functions must have been called - * with the locally generated beacon -- this guarantees that there is - * always a scan result for this IBSS. cfg80211 will handle the rest. - */ -void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); - -/** - * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate - * - * @dev: network device - * @macaddr: the MAC address of the new candidate - * @ie: information elements advertised by the peer candidate - * @ie_len: lenght of the information elements buffer - * @gfp: allocation flags - * - * This function notifies cfg80211 that the mesh peer candidate has been - * detected, most likely via a beacon or, less likely, via a probe response. - * cfg80211 then sends a notification to userspace. - */ -void cfg80211_notify_new_peer_candidate(struct net_device *dev, - const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); - -/** - * DOC: RFkill integration - * - * RFkill integration in cfg80211 is almost invisible to drivers, - * as cfg80211 automatically registers an rfkill instance for each - * wireless device it knows about. Soft kill is also translated - * into disconnecting and turning all interfaces off, drivers are - * expected to turn off the device when all interfaces are down. - * - * However, devices may have a hard RFkill line, in which case they - * also need to interact with the rfkill subsystem, via cfg80211. - * They can do this with a few helper functions documented here. - */ - -/** - * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state - * @wiphy: the wiphy - * @blocked: block status - */ -void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked); - -/** - * wiphy_rfkill_start_polling - start polling rfkill - * @wiphy: the wiphy - */ -void wiphy_rfkill_start_polling(struct wiphy *wiphy); - -/** - * wiphy_rfkill_stop_polling - stop polling rfkill - * @wiphy: the wiphy - */ -void wiphy_rfkill_stop_polling(struct wiphy *wiphy); - -#ifdef CONFIG_NL80211_TESTMODE -/** - * DOC: Test mode - * - * Test mode is a set of utility functions to allow drivers to - * interact with driver-specific tools to aid, for instance, - * factory programming. - * - * This chapter describes how drivers interact with it, for more - * information see the nl80211 book's chapter on it. - */ - -/** - * cfg80211_testmode_alloc_reply_skb - allocate testmode reply - * @wiphy: the wiphy - * @approxlen: an upper bound of the length of the data that will - * be put into the skb - * - * This function allocates and pre-fills an skb for a reply to - * the testmode command. Since it is intended for a reply, calling - * it outside of the @testmode_cmd operation is invalid. - * - * The returned skb (or %NULL if any errors happen) is pre-filled - * with the wiphy index and set up in a way that any data that is - * put into the skb (with skb_put(), nla_put() or similar) will end - * up being within the %NL80211_ATTR_TESTDATA attribute, so all that - * needs to be done with the skb is adding data for the corresponding - * userspace tool which can then read that data out of the testdata - * attribute. You must not modify the skb in any other way. - * - * When done, call cfg80211_testmode_reply() with the skb and return - * its error code as the result of the @testmode_cmd operation. - */ -struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, - int approxlen); - -/** - * cfg80211_testmode_reply - send the reply skb - * @skb: The skb, must have been allocated with - * cfg80211_testmode_alloc_reply_skb() - * - * Returns an error code or 0 on success, since calling this - * function will usually be the last thing before returning - * from the @testmode_cmd you should return the error code. - * Note that this function consumes the skb regardless of the - * return value. - */ -int cfg80211_testmode_reply(struct sk_buff *skb); - -/** - * cfg80211_testmode_alloc_event_skb - allocate testmode event - * @wiphy: the wiphy - * @approxlen: an upper bound of the length of the data that will - * be put into the skb - * @gfp: allocation flags - * - * This function allocates and pre-fills an skb for an event on the - * testmode multicast group. - * - * The returned skb (or %NULL if any errors happen) is set up in the - * same way as with cfg80211_testmode_alloc_reply_skb() but prepared - * for an event. As there, you should simply add data to it that will - * then end up in the %NL80211_ATTR_TESTDATA attribute. Again, you must - * not modify the skb in any other way. - * - * When done filling the skb, call cfg80211_testmode_event() with the - * skb to send the event. - */ -struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, - int approxlen, gfp_t gfp); - -/** - * cfg80211_testmode_event - send the event - * @skb: The skb, must have been allocated with - * cfg80211_testmode_alloc_event_skb() - * @gfp: allocation flags - * - * This function sends the given @skb, which must have been allocated - * by cfg80211_testmode_alloc_event_skb(), as an event. It always - * consumes it. - */ -void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); - -#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd), -#define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd), -#else -#define CFG80211_TESTMODE_CMD(cmd) -#define CFG80211_TESTMODE_DUMP(cmd) -#endif - -/** - * cfg80211_connect_result - notify cfg80211 of connection result - * - * @dev: network device - * @bssid: the BSSID of the AP - * @req_ie: association request IEs (maybe be %NULL) - * @req_ie_len: association request IEs length - * @resp_ie: association response IEs (may be %NULL) - * @resp_ie_len: assoc response IEs length - * @status: status code, 0 for successful connection, use - * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you - * the real status code for failures. - * @gfp: allocation flags - * - * It should be called by the underlying driver whenever connect() has - * succeeded. - */ -void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len, - u16 status, gfp_t gfp); - -/** - * cfg80211_roamed - notify cfg80211 of roaming - * - * @dev: network device - * @channel: the channel of the new AP - * @bssid: the BSSID of the new AP - * @req_ie: association request IEs (maybe be %NULL) - * @req_ie_len: association request IEs length - * @resp_ie: association response IEs (may be %NULL) - * @resp_ie_len: assoc response IEs length - * @gfp: allocation flags - * - * It should be called by the underlying driver whenever it roamed - * from one AP to another while connected. - */ -void cfg80211_roamed(struct net_device *dev, - struct ieee80211_channel *channel, - const u8 *bssid, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); - -/** - * cfg80211_roamed_bss - notify cfg80211 of roaming - * - * @dev: network device - * @bss: entry of bss to which STA got roamed - * @req_ie: association request IEs (maybe be %NULL) - * @req_ie_len: association request IEs length - * @resp_ie: association response IEs (may be %NULL) - * @resp_ie_len: assoc response IEs length - * @gfp: allocation flags - * - * This is just a wrapper to notify cfg80211 of roaming event with driver - * passing bss to avoid a race in timeout of the bss entry. It should be - * called by the underlying driver whenever it roamed from one AP to another - * while connected. Drivers which have roaming implemented in firmware - * may use this function to avoid a race in bss entry timeout where the bss - * entry of the new AP is seen in the driver, but gets timed out by the time - * it is accessed in __cfg80211_roamed() due to delay in scheduling - * rdev->event_work. In case of any failures, the reference is released - * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise, - * it will be released while diconneting from the current bss. - */ -void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); - -/** - * cfg80211_disconnected - notify cfg80211 that connection was dropped - * - * @dev: network device - * @ie: information elements of the deauth/disassoc frame (may be %NULL) - * @ie_len: length of IEs - * @reason: reason code for the disconnection, set it to 0 if unknown - * @gfp: allocation flags - * - * After it calls this function, the driver should enter an idle state - * and not try to connect to any AP any more. - */ -void cfg80211_disconnected(struct net_device *dev, u16 reason, - u8 *ie, size_t ie_len, gfp_t gfp); - -/** - * cfg80211_ready_on_channel - notification of remain_on_channel start - * @dev: network device - * @cookie: the request cookie - * @chan: The current channel (from remain_on_channel request) - * @channel_type: Channel type - * @duration: Duration in milliseconds that the driver intents to remain on the - * channel - * @gfp: allocation flags - */ -void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, gfp_t gfp); - -/** - * cfg80211_remain_on_channel_expired - remain_on_channel duration expired - * @dev: network device - * @cookie: the request cookie - * @chan: The current channel (from remain_on_channel request) - * @channel_type: Channel type - * @gfp: allocation flags - */ -void cfg80211_remain_on_channel_expired(struct net_device *dev, - u64 cookie, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - gfp_t gfp); - - -/** - * cfg80211_new_sta - notify userspace about station - * - * @dev: the netdev - * @mac_addr: the station's address - * @sinfo: the station information - * @gfp: allocation flags - */ -void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, - struct station_info *sinfo, gfp_t gfp); - -/** - * cfg80211_del_sta - notify userspace about deletion of a station - * - * @dev: the netdev - * @mac_addr: the station's address - * @gfp: allocation flags - */ -void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); - -/** - * cfg80211_rx_mgmt - notification of received, unprocessed management frame - * @dev: network device - * @freq: Frequency on which the frame was received in MHz - * @sig_dbm: signal strength in mBm, or 0 if unknown - * @buf: Management frame (header + body) - * @len: length of the frame data - * @gfp: context flags - * - * Returns %true if a user space application has registered for this frame. - * For action frames, that makes it responsible for rejecting unrecognized - * action frames; %false otherwise, in which case for action frames the - * driver is responsible for rejecting the frame. - * - * This function is called whenever an Action frame is received for a station - * mode interface, but is not processed in kernel. - */ -bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm, - const u8 *buf, size_t len, gfp_t gfp); - -/** - * cfg80211_mgmt_tx_status - notification of TX status for management frame - * @dev: network device - * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() - * @buf: Management frame (header + body) - * @len: length of the frame data - * @ack: Whether frame was acknowledged - * @gfp: context flags - * - * This function is called whenever a management frame was requested to be - * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the - * transmission attempt. - */ -void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie, - const u8 *buf, size_t len, bool ack, gfp_t gfp); - - -/** - * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event - * @dev: network device - * @rssi_event: the triggered RSSI event - * @gfp: context flags - * - * This function is called when a configured connection quality monitoring - * rssi threshold reached event occurs. - */ -void cfg80211_cqm_rssi_notify(struct net_device *dev, - enum nl80211_cqm_rssi_threshold_event rssi_event, - gfp_t gfp); - -/** - * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer - * @dev: network device - * @peer: peer's MAC address - * @num_packets: how many packets were lost -- should be a fixed threshold - * but probably no less than maybe 50, or maybe a throughput dependent - * threshold (to account for temporary interference) - * @gfp: context flags - */ -void cfg80211_cqm_pktloss_notify(struct net_device *dev, - const u8 *peer, u32 num_packets, gfp_t gfp); - -/** - * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying - * @dev: network device - * @bssid: BSSID of AP (to avoid races) - * @replay_ctr: new replay counter - * @gfp: allocation flags - */ -void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, - const u8 *replay_ctr, gfp_t gfp); - -/** - * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate - * @dev: network device - * @index: candidate index (the smaller the index, the higher the priority) - * @bssid: BSSID of AP - * @preauth: Whether AP advertises support for RSN pre-authentication - * @gfp: allocation flags - */ -void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, - const u8 *bssid, bool preauth, gfp_t gfp); - -/** - * cfg80211_rx_spurious_frame - inform userspace about a spurious frame - * @dev: The device the frame matched to - * @addr: the transmitter address - * @gfp: context flags - * - * This function is used in AP mode (only!) to inform userspace that - * a spurious class 3 frame was received, to be able to deauth the - * sender. - * Returns %true if the frame was passed to userspace (or this failed - * for a reason other than not having a subscription.) - */ -bool cfg80211_rx_spurious_frame(struct net_device *dev, - const u8 *addr, gfp_t gfp); - -/** - * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame - * @dev: The device the frame matched to - * @addr: the transmitter address - * @gfp: context flags - * - * This function is used in AP mode (only!) to inform userspace that - * an associated station sent a 4addr frame but that wasn't expected. - * It is allowed and desirable to send this event only once for each - * station to avoid event flooding. - * Returns %true if the frame was passed to userspace (or this failed - * for a reason other than not having a subscription.) - */ -bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, - const u8 *addr, gfp_t gfp); - -/** - * cfg80211_probe_status - notify userspace about probe status - * @dev: the device the probe was sent on - * @addr: the address of the peer - * @cookie: the cookie filled in @probe_client previously - * @acked: indicates whether probe was acked or not - * @gfp: allocation flags - */ -void cfg80211_probe_status(struct net_device *dev, const u8 *addr, - u64 cookie, bool acked, gfp_t gfp); - -/** - * cfg80211_report_obss_beacon - report beacon from other APs - * @wiphy: The wiphy that received the beacon - * @frame: the frame - * @len: length of the frame - * @freq: frequency the frame was received on - * @sig_dbm: signal strength in mBm, or 0 if unknown - * @gfp: allocation flags - * - * Use this function to report to userspace when a beacon was - * received. It is not useful to call this when there is no - * netdev that is in AP/GO mode. - */ -void cfg80211_report_obss_beacon(struct wiphy *wiphy, - const u8 *frame, size_t len, - int freq, int sig_dbm, gfp_t gfp); - -/* - * cfg80211_can_beacon_sec_chan - test if ht40 on extension channel can be used - * @wiphy: the wiphy - * @chan: main channel - * @channel_type: HT mode - */ -int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type); - -/* - * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units) - * @rate: given rate_info to calculate bitrate from - * - * return 0 if MCS index >= 32 - */ -u16 cfg80211_calculate_bitrate(struct rate_info *rate); - -/* Logging, debugging and troubleshooting/diagnostic helpers. */ - -/* wiphy_printk helpers, similar to dev_printk */ - -#define wiphy_printk(level, wiphy, format, args...) \ - dev_printk(level, &(wiphy)->dev, format, ##args) -#define wiphy_emerg(wiphy, format, args...) \ - dev_emerg(&(wiphy)->dev, format, ##args) -#define wiphy_alert(wiphy, format, args...) \ - dev_alert(&(wiphy)->dev, format, ##args) -#define wiphy_crit(wiphy, format, args...) \ - dev_crit(&(wiphy)->dev, format, ##args) -#define wiphy_err(wiphy, format, args...) \ - dev_err(&(wiphy)->dev, format, ##args) -#define wiphy_warn(wiphy, format, args...) \ - dev_warn(&(wiphy)->dev, format, ##args) -#define wiphy_notice(wiphy, format, args...) \ - dev_notice(&(wiphy)->dev, format, ##args) -#define wiphy_info(wiphy, format, args...) \ - dev_info(&(wiphy)->dev, format, ##args) - -#define wiphy_debug(wiphy, format, args...) \ - wiphy_printk(KERN_DEBUG, wiphy, format, ##args) - -#define wiphy_dbg(wiphy, format, args...) \ - dev_dbg(&(wiphy)->dev, format, ##args) - -#if defined(VERBOSE_DEBUG) -#define wiphy_vdbg wiphy_dbg -#else -#define wiphy_vdbg(wiphy, format, args...) \ -({ \ - if (0) \ - wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ - 0; \ -}) -#endif - -/* - * wiphy_WARN() acts like wiphy_printk(), but with the key difference - * of using a WARN/WARN_ON to get the message out, including the - * file/line information and a backtrace. - */ -#define wiphy_WARN(wiphy, format, args...) \ - WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); - -#endif /* __NET_CFG80211_H */ diff --git a/openairITS/mac/DOT11/include/net/ieee80211_radiotap.h b/openairITS/mac/DOT11/include/net/ieee80211_radiotap.h deleted file mode 100644 index 0484e6d51e3..00000000000 --- a/openairITS/mac/DOT11/include/net/ieee80211_radiotap.h +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2003, 2004 David Young. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of David Young may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID - * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - */ - -/* - * Modifications to fit into the linux IEEE 802.11 stack, - * Mike Kershaw (dragorn@kismetwireless.net) - */ - -#ifndef IEEE80211RADIOTAP_H -#define IEEE80211RADIOTAP_H - -#include <linux/if_ether.h> -#include <linux/kernel.h> -#include <asm/unaligned.h> - -/* Base version of the radiotap packet header data */ -#define PKTHDR_RADIOTAP_VERSION 0 - -/* A generic radio capture format is desirable. There is one for - * Linux, but it is neither rigidly defined (there were not even - * units given for some fields) nor easily extensible. - * - * I suggest the following extensible radio capture format. It is - * based on a bitmap indicating which fields are present. - * - * I am trying to describe precisely what the application programmer - * should expect in the following, and for that reason I tell the - * units and origin of each measurement (where it applies), or else I - * use sufficiently weaselly language ("is a monotonically nondecreasing - * function of...") that I cannot set false expectations for lawyerly - * readers. - */ - -/* - * The radio capture header precedes the 802.11 header. - * All data in the header is little endian on all platforms. - */ -struct ieee80211_radiotap_header { - u8 it_version; /* Version 0. Only increases - * for drastic changes, - * introduction of compatible - * new fields does not count. - */ - u8 it_pad; - __le16 it_len; /* length of the whole - * header in bytes, including - * it_version, it_pad, - * it_len, and data fields. - */ - __le32 it_present; /* A bitmap telling which - * fields are present. Set bit 31 - * (0x80000000) to extend the - * bitmap by another 32 bits. - * Additional extensions are made - * by setting bit 31. - */ -} __packed; - -/* Name Data type Units - * ---- --------- ----- - * - * IEEE80211_RADIOTAP_TSFT __le64 microseconds - * - * Value in microseconds of the MAC's 64-bit 802.11 Time - * Synchronization Function timer when the first bit of the - * MPDU arrived at the MAC. For received frames, only. - * - * IEEE80211_RADIOTAP_CHANNEL 2 x __le16 MHz, bitmap - * - * Tx/Rx frequency in MHz, followed by flags (see below). - * - * IEEE80211_RADIOTAP_FHSS __le16 see below - * - * For frequency-hopping radios, the hop set (first byte) - * and pattern (second byte). - * - * IEEE80211_RADIOTAP_RATE u8 500kb/s - * - * Tx/Rx data rate - * - * IEEE80211_RADIOTAP_DBM_ANTSIGNAL s8 decibels from - * one milliwatt (dBm) - * - * RF signal power at the antenna, decibel difference from - * one milliwatt. - * - * IEEE80211_RADIOTAP_DBM_ANTNOISE s8 decibels from - * one milliwatt (dBm) - * - * RF noise power at the antenna, decibel difference from one - * milliwatt. - * - * IEEE80211_RADIOTAP_DB_ANTSIGNAL u8 decibel (dB) - * - * RF signal power at the antenna, decibel difference from an - * arbitrary, fixed reference. - * - * IEEE80211_RADIOTAP_DB_ANTNOISE u8 decibel (dB) - * - * RF noise power at the antenna, decibel difference from an - * arbitrary, fixed reference point. - * - * IEEE80211_RADIOTAP_LOCK_QUALITY __le16 unitless - * - * Quality of Barker code lock. Unitless. Monotonically - * nondecreasing with "better" lock strength. Called "Signal - * Quality" in datasheets. (Is there a standard way to measure - * this?) - * - * IEEE80211_RADIOTAP_TX_ATTENUATION __le16 unitless - * - * Transmit power expressed as unitless distance from max - * power set at factory calibration. 0 is max power. - * Monotonically nondecreasing with lower power levels. - * - * IEEE80211_RADIOTAP_DB_TX_ATTENUATION __le16 decibels (dB) - * - * Transmit power expressed as decibel distance from max power - * set at factory calibration. 0 is max power. Monotonically - * nondecreasing with lower power levels. - * - * IEEE80211_RADIOTAP_DBM_TX_POWER s8 decibels from - * one milliwatt (dBm) - * - * Transmit power expressed as dBm (decibels from a 1 milliwatt - * reference). This is the absolute power level measured at - * the antenna port. - * - * IEEE80211_RADIOTAP_FLAGS u8 bitmap - * - * Properties of transmitted and received frames. See flags - * defined below. - * - * IEEE80211_RADIOTAP_ANTENNA u8 antenna index - * - * Unitless indication of the Rx/Tx antenna for this packet. - * The first antenna is antenna 0. - * - * IEEE80211_RADIOTAP_RX_FLAGS __le16 bitmap - * - * Properties of received frames. See flags defined below. - * - * IEEE80211_RADIOTAP_TX_FLAGS __le16 bitmap - * - * Properties of transmitted frames. See flags defined below. - * - * IEEE80211_RADIOTAP_RTS_RETRIES u8 data - * - * Number of rts retries a transmitted frame used. - * - * IEEE80211_RADIOTAP_DATA_RETRIES u8 data - * - * Number of unicast retries a transmitted frame used. - * - * IEEE80211_RADIOTAP_MCS u8, u8, u8 unitless - * - * Contains a bitmap of known fields/flags, the flags, and - * the MCS index. - * - */ -enum ieee80211_radiotap_type { - IEEE80211_RADIOTAP_TSFT = 0, - IEEE80211_RADIOTAP_FLAGS = 1, - IEEE80211_RADIOTAP_RATE = 2, - IEEE80211_RADIOTAP_CHANNEL = 3, - IEEE80211_RADIOTAP_FHSS = 4, - IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5, - IEEE80211_RADIOTAP_DBM_ANTNOISE = 6, - IEEE80211_RADIOTAP_LOCK_QUALITY = 7, - IEEE80211_RADIOTAP_TX_ATTENUATION = 8, - IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9, - IEEE80211_RADIOTAP_DBM_TX_POWER = 10, - IEEE80211_RADIOTAP_ANTENNA = 11, - IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, - IEEE80211_RADIOTAP_DB_ANTNOISE = 13, - IEEE80211_RADIOTAP_RX_FLAGS = 14, - IEEE80211_RADIOTAP_TX_FLAGS = 15, - IEEE80211_RADIOTAP_RTS_RETRIES = 16, - IEEE80211_RADIOTAP_DATA_RETRIES = 17, - - IEEE80211_RADIOTAP_MCS = 19, - - /* valid in every it_present bitmap, even vendor namespaces */ - IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, - IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30, - IEEE80211_RADIOTAP_EXT = 31 -}; - -/* Channel flags. */ -/* - * [PLATA] needto add the new bands - */ -#define IEEE80211_CHAN_TURBO 0x0010 /* Turbo channel */ -#define IEEE80211_CHAN_CCK 0x0020 /* CCK channel */ -#define IEEE80211_CHAN_OFDM 0x0040 /* OFDM channel */ -#define IEEE80211_CHAN_2GHZ 0x0080 /* 2 GHz spectrum channel. */ -#define IEEE80211_CHAN_5GHZ 0x0100 /* 5 GHz spectrum channel */ -/* - * [PLATA] - new bands - */ -#define IEEE80211_CHAN_5_9GHZ 0x0120 /* 5.9 GHz ITS spectrum channel */ -#define IEEE80211_CHAN_0_8GHZ 0x0140 /* 800 MHz ITS spectrum channel */ -/* - * [PLATA] - end - */ -#define IEEE80211_CHAN_PASSIVE 0x0200 /* Only passive scan allowed */ -#define IEEE80211_CHAN_DYN 0x0400 /* Dynamic CCK-OFDM channel */ -#define IEEE80211_CHAN_GFSK 0x0800 /* GFSK channel (FHSS PHY) */ - -/* For IEEE80211_RADIOTAP_FLAGS */ -#define IEEE80211_RADIOTAP_F_CFP 0x01 /* sent/received - * during CFP - */ -#define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 /* sent/received - * with short - * preamble - */ -#define IEEE80211_RADIOTAP_F_WEP 0x04 /* sent/received - * with WEP encryption - */ -#define IEEE80211_RADIOTAP_F_FRAG 0x08 /* sent/received - * with fragmentation - */ -#define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ -#define IEEE80211_RADIOTAP_F_DATAPAD 0x20 /* frame has padding between - * 802.11 header and payload - * (to 32-bit boundary) - */ -#define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* bad FCS */ - -/* For IEEE80211_RADIOTAP_RX_FLAGS */ -#define IEEE80211_RADIOTAP_F_RX_BADPLCP 0x0002 /* frame has bad PLCP */ - -/* For IEEE80211_RADIOTAP_TX_FLAGS */ -#define IEEE80211_RADIOTAP_F_TX_FAIL 0x0001 /* failed due to excessive - * retries */ -#define IEEE80211_RADIOTAP_F_TX_CTS 0x0002 /* used cts 'protection' */ -#define IEEE80211_RADIOTAP_F_TX_RTS 0x0004 /* used rts/cts handshake */ -#define IEEE80211_RADIOTAP_F_TX_NOACK 0x0008 /* don't expect an ack */ - - -/* For IEEE80211_RADIOTAP_MCS */ -#define IEEE80211_RADIOTAP_MCS_HAVE_BW 0x01 -#define IEEE80211_RADIOTAP_MCS_HAVE_MCS 0x02 -#define IEEE80211_RADIOTAP_MCS_HAVE_GI 0x04 -#define IEEE80211_RADIOTAP_MCS_HAVE_FMT 0x08 -#define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10 - -#define IEEE80211_RADIOTAP_MCS_BW_MASK 0x03 -#define IEEE80211_RADIOTAP_MCS_BW_20 0 -#define IEEE80211_RADIOTAP_MCS_BW_40 1 -#define IEEE80211_RADIOTAP_MCS_BW_20L 2 -#define IEEE80211_RADIOTAP_MCS_BW_20U 3 -#define IEEE80211_RADIOTAP_MCS_SGI 0x04 -#define IEEE80211_RADIOTAP_MCS_FMT_GF 0x08 -#define IEEE80211_RADIOTAP_MCS_FEC_LDPC 0x10 - - -/* helpers */ -static inline int ieee80211_get_radiotap_len(unsigned char *data) -{ - struct ieee80211_radiotap_header *hdr = - (struct ieee80211_radiotap_header *)data; - - return get_unaligned_le16(&hdr->it_len); -} - -#endif /* IEEE80211_RADIOTAP_H */ diff --git a/openairITS/mac/DOT11/include/net/lib80211.h b/openairITS/mac/DOT11/include/net/lib80211.h deleted file mode 100644 index d178c26a555..00000000000 --- a/openairITS/mac/DOT11/include/net/lib80211.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * lib80211.h -- common bits for IEEE802.11 wireless drivers - * - * Copyright (c) 2008, John W. Linville <linville@tuxdriver.com> - * - * Some bits copied from old ieee80211 component, w/ original copyright - * notices below: - * - * Original code based on Host AP (software wireless LAN access point) driver - * for Intersil Prism2/2.5/3. - * - * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen - * <j@w1.fi> - * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi> - * - * Adaption to a generic IEEE 802.11 stack by James Ketrenos - * <jketreno@linux.intel.com> - * - * Copyright (c) 2004, Intel Corporation - * - */ - -#ifndef LIB80211_H -#define LIB80211_H - -#include <linux/types.h> -#include <linux/list.h> -#include <linux/atomic.h> -#include <linux/if.h> -#include <linux/skbuff.h> -#include <linux/ieee80211.h> -#include <linux/timer.h> -/* print_ssid() is intended to be used in debug (and possibly error) - * messages. It should never be used for passing ssid to user space. */ -const char *print_ssid(char *buf, const char *ssid, u8 ssid_len); -#define DECLARE_SSID_BUF(var) char var[IEEE80211_MAX_SSID_LEN * 4 + 1] __maybe_unused - -#define NUM_WEP_KEYS 4 - -enum { - IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), -}; - -struct module; - -struct lib80211_crypto_ops { - const char *name; - struct list_head list; - - /* init new crypto context (e.g., allocate private data space, - * select IV, etc.); returns NULL on failure or pointer to allocated - * private data on success */ - void *(*init) (int keyidx); - - /* deinitialize crypto context and free allocated private data */ - void (*deinit) (void *priv); - - /* encrypt/decrypt return < 0 on error or >= 0 on success. The return - * value from decrypt_mpdu is passed as the keyidx value for - * decrypt_msdu. skb must have enough head and tail room for the - * encryption; if not, error will be returned; these functions are - * called for all MPDUs (i.e., fragments). - */ - int (*encrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv); - int (*decrypt_mpdu) (struct sk_buff * skb, int hdr_len, void *priv); - - /* These functions are called for full MSDUs, i.e. full frames. - * These can be NULL if full MSDU operations are not needed. */ - int (*encrypt_msdu) (struct sk_buff * skb, int hdr_len, void *priv); - int (*decrypt_msdu) (struct sk_buff * skb, int keyidx, int hdr_len, - void *priv); - - int (*set_key) (void *key, int len, u8 * seq, void *priv); - int (*get_key) (void *key, int len, u8 * seq, void *priv); - - /* procfs handler for printing out key information and possible - * statistics */ - char *(*print_stats) (char *p, void *priv); - - /* Crypto specific flag get/set for configuration settings */ - unsigned long (*get_flags) (void *priv); - unsigned long (*set_flags) (unsigned long flags, void *priv); - - /* maximum number of bytes added by encryption; encrypt buf is - * allocated with extra_prefix_len bytes, copy of in_buf, and - * extra_postfix_len; encrypt need not use all this space, but - * the result must start at the beginning of the buffer and correct - * length must be returned */ - int extra_mpdu_prefix_len, extra_mpdu_postfix_len; - int extra_msdu_prefix_len, extra_msdu_postfix_len; - - struct module *owner; -}; - -struct lib80211_crypt_data { - struct list_head list; /* delayed deletion list */ - struct lib80211_crypto_ops *ops; - void *priv; - atomic_t refcnt; -}; - -struct lib80211_crypt_info { - char *name; - /* Most clients will already have a lock, - so just point to that. */ - spinlock_t *lock; - - struct lib80211_crypt_data *crypt[NUM_WEP_KEYS]; - int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ - struct list_head crypt_deinit_list; - struct timer_list crypt_deinit_timer; - int crypt_quiesced; -}; - -int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name, - spinlock_t *lock); -void lib80211_crypt_info_free(struct lib80211_crypt_info *info); -int lib80211_register_crypto_ops(struct lib80211_crypto_ops *ops); -int lib80211_unregister_crypto_ops(struct lib80211_crypto_ops *ops); -struct lib80211_crypto_ops *lib80211_get_crypto_ops(const char *name); -void lib80211_crypt_delayed_deinit(struct lib80211_crypt_info *info, - struct lib80211_crypt_data **crypt); - -#endif /* LIB80211_H */ diff --git a/openairITS/mac/DOT11/include/net/mac80211.h b/openairITS/mac/DOT11/include/net/mac80211.h deleted file mode 100644 index e555977c064..00000000000 --- a/openairITS/mac/DOT11/include/net/mac80211.h +++ /dev/null @@ -1,3724 +0,0 @@ -/* - * mac80211 <-> driver interface - * - * Copyright 2002-2005, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef MAC80211_H -#define MAC80211_H - -#include <linux/bug.h> -#include <linux/kernel.h> -#include <linux/if_ether.h> -#include <linux/skbuff.h> -#include <linux/ieee80211.h> -#include <net/cfg80211.h> -#include <asm/unaligned.h> - -/** - * DOC: Introduction - * - * mac80211 is the Linux stack for 802.11 hardware that implements - * only partial functionality in hard- or firmware. This document - * defines the interface between mac80211 and low-level hardware - * drivers. - */ - -/** - * DOC: Calling mac80211 from interrupts - * - * Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be - * called in hardware interrupt context. The low-level driver must not call any - * other functions in hardware interrupt context. If there is a need for such - * call, the low-level driver should first ACK the interrupt and perform the - * IEEE 802.11 code call after this, e.g. from a scheduled workqueue or even - * tasklet function. - * - * NOTE: If the driver opts to use the _irqsafe() functions, it may not also - * use the non-IRQ-safe functions! - */ - -/** - * DOC: Warning - * - * If you're reading this document and not the header file itself, it will - * be incomplete because not all documentation has been converted yet. - */ - -/** - * DOC: Frame format - * - * As a general rule, when frames are passed between mac80211 and the driver, - * they start with the IEEE 802.11 header and include the same octets that are - * sent over the air except for the FCS which should be calculated by the - * hardware. - * - * There are, however, various exceptions to this rule for advanced features: - * - * The first exception is for hardware encryption and decryption offload - * where the IV/ICV may or may not be generated in hardware. - * - * Secondly, when the hardware handles fragmentation, the frame handed to - * the driver from mac80211 is the MSDU, not the MPDU. - * - * Finally, for received frames, the driver is able to indicate that it has - * filled a radiotap header and put that in front of the frame; if it does - * not do so then mac80211 may add this under certain circumstances. - */ - -/** - * DOC: mac80211 workqueue - * - * mac80211 provides its own workqueue for drivers and internal mac80211 use. - * The workqueue is a single threaded workqueue and can only be accessed by - * helpers for sanity checking. Drivers must ensure all work added onto the - * mac80211 workqueue should be cancelled on the driver stop() callback. - * - * mac80211 will flushed the workqueue upon interface removal and during - * suspend. - * - * All work performed on the mac80211 workqueue must not acquire the RTNL lock. - * - */ - -struct device; - -/** - * enum ieee80211_max_queues - maximum number of queues - * - * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. - */ -enum ieee80211_max_queues { - IEEE80211_MAX_QUEUES = 4, -}; - -/** - * enum ieee80211_ac_numbers - AC numbers as used in mac80211 - * @IEEE80211_AC_VO: voice - * @IEEE80211_AC_VI: video - * @IEEE80211_AC_BE: best effort - * @IEEE80211_AC_BK: background - */ -enum ieee80211_ac_numbers { - IEEE80211_AC_VO = 0, - IEEE80211_AC_VI = 1, - IEEE80211_AC_BE = 2, - IEEE80211_AC_BK = 3, -}; -#define IEEE80211_NUM_ACS 4 - -/** - * struct ieee80211_tx_queue_params - transmit queue configuration - * - * The information provided in this structure is required for QoS - * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29. - * - * @aifs: arbitration interframe space [0..255] - * @cw_min: minimum contention window [a value of the form - * 2^n-1 in the range 1..32767] - * @cw_max: maximum contention window [like @cw_min] - * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled - * @uapsd: is U-APSD mode enabled for the queue - */ -struct ieee80211_tx_queue_params { - u16 txop; - u16 cw_min; - u16 cw_max; - u8 aifs; - bool uapsd; -}; - -struct ieee80211_low_level_stats { - unsigned int dot11ACKFailureCount; - unsigned int dot11RTSFailureCount; - unsigned int dot11FCSErrorCount; - unsigned int dot11RTSSuccessCount; -}; - -/** - * enum ieee80211_bss_change - BSS change notification flags - * - * These flags are used with the bss_info_changed() callback - * to indicate which BSS parameter changed. - * - * @BSS_CHANGED_ASSOC: association status changed (associated/disassociated), - * also implies a change in the AID. - * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed - * @BSS_CHANGED_ERP_PREAMBLE: preamble changed - * @BSS_CHANGED_ERP_SLOT: slot timing changed - * @BSS_CHANGED_HT: 802.11n parameters changed - * @BSS_CHANGED_BASIC_RATES: Basic rateset changed - * @BSS_CHANGED_BEACON_INT: Beacon interval changed - * @BSS_CHANGED_BSSID: BSSID changed, for whatever - * reason (IBSS and managed mode) - * @BSS_CHANGED_BEACON: Beacon data changed, retrieve - * new beacon (beaconing modes) - * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be - * enabled/disabled (beaconing modes) - * @BSS_CHANGED_CQM: Connection quality monitor config changed - * @BSS_CHANGED_IBSS: IBSS join status changed - * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed. - * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note - * that it is only ever disabled for station mode. - * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. - * @BSS_CHANGED_SSID: SSID changed for this BSS (AP mode) - * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode) - */ -enum ieee80211_bss_change { - BSS_CHANGED_ASSOC = 1<<0, - BSS_CHANGED_ERP_CTS_PROT = 1<<1, - BSS_CHANGED_ERP_PREAMBLE = 1<<2, - BSS_CHANGED_ERP_SLOT = 1<<3, - BSS_CHANGED_HT = 1<<4, - BSS_CHANGED_BASIC_RATES = 1<<5, - BSS_CHANGED_BEACON_INT = 1<<6, - BSS_CHANGED_BSSID = 1<<7, - BSS_CHANGED_BEACON = 1<<8, - BSS_CHANGED_BEACON_ENABLED = 1<<9, - BSS_CHANGED_CQM = 1<<10, - BSS_CHANGED_IBSS = 1<<11, - BSS_CHANGED_ARP_FILTER = 1<<12, - BSS_CHANGED_QOS = 1<<13, - BSS_CHANGED_IDLE = 1<<14, - BSS_CHANGED_SSID = 1<<15, - BSS_CHANGED_AP_PROBE_RESP = 1<<16, - - /* when adding here, make sure to change ieee80211_reconfig */ -}; - -/* - * The maximum number of IPv4 addresses listed for ARP filtering. If the number - * of addresses for an interface increase beyond this value, hardware ARP - * filtering will be disabled. - */ -#define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4 - -/** - * enum ieee80211_rssi_event - RSSI threshold event - * An indicator for when RSSI goes below/above a certain threshold. - * @RSSI_EVENT_HIGH: AP's rssi crossed the high threshold set by the driver. - * @RSSI_EVENT_LOW: AP's rssi crossed the low threshold set by the driver. - */ -enum ieee80211_rssi_event { - RSSI_EVENT_HIGH, - RSSI_EVENT_LOW, -}; - -/** - * struct ieee80211_bss_conf - holds the BSS's changing parameters - * - * This structure keeps information about a BSS (and an association - * to that BSS) that can change during the lifetime of the BSS. - * - * @assoc: association status - * @ibss_joined: indicates whether this station is part of an IBSS - * or not - * @aid: association ID number, valid only when @assoc is true - * @use_cts_prot: use CTS protection - * @use_short_preamble: use 802.11b short preamble; - * if the hardware cannot handle this it must set the - * IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE hardware flag - * @use_short_slot: use short slot time (only relevant for ERP); - * if the hardware cannot handle this it must set the - * IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE hardware flag - * @dtim_period: num of beacons before the next DTIM, for beaconing, - * valid in station mode only while @assoc is true and if also - * requested by %IEEE80211_HW_NEED_DTIM_PERIOD (cf. also hw conf - * @ps_dtim_period) - * @last_tsf: last beacon's/probe response's TSF timestamp (could be old - * as it may have been received during scanning long ago) - * @beacon_int: beacon interval - * @assoc_capability: capabilities taken from assoc resp - * @basic_rates: bitmap of basic rates, each bit stands for an - * index into the rate table configured by the driver in - * the current band. - * @mcast_rate: per-band multicast rate index + 1 (0: disabled) - * @bssid: The BSSID for this BSS - * @enable_beacon: whether beaconing should be enabled or not - * @channel_type: Channel type for this BSS -- the hardware might be - * configured for HT40+ while this BSS only uses no-HT, for - * example. - * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info). - * This field is only valid when the channel type is one of the HT types. - * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value - * implies disabled - * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis - * @arp_addr_list: List of IPv4 addresses for hardware ARP filtering. The - * may filter ARP queries targeted for other addresses than listed here. - * The driver must allow ARP queries targeted for all address listed here - * to pass through. An empty list implies no ARP queries need to pass. - * @arp_addr_cnt: Number of addresses currently on the list. - * @arp_filter_enabled: Enable ARP filtering - if enabled, the hardware may - * filter ARP queries based on the @arp_addr_list, if disabled, the - * hardware must not perform any ARP filtering. Note, that the filter will - * be enabled also in promiscuous mode. - * @qos: This is a QoS-enabled BSS. - * @idle: This interface is idle. There's also a global idle flag in the - * hardware config which may be more appropriate depending on what - * your driver/device needs to do. - * @ssid: The SSID of the current vif. Only valid in AP-mode. - * @ssid_len: Length of SSID given in @ssid. - * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode. - */ -struct ieee80211_bss_conf { - const u8 *bssid; - /* association related data */ - bool assoc, ibss_joined; - u16 aid; - /* erp related data */ - bool use_cts_prot; - bool use_short_preamble; - bool use_short_slot; - bool enable_beacon; - u8 dtim_period; - u16 beacon_int; - u16 assoc_capability; - u64 last_tsf; - u32 basic_rates; - int mcast_rate[IEEE80211_NUM_BANDS]; - u16 ht_operation_mode; - s32 cqm_rssi_thold; - u32 cqm_rssi_hyst; - enum nl80211_channel_type channel_type; - __be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; - u8 arp_addr_cnt; - bool arp_filter_enabled; - bool qos; - bool idle; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - size_t ssid_len; - bool hidden_ssid; -}; - -/** - * enum mac80211_tx_control_flags - flags to describe transmission information/status - * - * These flags are used with the @flags member of &ieee80211_tx_info. - * - * @IEEE80211_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame. - * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence - * number to this frame, taking care of not overwriting the fragment - * number and increasing the sequence number only when the - * IEEE80211_TX_CTL_FIRST_FRAGMENT flag is set. mac80211 will properly - * assign sequence numbers to QoS-data frames but cannot do so correctly - * for non-QoS-data and management frames because beacons need them from - * that counter as well and mac80211 cannot guarantee proper sequencing. - * If this flag is set, the driver should instruct the hardware to - * assign a sequence number to the frame or assign one itself. Cf. IEEE - * 802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for - * beacons and always be clear for frames without a sequence number field. - * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack - * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination - * station - * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame - * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon - * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU - * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211. - * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted - * because the destination STA was in powersave mode. Note that to - * avoid race conditions, the filter must be set by the hardware or - * firmware upon receiving a frame that indicates that the station - * went to sleep (must be done on device to filter frames already on - * the queue) and may only be unset after mac80211 gives the OK for - * that by setting the IEEE80211_TX_CTL_CLEAR_PS_FILT (see above), - * since only then is it guaranteed that no more frames are in the - * hardware queue. - * @IEEE80211_TX_STAT_ACK: Frame was acknowledged - * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status - * is for the whole aggregation. - * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned, - * so consider using block ack request (BAR). - * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be - * set by rate control algorithms to indicate probe rate, will - * be cleared for fragmented frames (except on the last fragment) - * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, - * used to indicate that a pending frame requires TX processing before - * it can be sent out. - * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211, - * used to indicate that a frame was already retried due to PS - * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211, - * used to indicate frame should not be encrypted - * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll - * frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must - * be sent although the station is in powersave mode. - * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the - * transmit function after the current frame, this can be used - * by drivers to kick the DMA queue only if unset or when the - * queue gets full. - * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted - * after TX status because the destination was asleep, it must not - * be modified again (no seqno assignment, crypto, etc.) - * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211 - * MLME command (internal to mac80211 to figure out whether to send TX - * status to user space) - * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame - * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this - * frame and selects the maximum number of streams that it can use. - * @IEEE80211_TX_CTL_TX_OFFCHAN: Marks this packet to be transmitted on - * the off-channel channel when a remain-on-channel offload is done - * in hardware -- normal packets still flow and are expected to be - * handled properly by the device. - * @IEEE80211_TX_INTFL_TKIP_MIC_FAILURE: Marks this packet to be used for TKIP - * testing. It will be sent out with incorrect Michael MIC key to allow - * TKIP countermeasures to be tested. - * @IEEE80211_TX_CTL_NO_CCK_RATE: This frame will be sent at non CCK rate. - * This flag is actually used for management frame especially for P2P - * frames not being sent at CCK rate in 2GHz band. - * @IEEE80211_TX_STATUS_EOSP: This packet marks the end of service period, - * when its status is reported the service period ends. For frames in - * an SP that mac80211 transmits, it is already set; for driver frames - * the driver may set this flag. It is also used to do the same for - * PS-Poll responses. - * @IEEE80211_TX_CTL_USE_MINRATE: This frame will be sent at lowest rate. - * This flag is used to send nullfunc frame at minimum rate when - * the nullfunc is used for connection monitoring purpose. - * @IEEE80211_TX_CTL_DONTFRAG: Don't fragment this packet even if it - * would be fragmented by size (this is optional, only used for - * monitor injection). - * - * Note: If you have to add new flags to the enumeration, then don't - * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. - */ -enum mac80211_tx_control_flags { - IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), - IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(1), - IEEE80211_TX_CTL_NO_ACK = BIT(2), - IEEE80211_TX_CTL_CLEAR_PS_FILT = BIT(3), - IEEE80211_TX_CTL_FIRST_FRAGMENT = BIT(4), - IEEE80211_TX_CTL_SEND_AFTER_DTIM = BIT(5), - IEEE80211_TX_CTL_AMPDU = BIT(6), - IEEE80211_TX_CTL_INJECTED = BIT(7), - IEEE80211_TX_STAT_TX_FILTERED = BIT(8), - IEEE80211_TX_STAT_ACK = BIT(9), - IEEE80211_TX_STAT_AMPDU = BIT(10), - IEEE80211_TX_STAT_AMPDU_NO_BACK = BIT(11), - IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), - IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), - IEEE80211_TX_INTFL_RETRIED = BIT(15), - IEEE80211_TX_INTFL_DONT_ENCRYPT = BIT(16), - IEEE80211_TX_CTL_NO_PS_BUFFER = BIT(17), - IEEE80211_TX_CTL_MORE_FRAMES = BIT(18), - IEEE80211_TX_INTFL_RETRANSMISSION = BIT(19), - /* hole at 20, use later */ - IEEE80211_TX_INTFL_NL80211_FRAME_TX = BIT(21), - IEEE80211_TX_CTL_LDPC = BIT(22), - IEEE80211_TX_CTL_STBC = BIT(23) | BIT(24), - IEEE80211_TX_CTL_TX_OFFCHAN = BIT(25), - IEEE80211_TX_INTFL_TKIP_MIC_FAILURE = BIT(26), - IEEE80211_TX_CTL_NO_CCK_RATE = BIT(27), - IEEE80211_TX_STATUS_EOSP = BIT(28), - IEEE80211_TX_CTL_USE_MINRATE = BIT(29), - IEEE80211_TX_CTL_DONTFRAG = BIT(30), -}; - -#define IEEE80211_TX_CTL_STBC_SHIFT 23 - -/* - * This definition is used as a mask to clear all temporary flags, which are - * set by the tx handlers for each transmission attempt by the mac80211 stack. - */ -#define IEEE80211_TX_TEMPORARY_FLAGS (IEEE80211_TX_CTL_NO_ACK | \ - IEEE80211_TX_CTL_CLEAR_PS_FILT | IEEE80211_TX_CTL_FIRST_FRAGMENT | \ - IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ - IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ - IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ - IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER | \ - IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ - IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP) - -/** - * enum mac80211_rate_control_flags - per-rate flags set by the - * Rate Control algorithm. - * - * These flags are set by the Rate control algorithm for each rate during tx, - * in the @flags member of struct ieee80211_tx_rate. - * - * @IEEE80211_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate. - * @IEEE80211_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required. - * This is set if the current BSS requires ERP protection. - * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble. - * @IEEE80211_TX_RC_MCS: HT rate. - * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in - * Greenfield mode. - * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz. - * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the - * adjacent 20 MHz channels, if the current channel type is - * NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS. - * @IEEE80211_TX_RC_SHORT_GI: Short Guard interval should be used for this rate. - */ -enum mac80211_rate_control_flags { - IEEE80211_TX_RC_USE_RTS_CTS = BIT(0), - IEEE80211_TX_RC_USE_CTS_PROTECT = BIT(1), - IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(2), - - /* rate index is an MCS rate number instead of an index */ - IEEE80211_TX_RC_MCS = BIT(3), - IEEE80211_TX_RC_GREEN_FIELD = BIT(4), - IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(5), - IEEE80211_TX_RC_DUP_DATA = BIT(6), - IEEE80211_TX_RC_SHORT_GI = BIT(7), -}; - - -/* there are 40 bytes if you don't need the rateset to be kept */ -#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40 - -/* if you do need the rateset, then you have less space */ -#define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24 - -/* maximum number of rate stages */ -#define IEEE80211_TX_MAX_RATES 5 - -/** - * struct ieee80211_tx_rate - rate selection/status - * - * @idx: rate index to attempt to send with - * @flags: rate control flags (&enum mac80211_rate_control_flags) - * @count: number of tries in this rate before going to the next rate - * - * A value of -1 for @idx indicates an invalid rate and, if used - * in an array of retry rates, that no more rates should be tried. - * - * When used for transmit status reporting, the driver should - * always report the rate along with the flags it used. - * - * &struct ieee80211_tx_info contains an array of these structs - * in the control information, and it will be filled by the rate - * control algorithm according to what should be sent. For example, - * if this array contains, in the format { <idx>, <count> } the - * information - * { 3, 2 }, { 2, 2 }, { 1, 4 }, { -1, 0 }, { -1, 0 } - * then this means that the frame should be transmitted - * up to twice at rate 3, up to twice at rate 2, and up to four - * times at rate 1 if it doesn't get acknowledged. Say it gets - * acknowledged by the peer after the fifth attempt, the status - * information should then contain - * { 3, 2 }, { 2, 2 }, { 1, 1 }, { -1, 0 } ... - * since it was transmitted twice at rate 3, twice at rate 2 - * and once at rate 1 after which we received an acknowledgement. - */ -struct ieee80211_tx_rate { - s8 idx; - u8 count; - u8 flags; -} __packed; - -/** - * struct ieee80211_tx_info - skb transmit information - * - * This structure is placed in skb->cb for three uses: - * (1) mac80211 TX control - mac80211 tells the driver what to do - * (2) driver internal use (if applicable) - * (3) TX status information - driver tells mac80211 what happened - * - * The TX control's sta pointer is only valid during the ->tx call, - * it may be NULL. - * - * @flags: transmit info flags, defined above - * @band: the band to transmit on (use for checking for races) - * @antenna_sel_tx: antenna to use, 0 for automatic diversity - * @ack_frame_id: internal frame ID for TX status, used internally - * @control: union for control data - * @status: union for status data - * @driver_data: array of driver_data pointers - * @ampdu_ack_len: number of acked aggregated frames. - * relevant only if IEEE80211_TX_STAT_AMPDU was set. - * @ampdu_len: number of aggregated frames. - * relevant only if IEEE80211_TX_STAT_AMPDU was set. - * @ack_signal: signal strength of the ACK frame - */ -struct ieee80211_tx_info { - /* common information */ - u32 flags; - u8 band; - - u8 antenna_sel_tx; - - u16 ack_frame_id; - - union { - struct { - union { - /* rate control */ - struct { - struct ieee80211_tx_rate rates[ - IEEE80211_TX_MAX_RATES]; - s8 rts_cts_rate_idx; - }; - /* only needed before rate control */ - unsigned long jiffies; - }; - /* NB: vif can be NULL for injected frames */ - struct ieee80211_vif *vif; - struct ieee80211_key_conf *hw_key; - struct ieee80211_sta *sta; - } control; - struct { - struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES]; - u8 ampdu_ack_len; - int ack_signal; - u8 ampdu_len; - /* 15 bytes free */ - } status; - struct { - struct ieee80211_tx_rate driver_rates[ - IEEE80211_TX_MAX_RATES]; - void *rate_driver_data[ - IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)]; - }; - void *driver_data[ - IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)]; - }; -}; - -/** - * struct ieee80211_sched_scan_ies - scheduled scan IEs - * - * This structure is used to pass the appropriate IEs to be used in scheduled - * scans for all bands. It contains both the IEs passed from the userspace - * and the ones generated by mac80211. - * - * @ie: array with the IEs for each supported band - * @len: array with the total length of the IEs for each band - */ -struct ieee80211_sched_scan_ies { - u8 *ie[IEEE80211_NUM_BANDS]; - size_t len[IEEE80211_NUM_BANDS]; -}; - -static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb) -{ - return (struct ieee80211_tx_info *)skb->cb; -} - -static inline struct ieee80211_rx_status *IEEE80211_SKB_RXCB(struct sk_buff *skb) -{ - return (struct ieee80211_rx_status *)skb->cb; -} - -/** - * ieee80211_tx_info_clear_status - clear TX status - * - * @info: The &struct ieee80211_tx_info to be cleared. - * - * When the driver passes an skb back to mac80211, it must report - * a number of things in TX status. This function clears everything - * in the TX status but the rate control information (it does clear - * the count since you need to fill that in anyway). - * - * NOTE: You can only use this function if you do NOT use - * info->driver_data! Use info->rate_driver_data - * instead if you need only the less space that allows. - */ -static inline void -ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) -{ - int i; - - BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != - offsetof(struct ieee80211_tx_info, control.rates)); - BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != - offsetof(struct ieee80211_tx_info, driver_rates)); - BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != 8); - /* clear the rate counts */ - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) - info->status.rates[i].count = 0; - - BUILD_BUG_ON( - offsetof(struct ieee80211_tx_info, status.ampdu_ack_len) != 23); - memset(&info->status.ampdu_ack_len, 0, - sizeof(struct ieee80211_tx_info) - - offsetof(struct ieee80211_tx_info, status.ampdu_ack_len)); -} - - -/** - * enum mac80211_rx_flags - receive flags - * - * These flags are used with the @flag member of &struct ieee80211_rx_status. - * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame. - * Use together with %RX_FLAG_MMIC_STRIPPED. - * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware. - * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame, - * verification has been done by the hardware. - * @RX_FLAG_IV_STRIPPED: The IV/ICV are stripped from this frame. - * If this flag is set, the stack cannot do any replay detection - * hence the driver or hardware will have to do that. - * @RX_FLAG_FAILED_FCS_CRC: Set this flag if the FCS check failed on - * the frame. - * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on - * the frame. - * @RX_FLAG_MACTIME_MPDU: The timestamp passed in the RX status (@mactime - * field) is valid and contains the time the first symbol of the MPDU - * was received. This is useful in monitor mode and for proper IBSS - * merging. - * @RX_FLAG_SHORTPRE: Short preamble was used for this frame - * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index - * @RX_FLAG_40MHZ: HT40 (40 MHz) was used - * @RX_FLAG_SHORT_GI: Short guard interval was used - * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present. - * Valid only for data frames (mainly A-MPDU) - */ -enum mac80211_rx_flags { - RX_FLAG_MMIC_ERROR = 1<<0, - RX_FLAG_DECRYPTED = 1<<1, - RX_FLAG_MMIC_STRIPPED = 1<<3, - RX_FLAG_IV_STRIPPED = 1<<4, - RX_FLAG_FAILED_FCS_CRC = 1<<5, - RX_FLAG_FAILED_PLCP_CRC = 1<<6, - RX_FLAG_MACTIME_MPDU = 1<<7, - RX_FLAG_SHORTPRE = 1<<8, - RX_FLAG_HT = 1<<9, - RX_FLAG_40MHZ = 1<<10, - RX_FLAG_SHORT_GI = 1<<11, - RX_FLAG_NO_SIGNAL_VAL = 1<<12, -}; - -/** - * struct ieee80211_rx_status - receive status - * - * The low-level driver should provide this information (the subset - * supported by hardware) to the 802.11 code with each received - * frame, in the skb's control buffer (cb). - * - * @mactime: value in microseconds of the 64-bit Time Synchronization Function - * (TSF) timer when the first data symbol (MPDU) arrived at the hardware. - * @band: the active band when this frame was received - * @freq: frequency the radio was tuned to when receiving this frame, in MHz - * @signal: signal strength when receiving this frame, either in dBm, in dB or - * unspecified depending on the hardware capabilities flags - * @IEEE80211_HW_SIGNAL_* - * @antenna: antenna used - * @rate_idx: index of data rate into band's supported rates or MCS index if - * HT rates are use (RX_FLAG_HT) - * @flag: %RX_FLAG_* - * @rx_flags: internal RX flags for mac80211 - */ -struct ieee80211_rx_status { - u64 mactime; - enum ieee80211_band band; - int freq; - int signal; - int antenna; - int rate_idx; - int flag; - unsigned int rx_flags; -}; - -/** - * enum ieee80211_conf_flags - configuration flags - * - * Flags to define PHY configuration options - * - * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this - * to determine for example whether to calculate timestamps for packets - * or not, do not use instead of filter flags! - * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only). - * This is the power save mode defined by IEEE 802.11-2007 section 11.2, - * meaning that the hardware still wakes up for beacons, is able to - * transmit frames and receive the possible acknowledgment frames. - * Not to be confused with hardware specific wakeup/sleep states, - * driver is responsible for that. See the section "Powersave support" - * for more. - * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set - * the driver should be prepared to handle configuration requests but - * may turn the device off as much as possible. Typically, this flag will - * be set when an interface is set UP but not associated or scanning, but - * it can also be unset in that case when monitor interfaces are active. - * @IEEE80211_CONF_OFFCHANNEL: The device is currently not on its main - * operating channel. - */ -enum ieee80211_conf_flags { - IEEE80211_CONF_MONITOR = (1<<0), - IEEE80211_CONF_PS = (1<<1), - IEEE80211_CONF_IDLE = (1<<2), - IEEE80211_CONF_OFFCHANNEL = (1<<3), -}; - - -/** - * enum ieee80211_conf_changed - denotes which configuration changed - * - * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed - * @IEEE80211_CONF_CHANGE_MONITOR: the monitor flag changed - * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed - * @IEEE80211_CONF_CHANGE_POWER: the TX power changed - * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed - * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed - * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed - * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed - */ -enum ieee80211_conf_changed { - IEEE80211_CONF_CHANGE_SMPS = BIT(1), - IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), - IEEE80211_CONF_CHANGE_MONITOR = BIT(3), - IEEE80211_CONF_CHANGE_PS = BIT(4), - IEEE80211_CONF_CHANGE_POWER = BIT(5), - IEEE80211_CONF_CHANGE_CHANNEL = BIT(6), - IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7), - IEEE80211_CONF_CHANGE_IDLE = BIT(8), -}; - -/** - * enum ieee80211_smps_mode - spatial multiplexing power save mode - * - * @IEEE80211_SMPS_AUTOMATIC: automatic - * @IEEE80211_SMPS_OFF: off - * @IEEE80211_SMPS_STATIC: static - * @IEEE80211_SMPS_DYNAMIC: dynamic - * @IEEE80211_SMPS_NUM_MODES: internal, don't use - */ -enum ieee80211_smps_mode { - IEEE80211_SMPS_AUTOMATIC, - IEEE80211_SMPS_OFF, - IEEE80211_SMPS_STATIC, - IEEE80211_SMPS_DYNAMIC, - - /* keep last */ - IEEE80211_SMPS_NUM_MODES, -}; - -/** - * struct ieee80211_conf - configuration of the device - * - * This struct indicates how the driver shall configure the hardware. - * - * @flags: configuration flags defined above - * - * @listen_interval: listen interval in units of beacon interval - * @max_sleep_period: the maximum number of beacon intervals to sleep for - * before checking the beacon for a TIM bit (managed mode only); this - * value will be only achievable between DTIM frames, the hardware - * needs to check for the multicast traffic bit in DTIM beacons. - * This variable is valid only when the CONF_PS flag is set. - * @ps_dtim_period: The DTIM period of the AP we're connected to, for use - * in power saving. Power saving will not be enabled until a beacon - * has been received and the DTIM period is known. - * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the - * powersave documentation below. This variable is valid only when - * the CONF_PS flag is set. - * - * @power_level: requested transmit power (in dBm) - * - * @channel: the channel to tune to - * @channel_type: the channel (HT) type - * - * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame - * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, - * but actually means the number of transmissions not the number of retries - * @short_frame_max_tx_count: Maximum number of transmissions for a "short" - * frame, called "dot11ShortRetryLimit" in 802.11, but actually means the - * number of transmissions not the number of retries - * - * @smps_mode: spatial multiplexing powersave mode; note that - * %IEEE80211_SMPS_STATIC is used when the device is not - * configured for an HT channel - */ -struct ieee80211_conf { - u32 flags; - int power_level, dynamic_ps_timeout; - int max_sleep_period; - - u16 listen_interval; - u8 ps_dtim_period; - - u8 long_frame_max_tx_count, short_frame_max_tx_count; - - struct ieee80211_channel *channel; - enum nl80211_channel_type channel_type; - enum ieee80211_smps_mode smps_mode; -}; - -/** - * struct ieee80211_channel_switch - holds the channel switch data - * - * The information provided in this structure is required for channel switch - * operation. - * - * @timestamp: value in microseconds of the 64-bit Time Synchronization - * Function (TSF) timer when the frame containing the channel switch - * announcement was received. This is simply the rx.mactime parameter - * the driver passed into mac80211. - * @block_tx: Indicates whether transmission must be blocked before the - * scheduled channel switch, as indicated by the AP. - * @channel: the new channel to switch to - * @count: the number of TBTT's until the channel switch event - */ -struct ieee80211_channel_switch { - u64 timestamp; - bool block_tx; - struct ieee80211_channel *channel; - u8 count; -}; - -/** - * enum ieee80211_vif_flags - virtual interface flags - * - * @IEEE80211_VIF_BEACON_FILTER: the device performs beacon filtering - * on this virtual interface to avoid unnecessary CPU wakeups - * @IEEE80211_VIF_SUPPORTS_CQM_RSSI: the device can do connection quality - * monitoring on this virtual interface -- i.e. it can monitor - * connection quality related parameters, such as the RSSI level and - * provide notifications if configured trigger levels are reached. - */ -enum ieee80211_vif_flags { - IEEE80211_VIF_BEACON_FILTER = BIT(0), - IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1), -}; - -/** - * struct ieee80211_vif - per-interface data - * - * Data in this structure is continually present for driver - * use during the life of a virtual interface. - * - * @type: type of this virtual interface - * @bss_conf: BSS configuration for this interface, either our own - * or the BSS we're associated to - * @addr: address of this interface - * @p2p: indicates whether this AP or STA interface is a p2p - * interface, i.e. a GO or p2p-sta respectively - * @driver_flags: flags/capabilities the driver has for this interface, - * these need to be set (or cleared) when the interface is added - * or, if supported by the driver, the interface type is changed - * at runtime, mac80211 will never touch this field - * @drv_priv: data area for driver use, will always be aligned to - * sizeof(void *). - */ -struct ieee80211_vif { - enum nl80211_iftype type; - struct ieee80211_bss_conf bss_conf; - u8 addr[ETH_ALEN]; - bool p2p; - u32 driver_flags; - /* must be last */ - u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); -}; - -static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) -{ -#ifdef CONFIG_MAC80211_MESH - return vif->type == NL80211_IFTYPE_MESH_POINT; -#endif - return false; -} - -/** - * enum ieee80211_key_flags - key flags - * - * These flags are used for communication about keys between the driver - * and mac80211, with the @flags parameter of &struct ieee80211_key_conf. - * - * @IEEE80211_KEY_FLAG_WMM_STA: Set by mac80211, this flag indicates - * that the STA this key will be used with could be using QoS. - * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the - * driver to indicate that it requires IV generation for this - * particular key. - * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by - * the driver for a TKIP key if it requires Michael MIC - * generation in software. - * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates - * that the key is pairwise rather then a shared key. - * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a - * CCMP key if it requires CCMP encryption of management frames (MFP) to - * be done in software. - * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver - * for a CCMP key if space should be prepared for the IV, but the IV - * itself should not be generated. Do not set together with - * @IEEE80211_KEY_FLAG_GENERATE_IV on the same key. - */ -enum ieee80211_key_flags { - IEEE80211_KEY_FLAG_WMM_STA = 1<<0, - IEEE80211_KEY_FLAG_GENERATE_IV = 1<<1, - IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2, - IEEE80211_KEY_FLAG_PAIRWISE = 1<<3, - IEEE80211_KEY_FLAG_SW_MGMT = 1<<4, - IEEE80211_KEY_FLAG_PUT_IV_SPACE = 1<<5, -}; - -/** - * struct ieee80211_key_conf - key information - * - * This key information is given by mac80211 to the driver by - * the set_key() callback in &struct ieee80211_ops. - * - * @hw_key_idx: To be set by the driver, this is the key index the driver - * wants to be given when a frame is transmitted and needs to be - * encrypted in hardware. - * @cipher: The key's cipher suite selector. - * @flags: key flags, see &enum ieee80211_key_flags. - * @keyidx: the key index (0-3) - * @keylen: key material length - * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte) - * data block: - * - Temporal Encryption Key (128 bits) - * - Temporal Authenticator Tx MIC Key (64 bits) - * - Temporal Authenticator Rx MIC Key (64 bits) - * @icv_len: The ICV length for this key type - * @iv_len: The IV length for this key type - */ -struct ieee80211_key_conf { - u32 cipher; - u8 icv_len; - u8 iv_len; - u8 hw_key_idx; - u8 flags; - s8 keyidx; - u8 keylen; - u8 key[0]; -}; - -/** - * enum set_key_cmd - key command - * - * Used with the set_key() callback in &struct ieee80211_ops, this - * indicates whether a key is being removed or added. - * - * @SET_KEY: a key is set - * @DISABLE_KEY: a key must be disabled - */ -enum set_key_cmd { - SET_KEY, DISABLE_KEY, -}; - -/* - * [PLATA] for the OCBMode, we should either be IEEE80211_STA_NONE or IEEE80211_STA_AUTHORIZED - */ -/** - * enum ieee80211_sta_state - station state - * - * @IEEE80211_STA_NOTEXIST: station doesn't exist at all, - * this is a special state for add/remove transitions - * @IEEE80211_STA_NONE: station exists without special state - * @IEEE80211_STA_AUTH: station is authenticated - * @IEEE80211_STA_ASSOC: station is associated - * @IEEE80211_STA_AUTHORIZED: station is authorized (802.1X) - */ -enum ieee80211_sta_state { - /* NOTE: These need to be ordered correctly! */ - IEEE80211_STA_NOTEXIST, - IEEE80211_STA_NONE, - IEEE80211_STA_AUTH, - IEEE80211_STA_ASSOC, - IEEE80211_STA_AUTHORIZED, -}; - -/** - * struct ieee80211_sta - station table entry - * - * A station table entry represents a station we are possibly - * communicating with. Since stations are RCU-managed in - * mac80211, any ieee80211_sta pointer you get access to must - * either be protected by rcu_read_lock() explicitly or implicitly, - * or you must take good care to not use such a pointer after a - * call to your sta_remove callback that removed it. - * - * @addr: MAC address - * @aid: AID we assigned to the station if we're an AP - * @supp_rates: Bitmap of supported rates (per band) - * @ht_cap: HT capabilities of this STA; restricted to our own TX capabilities - * @wme: indicates whether the STA supports WME. Only valid during AP-mode. - * @drv_priv: data area for driver use, will always be aligned to - * sizeof(void *), size is determined in hw information. - * @uapsd_queues: bitmap of queues configured for uapsd. Only valid - * if wme is supported. - * @max_sp: max Service Period. Only valid if wme is supported. - */ -struct ieee80211_sta { - u32 supp_rates[IEEE80211_NUM_BANDS]; - u8 addr[ETH_ALEN]; - u16 aid; - struct ieee80211_sta_ht_cap ht_cap; - bool wme; - u8 uapsd_queues; - u8 max_sp; - - /* must be last */ - u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); -}; - -/** - * enum sta_notify_cmd - sta notify command - * - * Used with the sta_notify() callback in &struct ieee80211_ops, this - * indicates if an associated station made a power state transition. - * - * @STA_NOTIFY_SLEEP: a station is now sleeping - * @STA_NOTIFY_AWAKE: a sleeping station woke up - */ -enum sta_notify_cmd { - STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE, -}; - -/** - * enum ieee80211_hw_flags - hardware flags - * - * These flags are used to indicate hardware capabilities to - * the stack. Generally, flags here should have their meaning - * done in a way that the simplest hardware doesn't need setting - * any particular flags. There are some exceptions to this rule, - * however, so you are advised to review these flags carefully. - * - * @IEEE80211_HW_HAS_RATE_CONTROL: - * The hardware or firmware includes rate control, and cannot be - * controlled by the stack. As such, no rate control algorithm - * should be instantiated, and the TX rate reported to userspace - * will be taken from the TX status instead of the rate control - * algorithm. - * Note that this requires that the driver implement a number of - * callbacks so it has the correct information, it needs to have - * the @set_rts_threshold callback and must look at the BSS config - * @use_cts_prot for G/N protection, @use_short_slot for slot - * timing in 2.4 GHz and @use_short_preamble for preambles for - * CCK frames. - * - * @IEEE80211_HW_RX_INCLUDES_FCS: - * Indicates that received frames passed to the stack include - * the FCS at the end. - * - * @IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING: - * Some wireless LAN chipsets buffer broadcast/multicast frames - * for power saving stations in the hardware/firmware and others - * rely on the host system for such buffering. This option is used - * to configure the IEEE 802.11 upper layer to buffer broadcast and - * multicast frames when there are power saving stations so that - * the driver can fetch them with ieee80211_get_buffered_bc(). - * - * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE: - * Hardware is not capable of short slot operation on the 2.4 GHz band. - * - * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE: - * Hardware is not capable of receiving frames with short preamble on - * the 2.4 GHz band. - * - * @IEEE80211_HW_SIGNAL_UNSPEC: - * Hardware can provide signal values but we don't know its units. We - * expect values between 0 and @max_signal. - * If possible please provide dB or dBm instead. - * - * @IEEE80211_HW_SIGNAL_DBM: - * Hardware gives signal values in dBm, decibel difference from - * one milliwatt. This is the preferred method since it is standardized - * between different devices. @max_signal does not need to be set. - * - * @IEEE80211_HW_SPECTRUM_MGMT: - * Hardware supports spectrum management defined in 802.11h - * Measurement, Channel Switch, Quieting, TPC - * - * @IEEE80211_HW_AMPDU_AGGREGATION: - * Hardware supports 11n A-MPDU aggregation. - * - * @IEEE80211_HW_SUPPORTS_PS: - * Hardware has power save support (i.e. can go to sleep). - * - * @IEEE80211_HW_PS_NULLFUNC_STACK: - * Hardware requires nullfunc frame handling in stack, implies - * stack support for dynamic PS. - * - * @IEEE80211_HW_SUPPORTS_DYNAMIC_PS: - * Hardware has support for dynamic PS. - * - * @IEEE80211_HW_MFP_CAPABLE: - * Hardware supports management frame protection (MFP, IEEE 802.11w). - * - * @IEEE80211_HW_SUPPORTS_STATIC_SMPS: - * Hardware supports static spatial multiplexing powersave, - * ie. can turn off all but one chain even on HT connections - * that should be using more chains. - * - * @IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS: - * Hardware supports dynamic spatial multiplexing powersave, - * ie. can turn off all but one chain and then wake the rest - * up as required after, for example, rts/cts handshake. - * - * @IEEE80211_HW_SUPPORTS_UAPSD: - * Hardware supports Unscheduled Automatic Power Save Delivery - * (U-APSD) in managed mode. The mode is configured with - * conf_tx() operation. - * - * @IEEE80211_HW_REPORTS_TX_ACK_STATUS: - * Hardware can provide ack status reports of Tx frames to - * the stack. - * - * @IEEE80211_HW_CONNECTION_MONITOR: - * The hardware performs its own connection monitoring, including - * periodic keep-alives to the AP and probing the AP on beacon loss. - * When this flag is set, signaling beacon-loss will cause an immediate - * change to disassociated state. - * - * @IEEE80211_HW_NEED_DTIM_PERIOD: - * This device needs to know the DTIM period for the BSS before - * associating. - * - * @IEEE80211_HW_SUPPORTS_PER_STA_GTK: The device's crypto engine supports - * per-station GTKs as used by IBSS RSN or during fast transition. If - * the device doesn't support per-station GTKs, but can be asked not - * to decrypt group addressed frames, then IBSS RSN support is still - * possible but software crypto will be used. Advertise the wiphy flag - * only in that case. - * - * @IEEE80211_HW_AP_LINK_PS: When operating in AP mode the device - * autonomously manages the PS status of connected stations. When - * this flag is set mac80211 will not trigger PS mode for connected - * stations based on the PM bit of incoming frames. - * Use ieee80211_start_ps()/ieee8021_end_ps() to manually configure - * the PS mode of connected stations. - * - * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session - * setup strictly in HW. mac80211 should not attempt to do this in - * software. - * - * @IEEE80211_HW_SCAN_WHILE_IDLE: The device can do hw scan while - * being idle (i.e. mac80211 doesn't have to go idle-off during the - * the scan). - * - * @WIPHY_FLAG_OCB_SUPPORTED: the device supports operations related to the OCB - * mode (IEEE 802.11p). - */ -enum ieee80211_hw_flags { - IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, - IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, - IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, - IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3, - IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4, - IEEE80211_HW_SIGNAL_UNSPEC = 1<<5, - IEEE80211_HW_SIGNAL_DBM = 1<<6, - IEEE80211_HW_NEED_DTIM_PERIOD = 1<<7, - IEEE80211_HW_SPECTRUM_MGMT = 1<<8, - IEEE80211_HW_AMPDU_AGGREGATION = 1<<9, - IEEE80211_HW_SUPPORTS_PS = 1<<10, - IEEE80211_HW_PS_NULLFUNC_STACK = 1<<11, - IEEE80211_HW_SUPPORTS_DYNAMIC_PS = 1<<12, - IEEE80211_HW_MFP_CAPABLE = 1<<13, - /* reuse bit 14 */ - IEEE80211_HW_SUPPORTS_STATIC_SMPS = 1<<15, - IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS = 1<<16, - IEEE80211_HW_SUPPORTS_UAPSD = 1<<17, - IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, - IEEE80211_HW_CONNECTION_MONITOR = 1<<19, - /* reuse bit 20 */ - IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, - IEEE80211_HW_AP_LINK_PS = 1<<22, - IEEE80211_HW_TX_AMPDU_SETUP_IN_HW = 1<<23, - IEEE80211_HW_SCAN_WHILE_IDLE = 1<<24, - IEEE80211_HW_DOT11OCB_SUPPORTED = 1<<25, -}; - -/** - * struct ieee80211_hw - hardware information and state - * - * This structure contains the configuration and hardware - * information for an 802.11 PHY. - * - * @wiphy: This points to the &struct wiphy allocated for this - * 802.11 PHY. You must fill in the @perm_addr and @dev - * members of this structure using SET_IEEE80211_DEV() - * and SET_IEEE80211_PERM_ADDR(). Additionally, all supported - * bands (with channels, bitrates) are registered here. - * - * @conf: &struct ieee80211_conf, device configuration, don't use. - * - * @priv: pointer to private area that was allocated for driver use - * along with this structure. - * - * @flags: hardware flags, see &enum ieee80211_hw_flags. - * - * @extra_tx_headroom: headroom to reserve in each transmit skb - * for use by the driver (e.g. for transmit headers.) - * - * @channel_change_time: time (in microseconds) it takes to change channels. - * - * @max_signal: Maximum value for signal (rssi) in RX information, used - * only when @IEEE80211_HW_SIGNAL_UNSPEC or @IEEE80211_HW_SIGNAL_DB - * - * @max_listen_interval: max listen interval in units of beacon interval - * that HW supports - * - * @queues: number of available hardware transmit queues for - * data packets. WMM/QoS requires at least four, these - * queues need to have configurable access parameters. - * - * @rate_control_algorithm: rate control algorithm for this hardware. - * If unset (NULL), the default algorithm will be used. Must be - * set before calling ieee80211_register_hw(). - * - * @vif_data_size: size (in bytes) of the drv_priv data area - * within &struct ieee80211_vif. - * @sta_data_size: size (in bytes) of the drv_priv data area - * within &struct ieee80211_sta. - * - * @max_rates: maximum number of alternate rate retry stages the hw - * can handle. - * @max_report_rates: maximum number of alternate rate retry stages - * the hw can report back. - * @max_rate_tries: maximum number of tries for each stage - * - * @napi_weight: weight used for NAPI polling. You must specify an - * appropriate value here if a napi_poll operation is provided - * by your driver. - * - * @max_rx_aggregation_subframes: maximum buffer size (number of - * sub-frames) to be used for A-MPDU block ack receiver - * aggregation. - * This is only relevant if the device has restrictions on the - * number of subframes, if it relies on mac80211 to do reordering - * it shouldn't be set. - * - * @max_tx_aggregation_subframes: maximum number of subframes in an - * aggregate an HT driver will transmit, used by the peer as a - * hint to size its reorder buffer. - */ -struct ieee80211_hw { - struct ieee80211_conf conf; - struct wiphy *wiphy; - const char *rate_control_algorithm; - void *priv; - u32 flags; - unsigned int extra_tx_headroom; - int channel_change_time; - int vif_data_size; - int sta_data_size; - int napi_weight; - u16 queues; - u16 max_listen_interval; - s8 max_signal; - u8 max_rates; - u8 max_report_rates; - u8 max_rate_tries; - u8 max_rx_aggregation_subframes; - u8 max_tx_aggregation_subframes; -}; - -/** - * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy - * - * @wiphy: the &struct wiphy which we want to query - * - * mac80211 drivers can use this to get to their respective - * &struct ieee80211_hw. Drivers wishing to get to their own private - * structure can then access it via hw->priv. Note that mac802111 drivers should - * not use wiphy_priv() to try to get their private driver structure as this - * is already used internally by mac80211. - */ -struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy); - -/** - * SET_IEEE80211_DEV - set device for 802.11 hardware - * - * @hw: the &struct ieee80211_hw to set the device for - * @dev: the &struct device of this 802.11 device - */ -static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev) -{ - set_wiphy_dev(hw->wiphy, dev); -} - -/** - * SET_IEEE80211_PERM_ADDR - set the permanent MAC address for 802.11 hardware - * - * @hw: the &struct ieee80211_hw to set the MAC address for - * @addr: the address to set - */ -static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr) -{ - memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN); -} - -static inline struct ieee80211_rate * -ieee80211_get_tx_rate(const struct ieee80211_hw *hw, - const struct ieee80211_tx_info *c) -{ - if (WARN_ON_ONCE(c->control.rates[0].idx < 0)) - return NULL; - return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx]; -} - -static inline struct ieee80211_rate * -ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw, - const struct ieee80211_tx_info *c) -{ - if (c->control.rts_cts_rate_idx < 0) - return NULL; - return &hw->wiphy->bands[c->band]->bitrates[c->control.rts_cts_rate_idx]; -} - -static inline struct ieee80211_rate * -ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, - const struct ieee80211_tx_info *c, int idx) -{ - if (c->control.rates[idx + 1].idx < 0) - return NULL; - return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx]; -} - -/** - * ieee80211_free_txskb - free TX skb - * @hw: the hardware - * @skb: the skb - * - * Free a transmit skb. Use this funtion when some failure - * to transmit happened and thus status cannot be reported. - */ -void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); - -/** - * DOC: Hardware crypto acceleration - * - * mac80211 is capable of taking advantage of many hardware - * acceleration designs for encryption and decryption operations. - * - * The set_key() callback in the &struct ieee80211_ops for a given - * device is called to enable hardware acceleration of encryption and - * decryption. The callback takes a @sta parameter that will be NULL - * for default keys or keys used for transmission only, or point to - * the station information for the peer for individual keys. - * Multiple transmission keys with the same key index may be used when - * VLANs are configured for an access point. - * - * When transmitting, the TX control data will use the @hw_key_idx - * selected by the driver by modifying the &struct ieee80211_key_conf - * pointed to by the @key parameter to the set_key() function. - * - * The set_key() call for the %SET_KEY command should return 0 if - * the key is now in use, -%EOPNOTSUPP or -%ENOSPC if it couldn't be - * added; if you return 0 then hw_key_idx must be assigned to the - * hardware key index, you are free to use the full u8 range. - * - * When the cmd is %DISABLE_KEY then it must succeed. - * - * Note that it is permissible to not decrypt a frame even if a key - * for it has been uploaded to hardware, the stack will not make any - * decision based on whether a key has been uploaded or not but rather - * based on the receive flags. - * - * The &struct ieee80211_key_conf structure pointed to by the @key - * parameter is guaranteed to be valid until another call to set_key() - * removes it, but it can only be used as a cookie to differentiate - * keys. - * - * In TKIP some HW need to be provided a phase 1 key, for RX decryption - * acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key - * handler. - * The update_tkip_key() call updates the driver with the new phase 1 key. - * This happens every time the iv16 wraps around (every 65536 packets). The - * set_key() call will happen only once for each key (unless the AP did - * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is - * provided by update_tkip_key only. The trigger that makes mac80211 call this - * handler is software decryption with wrap around of iv16. - */ - -/** - * DOC: Powersave support - * - * mac80211 has support for various powersave implementations. - * - * First, it can support hardware that handles all powersaving by itself, - * such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS hardware - * flag. In that case, it will be told about the desired powersave mode - * with the %IEEE80211_CONF_PS flag depending on the association status. - * The hardware must take care of sending nullfunc frames when necessary, - * i.e. when entering and leaving powersave mode. The hardware is required - * to look at the AID in beacons and signal to the AP that it woke up when - * it finds traffic directed to it. - * - * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in - * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused - * with hardware wakeup and sleep states. Driver is responsible for waking - * up the hardware before issuing commands to the hardware and putting it - * back to sleep at appropriate times. - * - * When PS is enabled, hardware needs to wakeup for beacons and receive the - * buffered multicast/broadcast frames after the beacon. Also it must be - * possible to send frames and receive the acknowledment frame. - * - * Other hardware designs cannot send nullfunc frames by themselves and also - * need software support for parsing the TIM bitmap. This is also supported - * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and - * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still - * required to pass up beacons. The hardware is still required to handle - * waking up for multicast traffic; if it cannot the driver must handle that - * as best as it can, mac80211 is too slow to do that. - * - * Dynamic powersave is an extension to normal powersave in which the - * hardware stays awake for a user-specified period of time after sending a - * frame so that reply frames need not be buffered and therefore delayed to - * the next wakeup. It's compromise of getting good enough latency when - * there's data traffic and still saving significantly power in idle - * periods. - * - * Dynamic powersave is simply supported by mac80211 enabling and disabling - * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS - * flag and mac80211 will handle everything automatically. Additionally, - * hardware having support for the dynamic PS feature may set the - * %IEEE80211_HW_SUPPORTS_DYNAMIC_PS flag to indicate that it can support - * dynamic PS mode itself. The driver needs to look at the - * @dynamic_ps_timeout hardware configuration value and use it that value - * whenever %IEEE80211_CONF_PS is set. In this case mac80211 will disable - * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS - * enabled whenever user has enabled powersave. - * - * Some hardware need to toggle a single shared antenna between WLAN and - * Bluetooth to facilitate co-existence. These types of hardware set - * limitations on the use of host controlled dynamic powersave whenever there - * is simultaneous WLAN and Bluetooth traffic. For these types of hardware, the - * driver may request temporarily going into full power save, in order to - * enable toggling the antenna between BT and WLAN. If the driver requests - * disabling dynamic powersave, the @dynamic_ps_timeout value will be - * temporarily set to zero until the driver re-enables dynamic powersave. - * - * Driver informs U-APSD client support by enabling - * %IEEE80211_HW_SUPPORTS_UAPSD flag. The mode is configured through the - * uapsd paramater in conf_tx() operation. Hardware needs to send the QoS - * Nullfunc frames and stay awake until the service period has ended. To - * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames - * from that AC are transmitted with powersave enabled. - * - * Note: U-APSD client mode is not yet supported with - * %IEEE80211_HW_PS_NULLFUNC_STACK. - */ - -/** - * DOC: Beacon filter support - * - * Some hardware have beacon filter support to reduce host cpu wakeups - * which will reduce system power consumption. It usually works so that - * the firmware creates a checksum of the beacon but omits all constantly - * changing elements (TSF, TIM etc). Whenever the checksum changes the - * beacon is forwarded to the host, otherwise it will be just dropped. That - * way the host will only receive beacons where some relevant information - * (for example ERP protection or WMM settings) have changed. - * - * Beacon filter support is advertised with the %IEEE80211_VIF_BEACON_FILTER - * interface capability. The driver needs to enable beacon filter support - * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When - * power save is enabled, the stack will not check for beacon loss and the - * driver needs to notify about loss of beacons with ieee80211_beacon_loss(). - * - * The time (or number of beacons missed) until the firmware notifies the - * driver of a beacon loss event (which in turn causes the driver to call - * ieee80211_beacon_loss()) should be configurable and will be controlled - * by mac80211 and the roaming algorithm in the future. - * - * Since there may be constantly changing information elements that nothing - * in the software stack cares about, we will, in the future, have mac80211 - * tell the driver which information elements are interesting in the sense - * that we want to see changes in them. This will include - * - a list of information element IDs - * - a list of OUIs for the vendor information element - * - * Ideally, the hardware would filter out any beacons without changes in the - * requested elements, but if it cannot support that it may, at the expense - * of some efficiency, filter out only a subset. For example, if the device - * doesn't support checking for OUIs it should pass up all changes in all - * vendor information elements. - * - * Note that change, for the sake of simplification, also includes information - * elements appearing or disappearing from the beacon. - * - * Some hardware supports an "ignore list" instead, just make sure nothing - * that was requested is on the ignore list, and include commonly changing - * information element IDs in the ignore list, for example 11 (BSS load) and - * the various vendor-assigned IEs with unknown contents (128, 129, 133-136, - * 149, 150, 155, 156, 173, 176, 178, 179, 219); for forward compatibility - * it could also include some currently unused IDs. - * - * - * In addition to these capabilities, hardware should support notifying the - * host of changes in the beacon RSSI. This is relevant to implement roaming - * when no traffic is flowing (when traffic is flowing we see the RSSI of - * the received data packets). This can consist in notifying the host when - * the RSSI changes significantly or when it drops below or rises above - * configurable thresholds. In the future these thresholds will also be - * configured by mac80211 (which gets them from userspace) to implement - * them as the roaming algorithm requires. - * - * If the hardware cannot implement this, the driver should ask it to - * periodically pass beacon frames to the host so that software can do the - * signal strength threshold checking. - */ - -/** - * DOC: Spatial multiplexing power save - * - * SMPS (Spatial multiplexing power save) is a mechanism to conserve - * power in an 802.11n implementation. For details on the mechanism - * and rationale, please refer to 802.11 (as amended by 802.11n-2009) - * "11.2.3 SM power save". - * - * The mac80211 implementation is capable of sending action frames - * to update the AP about the station's SMPS mode, and will instruct - * the driver to enter the specific mode. It will also announce the - * requested SMPS mode during the association handshake. Hardware - * support for this feature is required, and can be indicated by - * hardware flags. - * - * The default mode will be "automatic", which nl80211/cfg80211 - * defines to be dynamic SMPS in (regular) powersave, and SMPS - * turned off otherwise. - * - * To support this feature, the driver must set the appropriate - * hardware support flags, and handle the SMPS flag to the config() - * operation. It will then with this mechanism be instructed to - * enter the requested SMPS mode while associated to an HT AP. - */ - -/** - * DOC: Frame filtering - * - * mac80211 requires to see many management frames for proper - * operation, and users may want to see many more frames when - * in monitor mode. However, for best CPU usage and power consumption, - * having as few frames as possible percolate through the stack is - * desirable. Hence, the hardware should filter as much as possible. - * - * To achieve this, mac80211 uses filter flags (see below) to tell - * the driver's configure_filter() function which frames should be - * passed to mac80211 and which should be filtered out. - * - * Before configure_filter() is invoked, the prepare_multicast() - * callback is invoked with the parameters @mc_count and @mc_list - * for the combined multicast address list of all virtual interfaces. - * It's use is optional, and it returns a u64 that is passed to - * configure_filter(). Additionally, configure_filter() has the - * arguments @changed_flags telling which flags were changed and - * @total_flags with the new flag states. - * - * If your device has no multicast address filters your driver will - * need to check both the %FIF_ALLMULTI flag and the @mc_count - * parameter to see whether multicast frames should be accepted - * or dropped. - * - * All unsupported flags in @total_flags must be cleared. - * Hardware does not support a flag if it is incapable of _passing_ - * the frame to the stack. Otherwise the driver must ignore - * the flag, but not clear it. - * You must _only_ clear the flag (announce no support for the - * flag to mac80211) if you are not able to pass the packet type - * to the stack (so the hardware always filters it). - * So for example, you should clear @FIF_CONTROL, if your hardware - * always filters control frames. If your hardware always passes - * control frames to the kernel and is incapable of filtering them, - * you do _not_ clear the @FIF_CONTROL flag. - * This rule applies to all other FIF flags as well. - */ - -/** - * DOC: AP support for powersaving clients - * - * In order to implement AP and P2P GO modes, mac80211 has support for - * client powersaving, both "legacy" PS (PS-Poll/null data) and uAPSD. - * There currently is no support for sAPSD. - * - * There is one assumption that mac80211 makes, namely that a client - * will not poll with PS-Poll and trigger with uAPSD at the same time. - * Both are supported, and both can be used by the same client, but - * they can't be used concurrently by the same client. This simplifies - * the driver code. - * - * The first thing to keep in mind is that there is a flag for complete - * driver implementation: %IEEE80211_HW_AP_LINK_PS. If this flag is set, - * mac80211 expects the driver to handle most of the state machine for - * powersaving clients and will ignore the PM bit in incoming frames. - * Drivers then use ieee80211_sta_ps_transition() to inform mac80211 of - * stations' powersave transitions. In this mode, mac80211 also doesn't - * handle PS-Poll/uAPSD. - * - * In the mode without %IEEE80211_HW_AP_LINK_PS, mac80211 will check the - * PM bit in incoming frames for client powersave transitions. When a - * station goes to sleep, we will stop transmitting to it. There is, - * however, a race condition: a station might go to sleep while there is - * data buffered on hardware queues. If the device has support for this - * it will reject frames, and the driver should give the frames back to - * mac80211 with the %IEEE80211_TX_STAT_TX_FILTERED flag set which will - * cause mac80211 to retry the frame when the station wakes up. The - * driver is also notified of powersave transitions by calling its - * @sta_notify callback. - * - * When the station is asleep, it has three choices: it can wake up, - * it can PS-Poll, or it can possibly start a uAPSD service period. - * Waking up is implemented by simply transmitting all buffered (and - * filtered) frames to the station. This is the easiest case. When - * the station sends a PS-Poll or a uAPSD trigger frame, mac80211 - * will inform the driver of this with the @allow_buffered_frames - * callback; this callback is optional. mac80211 will then transmit - * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER - * on each frame. The last frame in the service period (or the only - * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to - * indicate that it ends the service period; as this frame must have - * TX status report it also sets %IEEE80211_TX_CTL_REQ_TX_STATUS. - * When TX status is reported for this frame, the service period is - * marked has having ended and a new one can be started by the peer. - * - * Additionally, non-bufferable MMPDUs can also be transmitted by - * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them. - * - * Another race condition can happen on some devices like iwlwifi - * when there are frames queued for the station and it wakes up - * or polls; the frames that are already queued could end up being - * transmitted first instead, causing reordering and/or wrong - * processing of the EOSP. The cause is that allowing frames to be - * transmitted to a certain station is out-of-band communication to - * the device. To allow this problem to be solved, the driver can - * call ieee80211_sta_block_awake() if frames are buffered when it - * is notified that the station went to sleep. When all these frames - * have been filtered (see above), it must call the function again - * to indicate that the station is no longer blocked. - * - * If the driver buffers frames in the driver for aggregation in any - * way, it must use the ieee80211_sta_set_buffered() call when it is - * notified of the station going to sleep to inform mac80211 of any - * TIDs that have frames buffered. Note that when a station wakes up - * this information is reset (hence the requirement to call it when - * informed of the station going to sleep). Then, when a service - * period starts for any reason, @release_buffered_frames is called - * with the number of frames to be released and which TIDs they are - * to come from. In this case, the driver is responsible for setting - * the EOSP (for uAPSD) and MORE_DATA bits in the released frames, - * to help the @more_data paramter is passed to tell the driver if - * there is more data on other TIDs -- the TIDs to release frames - * from are ignored since mac80211 doesn't know how many frames the - * buffers for those TIDs contain. - * - * If the driver also implement GO mode, where absence periods may - * shorten service periods (or abort PS-Poll responses), it must - * filter those response frames except in the case of frames that - * are buffered in the driver -- those must remain buffered to avoid - * reordering. Because it is possible that no frames are released - * in this case, the driver must call ieee80211_sta_eosp_irqsafe() - * to indicate to mac80211 that the service period ended anyway. - * - * Finally, if frames from multiple TIDs are released from mac80211 - * but the driver might reorder them, it must clear & set the flags - * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP) - * and also take care of the EOSP and MORE_DATA bits in the frame. - * The driver may also use ieee80211_sta_eosp_irqsafe() in this case. - */ - -/** - * enum ieee80211_filter_flags - hardware filter flags - * - * These flags determine what the filter in hardware should be - * programmed to let through and what should not be passed to the - * stack. It is always safe to pass more frames than requested, - * but this has negative impact on power consumption. - * - * @FIF_PROMISC_IN_BSS: promiscuous mode within your BSS, - * think of the BSS as your network segment and then this corresponds - * to the regular ethernet device promiscuous mode. - * - * @FIF_ALLMULTI: pass all multicast frames, this is used if requested - * by the user or if the hardware is not capable of filtering by - * multicast address. - * - * @FIF_FCSFAIL: pass frames with failed FCS (but you need to set the - * %RX_FLAG_FAILED_FCS_CRC for them) - * - * @FIF_PLCPFAIL: pass frames with failed PLCP CRC (but you need to set - * the %RX_FLAG_FAILED_PLCP_CRC for them - * - * @FIF_BCN_PRBRESP_PROMISC: This flag is set during scanning to indicate - * to the hardware that it should not filter beacons or probe responses - * by BSSID. Filtering them can greatly reduce the amount of processing - * mac80211 needs to do and the amount of CPU wakeups, so you should - * honour this flag if possible. - * - * @FIF_CONTROL: pass control frames (except for PS Poll), if PROMISC_IN_BSS - * is not set then only those addressed to this station. - * - * @FIF_OTHER_BSS: pass frames destined to other BSSes - * - * @FIF_PSPOLL: pass PS Poll frames, if PROMISC_IN_BSS is not set then only - * those addressed to this station. - * - * @FIF_PROBE_REQ: pass probe request frames - */ -enum ieee80211_filter_flags { - FIF_PROMISC_IN_BSS = 1<<0, - FIF_ALLMULTI = 1<<1, - FIF_FCSFAIL = 1<<2, - FIF_PLCPFAIL = 1<<3, - FIF_BCN_PRBRESP_PROMISC = 1<<4, - FIF_CONTROL = 1<<5, - FIF_OTHER_BSS = 1<<6, - FIF_PSPOLL = 1<<7, - FIF_PROBE_REQ = 1<<8, -}; - -/** - * enum ieee80211_ampdu_mlme_action - A-MPDU actions - * - * These flags are used with the ampdu_action() callback in - * &struct ieee80211_ops to indicate which action is needed. - * - * Note that drivers MUST be able to deal with a TX aggregation - * session being stopped even before they OK'ed starting it by - * calling ieee80211_start_tx_ba_cb_irqsafe, because the peer - * might receive the addBA frame and send a delBA right away! - * - * @IEEE80211_AMPDU_RX_START: start Rx aggregation - * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation - * @IEEE80211_AMPDU_TX_START: start Tx aggregation - * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation - * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational - */ -enum ieee80211_ampdu_mlme_action { - IEEE80211_AMPDU_RX_START, - IEEE80211_AMPDU_RX_STOP, - IEEE80211_AMPDU_TX_START, - IEEE80211_AMPDU_TX_STOP, - IEEE80211_AMPDU_TX_OPERATIONAL, -}; - -/** - * enum ieee80211_frame_release_type - frame release reason - * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll - * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to - * frame received on trigger-enabled AC - */ -enum ieee80211_frame_release_type { - IEEE80211_FRAME_RELEASE_PSPOLL, - IEEE80211_FRAME_RELEASE_UAPSD, -}; - -/** - * struct ieee80211_ops - callbacks from mac80211 to the driver - * - * This structure contains various callbacks that the driver may - * handle or, in some cases, must handle, for example to configure - * the hardware to a new channel or to transmit a frame. - * - * @tx: Handler that 802.11 module calls for each transmitted frame. - * skb contains the buffer starting from the IEEE 802.11 header. - * The low-level driver should send the frame out based on - * configuration in the TX control data. This handler should, - * preferably, never fail and stop queues appropriately. - * This must be implemented if @tx_frags is not. - * Must be atomic. - * - * @tx_frags: Called to transmit multiple fragments of a single MSDU. - * This handler must consume all fragments, sending out some of - * them only is useless and it can't ask for some of them to be - * queued again. If the frame is not fragmented the queue has a - * single SKB only. To avoid issues with the networking stack - * when TX status is reported the frames should be removed from - * the skb queue. - * If this is used, the tx_info @vif and @sta pointers will be - * invalid -- you must not use them in that case. - * This must be implemented if @tx isn't. - * Must be atomic. - * - * @start: Called before the first netdevice attached to the hardware - * is enabled. This should turn on the hardware and must turn on - * frame reception (for possibly enabled monitor interfaces.) - * Returns negative error codes, these may be seen in userspace, - * or zero. - * When the device is started it should not have a MAC address - * to avoid acknowledging frames before a non-monitor device - * is added. - * Must be implemented and can sleep. - * - * @stop: Called after last netdevice attached to the hardware - * is disabled. This should turn off the hardware (at least - * it must turn off frame reception.) - * May be called right after add_interface if that rejects - * an interface. If you added any work onto the mac80211 workqueue - * you should ensure to cancel it on this callback. - * Must be implemented and can sleep. - * - * @suspend: Suspend the device; mac80211 itself will quiesce before and - * stop transmitting and doing any other configuration, and then - * ask the device to suspend. This is only invoked when WoWLAN is - * configured, otherwise the device is deconfigured completely and - * reconfigured at resume time. - * The driver may also impose special conditions under which it - * wants to use the "normal" suspend (deconfigure), say if it only - * supports WoWLAN when the device is associated. In this case, it - * must return 1 from this function. - * - * @resume: If WoWLAN was configured, this indicates that mac80211 is - * now resuming its operation, after this the device must be fully - * functional again. If this returns an error, the only way out is - * to also unregister the device. If it returns 1, then mac80211 - * will also go through the regular complete restart on resume. - * - * @add_interface: Called when a netdevice attached to the hardware is - * enabled. Because it is not called for monitor mode devices, @start - * and @stop must be implemented. - * The driver should perform any initialization it needs before - * the device can be enabled. The initial configuration for the - * interface is given in the conf parameter. - * The callback may refuse to add an interface by returning a - * negative error code (which will be seen in userspace.) - * Must be implemented and can sleep. - * - * @change_interface: Called when a netdevice changes type. This callback - * is optional, but only if it is supported can interface types be - * switched while the interface is UP. The callback may sleep. - * Note that while an interface is being switched, it will not be - * found by the interface iteration callbacks. - * - * @remove_interface: Notifies a driver that an interface is going down. - * The @stop callback is called after this if it is the last interface - * and no monitor interfaces are present. - * When all interfaces are removed, the MAC address in the hardware - * must be cleared so the device no longer acknowledges packets, - * the mac_addr member of the conf structure is, however, set to the - * MAC address of the device going away. - * Hence, this callback must be implemented. It can sleep. - * - * @config: Handler for configuration requests. IEEE 802.11 code calls this - * function to change hardware configuration, e.g., channel. - * This function should never fail but returns a negative error code - * if it does. The callback can sleep. - * - * @bss_info_changed: Handler for configuration requests related to BSS - * parameters that may vary during BSS's lifespan, and may affect low - * level driver (e.g. assoc/disassoc status, erp parameters). - * This function should not be used if no BSS has been set, unless - * for association indication. The @changed parameter indicates which - * of the bss parameters has changed when a call is made. The callback - * can sleep. - * - * @prepare_multicast: Prepare for multicast filter configuration. - * This callback is optional, and its return value is passed - * to configure_filter(). This callback must be atomic. - * - * @configure_filter: Configure the device's RX filter. - * See the section "Frame filtering" for more information. - * This callback must be implemented and can sleep. - * - * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit - * must be set or cleared for a given STA. Must be atomic. - * - * @set_key: See the section "Hardware crypto acceleration" - * This callback is only called between add_interface and - * remove_interface calls, i.e. while the given virtual interface - * is enabled. - * Returns a negative error code if the key can't be added. - * The callback can sleep. - * - * @update_tkip_key: See the section "Hardware crypto acceleration" - * This callback will be called in the context of Rx. Called for drivers - * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY. - * The callback must be atomic. - * - * @set_rekey_data: If the device supports GTK rekeying, for example while the - * host is suspended, it can assign this callback to retrieve the data - * necessary to do GTK rekeying, this is the KEK, KCK and replay counter. - * After rekeying was done it should (for example during resume) notify - * userspace of the new replay counter using ieee80211_gtk_rekey_notify(). - * - * @hw_scan: Ask the hardware to service the scan request, no need to start - * the scan state machine in stack. The scan must honour the channel - * configuration done by the regulatory agent in the wiphy's - * registered bands. The hardware (or the driver) needs to make sure - * that power save is disabled. - * The @req ie/ie_len members are rewritten by mac80211 to contain the - * entire IEs after the SSID, so that drivers need not look at these - * at all but just send them after the SSID -- mac80211 includes the - * (extended) supported rates and HT information (where applicable). - * When the scan finishes, ieee80211_scan_completed() must be called; - * note that it also must be called when the scan cannot finish due to - * any error unless this callback returned a negative error code. - * The callback can sleep. - * - * @cancel_hw_scan: Ask the low-level tp cancel the active hw scan. - * The driver should ask the hardware to cancel the scan (if possible), - * but the scan will be completed only after the driver will call - * ieee80211_scan_completed(). - * This callback is needed for wowlan, to prevent enqueueing a new - * scan_work after the low-level driver was already suspended. - * The callback can sleep. - * - * @sched_scan_start: Ask the hardware to start scanning repeatedly at - * specific intervals. The driver must call the - * ieee80211_sched_scan_results() function whenever it finds results. - * This process will continue until sched_scan_stop is called. - * - * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan. - * - * @sw_scan_start: Notifier function that is called just before a software scan - * is started. Can be NULL, if the driver doesn't need this notification. - * The callback can sleep. - * - * @sw_scan_complete: Notifier function that is called just after a - * software scan finished. Can be NULL, if the driver doesn't need - * this notification. - * The callback can sleep. - * - * @get_stats: Return low-level statistics. - * Returns zero if statistics are available. - * The callback can sleep. - * - * @get_tkip_seq: If your device implements TKIP encryption in hardware this - * callback should be provided to read the TKIP transmit IVs (both IV32 - * and IV16) for the given key from hardware. - * The callback must be atomic. - * - * @set_frag_threshold: Configuration of fragmentation threshold. Assign this - * if the device does fragmentation by itself; if this callback is - * implemented then the stack will not do fragmentation. - * The callback can sleep. - * - * @set_rts_threshold: Configuration of RTS threshold (if device needs it) - * The callback can sleep. - * - * @sta_add: Notifies low level driver about addition of an associated station, - * AP, IBSS/WDS/mesh peer etc. This callback can sleep. - * - * @sta_remove: Notifies low level driver about removal of an associated - * station, AP, IBSS/WDS/mesh peer etc. This callback can sleep. - * - * @sta_notify: Notifies low level driver about power state transition of an - * associated station, AP, IBSS/WDS/mesh peer etc. For a VIF operating - * in AP mode, this callback will not be called when the flag - * %IEEE80211_HW_AP_LINK_PS is set. Must be atomic. - * - * @sta_state: Notifies low level driver about state transition of a - * station (which can be the AP, a client, IBSS/WDS/mesh peer etc.) - * This callback is mutually exclusive with @sta_add/@sta_remove. - * It must not fail for down transitions but may fail for transitions - * up the list of states. - * The callback can sleep. - * - * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), - * bursting) for a hardware TX queue. - * Returns a negative error code on failure. - * The callback can sleep. - * - * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently, - * this is only used for IBSS mode BSSID merging and debugging. Is not a - * required function. - * The callback can sleep. - * - * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware. - * Currently, this is only used for IBSS mode debugging. Is not a - * required function. - * The callback can sleep. - * - * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize - * with other STAs in the IBSS. This is only used in IBSS mode. This - * function is optional if the firmware/hardware takes full care of - * TSF synchronization. - * The callback can sleep. - * - * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. - * This is needed only for IBSS mode and the result of this function is - * used to determine whether to reply to Probe Requests. - * Returns non-zero if this device sent the last beacon. - * The callback can sleep. - * - * @ampdu_action: Perform a certain A-MPDU action - * The RA/TID combination determines the destination and TID we want - * the ampdu action to be performed for. The action is defined through - * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) - * is the first frame we expect to perform the action on. Notice - * that TX/RX_STOP can pass NULL for this parameter. - * The @buf_size parameter is only valid when the action is set to - * %IEEE80211_AMPDU_TX_OPERATIONAL and indicates the peer's reorder - * buffer size (number of subframes) for this session -- the driver - * may neither send aggregates containing more subframes than this - * nor send aggregates in a way that lost frames would exceed the - * buffer size. If just limiting the aggregate size, this would be - * possible with a buf_size of 8: - * - TX: 1.....7 - * - RX: 2....7 (lost frame #1) - * - TX: 8..1... - * which is invalid since #1 was now re-transmitted well past the - * buffer size of 8. Correct ways to retransmit #1 would be: - * - TX: 1 or 18 or 81 - * Even "189" would be wrong since 1 could be lost again. - * - * Returns a negative error code on failure. - * The callback can sleep. - * - * @get_survey: Return per-channel survey information - * - * @rfkill_poll: Poll rfkill hardware state. If you need this, you also - * need to set wiphy->rfkill_poll to %true before registration, - * and need to call wiphy_rfkill_set_hw_state() in the callback. - * The callback can sleep. - * - * @set_coverage_class: Set slot time for given coverage class as specified - * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout - * accordingly. This callback is not required and may sleep. - * - * @testmode_cmd: Implement a cfg80211 test mode command. - * The callback can sleep. - * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep. - * - * @flush: Flush all pending frames from the hardware queue, making sure - * that the hardware queues are empty. If the parameter @drop is set - * to %true, pending frames may be dropped. The callback can sleep. - * - * @channel_switch: Drivers that need (or want) to offload the channel - * switch operation for CSAs received from the AP may implement this - * callback. They must then call ieee80211_chswitch_done() to indicate - * completion of the channel switch. - * - * @napi_poll: Poll Rx queue for incoming data frames. - * - * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device. - * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may - * reject TX/RX mask combinations they cannot support by returning -EINVAL - * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX). - * - * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant). - * - * @remain_on_channel: Starts an off-channel period on the given channel, must - * call back to ieee80211_ready_on_channel() when on that channel. Note - * that normal channel traffic is not stopped as this is intended for hw - * offload. Frames to transmit on the off-channel channel are transmitted - * normally except for the %IEEE80211_TX_CTL_TX_OFFCHAN flag. When the - * duration (which will always be non-zero) expires, the driver must call - * ieee80211_remain_on_channel_expired(). This callback may sleep. - * @cancel_remain_on_channel: Requests that an ongoing off-channel period is - * aborted before it expires. This callback may sleep. - * - * @set_ringparam: Set tx and rx ring sizes. - * - * @get_ringparam: Get tx and rx ring current and maximum sizes. - * - * @tx_frames_pending: Check if there is any pending frame in the hardware - * queues before entering power save. - * - * @set_bitrate_mask: Set a mask of rates to be used for rate control selection - * when transmitting a frame. Currently only legacy rates are handled. - * The callback can sleep. - * @rssi_callback: Notify driver when the average RSSI goes above/below - * thresholds that were registered previously. The callback can sleep. - * - * @release_buffered_frames: Release buffered frames according to the given - * parameters. In the case where the driver buffers some frames for - * sleeping stations mac80211 will use this callback to tell the driver - * to release some frames, either for PS-poll or uAPSD. - * Note that if the @more_data paramter is %false the driver must check - * if there are more frames on the given TIDs, and if there are more than - * the frames being released then it must still set the more-data bit in - * the frame. If the @more_data parameter is %true, then of course the - * more-data bit must always be set. - * The @tids parameter tells the driver which TIDs to release frames - * from, for PS-poll it will always have only a single bit set. - * In the case this is used for a PS-poll initiated release, the - * @num_frames parameter will always be 1 so code can be shared. In - * this case the driver must also set %IEEE80211_TX_STATUS_EOSP flag - * on the TX status (and must report TX status) so that the PS-poll - * period is properly ended. This is used to avoid sending multiple - * responses for a retried PS-poll frame. - * In the case this is used for uAPSD, the @num_frames parameter may be - * bigger than one, but the driver may send fewer frames (it must send - * at least one, however). In this case it is also responsible for - * setting the EOSP flag in the QoS header of the frames. Also, when the - * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP - * on the last frame in the SP. Alternatively, it may call the function - * ieee80211_sta_eosp_irqsafe() to inform mac80211 of the end of the SP. - * This callback must be atomic. - * @allow_buffered_frames: Prepare device to allow the given number of frames - * to go out to the given station. The frames will be sent by mac80211 - * via the usual TX path after this call. The TX information for frames - * released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set - * and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case - * frames from multiple TIDs are released and the driver might reorder - * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag - * on the last frame and clear it on all others and also handle the EOSP - * bit in the QoS header correctly. Alternatively, it can also call the - * ieee80211_sta_eosp_irqsafe() function. - * The @tids parameter is a bitmap and tells the driver which TIDs the - * frames will be on; it will at most have two bits set. - * This callback must be atomic. - */ -struct ieee80211_ops { - void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); - void (*tx_frags)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, struct sk_buff_head *skbs); - int (*start)(struct ieee80211_hw *hw); - void (*stop)(struct ieee80211_hw *hw); -#ifdef CONFIG_PM - int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); - int (*resume)(struct ieee80211_hw *hw); -#endif - int (*add_interface)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); - int (*change_interface)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum nl80211_iftype new_type, bool p2p); - void (*remove_interface)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); - int (*config)(struct ieee80211_hw *hw, u32 changed); - void (*bss_info_changed)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, - u32 changed); - - u64 (*prepare_multicast)(struct ieee80211_hw *hw, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - struct netdev_hw_addr_list *mc_list); -#else - int mc_count, struct dev_addr_list *mc_list); -#endif - void (*configure_filter)(struct ieee80211_hw *hw, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast); - int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta, - bool set); - int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key); - void (*update_tkip_key)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_key_conf *conf, - struct ieee80211_sta *sta, - u32 iv32, u16 *phase1key); - void (*set_rekey_data)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_gtk_rekey_data *data); - int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct cfg80211_scan_request *req); - void (*cancel_hw_scan)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); - int (*sched_scan_start)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct cfg80211_sched_scan_request *req, - struct ieee80211_sched_scan_ies *ies); - void (*sched_scan_stop)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); - void (*sw_scan_start)(struct ieee80211_hw *hw); - void (*sw_scan_complete)(struct ieee80211_hw *hw); - int (*get_stats)(struct ieee80211_hw *hw, - struct ieee80211_low_level_stats *stats); - void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, - u32 *iv32, u16 *iv16); - int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); - int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); - int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); - int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); - void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - enum sta_notify_cmd, struct ieee80211_sta *sta); - int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - enum ieee80211_sta_state old_state, - enum ieee80211_sta_state new_state); - int (*conf_tx)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, u16 queue, - const struct ieee80211_tx_queue_params *params); - u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); - void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - u64 tsf); - void (*reset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif); - int (*tx_last_beacon)(struct ieee80211_hw *hw); - int (*ampdu_action)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, u16 *ssn, - u8 buf_size); - int (*get_survey)(struct ieee80211_hw *hw, int idx, - struct survey_info *survey); - void (*rfkill_poll)(struct ieee80211_hw *hw); - void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); -#ifdef CONFIG_NL80211_TESTMODE - int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); - int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb, - struct netlink_callback *cb, - void *data, int len); -#endif - void (*flush)(struct ieee80211_hw *hw, bool drop); - void (*channel_switch)(struct ieee80211_hw *hw, - struct ieee80211_channel_switch *ch_switch); - int (*napi_poll)(struct ieee80211_hw *hw, int budget); - int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); - int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); - - int (*remain_on_channel)(struct ieee80211_hw *hw, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - int duration); - int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); - int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); - void (*get_ringparam)(struct ieee80211_hw *hw, - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); - bool (*tx_frames_pending)(struct ieee80211_hw *hw); - int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - const struct cfg80211_bitrate_mask *mask); - void (*rssi_callback)(struct ieee80211_hw *hw, - enum ieee80211_rssi_event rssi_event); - - void (*allow_buffered_frames)(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - u16 tids, int num_frames, - enum ieee80211_frame_release_type reason, - bool more_data); - void (*release_buffered_frames)(struct ieee80211_hw *hw, - struct ieee80211_sta *sta, - u16 tids, int num_frames, - enum ieee80211_frame_release_type reason, - bool more_data); -}; - -/** - * ieee80211_alloc_hw - Allocate a new hardware device - * - * This must be called once for each hardware device. The returned pointer - * must be used to refer to this device when calling other functions. - * mac80211 allocates a private data area for the driver pointed to by - * @priv in &struct ieee80211_hw, the size of this area is given as - * @priv_data_len. - * - * @priv_data_len: length of private data - * @ops: callbacks for this device - */ -struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, - const struct ieee80211_ops *ops); - -/** - * ieee80211_register_hw - Register hardware device - * - * You must call this function before any other functions in - * mac80211. Note that before a hardware can be registered, you - * need to fill the contained wiphy's information. - * - * @hw: the device to register as returned by ieee80211_alloc_hw() - */ -int ieee80211_register_hw(struct ieee80211_hw *hw); - -/** - * struct ieee80211_tpt_blink - throughput blink description - * @throughput: throughput in Kbit/sec - * @blink_time: blink time in milliseconds - * (full cycle, ie. one off + one on period) - */ -struct ieee80211_tpt_blink { - int throughput; - int blink_time; -}; - -/** - * enum ieee80211_tpt_led_trigger_flags - throughput trigger flags - * @IEEE80211_TPT_LEDTRIG_FL_RADIO: enable blinking with radio - * @IEEE80211_TPT_LEDTRIG_FL_WORK: enable blinking when working - * @IEEE80211_TPT_LEDTRIG_FL_CONNECTED: enable blinking when at least one - * interface is connected in some way, including being an AP - */ -enum ieee80211_tpt_led_trigger_flags { - IEEE80211_TPT_LEDTRIG_FL_RADIO = BIT(0), - IEEE80211_TPT_LEDTRIG_FL_WORK = BIT(1), - IEEE80211_TPT_LEDTRIG_FL_CONNECTED = BIT(2), -}; - -#ifdef CONFIG_MAC80211_LEDS -extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); -extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); -extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw); -extern char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw); -extern char *__ieee80211_create_tpt_led_trigger( - struct ieee80211_hw *hw, unsigned int flags, - const struct ieee80211_tpt_blink *blink_table, - unsigned int blink_table_len); -#endif -/** - * ieee80211_get_tx_led_name - get name of TX LED - * - * mac80211 creates a transmit LED trigger for each wireless hardware - * that can be used to drive LEDs if your driver registers a LED device. - * This function returns the name (or %NULL if not configured for LEDs) - * of the trigger so you can automatically link the LED device. - * - * @hw: the hardware to get the LED trigger name for - */ -static inline char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw) -{ -#ifdef CONFIG_MAC80211_LEDS - return __ieee80211_get_tx_led_name(hw); -#else - return NULL; -#endif -} - -/** - * ieee80211_get_rx_led_name - get name of RX LED - * - * mac80211 creates a receive LED trigger for each wireless hardware - * that can be used to drive LEDs if your driver registers a LED device. - * This function returns the name (or %NULL if not configured for LEDs) - * of the trigger so you can automatically link the LED device. - * - * @hw: the hardware to get the LED trigger name for - */ -static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw) -{ -#ifdef CONFIG_MAC80211_LEDS - return __ieee80211_get_rx_led_name(hw); -#else - return NULL; -#endif -} - -/** - * ieee80211_get_assoc_led_name - get name of association LED - * - * mac80211 creates a association LED trigger for each wireless hardware - * that can be used to drive LEDs if your driver registers a LED device. - * This function returns the name (or %NULL if not configured for LEDs) - * of the trigger so you can automatically link the LED device. - * - * @hw: the hardware to get the LED trigger name for - */ -static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) -{ -#ifdef CONFIG_MAC80211_LEDS - return __ieee80211_get_assoc_led_name(hw); -#else - return NULL; -#endif -} - -/** - * ieee80211_get_radio_led_name - get name of radio LED - * - * mac80211 creates a radio change LED trigger for each wireless hardware - * that can be used to drive LEDs if your driver registers a LED device. - * This function returns the name (or %NULL if not configured for LEDs) - * of the trigger so you can automatically link the LED device. - * - * @hw: the hardware to get the LED trigger name for - */ -static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw) -{ -#ifdef CONFIG_MAC80211_LEDS - return __ieee80211_get_radio_led_name(hw); -#else - return NULL; -#endif -} - -/** - * ieee80211_create_tpt_led_trigger - create throughput LED trigger - * @hw: the hardware to create the trigger for - * @flags: trigger flags, see &enum ieee80211_tpt_led_trigger_flags - * @blink_table: the blink table -- needs to be ordered by throughput - * @blink_table_len: size of the blink table - * - * This function returns %NULL (in case of error, or if no LED - * triggers are configured) or the name of the new trigger. - * This function must be called before ieee80211_register_hw(). - */ -static inline char * -ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags, - const struct ieee80211_tpt_blink *blink_table, - unsigned int blink_table_len) -{ -#ifdef CONFIG_MAC80211_LEDS - return __ieee80211_create_tpt_led_trigger(hw, flags, blink_table, - blink_table_len); -#else - return NULL; -#endif -} - -/** - * ieee80211_unregister_hw - Unregister a hardware device - * - * This function instructs mac80211 to free allocated resources - * and unregister netdevices from the networking subsystem. - * - * @hw: the hardware to unregister - */ -void ieee80211_unregister_hw(struct ieee80211_hw *hw); - -/** - * ieee80211_free_hw - free hardware descriptor - * - * This function frees everything that was allocated, including the - * private data for the driver. You must call ieee80211_unregister_hw() - * before calling this function. - * - * @hw: the hardware to free - */ -void ieee80211_free_hw(struct ieee80211_hw *hw); - -/** - * ieee80211_restart_hw - restart hardware completely - * - * Call this function when the hardware was restarted for some reason - * (hardware error, ...) and the driver is unable to restore its state - * by itself. mac80211 assumes that at this point the driver/hardware - * is completely uninitialised and stopped, it starts the process by - * calling the ->start() operation. The driver will need to reset all - * internal state that it has prior to calling this function. - * - * @hw: the hardware to restart - */ -void ieee80211_restart_hw(struct ieee80211_hw *hw); - -/** ieee80211_napi_schedule - schedule NAPI poll - * - * Use this function to schedule NAPI polling on a device. - * - * @hw: the hardware to start polling - */ -void ieee80211_napi_schedule(struct ieee80211_hw *hw); - -/** ieee80211_napi_complete - complete NAPI polling - * - * Use this function to finish NAPI polling on a device. - * - * @hw: the hardware to stop polling - */ -void ieee80211_napi_complete(struct ieee80211_hw *hw); - -/** - * ieee80211_rx - receive frame - * - * Use this function to hand received frames to mac80211. The receive - * buffer in @skb must start with an IEEE 802.11 header. In case of a - * paged @skb is used, the driver is recommended to put the ieee80211 - * header of the frame on the linear part of the @skb to avoid memory - * allocation and/or memcpy by the stack. - * - * This function may not be called in IRQ context. Calls to this function - * for a single hardware must be synchronized against each other. Calls to - * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be - * mixed for a single hardware. - * - * In process context use instead ieee80211_rx_ni(). - * - * @hw: the hardware this frame came in on - * @skb: the buffer to receive, owned by mac80211 after this call - */ -void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb); - -/** - * ieee80211_rx_irqsafe - receive frame - * - * Like ieee80211_rx() but can be called in IRQ context - * (internally defers to a tasklet.) - * - * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not - * be mixed for a single hardware. - * - * @hw: the hardware this frame came in on - * @skb: the buffer to receive, owned by mac80211 after this call - */ -void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb); - -/** - * ieee80211_rx_ni - receive frame (in process context) - * - * Like ieee80211_rx() but can be called in process context - * (internally disables bottom halves). - * - * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may - * not be mixed for a single hardware. - * - * @hw: the hardware this frame came in on - * @skb: the buffer to receive, owned by mac80211 after this call - */ -static inline void ieee80211_rx_ni(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - local_bh_disable(); - ieee80211_rx(hw, skb); - local_bh_enable(); -} - -/** - * ieee80211_sta_ps_transition - PS transition for connected sta - * - * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS - * flag set, use this function to inform mac80211 about a connected station - * entering/leaving PS mode. - * - * This function may not be called in IRQ context or with softirqs enabled. - * - * Calls to this function for a single hardware must be synchronized against - * each other. - * - * The function returns -EINVAL when the requested PS mode is already set. - * - * @sta: currently connected sta - * @start: start or stop PS - */ -int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start); - -/** - * ieee80211_sta_ps_transition_ni - PS transition for connected sta - * (in process context) - * - * Like ieee80211_sta_ps_transition() but can be called in process context - * (internally disables bottom halves). Concurrent call restriction still - * applies. - * - * @sta: currently connected sta - * @start: start or stop PS - */ -static inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta, - bool start) -{ - int ret; - - local_bh_disable(); - ret = ieee80211_sta_ps_transition(sta, start); - local_bh_enable(); - - return ret; -} - -/* - * The TX headroom reserved by mac80211 for its own tx_status functions. - * This is enough for the radiotap header. - */ -#define IEEE80211_TX_STATUS_HEADROOM 14 - -/** - * ieee80211_sta_set_buffered - inform mac80211 about driver-buffered frames - * @sta: &struct ieee80211_sta pointer for the sleeping station - * @tid: the TID that has buffered frames - * @buffered: indicates whether or not frames are buffered for this TID - * - * If a driver buffers frames for a powersave station instead of passing - * them back to mac80211 for retransmission, the station may still need - * to be told that there are buffered frames via the TIM bit. - * - * This function informs mac80211 whether or not there are frames that are - * buffered in the driver for a given TID; mac80211 can then use this data - * to set the TIM bit (NOTE: This may call back into the driver's set_tim - * call! Beware of the locking!) - * - * If all frames are released to the station (due to PS-poll or uAPSD) - * then the driver needs to inform mac80211 that there no longer are - * frames buffered. However, when the station wakes up mac80211 assumes - * that all buffered frames will be transmitted and clears this data, - * drivers need to make sure they inform mac80211 about all buffered - * frames on the sleep transition (sta_notify() with %STA_NOTIFY_SLEEP). - * - * Note that technically mac80211 only needs to know this per AC, not per - * TID, but since driver buffering will inevitably happen per TID (since - * it is related to aggregation) it is easier to make mac80211 map the - * TID to the AC as required instead of keeping track in all drivers that - * use this API. - */ -void ieee80211_sta_set_buffered(struct ieee80211_sta *sta, - u8 tid, bool buffered); - -/** - * ieee80211_tx_status - transmit status callback - * - * Call this function for all transmitted frames after they have been - * transmitted. It is permissible to not call this function for - * multicast frames but this can affect statistics. - * - * This function may not be called in IRQ context. Calls to this function - * for a single hardware must be synchronized against each other. Calls - * to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe() - * may not be mixed for a single hardware. - * - * @hw: the hardware the frame was transmitted by - * @skb: the frame that was transmitted, owned by mac80211 after this call - */ -void ieee80211_tx_status(struct ieee80211_hw *hw, - struct sk_buff *skb); - -/** - * ieee80211_tx_status_ni - transmit status callback (in process context) - * - * Like ieee80211_tx_status() but can be called in process context. - * - * Calls to this function, ieee80211_tx_status() and - * ieee80211_tx_status_irqsafe() may not be mixed - * for a single hardware. - * - * @hw: the hardware the frame was transmitted by - * @skb: the frame that was transmitted, owned by mac80211 after this call - */ -static inline void ieee80211_tx_status_ni(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - local_bh_disable(); - ieee80211_tx_status(hw, skb); - local_bh_enable(); -} - -/** - * ieee80211_tx_status_irqsafe - IRQ-safe transmit status callback - * - * Like ieee80211_tx_status() but can be called in IRQ context - * (internally defers to a tasklet.) - * - * Calls to this function, ieee80211_tx_status() and - * ieee80211_tx_status_ni() may not be mixed for a single hardware. - * - * @hw: the hardware the frame was transmitted by - * @skb: the frame that was transmitted, owned by mac80211 after this call - */ -void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, - struct sk_buff *skb); - -/** - * ieee80211_report_low_ack - report non-responding station - * - * When operating in AP-mode, call this function to report a non-responding - * connected STA. - * - * @sta: the non-responding connected sta - * @num_packets: number of packets sent to @sta without a response - */ -void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets); - -/** - * ieee80211_beacon_get_tim - beacon generation function - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @tim_offset: pointer to variable that will receive the TIM IE offset. - * Set to 0 if invalid (in non-AP modes). - * @tim_length: pointer to variable that will receive the TIM IE length, - * (including the ID and length bytes!). - * Set to 0 if invalid (in non-AP modes). - * - * If the driver implements beaconing modes, it must use this function to - * obtain the beacon frame/template. - * - * If the beacon frames are generated by the host system (i.e., not in - * hardware/firmware), the driver uses this function to get each beacon - * frame from mac80211 -- it is responsible for calling this function - * before the beacon is needed (e.g. based on hardware interrupt). - * - * If the beacon frames are generated by the device, then the driver - * must use the returned beacon as the template and change the TIM IE - * according to the current DTIM parameters/TIM bitmap. - * - * The driver is responsible for freeing the returned skb. - */ -struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - u16 *tim_offset, u16 *tim_length); - -/** - * ieee80211_beacon_get - beacon generation function - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * See ieee80211_beacon_get_tim(). - */ -static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - return ieee80211_beacon_get_tim(hw, vif, NULL, NULL); -} - -/** - * ieee80211_proberesp_get - retrieve a Probe Response template - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * Creates a Probe Response template which can, for example, be uploaded to - * hardware. The destination address should be set by the caller. - * - * Can only be called in AP mode. - */ -struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); - -/** - * ieee80211_pspoll_get - retrieve a PS Poll template - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * Creates a PS Poll a template which can, for example, uploaded to - * hardware. The template must be updated after association so that correct - * AID, BSSID and MAC address is used. - * - * Note: Caller (or hardware) is responsible for setting the - * &IEEE80211_FCTL_PM bit. - */ -struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); - -/** - * ieee80211_nullfunc_get - retrieve a nullfunc template - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * Creates a Nullfunc template which can, for example, uploaded to - * hardware. The template must be updated after association so that correct - * BSSID and address is used. - * - * Note: Caller (or hardware) is responsible for setting the - * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields. - */ -struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); - -/** - * ieee80211_probereq_get - retrieve a Probe Request template - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @ssid: SSID buffer - * @ssid_len: length of SSID - * @ie: buffer containing all IEs except SSID for the template - * @ie_len: length of the IE buffer - * - * Creates a Probe Request template which can, for example, be uploaded to - * hardware. - */ -struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - const u8 *ssid, size_t ssid_len, - const u8 *ie, size_t ie_len); - -/** - * ieee80211_rts_get - RTS frame generation function - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @frame: pointer to the frame that is going to be protected by the RTS. - * @frame_len: the frame length (in octets). - * @frame_txctl: &struct ieee80211_tx_info of the frame. - * @rts: The buffer where to store the RTS frame. - * - * If the RTS frames are generated by the host system (i.e., not in - * hardware/firmware), the low-level driver uses this function to receive - * the next RTS frame from the 802.11 code. The low-level is responsible - * for calling this function before and RTS frame is needed. - */ -void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - const void *frame, size_t frame_len, - const struct ieee80211_tx_info *frame_txctl, - struct ieee80211_rts *rts); - -/** - * ieee80211_rts_duration - Get the duration field for an RTS frame - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @frame_len: the length of the frame that is going to be protected by the RTS. - * @frame_txctl: &struct ieee80211_tx_info of the frame. - * - * If the RTS is generated in firmware, but the host system must provide - * the duration field, the low-level driver uses this function to receive - * the duration field value in little-endian byteorder. - */ -__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, size_t frame_len, - const struct ieee80211_tx_info *frame_txctl); - -/** - * ieee80211_ctstoself_get - CTS-to-self frame generation function - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @frame: pointer to the frame that is going to be protected by the CTS-to-self. - * @frame_len: the frame length (in octets). - * @frame_txctl: &struct ieee80211_tx_info of the frame. - * @cts: The buffer where to store the CTS-to-self frame. - * - * If the CTS-to-self frames are generated by the host system (i.e., not in - * hardware/firmware), the low-level driver uses this function to receive - * the next CTS-to-self frame from the 802.11 code. The low-level is responsible - * for calling this function before and CTS-to-self frame is needed. - */ -void ieee80211_ctstoself_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - const void *frame, size_t frame_len, - const struct ieee80211_tx_info *frame_txctl, - struct ieee80211_cts *cts); - -/** - * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. - * @frame_txctl: &struct ieee80211_tx_info of the frame. - * - * If the CTS-to-self is generated in firmware, but the host system must provide - * the duration field, the low-level driver uses this function to receive - * the duration field value in little-endian byteorder. - */ -__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - size_t frame_len, - const struct ieee80211_tx_info *frame_txctl); - -/** - * ieee80211_generic_frame_duration - Calculate the duration field for a frame - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @frame_len: the length of the frame. - * @rate: the rate at which the frame is going to be transmitted. - * - * Calculate the duration field of some generic frame, given its - * length and transmission rate (in 100kbps). - */ -__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - size_t frame_len, - struct ieee80211_rate *rate); - -/** - * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * Function for accessing buffered broadcast and multicast frames. If - * hardware/firmware does not implement buffering of broadcast/multicast - * frames when power saving is used, 802.11 code buffers them in the host - * memory. The low-level driver uses this function to fetch next buffered - * frame. In most cases, this is used when generating beacon frame. This - * function returns a pointer to the next buffered skb or NULL if no more - * buffered frames are available. - * - * Note: buffered frames are returned only after DTIM beacon frame was - * generated with ieee80211_beacon_get() and the low-level driver must thus - * call ieee80211_beacon_get() first. ieee80211_get_buffered_bc() returns - * NULL if the previous generated beacon was not DTIM, so the low-level driver - * does not need to check for DTIM beacons separately and should be able to - * use common code for all beacons. - */ -struct sk_buff * -ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); - -/** - * ieee80211_get_tkip_p1k_iv - get a TKIP phase 1 key for IV32 - * - * This function returns the TKIP phase 1 key for the given IV32. - * - * @keyconf: the parameter passed with the set key - * @iv32: IV32 to get the P1K for - * @p1k: a buffer to which the key will be written, as 5 u16 values - */ -void ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *keyconf, - u32 iv32, u16 *p1k); - -/** - * ieee80211_get_tkip_p1k - get a TKIP phase 1 key - * - * This function returns the TKIP phase 1 key for the IV32 taken - * from the given packet. - * - * @keyconf: the parameter passed with the set key - * @skb: the packet to take the IV32 value from that will be encrypted - * with this P1K - * @p1k: a buffer to which the key will be written, as 5 u16 values - */ -static inline void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf, - struct sk_buff *skb, u16 *p1k) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); - u32 iv32 = get_unaligned_le32(&data[4]); - - ieee80211_get_tkip_p1k_iv(keyconf, iv32, p1k); -} - -/** - * ieee80211_get_tkip_rx_p1k - get a TKIP phase 1 key for RX - * - * This function returns the TKIP phase 1 key for the given IV32 - * and transmitter address. - * - * @keyconf: the parameter passed with the set key - * @ta: TA that will be used with the key - * @iv32: IV32 to get the P1K for - * @p1k: a buffer to which the key will be written, as 5 u16 values - */ -void ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf, - const u8 *ta, u32 iv32, u16 *p1k); - -/** - * ieee80211_get_tkip_p2k - get a TKIP phase 2 key - * - * This function computes the TKIP RC4 key for the IV values - * in the packet. - * - * @keyconf: the parameter passed with the set key - * @skb: the packet to take the IV32/IV16 values from that will be - * encrypted with this key - * @p2k: a buffer to which the key will be written, 16 bytes - */ -void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf, - struct sk_buff *skb, u8 *p2k); - -/** - * struct ieee80211_key_seq - key sequence counter - * - * @tkip: TKIP data, containing IV32 and IV16 in host byte order - * @ccmp: PN data, most significant byte first (big endian, - * reverse order than in packet) - * @aes_cmac: PN data, most significant byte first (big endian, - * reverse order than in packet) - */ -struct ieee80211_key_seq { - union { - struct { - u32 iv32; - u16 iv16; - } tkip; - struct { - u8 pn[6]; - } ccmp; - struct { - u8 pn[6]; - } aes_cmac; - }; -}; - -/** - * ieee80211_get_key_tx_seq - get key TX sequence counter - * - * @keyconf: the parameter passed with the set key - * @seq: buffer to receive the sequence data - * - * This function allows a driver to retrieve the current TX IV/PN - * for the given key. It must not be called if IV generation is - * offloaded to the device. - * - * Note that this function may only be called when no TX processing - * can be done concurrently, for example when queues are stopped - * and the stop has been synchronized. - */ -void ieee80211_get_key_tx_seq(struct ieee80211_key_conf *keyconf, - struct ieee80211_key_seq *seq); - -/** - * ieee80211_get_key_rx_seq - get key RX sequence counter - * - * @keyconf: the parameter passed with the set key - * @tid: The TID, or -1 for the management frame value (CCMP only); - * the value on TID 0 is also used for non-QoS frames. For - * CMAC, only TID 0 is valid. - * @seq: buffer to receive the sequence data - * - * This function allows a driver to retrieve the current RX IV/PNs - * for the given key. It must not be called if IV checking is done - * by the device and not by mac80211. - * - * Note that this function may only be called when no RX processing - * can be done concurrently. - */ -void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, - int tid, struct ieee80211_key_seq *seq); - -/** - * ieee80211_gtk_rekey_notify - notify userspace supplicant of rekeying - * @vif: virtual interface the rekeying was done on - * @bssid: The BSSID of the AP, for checking association - * @replay_ctr: the new replay counter after GTK rekeying - * @gfp: allocation flags - */ -void ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid, - const u8 *replay_ctr, gfp_t gfp); - -/** - * ieee80211_wake_queue - wake specific queue - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @queue: queue number (counted from zero). - * - * Drivers should use this function instead of netif_wake_queue. - */ -void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue); - -/** - * ieee80211_stop_queue - stop specific queue - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @queue: queue number (counted from zero). - * - * Drivers should use this function instead of netif_stop_queue. - */ -void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); - -/** - * ieee80211_queue_stopped - test status of the queue - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @queue: queue number (counted from zero). - * - * Drivers should use this function instead of netif_stop_queue. - */ - -int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue); - -/** - * ieee80211_stop_queues - stop all queues - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * - * Drivers should use this function instead of netif_stop_queue. - */ -void ieee80211_stop_queues(struct ieee80211_hw *hw); - -/** - * ieee80211_wake_queues - wake all queues - * @hw: pointer as obtained from ieee80211_alloc_hw(). - * - * Drivers should use this function instead of netif_wake_queue. - */ -void ieee80211_wake_queues(struct ieee80211_hw *hw); - -/** - * ieee80211_scan_completed - completed hardware scan - * - * When hardware scan offload is used (i.e. the hw_scan() callback is - * assigned) this function needs to be called by the driver to notify - * mac80211 that the scan finished. This function can be called from - * any context, including hardirq context. - * - * @hw: the hardware that finished the scan - * @aborted: set to true if scan was aborted - */ -void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted); - -/** - * ieee80211_sched_scan_results - got results from scheduled scan - * - * When a scheduled scan is running, this function needs to be called by the - * driver whenever there are new scan results available. - * - * @hw: the hardware that is performing scheduled scans - */ -void ieee80211_sched_scan_results(struct ieee80211_hw *hw); - -/** - * ieee80211_sched_scan_stopped - inform that the scheduled scan has stopped - * - * When a scheduled scan is running, this function can be called by - * the driver if it needs to stop the scan to perform another task. - * Usual scenarios are drivers that cannot continue the scheduled scan - * while associating, for instance. - * - * @hw: the hardware that is performing scheduled scans - */ -void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw); - -/** - * ieee80211_iterate_active_interfaces - iterate active interfaces - * - * This function iterates over the interfaces associated with a given - * hardware that are currently active and calls the callback for them. - * This function allows the iterator function to sleep, when the iterator - * function is atomic @ieee80211_iterate_active_interfaces_atomic can - * be used. - * Does not iterate over a new interface during add_interface() - * - * @hw: the hardware struct of which the interfaces should be iterated over - * @iterator: the iterator function to call - * @data: first argument of the iterator function - */ -void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, - void (*iterator)(void *data, u8 *mac, - struct ieee80211_vif *vif), - void *data); - -/** - * ieee80211_iterate_active_interfaces_atomic - iterate active interfaces - * - * This function iterates over the interfaces associated with a given - * hardware that are currently active and calls the callback for them. - * This function requires the iterator callback function to be atomic, - * if that is not desired, use @ieee80211_iterate_active_interfaces instead. - * Does not iterate over a new interface during add_interface() - * - * @hw: the hardware struct of which the interfaces should be iterated over - * @iterator: the iterator function to call, cannot sleep - * @data: first argument of the iterator function - */ -void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw, - void (*iterator)(void *data, - u8 *mac, - struct ieee80211_vif *vif), - void *data); - -/** - * ieee80211_queue_work - add work onto the mac80211 workqueue - * - * Drivers and mac80211 use this to add work onto the mac80211 workqueue. - * This helper ensures drivers are not queueing work when they should not be. - * - * @hw: the hardware struct for the interface we are adding work for - * @work: the work we want to add onto the mac80211 workqueue - */ -void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work); - -/** - * ieee80211_queue_delayed_work - add work onto the mac80211 workqueue - * - * Drivers and mac80211 use this to queue delayed work onto the mac80211 - * workqueue. - * - * @hw: the hardware struct for the interface we are adding work for - * @dwork: delayable work to queue onto the mac80211 workqueue - * @delay: number of jiffies to wait before queueing - */ -void ieee80211_queue_delayed_work(struct ieee80211_hw *hw, - struct delayed_work *dwork, - unsigned long delay); - -/** - * ieee80211_start_tx_ba_session - Start a tx Block Ack session. - * @sta: the station for which to start a BA session - * @tid: the TID to BA on. - * @timeout: session timeout value (in TUs) - * - * Return: success if addBA request was sent, failure otherwise - * - * Although mac80211/low level driver/user space application can estimate - * the need to start aggregation on a certain RA/TID, the session level - * will be managed by the mac80211. - */ -int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid, - u16 timeout); - -/** - * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate. - * @vif: &struct ieee80211_vif pointer from the add_interface callback - * @ra: receiver address of the BA session recipient. - * @tid: the TID to BA on. - * - * This function must be called by low level driver once it has - * finished with preparations for the BA session. It can be called - * from any context. - */ -void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, - u16 tid); - -/** - * ieee80211_stop_tx_ba_session - Stop a Block Ack session. - * @sta: the station whose BA session to stop - * @tid: the TID to stop BA. - * - * Return: negative error if the TID is invalid, or no aggregation active - * - * Although mac80211/low level driver/user space application can estimate - * the need to stop aggregation on a certain RA/TID, the session level - * will be managed by the mac80211. - */ -int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid); - -/** - * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate. - * @vif: &struct ieee80211_vif pointer from the add_interface callback - * @ra: receiver address of the BA session recipient. - * @tid: the desired TID to BA on. - * - * This function must be called by low level driver once it has - * finished with preparations for the BA session tear down. It - * can be called from any context. - */ -void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra, - u16 tid); - -/** - * ieee80211_find_sta - find a station - * - * @vif: virtual interface to look for station on - * @addr: station's address - * - * This function must be called under RCU lock and the - * resulting pointer is only valid under RCU lock as well. - */ -struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif, - const u8 *addr); - -/** - * ieee80211_find_sta_by_ifaddr - find a station on hardware - * - * @hw: pointer as obtained from ieee80211_alloc_hw() - * @addr: remote station's address - * @localaddr: local address (vif->sdata->vif.addr). Use NULL for 'any'. - * - * This function must be called under RCU lock and the - * resulting pointer is only valid under RCU lock as well. - * - * NOTE: You may pass NULL for localaddr, but then you will just get - * the first STA that matches the remote address 'addr'. - * We can have multiple STA associated with multiple - * logical stations (e.g. consider a station connecting to another - * BSSID on the same AP hardware without disconnecting first). - * In this case, the result of this method with localaddr NULL - * is not reliable. - * - * DO NOT USE THIS FUNCTION with localaddr NULL if at all possible. - */ -struct ieee80211_sta *ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, - const u8 *addr, - const u8 *localaddr); - -/** - * ieee80211_sta_block_awake - block station from waking up - * @hw: the hardware - * @pubsta: the station - * @block: whether to block or unblock - * - * Some devices require that all frames that are on the queues - * for a specific station that went to sleep are flushed before - * a poll response or frames after the station woke up can be - * delivered to that it. Note that such frames must be rejected - * by the driver as filtered, with the appropriate status flag. - * - * This function allows implementing this mode in a race-free - * manner. - * - * To do this, a driver must keep track of the number of frames - * still enqueued for a specific station. If this number is not - * zero when the station goes to sleep, the driver must call - * this function to force mac80211 to consider the station to - * be asleep regardless of the station's actual state. Once the - * number of outstanding frames reaches zero, the driver must - * call this function again to unblock the station. That will - * cause mac80211 to be able to send ps-poll responses, and if - * the station queried in the meantime then frames will also - * be sent out as a result of this. Additionally, the driver - * will be notified that the station woke up some time after - * it is unblocked, regardless of whether the station actually - * woke up while blocked or not. - */ -void ieee80211_sta_block_awake(struct ieee80211_hw *hw, - struct ieee80211_sta *pubsta, bool block); - -/** - * ieee80211_sta_eosp - notify mac80211 about end of SP - * @pubsta: the station - * - * When a device transmits frames in a way that it can't tell - * mac80211 in the TX status about the EOSP, it must clear the - * %IEEE80211_TX_STATUS_EOSP bit and call this function instead. - * This applies for PS-Poll as well as uAPSD. - * - * Note that there is no non-_irqsafe version right now as - * it wasn't needed, but just like _tx_status() and _rx() - * must not be mixed in irqsafe/non-irqsafe versions, this - * function must not be mixed with those either. Use the - * all irqsafe, or all non-irqsafe, don't mix! If you need - * the non-irqsafe version of this, you need to add it. - */ -void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta); - -/** - * ieee80211_iter_keys - iterate keys programmed into the device - * @hw: pointer obtained from ieee80211_alloc_hw() - * @vif: virtual interface to iterate, may be %NULL for all - * @iter: iterator function that will be called for each key - * @iter_data: custom data to pass to the iterator function - * - * This function can be used to iterate all the keys known to - * mac80211, even those that weren't previously programmed into - * the device. This is intended for use in WoWLAN if the device - * needs reprogramming of the keys during suspend. Note that due - * to locking reasons, it is also only safe to call this at few - * spots since it must hold the RTNL and be able to sleep. - * - * The order in which the keys are iterated matches the order - * in which they were originally installed and handed to the - * set_key callback. - */ -void ieee80211_iter_keys(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - void (*iter)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key, - void *data), - void *iter_data); - -/** - * ieee80211_ap_probereq_get - retrieve a Probe Request template - * @hw: pointer obtained from ieee80211_alloc_hw(). - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * Creates a Probe Request template which can, for example, be uploaded to - * hardware. The template is filled with bssid, ssid and supported rate - * information. This function must only be called from within the - * .bss_info_changed callback function and only in managed mode. The function - * is only useful when the interface is associated, otherwise it will return - * NULL. - */ -struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif); - -/** - * ieee80211_beacon_loss - inform hardware does not receive beacons - * - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER and - * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the - * hardware is not receiving beacons with this function. - */ -void ieee80211_beacon_loss(struct ieee80211_vif *vif); - -/** - * ieee80211_connection_loss - inform hardware has lost connection to the AP - * - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and - * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver - * needs to inform if the connection to the AP has been lost. - * - * This function will cause immediate change to disassociated state, - * without connection recovery attempts. - */ -void ieee80211_connection_loss(struct ieee80211_vif *vif); - -/** - * ieee80211_resume_disconnect - disconnect from AP after resume - * - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * Instructs mac80211 to disconnect from the AP after resume. - * Drivers can use this after WoWLAN if they know that the - * connection cannot be kept up, for example because keys were - * used while the device was asleep but the replay counters or - * similar cannot be retrieved from the device during resume. - * - * Note that due to implementation issues, if the driver uses - * the reconfiguration functionality during resume the interface - * will still be added as associated first during resume and then - * disconnect normally later. - * - * This function can only be called from the resume callback and - * the driver must not be holding any of its own locks while it - * calls this function, or at least not any locks it needs in the - * key configuration paths (if it supports HW crypto). - */ -void ieee80211_resume_disconnect(struct ieee80211_vif *vif); - -/** - * ieee80211_disable_dyn_ps - force mac80211 to temporarily disable dynamic psm - * - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * Some hardware require full power save to manage simultaneous BT traffic - * on the WLAN frequency. Full PSM is required periodically, whenever there are - * burst of BT traffic. The hardware gets information of BT traffic via - * hardware co-existence lines, and consequentially requests mac80211 to - * (temporarily) enter full psm. - * This function will only temporarily disable dynamic PS, not enable PSM if - * it was not already enabled. - * The driver must make sure to re-enable dynamic PS using - * ieee80211_enable_dyn_ps() if the driver has disabled it. - * - */ -void ieee80211_disable_dyn_ps(struct ieee80211_vif *vif); - -/** - * ieee80211_enable_dyn_ps - restore dynamic psm after being disabled - * - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * This function restores dynamic PS after being temporarily disabled via - * ieee80211_disable_dyn_ps(). Each ieee80211_disable_dyn_ps() call must - * be coupled with an eventual call to this function. - * - */ -void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif); - -/** - * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring - * rssi threshold triggered - * - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @rssi_event: the RSSI trigger event type - * @gfp: context flags - * - * When the %IEEE80211_VIF_SUPPORTS_CQM_RSSI is set, and a connection quality - * monitoring is configured with an rssi threshold, the driver will inform - * whenever the rssi level reaches the threshold. - */ -void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, - enum nl80211_cqm_rssi_threshold_event rssi_event, - gfp_t gfp); - -/** - * ieee80211_get_operstate - get the operstate of the vif - * - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * - * The driver might need to know the operstate of the net_device - * (specifically, whether the link is IF_OPER_UP after resume) - */ -unsigned char ieee80211_get_operstate(struct ieee80211_vif *vif); - -/** - * ieee80211_chswitch_done - Complete channel switch process - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @success: make the channel switch successful or not - * - * Complete the channel switch post-process: set the new operational channel - * and wake up the suspended queues. - */ -void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success); - -/** - * ieee80211_request_smps - request SM PS transition - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @smps_mode: new SM PS mode - * - * This allows the driver to request an SM PS transition in managed - * mode. This is useful when the driver has more information than - * the stack about possible interference, for example by bluetooth. - */ -void ieee80211_request_smps(struct ieee80211_vif *vif, - enum ieee80211_smps_mode smps_mode); - -/** - * ieee80211_key_removed - disable hw acceleration for key - * @key_conf: The key hw acceleration should be disabled for - * - * This allows drivers to indicate that the given key has been - * removed from hardware acceleration, due to a new key that - * was added. Don't use this if the key can continue to be used - * for TX, if the key restriction is on RX only it is permitted - * to keep the key for TX only and not call this function. - * - * Due to locking constraints, it may only be called during - * @set_key. This function must be allowed to sleep, and the - * key it tries to disable may still be used until it returns. - */ -void ieee80211_key_removed(struct ieee80211_key_conf *key_conf); - -/** - * ieee80211_ready_on_channel - notification of remain-on-channel start - * @hw: pointer as obtained from ieee80211_alloc_hw() - */ -void ieee80211_ready_on_channel(struct ieee80211_hw *hw); - -/** - * ieee80211_remain_on_channel_expired - remain_on_channel duration expired - * @hw: pointer as obtained from ieee80211_alloc_hw() - */ -void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw); - -/** - * ieee80211_stop_rx_ba_session - callback to stop existing BA sessions - * - * in order not to harm the system performance and user experience, the device - * may request not to allow any rx ba session and tear down existing rx ba - * sessions based on system constraints such as periodic BT activity that needs - * to limit wlan activity (eg.sco or a2dp)." - * in such cases, the intention is to limit the duration of the rx ppdu and - * therefore prevent the peer device to use a-mpdu aggregation. - * - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @ba_rx_bitmap: Bit map of open rx ba per tid - * @addr: & to bssid mac address - */ -void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap, - const u8 *addr); - -/** - * ieee80211_send_bar - send a BlockAckReq frame - * - * can be used to flush pending frames from the peer's aggregation reorder - * buffer. - * - * @vif: &struct ieee80211_vif pointer from the add_interface callback. - * @ra: the peer's destination address - * @tid: the TID of the aggregation session - * @ssn: the new starting sequence number for the receiver - */ -void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn); - -/* Rate control API */ - -/** - * enum rate_control_changed - flags to indicate which parameter changed - * - * @IEEE80211_RC_HT_CHANGED: The HT parameters of the operating channel have - * changed, rate control algorithm can update its internal state if needed. - * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed, the rate - * control algorithm needs to adjust accordingly. - */ -enum rate_control_changed { - IEEE80211_RC_HT_CHANGED = BIT(0), - IEEE80211_RC_SMPS_CHANGED = BIT(1), -}; - -/** - * struct ieee80211_tx_rate_control - rate control information for/from RC algo - * - * @hw: The hardware the algorithm is invoked for. - * @sband: The band this frame is being transmitted on. - * @bss_conf: the current BSS configuration - * @skb: the skb that will be transmitted, the control information in it needs - * to be filled in - * @reported_rate: The rate control algorithm can fill this in to indicate - * which rate should be reported to userspace as the current rate and - * used for rate calculations in the mesh network. - * @rts: whether RTS will be used for this frame because it is longer than the - * RTS threshold - * @short_preamble: whether mac80211 will request short-preamble transmission - * if the selected rate supports it - * @max_rate_idx: user-requested maximum (legacy) rate - * (deprecated; this will be removed once drivers get updated to use - * rate_idx_mask) - * @rate_idx_mask: user-requested (legacy) rate mask - * @rate_idx_mcs_mask: user-requested MCS rate mask - * @bss: whether this frame is sent out in AP or IBSS mode - */ -struct ieee80211_tx_rate_control { - struct ieee80211_hw *hw; - struct ieee80211_supported_band *sband; - struct ieee80211_bss_conf *bss_conf; - struct sk_buff *skb; - struct ieee80211_tx_rate reported_rate; - bool rts, short_preamble; - u8 max_rate_idx; - u32 rate_idx_mask; - u8 rate_idx_mcs_mask[IEEE80211_HT_MCS_MASK_LEN]; - bool bss; -}; - -struct rate_control_ops { - struct module *module; - const char *name; - void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); - void (*free)(void *priv); - - void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); - void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta); - void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, - void *priv_sta, u32 changed, - enum nl80211_channel_type oper_chan_type); - void (*free_sta)(void *priv, struct ieee80211_sta *sta, - void *priv_sta); - - void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - struct sk_buff *skb); - void (*get_rate)(void *priv, struct ieee80211_sta *sta, void *priv_sta, - struct ieee80211_tx_rate_control *txrc); - - void (*add_sta_debugfs)(void *priv, void *priv_sta, - struct dentry *dir); - void (*remove_sta_debugfs)(void *priv, void *priv_sta); -}; - -static inline int rate_supported(struct ieee80211_sta *sta, - enum ieee80211_band band, - int index) -{ - return (sta == NULL || sta->supp_rates[band] & BIT(index)); -} - -/** - * rate_control_send_low - helper for drivers for management/no-ack frames - * - * Rate control algorithms that agree to use the lowest rate to - * send management frames and NO_ACK data with the respective hw - * retries should use this in the beginning of their mac80211 get_rate - * callback. If true is returned the rate control can simply return. - * If false is returned we guarantee that sta and sta and priv_sta is - * not null. - * - * Rate control algorithms wishing to do more intelligent selection of - * rate for multicast/broadcast frames may choose to not use this. - * - * @sta: &struct ieee80211_sta pointer to the target destination. Note - * that this may be null. - * @priv_sta: private rate control structure. This may be null. - * @txrc: rate control information we sholud populate for mac80211. - */ -bool rate_control_send_low(struct ieee80211_sta *sta, - void *priv_sta, - struct ieee80211_tx_rate_control *txrc); - - -static inline s8 -rate_lowest_index(struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta) -{ - int i; - - for (i = 0; i < sband->n_bitrates; i++) - if (rate_supported(sta, sband->band, i)) - return i; - - /* warn when we cannot find a rate. */ - WARN_ON_ONCE(1); - - /* and return 0 (the lowest index) */ - return 0; -} - -static inline -bool rate_usable_index_exists(struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta) -{ - unsigned int i; - - for (i = 0; i < sband->n_bitrates; i++) - if (rate_supported(sta, sband->band, i)) - return true; - return false; -} - -int ieee80211_rate_control_register(struct rate_control_ops *ops); -void ieee80211_rate_control_unregister(struct rate_control_ops *ops); - -static inline bool -conf_is_ht20(struct ieee80211_conf *conf) -{ - return conf->channel_type == NL80211_CHAN_HT20; -} - -static inline bool -conf_is_ht40_minus(struct ieee80211_conf *conf) -{ - return conf->channel_type == NL80211_CHAN_HT40MINUS; -} - -static inline bool -conf_is_ht40_plus(struct ieee80211_conf *conf) -{ - return conf->channel_type == NL80211_CHAN_HT40PLUS; -} - -static inline bool -conf_is_ht40(struct ieee80211_conf *conf) -{ - return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf); -} - -static inline bool -conf_is_ht(struct ieee80211_conf *conf) -{ - return conf->channel_type != NL80211_CHAN_NO_HT; -} - -static inline enum nl80211_iftype -ieee80211_iftype_p2p(enum nl80211_iftype type, bool p2p) -{ - if (p2p) { - switch (type) { - case NL80211_IFTYPE_STATION: - return NL80211_IFTYPE_P2P_CLIENT; - case NL80211_IFTYPE_AP: - return NL80211_IFTYPE_P2P_GO; - default: - break; - } - } - return type; -} - -static inline enum nl80211_iftype -ieee80211_vif_type_p2p(struct ieee80211_vif *vif) -{ - return ieee80211_iftype_p2p(vif->type, vif->p2p); -} - -void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif, - int rssi_min_thold, - int rssi_max_thold); - -void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif); - -int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb); - -int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, - struct sk_buff *skb); -#endif /* MAC80211_H */ diff --git a/openairITS/mac/DOT11/include/net/net_namespace.h b/openairITS/mac/DOT11/include/net/net_namespace.h deleted file mode 100644 index 0f74944b382..00000000000 --- a/openairITS/mac/DOT11/include/net/net_namespace.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _COMPAT_NET_NET_NAMESPACE_H -#define _COMPAT_NET_NET_NAMESPACE_H 1 - -#include <linux/version.h> - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)) -#include_next <net/net_namespace.h> -#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)) */ - -#endif /* _COMPAT_NET_NET_NAMESPACE_H */ diff --git a/openairITS/mac/DOT11/include/net/regulatory.h b/openairITS/mac/DOT11/include/net/regulatory.h deleted file mode 100644 index a5f79933e21..00000000000 --- a/openairITS/mac/DOT11/include/net/regulatory.h +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef __NET_REGULATORY_H -#define __NET_REGULATORY_H -/* - * regulatory support structures - * - * Copyright 2008-2009 Luis R. Rodriguez <mcgrof@qca.qualcomm.com> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -/** - * enum environment_cap - Environment parsed from country IE - * @ENVIRON_ANY: indicates country IE applies to both indoor and - * outdoor operation. - * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation - * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation - */ -enum environment_cap { - ENVIRON_ANY, - ENVIRON_INDOOR, - ENVIRON_OUTDOOR, -}; - -/** - * struct regulatory_request - used to keep track of regulatory requests - * - * @wiphy_idx: this is set if this request's initiator is - * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This - * can be used by the wireless core to deal with conflicts - * and potentially inform users of which devices specifically - * cased the conflicts. - * @initiator: indicates who sent this request, could be any of - * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*) - * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested - * regulatory domain. We have a few special codes: - * 00 - World regulatory domain - * 99 - built by driver but a specific alpha2 cannot be determined - * 98 - result of an intersection between two regulatory domains - * 97 - regulatory domain has not yet been configured - * @dfs_region: If CRDA responded with a regulatory domain that requires - * DFS master operation on a known DFS region (NL80211_DFS_*), - * dfs_region represents that region. Drivers can use this and the - * @alpha2 to adjust their device's DFS parameters as required. - * @intersect: indicates whether the wireless core should intersect - * the requested regulatory domain with the presently set regulatory - * domain. - * @processed: indicates whether or not this requests has already been - * processed. When the last request is processed it means that the - * currently regulatory domain set on cfg80211 is updated from - * CRDA and can be used by other regulatory requests. When a - * the last request is not yet processed we must yield until it - * is processed before processing any new requests. - * @country_ie_checksum: checksum of the last processed and accepted - * country IE - * @country_ie_env: lets us know if the AP is telling us we are outdoor, - * indoor, or if it doesn't matter - * @list: used to insert into the reg_requests_list linked list - */ -struct regulatory_request { - int wiphy_idx; - enum nl80211_reg_initiator initiator; - char alpha2[2]; - u8 dfs_region; - bool intersect; - bool processed; - enum environment_cap country_ie_env; - struct list_head list; -}; - -struct ieee80211_freq_range { - u32 start_freq_khz; - u32 end_freq_khz; - u32 max_bandwidth_khz; -}; - -struct ieee80211_power_rule { - u32 max_antenna_gain; - u32 max_eirp; -}; - -struct ieee80211_reg_rule { - struct ieee80211_freq_range freq_range; - struct ieee80211_power_rule power_rule; - u32 flags; -}; - -struct ieee80211_regdomain { - u32 n_reg_rules; - char alpha2[2]; - u8 dfs_region; - struct ieee80211_reg_rule reg_rules[]; -}; - -#define MHZ_TO_KHZ(freq) ((freq) * 1000) -#define KHZ_TO_MHZ(freq) ((freq) / 1000) -#define DBI_TO_MBI(gain) ((gain) * 100) -#define MBI_TO_DBI(gain) ((gain) / 100) -#define DBM_TO_MBM(gain) ((gain) * 100) -#define MBM_TO_DBM(gain) ((gain) / 100) - -#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \ -{ \ - .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \ - .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \ - .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \ - .power_rule.max_antenna_gain = DBI_TO_MBI(gain),\ - .power_rule.max_eirp = DBM_TO_MBM(eirp), \ - .flags = reg_flags, \ -} - -#endif diff --git a/openairITS/mac/DOT11/net/mac80211/Makefile b/openairITS/mac/DOT11/net/mac80211/Makefile deleted file mode 100644 index 66ca5eadd89..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -obj-$(CONFIG_MAC80211) += mac80211_eurecom.o - -# mac80211 objects -mac80211_eurecom-y := \ - main.o status.o \ - sta_info.o \ - wep.o \ - wpa.o \ - scan.o offchannel.o \ - ht.o agg-tx.o agg-rx.o \ - ibss.o \ - work.o \ - iface.o \ - rate.o \ - michael.o \ - tkip.o \ - aes_ccm.o \ - aes_cmac.o \ - cfg.o \ - rx.o \ - spectmgmt.o \ - tx.o \ - key.o \ - util.o \ - wme.o \ - event.o \ - chan.o \ - mlme.o - -mac80211_eurecom-$(CONFIG_COMPAT_MAC80211_DRIVER_API_TRACER) += driver-trace.o - -mac80211_eurecom-$(CONFIG_MAC80211_LEDS) += led.o -mac80211_eurecom-$(CONFIG_MAC80211_DEBUGFS) += \ - debugfs.o \ - debugfs_sta.o \ - debugfs_netdev.o \ - debugfs_key.o - -mac80211_eurecom-$(CONFIG_MAC80211_MESH) += \ - mesh.o \ - mesh_pathtbl.o \ - mesh_plink.o \ - mesh_hwmp.o - -mac80211_eurecom-$(CONFIG_PM) += pm.o - -CFLAGS_driver-trace.o := -I$(src) - -# objects for PID algorithm -rc80211_pid-y := rc80211_pid_algo.o -rc80211_pid-$(CONFIG_MAC80211_DEBUGFS) += rc80211_pid_debugfs.o - -rc80211_minstrel-y := rc80211_minstrel.o -rc80211_minstrel-$(CONFIG_MAC80211_DEBUGFS) += rc80211_minstrel_debugfs.o - -rc80211_minstrel_ht-y := rc80211_minstrel_ht.o -rc80211_minstrel_ht-$(CONFIG_MAC80211_DEBUGFS) += rc80211_minstrel_ht_debugfs.o - -mac80211_eurecom-$(CONFIG_MAC80211_RC_PID) += $(rc80211_pid-y) -mac80211_eurecom-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) -mac80211_eurecom-$(CONFIG_MAC80211_RC_MINSTREL_HT) += $(rc80211_minstrel_ht-y) - -ccflags-y += -D__CHECK_ENDIAN__ diff --git a/openairITS/mac/DOT11/net/mac80211/aes_ccm.c b/openairITS/mac/DOT11/net/mac80211/aes_ccm.c deleted file mode 100644 index 0785e95c992..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/aes_ccm.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2003-2004, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/kernel.h> -#include <linux/types.h> -#include <linux/crypto.h> -#include <linux/err.h> -#include <crypto/aes.h> - -#include <net/mac80211.h> -#include "key.h" -#include "aes_ccm.h" - -static void aes_ccm_prepare(struct crypto_cipher *tfm, u8 *scratch, u8 *a) -{ - int i; - u8 *b_0, *aad, *b, *s_0; - - b_0 = scratch + 3 * AES_BLOCK_SIZE; - aad = scratch + 4 * AES_BLOCK_SIZE; - b = scratch; - s_0 = scratch + AES_BLOCK_SIZE; - - crypto_cipher_encrypt_one(tfm, b, b_0); - - /* Extra Authenticate-only data (always two AES blocks) */ - for (i = 0; i < AES_BLOCK_SIZE; i++) - aad[i] ^= b[i]; - crypto_cipher_encrypt_one(tfm, b, aad); - - aad += AES_BLOCK_SIZE; - - for (i = 0; i < AES_BLOCK_SIZE; i++) - aad[i] ^= b[i]; - crypto_cipher_encrypt_one(tfm, a, aad); - - /* Mask out bits from auth-only-b_0 */ - b_0[0] &= 0x07; - - /* S_0 is used to encrypt T (= MIC) */ - b_0[14] = 0; - b_0[15] = 0; - crypto_cipher_encrypt_one(tfm, s_0, b_0); -} - - -void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch, - u8 *data, size_t data_len, - u8 *cdata, u8 *mic) -{ - int i, j, last_len, num_blocks; - u8 *pos, *cpos, *b, *s_0, *e, *b_0; - - b = scratch; - s_0 = scratch + AES_BLOCK_SIZE; - e = scratch + 2 * AES_BLOCK_SIZE; - b_0 = scratch + 3 * AES_BLOCK_SIZE; - - num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); - last_len = data_len % AES_BLOCK_SIZE; - aes_ccm_prepare(tfm, scratch, b); - - /* Process payload blocks */ - pos = data; - cpos = cdata; - for (j = 1; j <= num_blocks; j++) { - int blen = (j == num_blocks && last_len) ? - last_len : AES_BLOCK_SIZE; - - /* Authentication followed by encryption */ - for (i = 0; i < blen; i++) - b[i] ^= pos[i]; - crypto_cipher_encrypt_one(tfm, b, b); - - b_0[14] = (j >> 8) & 0xff; - b_0[15] = j & 0xff; - crypto_cipher_encrypt_one(tfm, e, b_0); - for (i = 0; i < blen; i++) - *cpos++ = *pos++ ^ e[i]; - } - - for (i = 0; i < CCMP_MIC_LEN; i++) - mic[i] = b[i] ^ s_0[i]; -} - - -int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch, - u8 *cdata, size_t data_len, u8 *mic, u8 *data) -{ - int i, j, last_len, num_blocks; - u8 *pos, *cpos, *b, *s_0, *a, *b_0; - - b = scratch; - s_0 = scratch + AES_BLOCK_SIZE; - a = scratch + 2 * AES_BLOCK_SIZE; - b_0 = scratch + 3 * AES_BLOCK_SIZE; - - num_blocks = DIV_ROUND_UP(data_len, AES_BLOCK_SIZE); - last_len = data_len % AES_BLOCK_SIZE; - aes_ccm_prepare(tfm, scratch, a); - - /* Process payload blocks */ - cpos = cdata; - pos = data; - for (j = 1; j <= num_blocks; j++) { - int blen = (j == num_blocks && last_len) ? - last_len : AES_BLOCK_SIZE; - - /* Decryption followed by authentication */ - b_0[14] = (j >> 8) & 0xff; - b_0[15] = j & 0xff; - crypto_cipher_encrypt_one(tfm, b, b_0); - for (i = 0; i < blen; i++) { - *pos = *cpos++ ^ b[i]; - a[i] ^= *pos++; - } - crypto_cipher_encrypt_one(tfm, a, a); - } - - for (i = 0; i < CCMP_MIC_LEN; i++) { - if ((mic[i] ^ s_0[i]) != a[i]) - return -1; - } - - return 0; -} - - -struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]) -{ - struct crypto_cipher *tfm; - - tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); - if (!IS_ERR(tfm)) - crypto_cipher_setkey(tfm, key, ALG_CCMP_KEY_LEN); - - return tfm; -} - - -void ieee80211_aes_key_free(struct crypto_cipher *tfm) -{ - crypto_free_cipher(tfm); -} diff --git a/openairITS/mac/DOT11/net/mac80211/aes_ccm.h b/openairITS/mac/DOT11/net/mac80211/aes_ccm.h deleted file mode 100644 index 5b7d744e237..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/aes_ccm.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2003-2004, Instant802 Networks, Inc. - * Copyright 2006, Devicescape Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef AES_CCM_H -#define AES_CCM_H - -#include <linux/crypto.h> - -struct crypto_cipher *ieee80211_aes_key_setup_encrypt(const u8 key[]); -void ieee80211_aes_ccm_encrypt(struct crypto_cipher *tfm, u8 *scratch, - u8 *data, size_t data_len, - u8 *cdata, u8 *mic); -int ieee80211_aes_ccm_decrypt(struct crypto_cipher *tfm, u8 *scratch, - u8 *cdata, size_t data_len, - u8 *mic, u8 *data); -void ieee80211_aes_key_free(struct crypto_cipher *tfm); - -#endif /* AES_CCM_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/aes_cmac.c b/openairITS/mac/DOT11/net/mac80211/aes_cmac.c deleted file mode 100644 index 8dfd70d8fcf..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/aes_cmac.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * AES-128-CMAC with TLen 16 for IEEE 802.11w BIP - * Copyright 2008, Jouni Malinen <j@w1.fi> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/kernel.h> -#include <linux/types.h> -#include <linux/crypto.h> -#include <linux/err.h> -#include <crypto/aes.h> - -#include <net/mac80211.h> -#include "key.h" -#include "aes_cmac.h" - -#define AES_CMAC_KEY_LEN 16 -#define CMAC_TLEN 8 /* CMAC TLen = 64 bits (8 octets) */ -#define AAD_LEN 20 - - -static void gf_mulx(u8 *pad) -{ - int i, carry; - - carry = pad[0] & 0x80; - for (i = 0; i < AES_BLOCK_SIZE - 1; i++) - pad[i] = (pad[i] << 1) | (pad[i + 1] >> 7); - pad[AES_BLOCK_SIZE - 1] <<= 1; - if (carry) - pad[AES_BLOCK_SIZE - 1] ^= 0x87; -} - - -static void aes_128_cmac_vector(struct crypto_cipher *tfm, size_t num_elem, - const u8 *addr[], const size_t *len, u8 *mac) -{ - u8 scratch[2 * AES_BLOCK_SIZE]; - u8 *cbc, *pad; - const u8 *pos, *end; - size_t i, e, left, total_len; - - cbc = scratch; - pad = scratch + AES_BLOCK_SIZE; - - memset(cbc, 0, AES_BLOCK_SIZE); - - total_len = 0; - for (e = 0; e < num_elem; e++) - total_len += len[e]; - left = total_len; - - e = 0; - pos = addr[0]; - end = pos + len[0]; - - while (left >= AES_BLOCK_SIZE) { - for (i = 0; i < AES_BLOCK_SIZE; i++) { - cbc[i] ^= *pos++; - if (pos >= end) { - e++; - pos = addr[e]; - end = pos + len[e]; - } - } - if (left > AES_BLOCK_SIZE) - crypto_cipher_encrypt_one(tfm, cbc, cbc); - left -= AES_BLOCK_SIZE; - } - - memset(pad, 0, AES_BLOCK_SIZE); - crypto_cipher_encrypt_one(tfm, pad, pad); - gf_mulx(pad); - - if (left || total_len == 0) { - for (i = 0; i < left; i++) { - cbc[i] ^= *pos++; - if (pos >= end) { - e++; - pos = addr[e]; - end = pos + len[e]; - } - } - cbc[left] ^= 0x80; - gf_mulx(pad); - } - - for (i = 0; i < AES_BLOCK_SIZE; i++) - pad[i] ^= cbc[i]; - crypto_cipher_encrypt_one(tfm, pad, pad); - memcpy(mac, pad, CMAC_TLEN); -} - - -void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad, - const u8 *data, size_t data_len, u8 *mic) -{ - const u8 *addr[3]; - size_t len[3]; - u8 zero[CMAC_TLEN]; - - memset(zero, 0, CMAC_TLEN); - addr[0] = aad; - len[0] = AAD_LEN; - addr[1] = data; - len[1] = data_len - CMAC_TLEN; - addr[2] = zero; - len[2] = CMAC_TLEN; - - aes_128_cmac_vector(tfm, 3, addr, len, mic); -} - - -struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]) -{ - struct crypto_cipher *tfm; - - tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); - if (!IS_ERR(tfm)) - crypto_cipher_setkey(tfm, key, AES_CMAC_KEY_LEN); - - return tfm; -} - - -void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm) -{ - crypto_free_cipher(tfm); -} diff --git a/openairITS/mac/DOT11/net/mac80211/aes_cmac.h b/openairITS/mac/DOT11/net/mac80211/aes_cmac.h deleted file mode 100644 index 20785a64725..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/aes_cmac.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2008, Jouni Malinen <j@w1.fi> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef AES_CMAC_H -#define AES_CMAC_H - -#include <linux/crypto.h> - -struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]); -void ieee80211_aes_cmac(struct crypto_cipher *tfm, const u8 *aad, - const u8 *data, size_t data_len, u8 *mic); -void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm); - -#endif /* AES_CMAC_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/agg-rx.c b/openairITS/mac/DOT11/net/mac80211/agg-rx.c deleted file mode 100644 index 64d3ce5ea1a..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/agg-rx.c +++ /dev/null @@ -1,347 +0,0 @@ -/* - * HT handling - * - * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi> - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007, Michael Wu <flamingice@sourmilk.net> - * Copyright 2007-2010, Intel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -/** - * DOC: RX A-MPDU aggregation - * - * Aggregation on the RX side requires only implementing the - * @ampdu_action callback that is invoked to start/stop any - * block-ack sessions for RX aggregation. - * - * When RX aggregation is started by the peer, the driver is - * notified via @ampdu_action function, with the - * %IEEE80211_AMPDU_RX_START action, and may reject the request - * in which case a negative response is sent to the peer, if it - * accepts it a positive response is sent. - * - * While the session is active, the device/driver are required - * to de-aggregate frames and pass them up one by one to mac80211, - * which will handle the reorder buffer. - * - * When the aggregation session is stopped again by the peer or - * ourselves, the driver's @ampdu_action function will be called - * with the action %IEEE80211_AMPDU_RX_STOP. In this case, the - * call must not fail. - */ - -#include <linux/ieee80211.h> -#include <linux/slab.h> -#include <linux/export.h> -#include <net/mac80211.h> -#include "ieee80211_i.h" -#include "driver-ops.h" - -static void ieee80211_free_tid_rx(struct rcu_head *h) -{ - struct tid_ampdu_rx *tid_rx = - container_of(h, struct tid_ampdu_rx, rcu_head); - int i; - - del_timer_sync(&tid_rx->reorder_timer); - - for (i = 0; i < tid_rx->buf_size; i++) - dev_kfree_skb(tid_rx->reorder_buf[i]); - kfree(tid_rx->reorder_buf); - kfree(tid_rx->reorder_time); - kfree(tid_rx); -} - -void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, - u16 initiator, u16 reason, bool tx) -{ - struct ieee80211_local *local = sta->local; - struct tid_ampdu_rx *tid_rx; - - lockdep_assert_held(&sta->ampdu_mlme.mtx); - - tid_rx = rcu_dereference_protected(sta->ampdu_mlme.tid_rx[tid], - lockdep_is_held(&sta->ampdu_mlme.mtx)); - - if (!tid_rx) - return; - - RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], NULL); - -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG - "Rx BA session stop requested for %pM tid %u %s reason: %d\n", - sta->sta.addr, tid, - initiator == WLAN_BACK_RECIPIENT ? "recipient" : "inititator", - (int)reason); -#endif /* CONFIG_MAC80211_HT_DEBUG */ - - if (drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_STOP, - &sta->sta, tid, NULL, 0)) - printk(KERN_DEBUG "HW problem - can not stop rx " - "aggregation for tid %d\n", tid); - - /* check if this is a self generated aggregation halt */ - if (initiator == WLAN_BACK_RECIPIENT && tx) - ieee80211_send_delba(sta->sdata, sta->sta.addr, - tid, WLAN_BACK_RECIPIENT, reason); - - del_timer_sync(&tid_rx->session_timer); - - call_rcu(&tid_rx->rcu_head, ieee80211_free_tid_rx); -} - -void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, - u16 initiator, u16 reason, bool tx) -{ - mutex_lock(&sta->ampdu_mlme.mtx); - ___ieee80211_stop_rx_ba_session(sta, tid, initiator, reason, tx); - mutex_unlock(&sta->ampdu_mlme.mtx); -} - -void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap, - const u8 *addr) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct sta_info *sta; - int i; - - rcu_read_lock(); - sta = sta_info_get_bss(sdata, addr); - if (!sta) { - rcu_read_unlock(); - return; - } - - for (i = 0; i < STA_TID_NUM; i++) - if (ba_rx_bitmap & BIT(i)) - set_bit(i, sta->ampdu_mlme.tid_rx_stop_requested); - - ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work); - rcu_read_unlock(); -} -EXPORT_SYMBOL(ieee80211_stop_rx_ba_session); - -/* - * After accepting the AddBA Request we activated a timer, - * resetting it after each frame that arrives from the originator. - */ -static void sta_rx_agg_session_timer_expired(unsigned long data) -{ - /* not an elegant detour, but there is no choice as the timer passes - * only one argument, and various sta_info are needed here, so init - * flow in sta_info_create gives the TID as data, while the timer_to_id - * array gives the sta through container_of */ - u8 *ptid = (u8 *)data; - u8 *timer_to_id = ptid - *ptid; - struct sta_info *sta = container_of(timer_to_id, struct sta_info, - timer_to_tid[0]); - -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid); -#endif - set_bit(*ptid, sta->ampdu_mlme.tid_rx_timer_expired); - ieee80211_queue_work(&sta->local->hw, &sta->ampdu_mlme.work); -} - -static void sta_rx_agg_reorder_timer_expired(unsigned long data) -{ - u8 *ptid = (u8 *)data; - u8 *timer_to_id = ptid - *ptid; - struct sta_info *sta = container_of(timer_to_id, struct sta_info, - timer_to_tid[0]); - - rcu_read_lock(); - ieee80211_release_reorder_timeout(sta, *ptid); - rcu_read_unlock(); -} - -static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *da, u16 tid, - u8 dialog_token, u16 status, u16 policy, - u16 buf_size, u16 timeout) -{ - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - u16 capab; - - skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom); - if (!skb) - return; - - skb_reserve(skb, local->hw.extra_tx_headroom); - mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); - memset(mgmt, 0, 24); - memcpy(mgmt->da, da, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - if (sdata->vif.type == NL80211_IFTYPE_AP || - sdata->vif.type == NL80211_IFTYPE_AP_VLAN || - sdata->vif.type == NL80211_IFTYPE_MESH_POINT) - memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); - else if (sdata->vif.type == NL80211_IFTYPE_STATION) - memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); - else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) - memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); - - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - - skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp)); - mgmt->u.action.category = WLAN_CATEGORY_BACK; - mgmt->u.action.u.addba_resp.action_code = WLAN_ACTION_ADDBA_RESP; - mgmt->u.action.u.addba_resp.dialog_token = dialog_token; - - capab = (u16)(policy << 1); /* bit 1 aggregation policy */ - capab |= (u16)(tid << 2); /* bit 5:2 TID number */ - capab |= (u16)(buf_size << 6); /* bit 15:6 max size of aggregation */ - - mgmt->u.action.u.addba_resp.capab = cpu_to_le16(capab); - mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout); - mgmt->u.action.u.addba_resp.status = cpu_to_le16(status); - - ieee80211_tx_skb(sdata, skb); -} - -void ieee80211_process_addba_request(struct ieee80211_local *local, - struct sta_info *sta, - struct ieee80211_mgmt *mgmt, - size_t len) -{ - struct tid_ampdu_rx *tid_agg_rx; - u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status; - u8 dialog_token; - int ret = -EOPNOTSUPP; - - /* extract session parameters from addba request frame */ - dialog_token = mgmt->u.action.u.addba_req.dialog_token; - timeout = le16_to_cpu(mgmt->u.action.u.addba_req.timeout); - start_seq_num = - le16_to_cpu(mgmt->u.action.u.addba_req.start_seq_num) >> 4; - - capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab); - ba_policy = (capab & IEEE80211_ADDBA_PARAM_POLICY_MASK) >> 1; - tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; - buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6; - - status = WLAN_STATUS_REQUEST_DECLINED; - - if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "Suspend in progress. " - "Denying ADDBA request\n"); -#endif - goto end_no_lock; - } - - /* sanity check for incoming parameters: - * check if configuration can support the BA policy - * and if buffer size does not exceeds max value */ - /* XXX: check own ht delayed BA capability?? */ - if (((ba_policy != 1) && - (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA))) || - (buf_size > IEEE80211_MAX_AMPDU_BUF)) { - status = WLAN_STATUS_INVALID_QOS_PARAM; -#ifdef CONFIG_MAC80211_HT_DEBUG - if (net_ratelimit()) - printk(KERN_DEBUG "AddBA Req with bad params from " - "%pM on tid %u. policy %d, buffer size %d\n", - mgmt->sa, tid, ba_policy, - buf_size); -#endif /* CONFIG_MAC80211_HT_DEBUG */ - goto end_no_lock; - } - /* determine default buffer size */ - if (buf_size == 0) - buf_size = IEEE80211_MAX_AMPDU_BUF; - - /* make sure the size doesn't exceed the maximum supported by the hw */ - if (buf_size > local->hw.max_rx_aggregation_subframes) - buf_size = local->hw.max_rx_aggregation_subframes; - - /* examine state machine */ - mutex_lock(&sta->ampdu_mlme.mtx); - - if (sta->ampdu_mlme.tid_rx[tid]) { -#ifdef CONFIG_MAC80211_HT_DEBUG - if (net_ratelimit()) - printk(KERN_DEBUG "unexpected AddBA Req from " - "%pM on tid %u\n", - mgmt->sa, tid); -#endif /* CONFIG_MAC80211_HT_DEBUG */ - - /* delete existing Rx BA session on the same tid */ - ___ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_RECIPIENT, - WLAN_STATUS_UNSPECIFIED_QOS, - false); - } - - /* prepare A-MPDU MLME for Rx aggregation */ - tid_agg_rx = kmalloc(sizeof(struct tid_ampdu_rx), GFP_KERNEL); - if (!tid_agg_rx) - goto end; - - spin_lock_init(&tid_agg_rx->reorder_lock); - - /* rx timer */ - tid_agg_rx->session_timer.function = sta_rx_agg_session_timer_expired; - tid_agg_rx->session_timer.data = (unsigned long)&sta->timer_to_tid[tid]; - init_timer(&tid_agg_rx->session_timer); - - /* rx reorder timer */ - tid_agg_rx->reorder_timer.function = sta_rx_agg_reorder_timer_expired; - tid_agg_rx->reorder_timer.data = (unsigned long)&sta->timer_to_tid[tid]; - init_timer(&tid_agg_rx->reorder_timer); - - /* prepare reordering buffer */ - tid_agg_rx->reorder_buf = - kcalloc(buf_size, sizeof(struct sk_buff *), GFP_KERNEL); - tid_agg_rx->reorder_time = - kcalloc(buf_size, sizeof(unsigned long), GFP_KERNEL); - if (!tid_agg_rx->reorder_buf || !tid_agg_rx->reorder_time) { - kfree(tid_agg_rx->reorder_buf); - kfree(tid_agg_rx->reorder_time); - kfree(tid_agg_rx); - goto end; - } - - ret = drv_ampdu_action(local, sta->sdata, IEEE80211_AMPDU_RX_START, - &sta->sta, tid, &start_seq_num, 0); -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n", tid, ret); -#endif /* CONFIG_MAC80211_HT_DEBUG */ - - if (ret) { - kfree(tid_agg_rx->reorder_buf); - kfree(tid_agg_rx->reorder_time); - kfree(tid_agg_rx); - goto end; - } - - /* update data */ - tid_agg_rx->dialog_token = dialog_token; - tid_agg_rx->ssn = start_seq_num; - tid_agg_rx->head_seq_num = start_seq_num; - tid_agg_rx->buf_size = buf_size; - tid_agg_rx->timeout = timeout; - tid_agg_rx->stored_mpdu_num = 0; - status = WLAN_STATUS_SUCCESS; - - /* activate it for RX */ - rcu_assign_pointer(sta->ampdu_mlme.tid_rx[tid], tid_agg_rx); - - if (timeout) - mod_timer(&tid_agg_rx->session_timer, TU_TO_EXP_TIME(timeout)); - -end: - mutex_unlock(&sta->ampdu_mlme.mtx); - -end_no_lock: - ieee80211_send_addba_resp(sta->sdata, sta->sta.addr, tid, - dialog_token, status, 1, buf_size, timeout); -} diff --git a/openairITS/mac/DOT11/net/mac80211/agg-tx.c b/openairITS/mac/DOT11/net/mac80211/agg-tx.c deleted file mode 100644 index 76be6174419..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/agg-tx.c +++ /dev/null @@ -1,898 +0,0 @@ -/* - * HT handling - * - * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi> - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007, Michael Wu <flamingice@sourmilk.net> - * Copyright 2007-2010, Intel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/ieee80211.h> -#include <linux/slab.h> -#include <linux/export.h> -#include <net/mac80211.h> -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "wme.h" - -/** - * DOC: TX A-MPDU aggregation - * - * Aggregation on the TX side requires setting the hardware flag - * %IEEE80211_HW_AMPDU_AGGREGATION. The driver will then be handed - * packets with a flag indicating A-MPDU aggregation. The driver - * or device is responsible for actually aggregating the frames, - * as well as deciding how many and which to aggregate. - * - * When TX aggregation is started by some subsystem (usually the rate - * control algorithm would be appropriate) by calling the - * ieee80211_start_tx_ba_session() function, the driver will be - * notified via its @ampdu_action function, with the - * %IEEE80211_AMPDU_TX_START action. - * - * In response to that, the driver is later required to call the - * ieee80211_start_tx_ba_cb_irqsafe() function, which will really - * start the aggregation session after the peer has also responded. - * If the peer responds negatively, the session will be stopped - * again right away. Note that it is possible for the aggregation - * session to be stopped before the driver has indicated that it - * is done setting it up, in which case it must not indicate the - * setup completion. - * - * Also note that, since we also need to wait for a response from - * the peer, the driver is notified of the completion of the - * handshake by the %IEEE80211_AMPDU_TX_OPERATIONAL action to the - * @ampdu_action callback. - * - * Similarly, when the aggregation session is stopped by the peer - * or something calling ieee80211_stop_tx_ba_session(), the driver's - * @ampdu_action function will be called with the action - * %IEEE80211_AMPDU_TX_STOP. In this case, the call must not fail, - * and the driver must later call ieee80211_stop_tx_ba_cb_irqsafe(). - * Note that the sta can get destroyed before the BA tear down is - * complete. - */ - -static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, - const u8 *da, u16 tid, - u8 dialog_token, u16 start_seq_num, - u16 agg_size, u16 timeout) -{ - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - u16 capab; - - skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom); - - if (!skb) - return; - - skb_reserve(skb, local->hw.extra_tx_headroom); - mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); - memset(mgmt, 0, 24); - memcpy(mgmt->da, da, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - if (sdata->vif.type == NL80211_IFTYPE_AP || - sdata->vif.type == NL80211_IFTYPE_AP_VLAN || - sdata->vif.type == NL80211_IFTYPE_MESH_POINT) - memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); - else if (sdata->vif.type == NL80211_IFTYPE_STATION) - memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); - else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) - memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); - - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - - skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_req)); - - mgmt->u.action.category = WLAN_CATEGORY_BACK; - mgmt->u.action.u.addba_req.action_code = WLAN_ACTION_ADDBA_REQ; - - mgmt->u.action.u.addba_req.dialog_token = dialog_token; - capab = (u16)(1 << 1); /* bit 1 aggregation policy */ - capab |= (u16)(tid << 2); /* bit 5:2 TID number */ - capab |= (u16)(agg_size << 6); /* bit 15:6 max size of aggergation */ - - mgmt->u.action.u.addba_req.capab = cpu_to_le16(capab); - - mgmt->u.action.u.addba_req.timeout = cpu_to_le16(timeout); - mgmt->u.action.u.addba_req.start_seq_num = - cpu_to_le16(start_seq_num << 4); - - ieee80211_tx_skb_tid(sdata, skb, tid); -} - -void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_bar *bar; - u16 bar_control = 0; - - skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom); - if (!skb) - return; - - skb_reserve(skb, local->hw.extra_tx_headroom); - bar = (struct ieee80211_bar *)skb_put(skb, sizeof(*bar)); - memset(bar, 0, sizeof(*bar)); - bar->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | - IEEE80211_STYPE_BACK_REQ); - memcpy(bar->ra, ra, ETH_ALEN); - memcpy(bar->ta, sdata->vif.addr, ETH_ALEN); - bar_control |= (u16)IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL; - bar_control |= (u16)IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA; - bar_control |= (u16)(tid << IEEE80211_BAR_CTRL_TID_INFO_SHIFT); - bar->control = cpu_to_le16(bar_control); - bar->start_seq_num = cpu_to_le16(ssn); - - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - ieee80211_tx_skb_tid(sdata, skb, tid); -} -EXPORT_SYMBOL(ieee80211_send_bar); - -void ieee80211_assign_tid_tx(struct sta_info *sta, int tid, - struct tid_ampdu_tx *tid_tx) -{ - lockdep_assert_held(&sta->ampdu_mlme.mtx); - lockdep_assert_held(&sta->lock); - rcu_assign_pointer(sta->ampdu_mlme.tid_tx[tid], tid_tx); -} - -int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, - enum ieee80211_back_parties initiator, - bool tx) -{ - struct ieee80211_local *local = sta->local; - struct tid_ampdu_tx *tid_tx; - int ret; - - lockdep_assert_held(&sta->ampdu_mlme.mtx); - - spin_lock_bh(&sta->lock); - - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); - if (!tid_tx) { - spin_unlock_bh(&sta->lock); - return -ENOENT; - } - - /* if we're already stopping ignore any new requests to stop */ - if (test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { - spin_unlock_bh(&sta->lock); - return -EALREADY; - } - - if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { - /* not even started yet! */ - ieee80211_assign_tid_tx(sta, tid, NULL); - spin_unlock_bh(&sta->lock); - kfree_rcu(tid_tx, rcu_head); - return 0; - } - - set_bit(HT_AGG_STATE_STOPPING, &tid_tx->state); - - spin_unlock_bh(&sta->lock); - -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n", - sta->sta.addr, tid); -#endif /* CONFIG_MAC80211_HT_DEBUG */ - - del_timer_sync(&tid_tx->addba_resp_timer); - del_timer_sync(&tid_tx->session_timer); - - /* - * After this packets are no longer handed right through - * to the driver but are put onto tid_tx->pending instead, - * with locking to ensure proper access. - */ - clear_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state); - - /* - * There might be a few packets being processed right now (on - * another CPU) that have already gotten past the aggregation - * check when it was still OPERATIONAL and consequently have - * IEEE80211_TX_CTL_AMPDU set. In that case, this code might - * call into the driver at the same time or even before the - * TX paths calls into it, which could confuse the driver. - * - * Wait for all currently running TX paths to finish before - * telling the driver. New packets will not go through since - * the aggregation session is no longer OPERATIONAL. - */ - synchronize_net(); - - tid_tx->stop_initiator = initiator; - tid_tx->tx_stop = tx; - - ret = drv_ampdu_action(local, sta->sdata, - IEEE80211_AMPDU_TX_STOP, - &sta->sta, tid, NULL, 0); - - /* HW shall not deny going back to legacy */ - if (WARN_ON(ret)) { - /* - * We may have pending packets get stuck in this case... - * Not bothering with a workaround for now. - */ - } - - return ret; -} - -/* - * After sending add Block Ack request we activated a timer until - * add Block Ack response will arrive from the recipient. - * If this timer expires sta_addba_resp_timer_expired will be executed. - */ -static void sta_addba_resp_timer_expired(unsigned long data) -{ - /* not an elegant detour, but there is no choice as the timer passes - * only one argument, and both sta_info and TID are needed, so init - * flow in sta_info_create gives the TID as data, while the timer_to_id - * array gives the sta through container_of */ - u16 tid = *(u8 *)data; - struct sta_info *sta = container_of((void *)data, - struct sta_info, timer_to_tid[tid]); - struct tid_ampdu_tx *tid_tx; - - /* check if the TID waits for addBA response */ - rcu_read_lock(); - tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); - if (!tid_tx || - test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) { - rcu_read_unlock(); -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "timer expired on tid %d but we are not " - "(or no longer) expecting addBA response there\n", - tid); -#endif - return; - } - -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid); -#endif - - ieee80211_stop_tx_ba_session(&sta->sta, tid); - rcu_read_unlock(); -} - -static inline int ieee80211_ac_from_tid(int tid) -{ - return ieee802_1d_to_ac[tid & 7]; -} - -/* - * When multiple aggregation sessions on multiple stations - * are being created/destroyed simultaneously, we need to - * refcount the global queue stop caused by that in order - * to not get into a situation where one of the aggregation - * setup or teardown re-enables queues before the other is - * ready to handle that. - * - * These two functions take care of this issue by keeping - * a global "agg_queue_stop" refcount. - */ -static void __acquires(agg_queue) -ieee80211_stop_queue_agg(struct ieee80211_local *local, int tid) -{ - int queue = ieee80211_ac_from_tid(tid); - - if (atomic_inc_return(&local->agg_queue_stop[queue]) == 1) - ieee80211_stop_queue_by_reason( - &local->hw, queue, - IEEE80211_QUEUE_STOP_REASON_AGGREGATION); - __acquire(agg_queue); -} - -static void __releases(agg_queue) -ieee80211_wake_queue_agg(struct ieee80211_local *local, int tid) -{ - int queue = ieee80211_ac_from_tid(tid); - - if (atomic_dec_return(&local->agg_queue_stop[queue]) == 0) - ieee80211_wake_queue_by_reason( - &local->hw, queue, - IEEE80211_QUEUE_STOP_REASON_AGGREGATION); - __release(agg_queue); -} - -/* - * splice packets from the STA's pending to the local pending, - * requires a call to ieee80211_agg_splice_finish later - */ -static void __acquires(agg_queue) -ieee80211_agg_splice_packets(struct ieee80211_local *local, - struct tid_ampdu_tx *tid_tx, u16 tid) -{ - int queue = ieee80211_ac_from_tid(tid); - unsigned long flags; - - ieee80211_stop_queue_agg(local, tid); - - if (WARN(!tid_tx, "TID %d gone but expected when splicing aggregates" - " from the pending queue\n", tid)) - return; - - if (!skb_queue_empty(&tid_tx->pending)) { - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - /* copy over remaining packets */ - skb_queue_splice_tail_init(&tid_tx->pending, - &local->pending[queue]); - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); - } -} - -static void __releases(agg_queue) -ieee80211_agg_splice_finish(struct ieee80211_local *local, u16 tid) -{ - ieee80211_wake_queue_agg(local, tid); -} - -void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid) -{ - struct tid_ampdu_tx *tid_tx; - struct ieee80211_local *local = sta->local; - struct ieee80211_sub_if_data *sdata = sta->sdata; - u16 start_seq_num; - int ret; - - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); - - /* - * Start queuing up packets for this aggregation session. - * We're going to release them once the driver is OK with - * that. - */ - clear_bit(HT_AGG_STATE_WANT_START, &tid_tx->state); - - /* - * Make sure no packets are being processed. This ensures that - * we have a valid starting sequence number and that in-flight - * packets have been flushed out and no packets for this TID - * will go into the driver during the ampdu_action call. - */ - synchronize_net(); - - start_seq_num = sta->tid_seq[tid] >> 4; - - ret = drv_ampdu_action(local, sdata, IEEE80211_AMPDU_TX_START, - &sta->sta, tid, &start_seq_num, 0); - if (ret) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "BA request denied - HW unavailable for" - " tid %d\n", tid); -#endif - spin_lock_bh(&sta->lock); - ieee80211_agg_splice_packets(local, tid_tx, tid); - ieee80211_assign_tid_tx(sta, tid, NULL); - ieee80211_agg_splice_finish(local, tid); - spin_unlock_bh(&sta->lock); - - kfree_rcu(tid_tx, rcu_head); - return; - } - - /* activate the timer for the recipient's addBA response */ - mod_timer(&tid_tx->addba_resp_timer, jiffies + ADDBA_RESP_INTERVAL); -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid); -#endif - - spin_lock_bh(&sta->lock); - sta->ampdu_mlme.last_addba_req_time[tid] = jiffies; - sta->ampdu_mlme.addba_req_num[tid]++; - spin_unlock_bh(&sta->lock); - - /* send AddBA request */ - ieee80211_send_addba_request(sdata, sta->sta.addr, tid, - tid_tx->dialog_token, start_seq_num, - local->hw.max_tx_aggregation_subframes, - tid_tx->timeout); -} - -/* - * After accepting the AddBA Response we activated a timer, - * resetting it after each frame that we send. - */ -static void sta_tx_agg_session_timer_expired(unsigned long data) -{ - /* not an elegant detour, but there is no choice as the timer passes - * only one argument, and various sta_info are needed here, so init - * flow in sta_info_create gives the TID as data, while the timer_to_id - * array gives the sta through container_of */ - u8 *ptid = (u8 *)data; - u8 *timer_to_id = ptid - *ptid; - struct sta_info *sta = container_of(timer_to_id, struct sta_info, - timer_to_tid[0]); - -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "tx session timer expired on tid %d\n", (u16)*ptid); -#endif - - ieee80211_stop_tx_ba_session(&sta->sta, *ptid); -} - -int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid, - u16 timeout) -{ - struct sta_info *sta = container_of(pubsta, struct sta_info, sta); - struct ieee80211_sub_if_data *sdata = sta->sdata; - struct ieee80211_local *local = sdata->local; - struct tid_ampdu_tx *tid_tx; - int ret = 0; - - trace_api_start_tx_ba_session(pubsta, tid); - - if (WARN_ON(!local->ops->ampdu_action)) - return -EINVAL; - - if ((tid >= STA_TID_NUM) || - !(local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION) || - (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW)) - return -EINVAL; - -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "Open BA session requested for %pM tid %u\n", - pubsta->addr, tid); -#endif /* CONFIG_MAC80211_HT_DEBUG */ - - if (sdata->vif.type != NL80211_IFTYPE_STATION && - sdata->vif.type != NL80211_IFTYPE_MESH_POINT && - sdata->vif.type != NL80211_IFTYPE_AP_VLAN && - sdata->vif.type != NL80211_IFTYPE_AP && - sdata->vif.type != NL80211_IFTYPE_ADHOC) - return -EINVAL; - - if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "BA sessions blocked. " - "Denying BA session request\n"); -#endif - return -EINVAL; - } - - /* - * 802.11n-2009 11.5.1.1: If the initiating STA is an HT STA, is a - * member of an IBSS, and has no other existing Block Ack agreement - * with the recipient STA, then the initiating STA shall transmit a - * Probe Request frame to the recipient STA and shall not transmit an - * ADDBA Request frame unless it receives a Probe Response frame - * from the recipient within dot11ADDBAFailureTimeout. - * - * The probe request mechanism for ADDBA is currently not implemented, - * but we only build up Block Ack session with HT STAs. This information - * is set when we receive a bss info from a probe response or a beacon. - */ - if (sta->sdata->vif.type == NL80211_IFTYPE_ADHOC && - !sta->sta.ht_cap.ht_supported) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "BA request denied - IBSS STA %pM" - "does not advertise HT support\n", pubsta->addr); -#endif /* CONFIG_MAC80211_HT_DEBUG */ - return -EINVAL; - } - - spin_lock_bh(&sta->lock); - - /* we have tried too many times, receiver does not want A-MPDU */ - if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_MAX_RETRIES) { - ret = -EBUSY; - goto err_unlock_sta; - } - - /* - * if we have tried more than HT_AGG_BURST_RETRIES times we - * will spread our requests in time to avoid stalling connection - * for too long - */ - if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_BURST_RETRIES && - time_before(jiffies, sta->ampdu_mlme.last_addba_req_time[tid] + - HT_AGG_RETRIES_PERIOD)) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "BA request denied - " - "waiting a grace period after %d failed requests " - "on tid %u\n", - sta->ampdu_mlme.addba_req_num[tid], tid); -#endif /* CONFIG_MAC80211_HT_DEBUG */ - ret = -EBUSY; - goto err_unlock_sta; - } - - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); - /* check if the TID is not in aggregation flow already */ - if (tid_tx || sta->ampdu_mlme.tid_start_tx[tid]) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "BA request denied - session is not " - "idle on tid %u\n", tid); -#endif /* CONFIG_MAC80211_HT_DEBUG */ - ret = -EAGAIN; - goto err_unlock_sta; - } - - /* prepare A-MPDU MLME for Tx aggregation */ - tid_tx = kzalloc(sizeof(struct tid_ampdu_tx), GFP_ATOMIC); - if (!tid_tx) { - ret = -ENOMEM; - goto err_unlock_sta; - } - - skb_queue_head_init(&tid_tx->pending); - __set_bit(HT_AGG_STATE_WANT_START, &tid_tx->state); - - tid_tx->timeout = timeout; - - /* response timer */ - tid_tx->addba_resp_timer.function = sta_addba_resp_timer_expired; - tid_tx->addba_resp_timer.data = (unsigned long)&sta->timer_to_tid[tid]; - init_timer(&tid_tx->addba_resp_timer); - - /* tx timer */ - tid_tx->session_timer.function = sta_tx_agg_session_timer_expired; - tid_tx->session_timer.data = (unsigned long)&sta->timer_to_tid[tid]; - init_timer(&tid_tx->session_timer); - - /* assign a dialog token */ - sta->ampdu_mlme.dialog_token_allocator++; - tid_tx->dialog_token = sta->ampdu_mlme.dialog_token_allocator; - - /* - * Finally, assign it to the start array; the work item will - * collect it and move it to the normal array. - */ - sta->ampdu_mlme.tid_start_tx[tid] = tid_tx; - - ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work); - - /* this flow continues off the work */ - err_unlock_sta: - spin_unlock_bh(&sta->lock); - return ret; -} -EXPORT_SYMBOL(ieee80211_start_tx_ba_session); - -static void ieee80211_agg_tx_operational(struct ieee80211_local *local, - struct sta_info *sta, u16 tid) -{ - struct tid_ampdu_tx *tid_tx; - - lockdep_assert_held(&sta->ampdu_mlme.mtx); - - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); - -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "Aggregation is on for tid %d\n", tid); -#endif - - drv_ampdu_action(local, sta->sdata, - IEEE80211_AMPDU_TX_OPERATIONAL, - &sta->sta, tid, NULL, tid_tx->buf_size); - - /* - * synchronize with TX path, while splicing the TX path - * should block so it won't put more packets onto pending. - */ - spin_lock_bh(&sta->lock); - - ieee80211_agg_splice_packets(local, tid_tx, tid); - /* - * Now mark as operational. This will be visible - * in the TX path, and lets it go lock-free in - * the common case. - */ - set_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state); - ieee80211_agg_splice_finish(local, tid); - - spin_unlock_bh(&sta->lock); -} - -void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - struct tid_ampdu_tx *tid_tx; - - trace_api_start_tx_ba_cb(sdata, ra, tid); - - if (tid >= STA_TID_NUM) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", - tid, STA_TID_NUM); -#endif - return; - } - - mutex_lock(&local->sta_mtx); - sta = sta_info_get_bss(sdata, ra); - if (!sta) { - mutex_unlock(&local->sta_mtx); -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "Could not find station: %pM\n", ra); -#endif - return; - } - - mutex_lock(&sta->ampdu_mlme.mtx); - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); - - if (WARN_ON(!tid_tx)) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "addBA was not requested!\n"); -#endif - goto unlock; - } - - if (WARN_ON(test_and_set_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state))) - goto unlock; - - if (test_bit(HT_AGG_STATE_RESPONSE_RECEIVED, &tid_tx->state)) - ieee80211_agg_tx_operational(local, sta, tid); - - unlock: - mutex_unlock(&sta->ampdu_mlme.mtx); - mutex_unlock(&local->sta_mtx); -} - -void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, - const u8 *ra, u16 tid) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_local *local = sdata->local; - struct ieee80211_ra_tid *ra_tid; - struct sk_buff *skb = dev_alloc_skb(0); - - if (unlikely(!skb)) - return; - - ra_tid = (struct ieee80211_ra_tid *) &skb->cb; - memcpy(&ra_tid->ra, ra, ETH_ALEN); - ra_tid->tid = tid; - - skb->pkt_type = IEEE80211_SDATA_QUEUE_AGG_START; - skb_queue_tail(&sdata->skb_queue, skb); - ieee80211_queue_work(&local->hw, &sdata->work); -} -EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe); - -int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, - enum ieee80211_back_parties initiator, - bool tx) -{ - int ret; - - mutex_lock(&sta->ampdu_mlme.mtx); - - ret = ___ieee80211_stop_tx_ba_session(sta, tid, initiator, tx); - - mutex_unlock(&sta->ampdu_mlme.mtx); - - return ret; -} - -int ieee80211_stop_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid) -{ - struct sta_info *sta = container_of(pubsta, struct sta_info, sta); - struct ieee80211_sub_if_data *sdata = sta->sdata; - struct ieee80211_local *local = sdata->local; - struct tid_ampdu_tx *tid_tx; - int ret = 0; - - trace_api_stop_tx_ba_session(pubsta, tid); - - if (!local->ops->ampdu_action) - return -EINVAL; - - if (tid >= STA_TID_NUM) - return -EINVAL; - - spin_lock_bh(&sta->lock); - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); - - if (!tid_tx) { - ret = -ENOENT; - goto unlock; - } - - if (test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { - /* already in progress stopping it */ - ret = 0; - goto unlock; - } - - set_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state); - ieee80211_queue_work(&local->hw, &sta->ampdu_mlme.work); - - unlock: - spin_unlock_bh(&sta->lock); - return ret; -} -EXPORT_SYMBOL(ieee80211_stop_tx_ba_session); - -void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - struct tid_ampdu_tx *tid_tx; - - trace_api_stop_tx_ba_cb(sdata, ra, tid); - - if (tid >= STA_TID_NUM) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", - tid, STA_TID_NUM); -#endif - return; - } - -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "Stopping Tx BA session for %pM tid %d\n", - ra, tid); -#endif /* CONFIG_MAC80211_HT_DEBUG */ - - mutex_lock(&local->sta_mtx); - - sta = sta_info_get_bss(sdata, ra); - if (!sta) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "Could not find station: %pM\n", ra); -#endif - goto unlock; - } - - mutex_lock(&sta->ampdu_mlme.mtx); - spin_lock_bh(&sta->lock); - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); - - if (!tid_tx || !test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n"); -#endif - goto unlock_sta; - } - - if (tid_tx->stop_initiator == WLAN_BACK_INITIATOR && tid_tx->tx_stop) - ieee80211_send_delba(sta->sdata, ra, tid, - WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); - - /* - * When we get here, the TX path will not be lockless any more wrt. - * aggregation, since the OPERATIONAL bit has long been cleared. - * Thus it will block on getting the lock, if it occurs. So if we - * stop the queue now, we will not get any more packets, and any - * that might be being processed will wait for us here, thereby - * guaranteeing that no packets go to the tid_tx pending queue any - * more. - */ - - ieee80211_agg_splice_packets(local, tid_tx, tid); - - /* future packets must not find the tid_tx struct any more */ - ieee80211_assign_tid_tx(sta, tid, NULL); - - ieee80211_agg_splice_finish(local, tid); - - kfree_rcu(tid_tx, rcu_head); - - unlock_sta: - spin_unlock_bh(&sta->lock); - mutex_unlock(&sta->ampdu_mlme.mtx); - unlock: - mutex_unlock(&local->sta_mtx); -} - -void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, - const u8 *ra, u16 tid) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_local *local = sdata->local; - struct ieee80211_ra_tid *ra_tid; - struct sk_buff *skb = dev_alloc_skb(0); - - if (unlikely(!skb)) - return; - - ra_tid = (struct ieee80211_ra_tid *) &skb->cb; - memcpy(&ra_tid->ra, ra, ETH_ALEN); - ra_tid->tid = tid; - - skb->pkt_type = IEEE80211_SDATA_QUEUE_AGG_STOP; - skb_queue_tail(&sdata->skb_queue, skb); - ieee80211_queue_work(&local->hw, &sdata->work); -} -EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb_irqsafe); - - -void ieee80211_process_addba_resp(struct ieee80211_local *local, - struct sta_info *sta, - struct ieee80211_mgmt *mgmt, - size_t len) -{ - struct tid_ampdu_tx *tid_tx; - u16 capab, tid; - u8 buf_size; - - capab = le16_to_cpu(mgmt->u.action.u.addba_resp.capab); - tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2; - buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6; - - mutex_lock(&sta->ampdu_mlme.mtx); - - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); - if (!tid_tx) - goto out; - - if (mgmt->u.action.u.addba_resp.dialog_token != tid_tx->dialog_token) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid); -#endif - goto out; - } - - del_timer_sync(&tid_tx->addba_resp_timer); - -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG "switched off addBA timer for tid %d\n", tid); -#endif - - /* - * addba_resp_timer may have fired before we got here, and - * caused WANT_STOP to be set. If the stop then was already - * processed further, STOPPING might be set. - */ - if (test_bit(HT_AGG_STATE_WANT_STOP, &tid_tx->state) || - test_bit(HT_AGG_STATE_STOPPING, &tid_tx->state)) { -#ifdef CONFIG_MAC80211_HT_DEBUG - printk(KERN_DEBUG - "got addBA resp for tid %d but we already gave up\n", - tid); -#endif - goto out; - } - - /* - * IEEE 802.11-2007 7.3.1.14: - * In an ADDBA Response frame, when the Status Code field - * is set to 0, the Buffer Size subfield is set to a value - * of at least 1. - */ - if (le16_to_cpu(mgmt->u.action.u.addba_resp.status) - == WLAN_STATUS_SUCCESS && buf_size) { - if (test_and_set_bit(HT_AGG_STATE_RESPONSE_RECEIVED, - &tid_tx->state)) { - /* ignore duplicate response */ - goto out; - } - - tid_tx->buf_size = buf_size; - - if (test_bit(HT_AGG_STATE_DRV_READY, &tid_tx->state)) - ieee80211_agg_tx_operational(local, sta, tid); - - sta->ampdu_mlme.addba_req_num[tid] = 0; - - if (tid_tx->timeout) - mod_timer(&tid_tx->session_timer, - TU_TO_EXP_TIME(tid_tx->timeout)); - - } else { - ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR, - true); - } - - out: - mutex_unlock(&sta->ampdu_mlme.mtx); -} diff --git a/openairITS/mac/DOT11/net/mac80211/cfg.c b/openairITS/mac/DOT11/net/mac80211/cfg.c deleted file mode 100644 index f66c78f7037..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/cfg.c +++ /dev/null @@ -1,2815 +0,0 @@ -/* - * mac80211 configuration hooks for cfg80211 - * - * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> - * - * This file is GPLv2 as found in COPYING. - */ - -#include <linux/ieee80211.h> -#include <linux/nl80211.h> -#include <linux/rtnetlink.h> -#include <linux/slab.h> -#include <net/net_namespace.h> -#include <linux/rcupdate.h> -#include <linux/if_ether.h> -#include <net/cfg80211.h> -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "cfg.h" -#include "rate.h" -#include "mesh.h" - -static struct net_device *ieee80211_add_iface(struct wiphy *wiphy, char *name, - enum nl80211_iftype type, - u32 *flags, - struct vif_params *params) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - struct net_device *dev; - struct ieee80211_sub_if_data *sdata; - int err; - - err = ieee80211_if_add(local, name, &dev, type, params); - if (err) - return ERR_PTR(err); - - if (type == NL80211_IFTYPE_MONITOR && flags) { - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - sdata->u.mntr_flags = *flags; - } - - return dev; -} - -static int ieee80211_del_iface(struct wiphy *wiphy, struct net_device *dev) -{ - ieee80211_if_remove(IEEE80211_DEV_TO_SUB_IF(dev)); - - return 0; -} - -static int ieee80211_change_iface(struct wiphy *wiphy, - struct net_device *dev, - enum nl80211_iftype type, u32 *flags, - struct vif_params *params) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - int ret; - - ret = ieee80211_if_change_type(sdata, type); - if (ret) - return ret; - - if (type == NL80211_IFTYPE_AP_VLAN && - params && params->use_4addr == 0) - RCU_INIT_POINTER(sdata->u.vlan.sta, NULL); - else if (type == NL80211_IFTYPE_STATION && - params && params->use_4addr >= 0) - sdata->u.mgd.use_4addr = params->use_4addr; - - if (sdata->vif.type == NL80211_IFTYPE_MONITOR && flags) { - struct ieee80211_local *local = sdata->local; - - if (ieee80211_sdata_running(sdata)) { - /* - * Prohibit MONITOR_FLAG_COOK_FRAMES to be - * changed while the interface is up. - * Else we would need to add a lot of cruft - * to update everything: - * cooked_mntrs, monitor and all fif_* counters - * reconfigure hardware - */ - if ((*flags & MONITOR_FLAG_COOK_FRAMES) != - (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES)) - return -EBUSY; - - ieee80211_adjust_monitor_flags(sdata, -1); - sdata->u.mntr_flags = *flags; - ieee80211_adjust_monitor_flags(sdata, 1); - - ieee80211_configure_filter(local); - } else { - /* - * Because the interface is down, ieee80211_do_stop - * and ieee80211_do_open take care of "everything" - * mentioned in the comment above. - */ - sdata->u.mntr_flags = *flags; - } - } - - return 0; -} - -static int ieee80211_set_noack_map(struct wiphy *wiphy, - struct net_device *dev, - u16 noack_map) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - sdata->noack_map = noack_map; - return 0; -} - -static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, - u8 key_idx, bool pairwise, const u8 *mac_addr, - struct key_params *params) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct sta_info *sta = NULL; - struct ieee80211_key *key; - int err; - - if (!ieee80211_sdata_running(sdata)) - return -ENETDOWN; - - /* reject WEP and TKIP keys if WEP failed to initialize */ - switch (params->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_TKIP: - case WLAN_CIPHER_SUITE_WEP104: - if (IS_ERR(sdata->local->wep_tx_tfm)) - return -EINVAL; - break; - default: - break; - } - - key = ieee80211_key_alloc(params->cipher, key_idx, params->key_len, - params->key, params->seq_len, params->seq); - if (IS_ERR(key)) - return PTR_ERR(key); - - if (pairwise) - key->conf.flags |= IEEE80211_KEY_FLAG_PAIRWISE; - - mutex_lock(&sdata->local->sta_mtx); - - if (mac_addr) { - if (ieee80211_vif_is_mesh(&sdata->vif)) - sta = sta_info_get(sdata, mac_addr); - else - sta = sta_info_get_bss(sdata, mac_addr); - if (!sta) { - ieee80211_key_free(sdata->local, key); - err = -ENOENT; - goto out_unlock; - } - } - - err = ieee80211_key_link(key, sdata, sta); - if (err) - ieee80211_key_free(sdata->local, key); - - out_unlock: - mutex_unlock(&sdata->local->sta_mtx); - - return err; -} - -static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, - u8 key_idx, bool pairwise, const u8 *mac_addr) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - struct ieee80211_key *key = NULL; - int ret; - - mutex_lock(&local->sta_mtx); - mutex_lock(&local->key_mtx); - - if (mac_addr) { - ret = -ENOENT; - - sta = sta_info_get_bss(sdata, mac_addr); - if (!sta) - goto out_unlock; - - if (pairwise) - key = key_mtx_dereference(local, sta->ptk); - else - key = key_mtx_dereference(local, sta->gtk[key_idx]); - } else - key = key_mtx_dereference(local, sdata->keys[key_idx]); - - if (!key) { - ret = -ENOENT; - goto out_unlock; - } - - __ieee80211_key_free(key); - - ret = 0; - out_unlock: - mutex_unlock(&local->key_mtx); - mutex_unlock(&local->sta_mtx); - - return ret; -} - -static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev, - u8 key_idx, bool pairwise, const u8 *mac_addr, - void *cookie, - void (*callback)(void *cookie, - struct key_params *params)) -{ - struct ieee80211_sub_if_data *sdata; - struct sta_info *sta = NULL; - u8 seq[6] = {0}; - struct key_params params; - struct ieee80211_key *key = NULL; - u64 pn64; - u32 iv32; - u16 iv16; - int err = -ENOENT; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - rcu_read_lock(); - - if (mac_addr) { - sta = sta_info_get_bss(sdata, mac_addr); - if (!sta) - goto out; - - if (pairwise) - key = rcu_dereference(sta->ptk); - else if (key_idx < NUM_DEFAULT_KEYS) - key = rcu_dereference(sta->gtk[key_idx]); - } else - key = rcu_dereference(sdata->keys[key_idx]); - - if (!key) - goto out; - - memset(¶ms, 0, sizeof(params)); - - params.cipher = key->conf.cipher; - - switch (key->conf.cipher) { - case WLAN_CIPHER_SUITE_TKIP: - iv32 = key->u.tkip.tx.iv32; - iv16 = key->u.tkip.tx.iv16; - - if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) - drv_get_tkip_seq(sdata->local, - key->conf.hw_key_idx, - &iv32, &iv16); - - seq[0] = iv16 & 0xff; - seq[1] = (iv16 >> 8) & 0xff; - seq[2] = iv32 & 0xff; - seq[3] = (iv32 >> 8) & 0xff; - seq[4] = (iv32 >> 16) & 0xff; - seq[5] = (iv32 >> 24) & 0xff; - params.seq = seq; - params.seq_len = 6; - break; - case WLAN_CIPHER_SUITE_CCMP: - pn64 = atomic64_read(&key->u.ccmp.tx_pn); - seq[0] = pn64; - seq[1] = pn64 >> 8; - seq[2] = pn64 >> 16; - seq[3] = pn64 >> 24; - seq[4] = pn64 >> 32; - seq[5] = pn64 >> 40; - params.seq = seq; - params.seq_len = 6; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn); - seq[0] = pn64; - seq[1] = pn64 >> 8; - seq[2] = pn64 >> 16; - seq[3] = pn64 >> 24; - seq[4] = pn64 >> 32; - seq[5] = pn64 >> 40; - params.seq = seq; - params.seq_len = 6; - break; - } - - params.key = key->conf.key; - params.key_len = key->conf.keylen; - - callback(cookie, ¶ms); - err = 0; - - out: - rcu_read_unlock(); - return err; -} - -static int ieee80211_config_default_key(struct wiphy *wiphy, - struct net_device *dev, - u8 key_idx, bool uni, - bool multi) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - ieee80211_set_default_key(sdata, key_idx, uni, multi); - - return 0; -} - -static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy, - struct net_device *dev, - u8 key_idx) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - ieee80211_set_default_mgmt_key(sdata, key_idx); - - return 0; -} - -static void rate_idx_to_bitrate(struct rate_info *rate, struct sta_info *sta, int idx) -{ - if (!(rate->flags & RATE_INFO_FLAGS_MCS)) { - struct ieee80211_supported_band *sband; - sband = sta->local->hw.wiphy->bands[ - sta->local->hw.conf.channel->band]; - rate->legacy = sband->bitrates[idx].bitrate; - } else - rate->mcs = idx; -} - -void sta_set_rate_info_tx(struct sta_info *sta, - const struct ieee80211_tx_rate *rate, - struct rate_info *rinfo) -{ - rinfo->flags = 0; - if (rate->flags & IEEE80211_TX_RC_MCS) - rinfo->flags |= RATE_INFO_FLAGS_MCS; - if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) - rinfo->flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; - if (rate->flags & IEEE80211_TX_RC_SHORT_GI) - rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; - rate_idx_to_bitrate(rinfo, sta, rate->idx); -} - -static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) -{ - struct ieee80211_sub_if_data *sdata = sta->sdata; - struct timespec uptime; - - sinfo->generation = sdata->local->sta_generation; - - sinfo->filled = STATION_INFO_INACTIVE_TIME | - STATION_INFO_RX_BYTES | - STATION_INFO_TX_BYTES | - STATION_INFO_RX_PACKETS | - STATION_INFO_TX_PACKETS | - STATION_INFO_TX_RETRIES | - STATION_INFO_TX_FAILED | - STATION_INFO_TX_BITRATE | - STATION_INFO_RX_BITRATE | - STATION_INFO_RX_DROP_MISC | - STATION_INFO_BSS_PARAM | - STATION_INFO_CONNECTED_TIME | - STATION_INFO_STA_FLAGS | - STATION_INFO_BEACON_LOSS_COUNT; - - do_posix_clock_monotonic_gettime(&uptime); - sinfo->connected_time = uptime.tv_sec - sta->last_connected; - - sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx); - sinfo->rx_bytes = sta->rx_bytes; - sinfo->tx_bytes = sta->tx_bytes; - sinfo->rx_packets = sta->rx_packets; - sinfo->tx_packets = sta->tx_packets; - sinfo->tx_retries = sta->tx_retry_count; - sinfo->tx_failed = sta->tx_retry_failed; - sinfo->rx_dropped_misc = sta->rx_dropped; - sinfo->beacon_loss_count = sta->beacon_loss_count; - - if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || - (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { - sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; - sinfo->signal = (s8)sta->last_signal; - sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); - } - - sta_set_rate_info_tx(sta, &sta->last_tx_rate, &sinfo->txrate); - - sinfo->rxrate.flags = 0; - if (sta->last_rx_rate_flag & RX_FLAG_HT) - sinfo->rxrate.flags |= RATE_INFO_FLAGS_MCS; - if (sta->last_rx_rate_flag & RX_FLAG_40MHZ) - sinfo->rxrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; - if (sta->last_rx_rate_flag & RX_FLAG_SHORT_GI) - sinfo->rxrate.flags |= RATE_INFO_FLAGS_SHORT_GI; - rate_idx_to_bitrate(&sinfo->rxrate, sta, sta->last_rx_rate_idx); - - if (ieee80211_vif_is_mesh(&sdata->vif)) { -#ifdef CONFIG_MAC80211_MESH - sinfo->filled |= STATION_INFO_LLID | - STATION_INFO_PLID | - STATION_INFO_PLINK_STATE; - - sinfo->llid = le16_to_cpu(sta->llid); - sinfo->plid = le16_to_cpu(sta->plid); - sinfo->plink_state = sta->plink_state; -#endif - } - - sinfo->bss_param.flags = 0; - if (sdata->vif.bss_conf.use_cts_prot) - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_CTS_PROT; - if (sdata->vif.bss_conf.use_short_preamble) - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_PREAMBLE; - if (sdata->vif.bss_conf.use_short_slot) - sinfo->bss_param.flags |= BSS_PARAM_FLAGS_SHORT_SLOT_TIME; - sinfo->bss_param.dtim_period = sdata->local->hw.conf.ps_dtim_period; - sinfo->bss_param.beacon_interval = sdata->vif.bss_conf.beacon_int; - - sinfo->sta_flags.set = 0; - sinfo->sta_flags.mask = BIT(NL80211_STA_FLAG_AUTHORIZED) | - BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) | - BIT(NL80211_STA_FLAG_WME) | - BIT(NL80211_STA_FLAG_MFP) | - BIT(NL80211_STA_FLAG_AUTHENTICATED) | - BIT(NL80211_STA_FLAG_TDLS_PEER); - if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHORIZED); - if (test_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE)) - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_SHORT_PREAMBLE); - if (test_sta_flag(sta, WLAN_STA_WME)) - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_WME); - if (test_sta_flag(sta, WLAN_STA_MFP)) - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_MFP); - if (test_sta_flag(sta, WLAN_STA_AUTH)) - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_AUTHENTICATED); - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER)) - sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER); -} - - -static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, - int idx, u8 *mac, struct station_info *sinfo) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct sta_info *sta; - int ret = -ENOENT; - - rcu_read_lock(); - - sta = sta_info_get_by_idx(sdata, idx); - if (sta) { - ret = 0; - memcpy(mac, sta->sta.addr, ETH_ALEN); - sta_set_sinfo(sta, sinfo); - } - - rcu_read_unlock(); - - return ret; -} - -static int ieee80211_dump_survey(struct wiphy *wiphy, struct net_device *dev, - int idx, struct survey_info *survey) -{ - struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); - - return drv_get_survey(local, idx, survey); -} - -static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_info *sinfo) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct sta_info *sta; - int ret = -ENOENT; - - rcu_read_lock(); - - sta = sta_info_get_bss(sdata, mac); - if (sta) { - ret = 0; - sta_set_sinfo(sta, sinfo); - } - - rcu_read_unlock(); - - return ret; -} - -static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, - const u8 *resp, size_t resp_len) -{ - struct sk_buff *new, *old; - - if (!resp || !resp_len) - return 1; - - old = rtnl_dereference(sdata->u.ap.probe_resp); - - new = dev_alloc_skb(resp_len); - if (!new) - return -ENOMEM; - - memcpy(skb_put(new, resp_len), resp, resp_len); - - rcu_assign_pointer(sdata->u.ap.probe_resp, new); - if (old) { - /* TODO: use call_rcu() */ - synchronize_rcu(); - dev_kfree_skb(old); - } - - return 0; -} - -static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, - struct cfg80211_beacon_data *params) -{ - struct beacon_data *new, *old; - int new_head_len, new_tail_len; - int size, err; - u32 changed = BSS_CHANGED_BEACON; - - old = rtnl_dereference(sdata->u.ap.beacon); - - /* Need to have a beacon head if we don't have one yet */ - if (!params->head && !old) - return -EINVAL; - - /* new or old head? */ - if (params->head) - new_head_len = params->head_len; - else - new_head_len = old->head_len; - - /* new or old tail? */ - if (params->tail || !old) - /* params->tail_len will be zero for !params->tail */ - new_tail_len = params->tail_len; - else - new_tail_len = old->tail_len; - - size = sizeof(*new) + new_head_len + new_tail_len; - - new = kzalloc(size, GFP_KERNEL); - if (!new) - return -ENOMEM; - - /* start filling the new info now */ - - /* - * pointers go into the block we allocated, - * memory is | beacon_data | head | tail | - */ - new->head = ((u8 *) new) + sizeof(*new); - new->tail = new->head + new_head_len; - new->head_len = new_head_len; - new->tail_len = new_tail_len; - - /* copy in head */ - if (params->head) - memcpy(new->head, params->head, new_head_len); - else - memcpy(new->head, old->head, new_head_len); - - /* copy in optional tail */ - if (params->tail) - memcpy(new->tail, params->tail, new_tail_len); - else - if (old) - memcpy(new->tail, old->tail, new_tail_len); - - err = ieee80211_set_probe_resp(sdata, params->probe_resp, - params->probe_resp_len); - if (err < 0) - return err; - if (err == 0) - changed |= BSS_CHANGED_AP_PROBE_RESP; - - rcu_assign_pointer(sdata->u.ap.beacon, new); - - if (old) - kfree_rcu(old, rcu_head); - - return changed; -} - -static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ap_settings *params) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct beacon_data *old; - struct ieee80211_sub_if_data *vlan; - u32 changed = BSS_CHANGED_BEACON_INT | - BSS_CHANGED_BEACON_ENABLED | - BSS_CHANGED_BEACON | - BSS_CHANGED_SSID; - int err; - - old = rtnl_dereference(sdata->u.ap.beacon); - if (old) - return -EALREADY; - - /* - * Apply control port protocol, this allows us to - * not encrypt dynamic WEP control frames. - */ - sdata->control_port_protocol = params->crypto.control_port_ethertype; - sdata->control_port_no_encrypt = params->crypto.control_port_no_encrypt; - list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) { - vlan->control_port_protocol = - params->crypto.control_port_ethertype; - vlan->control_port_no_encrypt = - params->crypto.control_port_no_encrypt; - } - - sdata->vif.bss_conf.beacon_int = params->beacon_interval; - sdata->vif.bss_conf.dtim_period = params->dtim_period; - - sdata->vif.bss_conf.ssid_len = params->ssid_len; - if (params->ssid_len) - memcpy(sdata->vif.bss_conf.ssid, params->ssid, - params->ssid_len); - sdata->vif.bss_conf.hidden_ssid = - (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE); - - err = ieee80211_assign_beacon(sdata, ¶ms->beacon); - if (err < 0) - return err; - changed |= err; - - ieee80211_bss_info_change_notify(sdata, changed); - - return 0; -} - -static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_beacon_data *params) -{ - struct ieee80211_sub_if_data *sdata; - struct beacon_data *old; - int err; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - old = rtnl_dereference(sdata->u.ap.beacon); - if (!old) - return -ENOENT; - - err = ieee80211_assign_beacon(sdata, params); - if (err < 0) - return err; - ieee80211_bss_info_change_notify(sdata, err); - return 0; -} - -static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev) -{ - struct ieee80211_sub_if_data *sdata; - struct beacon_data *old; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - old = rtnl_dereference(sdata->u.ap.beacon); - if (!old) - return -ENOENT; - - RCU_INIT_POINTER(sdata->u.ap.beacon, NULL); - - kfree_rcu(old, rcu_head); - - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); - - return 0; -} - -/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ -struct iapp_layer2_update { - u8 da[ETH_ALEN]; /* broadcast */ - u8 sa[ETH_ALEN]; /* STA addr */ - __be16 len; /* 6 */ - u8 dsap; /* 0 */ - u8 ssap; /* 0 */ - u8 control; - u8 xid_info[3]; -} __packed; - -static void ieee80211_send_layer2_update(struct sta_info *sta) -{ - struct iapp_layer2_update *msg; - struct sk_buff *skb; - - /* Send Level 2 Update Frame to update forwarding tables in layer 2 - * bridge devices */ - - skb = dev_alloc_skb(sizeof(*msg)); - if (!skb) - return; - msg = (struct iapp_layer2_update *)skb_put(skb, sizeof(*msg)); - - /* 802.2 Type 1 Logical Link Control (LLC) Exchange Identifier (XID) - * Update response frame; IEEE Std 802.2-1998, 5.4.1.2.1 */ - - memset(msg->da, 0xff, ETH_ALEN); - memcpy(msg->sa, sta->sta.addr, ETH_ALEN); - msg->len = htons(6); - msg->dsap = 0; - msg->ssap = 0x01; /* NULL LSAP, CR Bit: Response */ - msg->control = 0xaf; /* XID response lsb.1111F101. - * F=0 (no poll command; unsolicited frame) */ - msg->xid_info[0] = 0x81; /* XID format identifier */ - msg->xid_info[1] = 1; /* LLC types/classes: Type 1 LLC */ - msg->xid_info[2] = 0; /* XID sender's receive window size (RW) */ - - skb->dev = sta->sdata->dev; - skb->protocol = eth_type_trans(skb, sta->sdata->dev); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_rx_ni(skb); -} - -/* - * [PLATA] - should probably add a hook to directly go to the state associated if OCBActivated - */ -static int sta_apply_parameters(struct ieee80211_local *local, - struct sta_info *sta, - struct station_parameters *params) -{ - int ret = 0; - u32 rates; - int i, j; - struct ieee80211_supported_band *sband; - struct ieee80211_sub_if_data *sdata = sta->sdata; - u32 mask, set; - - sband = local->hw.wiphy->bands[local->oper_channel->band]; - - mask = params->sta_flags_mask; - set = params->sta_flags_set; - - /* - * In mesh mode, we can clear AUTHENTICATED flag but must - * also make ASSOCIATED follow appropriately for the driver - * API. See also below, after AUTHORIZED changes. - */ - if (mask & BIT(NL80211_STA_FLAG_AUTHENTICATED)) { - /* cfg80211 should not allow this in non-mesh modes */ - if (WARN_ON(!ieee80211_vif_is_mesh(&sdata->vif))) - return -EINVAL; - - if (set & BIT(NL80211_STA_FLAG_AUTHENTICATED) && - !test_sta_flag(sta, WLAN_STA_AUTH)) { - ret = sta_info_move_state(sta, IEEE80211_STA_AUTH); - if (ret) - return ret; - ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC); - if (ret) - return ret; - } - } - - if (mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) { - if (set & BIT(NL80211_STA_FLAG_AUTHORIZED)) - ret = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED); - else if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) - ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC); - if (ret) - return ret; - } - - if (mask & BIT(NL80211_STA_FLAG_AUTHENTICATED)) { - /* cfg80211 should not allow this in non-mesh modes */ - if (WARN_ON(!ieee80211_vif_is_mesh(&sdata->vif))) - return -EINVAL; - - if (!(set & BIT(NL80211_STA_FLAG_AUTHENTICATED)) && - test_sta_flag(sta, WLAN_STA_AUTH)) { - ret = sta_info_move_state(sta, IEEE80211_STA_AUTH); - if (ret) - return ret; - ret = sta_info_move_state(sta, IEEE80211_STA_NONE); - if (ret) - return ret; - } - } - - - if (mask & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE)) { - if (set & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE)) - set_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE); - else - clear_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE); - } - - if (mask & BIT(NL80211_STA_FLAG_WME)) { - if (set & BIT(NL80211_STA_FLAG_WME)) { - set_sta_flag(sta, WLAN_STA_WME); - sta->sta.wme = true; - } else { - clear_sta_flag(sta, WLAN_STA_WME); - sta->sta.wme = false; - } - } - - if (mask & BIT(NL80211_STA_FLAG_MFP)) { - if (set & BIT(NL80211_STA_FLAG_MFP)) - set_sta_flag(sta, WLAN_STA_MFP); - else - clear_sta_flag(sta, WLAN_STA_MFP); - } - - if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { - if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) - set_sta_flag(sta, WLAN_STA_TDLS_PEER); - else - clear_sta_flag(sta, WLAN_STA_TDLS_PEER); - } - - if (params->sta_modify_mask & STATION_PARAM_APPLY_UAPSD) { - sta->sta.uapsd_queues = params->uapsd_queues; - sta->sta.max_sp = params->max_sp; - } - - /* - * cfg80211 validates this (1-2007) and allows setting the AID - * only when creating a new station entry - */ - if (params->aid) - sta->sta.aid = params->aid; - - /* - * FIXME: updating the following information is racy when this - * function is called from ieee80211_change_station(). - * However, all this information should be static so - * maybe we should just reject attemps to change it. - */ - - if (params->listen_interval >= 0) - sta->listen_interval = params->listen_interval; - - if (params->supported_rates) { - rates = 0; - - for (i = 0; i < params->supported_rates_len; i++) { - int rate = (params->supported_rates[i] & 0x7f) * 5; - for (j = 0; j < sband->n_bitrates; j++) { - if (sband->bitrates[j].bitrate == rate) - rates |= BIT(j); - } - } - sta->sta.supp_rates[local->oper_channel->band] = rates; - } - - if (params->ht_capa) - ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, - params->ht_capa, - &sta->sta.ht_cap); - - if (ieee80211_vif_is_mesh(&sdata->vif)) { -#ifdef CONFIG_MAC80211_MESH - if (sdata->u.mesh.security & IEEE80211_MESH_SEC_SECURED) - switch (params->plink_state) { - case NL80211_PLINK_LISTEN: - case NL80211_PLINK_ESTAB: - case NL80211_PLINK_BLOCKED: - sta->plink_state = params->plink_state; - break; - default: - /* nothing */ - break; - } - else - switch (params->plink_action) { - case PLINK_ACTION_OPEN: - mesh_plink_open(sta); - break; - case PLINK_ACTION_BLOCK: - mesh_plink_block(sta); - break; - } -#endif - } - - return 0; -} - -static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, - u8 *mac, struct station_parameters *params) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - struct sta_info *sta; - struct ieee80211_sub_if_data *sdata; - int err; - int layer2_update; - - if (params->vlan) { - sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); - - if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && - sdata->vif.type != NL80211_IFTYPE_AP) - return -EINVAL; - } else - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if (compare_ether_addr(mac, sdata->vif.addr) == 0) - return -EINVAL; - - if (is_multicast_ether_addr(mac)) - return -EINVAL; - - sta = sta_info_alloc(sdata, mac, GFP_KERNEL); - if (!sta) - return -ENOMEM; - - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); - - err = sta_apply_parameters(local, sta, params); - if (err) { - sta_info_free(local, sta); - return err; - } - - /* - * for TDLS, rate control should be initialized only when supported - * rates are known. - */ - if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER)) - rate_control_rate_init(sta); - - layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || - sdata->vif.type == NL80211_IFTYPE_AP; - - err = sta_info_insert_rcu(sta); - if (err) { - rcu_read_unlock(); - return err; - } - - if (layer2_update) - ieee80211_send_layer2_update(sta); - - rcu_read_unlock(); - - return 0; -} - -static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, - u8 *mac) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - struct ieee80211_sub_if_data *sdata; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if (mac) - return sta_info_destroy_addr_bss(sdata, mac); - - sta_info_flush(local, sdata); - return 0; -} - -static int ieee80211_change_station(struct wiphy *wiphy, - struct net_device *dev, - u8 *mac, - struct station_parameters *params) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = wiphy_priv(wiphy); - struct sta_info *sta; - struct ieee80211_sub_if_data *vlansdata; - int err; - - mutex_lock(&local->sta_mtx); - - sta = sta_info_get_bss(sdata, mac); - if (!sta) { - mutex_unlock(&local->sta_mtx); - return -ENOENT; - } - - /* in station mode, supported rates are only valid with TDLS */ - if (sdata->vif.type == NL80211_IFTYPE_STATION && - params->supported_rates && - !test_sta_flag(sta, WLAN_STA_TDLS_PEER)) { - mutex_unlock(&local->sta_mtx); - return -EINVAL; - } - - if (params->vlan && params->vlan != sta->sdata->dev) { - vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); - - if (vlansdata->vif.type != NL80211_IFTYPE_AP_VLAN && - vlansdata->vif.type != NL80211_IFTYPE_AP) { - mutex_unlock(&local->sta_mtx); - return -EINVAL; - } - - if (params->vlan->ieee80211_ptr->use_4addr) { - if (vlansdata->u.vlan.sta) { - mutex_unlock(&local->sta_mtx); - return -EBUSY; - } - - rcu_assign_pointer(vlansdata->u.vlan.sta, sta); - } - - sta->sdata = vlansdata; - ieee80211_send_layer2_update(sta); - } - - err = sta_apply_parameters(local, sta, params); - if (err) { - mutex_unlock(&local->sta_mtx); - return err; - } - - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) && params->supported_rates) - rate_control_rate_init(sta); - - mutex_unlock(&local->sta_mtx); - - if (sdata->vif.type == NL80211_IFTYPE_STATION && - params->sta_flags_mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) - ieee80211_recalc_ps(local, -1); - - return 0; -} - -#ifdef CONFIG_MAC80211_MESH -static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, - u8 *dst, u8 *next_hop) -{ - struct ieee80211_sub_if_data *sdata; - struct mesh_path *mpath; - struct sta_info *sta; - int err; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - rcu_read_lock(); - sta = sta_info_get(sdata, next_hop); - if (!sta) { - rcu_read_unlock(); - return -ENOENT; - } - - err = mesh_path_add(dst, sdata); - if (err) { - rcu_read_unlock(); - return err; - } - - mpath = mesh_path_lookup(dst, sdata); - if (!mpath) { - rcu_read_unlock(); - return -ENXIO; - } - mesh_path_fix_nexthop(mpath, sta); - - rcu_read_unlock(); - return 0; -} - -static int ieee80211_del_mpath(struct wiphy *wiphy, struct net_device *dev, - u8 *dst) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if (dst) - return mesh_path_del(dst, sdata); - - mesh_path_flush_by_iface(sdata); - return 0; -} - -static int ieee80211_change_mpath(struct wiphy *wiphy, - struct net_device *dev, - u8 *dst, u8 *next_hop) -{ - struct ieee80211_sub_if_data *sdata; - struct mesh_path *mpath; - struct sta_info *sta; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - rcu_read_lock(); - - sta = sta_info_get(sdata, next_hop); - if (!sta) { - rcu_read_unlock(); - return -ENOENT; - } - - mpath = mesh_path_lookup(dst, sdata); - if (!mpath) { - rcu_read_unlock(); - return -ENOENT; - } - - mesh_path_fix_nexthop(mpath, sta); - - rcu_read_unlock(); - return 0; -} - -static void mpath_set_pinfo(struct mesh_path *mpath, u8 *next_hop, - struct mpath_info *pinfo) -{ - struct sta_info *next_hop_sta = rcu_dereference(mpath->next_hop); - - if (next_hop_sta) - memcpy(next_hop, next_hop_sta->sta.addr, ETH_ALEN); - else - memset(next_hop, 0, ETH_ALEN); - - pinfo->generation = mesh_paths_generation; - - pinfo->filled = MPATH_INFO_FRAME_QLEN | - MPATH_INFO_SN | - MPATH_INFO_METRIC | - MPATH_INFO_EXPTIME | - MPATH_INFO_DISCOVERY_TIMEOUT | - MPATH_INFO_DISCOVERY_RETRIES | - MPATH_INFO_FLAGS; - - pinfo->frame_qlen = mpath->frame_queue.qlen; - pinfo->sn = mpath->sn; - pinfo->metric = mpath->metric; - if (time_before(jiffies, mpath->exp_time)) - pinfo->exptime = jiffies_to_msecs(mpath->exp_time - jiffies); - pinfo->discovery_timeout = - jiffies_to_msecs(mpath->discovery_timeout); - pinfo->discovery_retries = mpath->discovery_retries; - pinfo->flags = 0; - if (mpath->flags & MESH_PATH_ACTIVE) - pinfo->flags |= NL80211_MPATH_FLAG_ACTIVE; - if (mpath->flags & MESH_PATH_RESOLVING) - pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING; - if (mpath->flags & MESH_PATH_SN_VALID) - pinfo->flags |= NL80211_MPATH_FLAG_SN_VALID; - if (mpath->flags & MESH_PATH_FIXED) - pinfo->flags |= NL80211_MPATH_FLAG_FIXED; - if (mpath->flags & MESH_PATH_RESOLVING) - pinfo->flags |= NL80211_MPATH_FLAG_RESOLVING; - - pinfo->flags = mpath->flags; -} - -static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev, - u8 *dst, u8 *next_hop, struct mpath_info *pinfo) - -{ - struct ieee80211_sub_if_data *sdata; - struct mesh_path *mpath; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - rcu_read_lock(); - mpath = mesh_path_lookup(dst, sdata); - if (!mpath) { - rcu_read_unlock(); - return -ENOENT; - } - memcpy(dst, mpath->dst, ETH_ALEN); - mpath_set_pinfo(mpath, next_hop, pinfo); - rcu_read_unlock(); - return 0; -} - -static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev, - int idx, u8 *dst, u8 *next_hop, - struct mpath_info *pinfo) -{ - struct ieee80211_sub_if_data *sdata; - struct mesh_path *mpath; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - rcu_read_lock(); - mpath = mesh_path_lookup_by_idx(idx, sdata); - if (!mpath) { - rcu_read_unlock(); - return -ENOENT; - } - memcpy(dst, mpath->dst, ETH_ALEN); - mpath_set_pinfo(mpath, next_hop, pinfo); - rcu_read_unlock(); - return 0; -} - -static int ieee80211_get_mesh_config(struct wiphy *wiphy, - struct net_device *dev, - struct mesh_config *conf) -{ - struct ieee80211_sub_if_data *sdata; - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - memcpy(conf, &(sdata->u.mesh.mshcfg), sizeof(struct mesh_config)); - return 0; -} - -static inline bool _chg_mesh_attr(enum nl80211_meshconf_params parm, u32 mask) -{ - return (mask >> (parm-1)) & 0x1; -} - -static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh, - const struct mesh_setup *setup) -{ - u8 *new_ie; - const u8 *old_ie; - struct ieee80211_sub_if_data *sdata = container_of(ifmsh, - struct ieee80211_sub_if_data, u.mesh); - - /* allocate information elements */ - new_ie = NULL; - old_ie = ifmsh->ie; - - if (setup->ie_len) { - new_ie = kmemdup(setup->ie, setup->ie_len, - GFP_KERNEL); - if (!new_ie) - return -ENOMEM; - } - ifmsh->ie_len = setup->ie_len; - ifmsh->ie = new_ie; - kfree(old_ie); - - /* now copy the rest of the setup parameters */ - ifmsh->mesh_id_len = setup->mesh_id_len; - memcpy(ifmsh->mesh_id, setup->mesh_id, ifmsh->mesh_id_len); - ifmsh->mesh_pp_id = setup->path_sel_proto; - ifmsh->mesh_pm_id = setup->path_metric; - ifmsh->security = IEEE80211_MESH_SEC_NONE; - if (setup->is_authenticated) - ifmsh->security |= IEEE80211_MESH_SEC_AUTHED; - if (setup->is_secure) - ifmsh->security |= IEEE80211_MESH_SEC_SECURED; - - /* mcast rate setting in Mesh Node */ - memcpy(sdata->vif.bss_conf.mcast_rate, setup->mcast_rate, - sizeof(setup->mcast_rate)); - - return 0; -} - -static int ieee80211_update_mesh_config(struct wiphy *wiphy, - struct net_device *dev, u32 mask, - const struct mesh_config *nconf) -{ - struct mesh_config *conf; - struct ieee80211_sub_if_data *sdata; - struct ieee80211_if_mesh *ifmsh; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - ifmsh = &sdata->u.mesh; - - /* Set the config options which we are interested in setting */ - conf = &(sdata->u.mesh.mshcfg); - if (_chg_mesh_attr(NL80211_MESHCONF_RETRY_TIMEOUT, mask)) - conf->dot11MeshRetryTimeout = nconf->dot11MeshRetryTimeout; - if (_chg_mesh_attr(NL80211_MESHCONF_CONFIRM_TIMEOUT, mask)) - conf->dot11MeshConfirmTimeout = nconf->dot11MeshConfirmTimeout; - if (_chg_mesh_attr(NL80211_MESHCONF_HOLDING_TIMEOUT, mask)) - conf->dot11MeshHoldingTimeout = nconf->dot11MeshHoldingTimeout; - if (_chg_mesh_attr(NL80211_MESHCONF_MAX_PEER_LINKS, mask)) - conf->dot11MeshMaxPeerLinks = nconf->dot11MeshMaxPeerLinks; - if (_chg_mesh_attr(NL80211_MESHCONF_MAX_RETRIES, mask)) - conf->dot11MeshMaxRetries = nconf->dot11MeshMaxRetries; - if (_chg_mesh_attr(NL80211_MESHCONF_TTL, mask)) - conf->dot11MeshTTL = nconf->dot11MeshTTL; - if (_chg_mesh_attr(NL80211_MESHCONF_ELEMENT_TTL, mask)) - conf->dot11MeshTTL = nconf->element_ttl; - if (_chg_mesh_attr(NL80211_MESHCONF_AUTO_OPEN_PLINKS, mask)) - conf->auto_open_plinks = nconf->auto_open_plinks; - if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, mask)) - conf->dot11MeshHWMPmaxPREQretries = - nconf->dot11MeshHWMPmaxPREQretries; - if (_chg_mesh_attr(NL80211_MESHCONF_PATH_REFRESH_TIME, mask)) - conf->path_refresh_time = nconf->path_refresh_time; - if (_chg_mesh_attr(NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, mask)) - conf->min_discovery_timeout = nconf->min_discovery_timeout; - if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, mask)) - conf->dot11MeshHWMPactivePathTimeout = - nconf->dot11MeshHWMPactivePathTimeout; - if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, mask)) - conf->dot11MeshHWMPpreqMinInterval = - nconf->dot11MeshHWMPpreqMinInterval; - if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, mask)) - conf->dot11MeshHWMPperrMinInterval = - nconf->dot11MeshHWMPperrMinInterval; - if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, - mask)) - conf->dot11MeshHWMPnetDiameterTraversalTime = - nconf->dot11MeshHWMPnetDiameterTraversalTime; - if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_ROOTMODE, mask)) { - conf->dot11MeshHWMPRootMode = nconf->dot11MeshHWMPRootMode; - ieee80211_mesh_root_setup(ifmsh); - } - if (_chg_mesh_attr(NL80211_MESHCONF_GATE_ANNOUNCEMENTS, mask)) { - /* our current gate announcement implementation rides on root - * announcements, so require this ifmsh to also be a root node - * */ - if (nconf->dot11MeshGateAnnouncementProtocol && - !conf->dot11MeshHWMPRootMode) { - conf->dot11MeshHWMPRootMode = 1; - ieee80211_mesh_root_setup(ifmsh); - } - conf->dot11MeshGateAnnouncementProtocol = - nconf->dot11MeshGateAnnouncementProtocol; - } - if (_chg_mesh_attr(NL80211_MESHCONF_HWMP_RANN_INTERVAL, mask)) { - conf->dot11MeshHWMPRannInterval = - nconf->dot11MeshHWMPRannInterval; - } - if (_chg_mesh_attr(NL80211_MESHCONF_FORWARDING, mask)) - conf->dot11MeshForwarding = nconf->dot11MeshForwarding; - if (_chg_mesh_attr(NL80211_MESHCONF_RSSI_THRESHOLD, mask)) { - /* our RSSI threshold implementation is supported only for - * devices that report signal in dBm. - */ - if (!(sdata->local->hw.flags & IEEE80211_HW_SIGNAL_DBM)) - return -ENOTSUPP; - conf->rssi_threshold = nconf->rssi_threshold; - } - return 0; -} - -static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev, - const struct mesh_config *conf, - const struct mesh_setup *setup) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - int err; - - memcpy(&ifmsh->mshcfg, conf, sizeof(struct mesh_config)); - err = copy_mesh_setup(ifmsh, setup); - if (err) - return err; - ieee80211_start_mesh(sdata); - - return 0; -} - -static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - ieee80211_stop_mesh(sdata); - - return 0; -} -#endif - -static int ieee80211_change_bss(struct wiphy *wiphy, - struct net_device *dev, - struct bss_parameters *params) -{ - struct ieee80211_sub_if_data *sdata; - u32 changed = 0; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if (params->use_cts_prot >= 0) { - sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot; - changed |= BSS_CHANGED_ERP_CTS_PROT; - } - if (params->use_short_preamble >= 0) { - sdata->vif.bss_conf.use_short_preamble = - params->use_short_preamble; - changed |= BSS_CHANGED_ERP_PREAMBLE; - } - - if (!sdata->vif.bss_conf.use_short_slot && - sdata->local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) { - sdata->vif.bss_conf.use_short_slot = true; - changed |= BSS_CHANGED_ERP_SLOT; - } - - if (params->use_short_slot_time >= 0) { - sdata->vif.bss_conf.use_short_slot = - params->use_short_slot_time; - changed |= BSS_CHANGED_ERP_SLOT; - } - - if (params->basic_rates) { - int i, j; - u32 rates = 0; - struct ieee80211_local *local = wiphy_priv(wiphy); - struct ieee80211_supported_band *sband = - wiphy->bands[local->oper_channel->band]; - - for (i = 0; i < params->basic_rates_len; i++) { - int rate = (params->basic_rates[i] & 0x7f) * 5; - for (j = 0; j < sband->n_bitrates; j++) { - if (sband->bitrates[j].bitrate == rate) - rates |= BIT(j); - } - } - sdata->vif.bss_conf.basic_rates = rates; - changed |= BSS_CHANGED_BASIC_RATES; - } - - if (params->ap_isolate >= 0) { - if (params->ap_isolate) - sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS; - else - sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS; - } - - if (params->ht_opmode >= 0) { - sdata->vif.bss_conf.ht_operation_mode = - (u16) params->ht_opmode; - changed |= BSS_CHANGED_HT; - } - - ieee80211_bss_info_change_notify(sdata, changed); - - return 0; -} - -static int ieee80211_set_txq_params(struct wiphy *wiphy, - struct net_device *dev, - struct ieee80211_txq_params *params) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_tx_queue_params p; - - if (!local->ops->conf_tx) - return -EOPNOTSUPP; - - memset(&p, 0, sizeof(p)); - p.aifs = params->aifs; - p.cw_max = params->cwmax; - p.cw_min = params->cwmin; - p.txop = params->txop; - - /* - * Setting tx queue params disables u-apsd because it's only - * called in master mode. - */ - p.uapsd = false; - - if (params->queue >= local->hw.queues) - return -EINVAL; - - sdata->tx_conf[params->queue] = p; - if (drv_conf_tx(local, sdata, params->queue, &p)) { - wiphy_debug(local->hw.wiphy, - "failed to set TX queue parameters for queue %d\n", - params->queue); - return -EINVAL; - } - - return 0; -} - -static int ieee80211_set_channel(struct wiphy *wiphy, - struct net_device *netdev, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - struct ieee80211_sub_if_data *sdata = NULL; - struct ieee80211_channel *old_oper; - enum nl80211_channel_type old_oper_type; - enum nl80211_channel_type old_vif_oper_type= NL80211_CHAN_NO_HT; - - if (netdev) - sdata = IEEE80211_DEV_TO_SUB_IF(netdev); - - switch (ieee80211_get_channel_mode(local, NULL)) { - case CHAN_MODE_HOPPING: - return -EBUSY; - case CHAN_MODE_FIXED: - if (local->oper_channel != chan) - return -EBUSY; - if (!sdata && local->_oper_channel_type == channel_type) - return 0; - break; - case CHAN_MODE_UNDEFINED: - break; - } - - if (sdata) - old_vif_oper_type = sdata->vif.bss_conf.channel_type; - old_oper_type = local->_oper_channel_type; - - if (!ieee80211_set_channel_type(local, sdata, channel_type)) - return -EBUSY; - - old_oper = local->oper_channel; - local->oper_channel = chan; - - /* Update driver if changes were actually made. */ - if ((old_oper != local->oper_channel) || - (old_oper_type != local->_oper_channel_type)) - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); - - if (sdata && sdata->vif.type != NL80211_IFTYPE_MONITOR && - old_vif_oper_type != sdata->vif.bss_conf.channel_type) - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_HT); - - return 0; -} - -#ifdef CONFIG_PM -static int ieee80211_suspend(struct wiphy *wiphy, - struct cfg80211_wowlan *wowlan) -{ - return __ieee80211_suspend(wiphy_priv(wiphy), wowlan); -} - -static int ieee80211_resume(struct wiphy *wiphy) -{ - return __ieee80211_resume(wiphy_priv(wiphy)); -} -#else -#define ieee80211_suspend NULL -#define ieee80211_resume NULL -#endif - -static int ieee80211_scan(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_scan_request *req) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - switch (ieee80211_vif_type_p2p(&sdata->vif)) { - case NL80211_IFTYPE_ADHOC: - if((sdata->local->hw.wiphy->dot11OCBActivated == 1) && (sdata->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - /* - * [PLATA] - we do not support the scan mode if we are configured with OCBActivated (mode 802.11p) - */ - printk(KERN_ERR "ieee80211_scan: no scan in 802.11p\n"); - return -EOPNOTSUPP; - } - break; - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_MESH_POINT: - case NL80211_IFTYPE_P2P_CLIENT: - break; - case NL80211_IFTYPE_P2P_GO: - if (sdata->local->ops->hw_scan) - break; - /* - * FIXME: implement NoA while scanning in software, - * for now fall through to allow scanning only when - * beaconing hasn't been configured yet - */ - case NL80211_IFTYPE_AP: - if (sdata->u.ap.beacon) - return -EOPNOTSUPP; - break; - default: - return -EOPNOTSUPP; - } - - return ieee80211_request_scan(sdata, req); -} - -static int -ieee80211_sched_scan_start(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_sched_scan_request *req) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if((sdata->local->hw.wiphy->dot11OCBActivated == 1) && (sdata->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - /* - * [PLATA] - we do not support the scan mode if we are configured with OCBActivated (mode 802.11p) - */ - printk(KERN_ERR "ieee80211_sched_scan_start: no scan in 802.11p"); - return -EOPNOTSUPP; - } - - if (!sdata->local->ops->sched_scan_start) - return -EOPNOTSUPP; - - return ieee80211_request_sched_scan_start(sdata, req); -} - -static int -ieee80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if (!sdata->local->ops->sched_scan_stop) - return -EOPNOTSUPP; - - return ieee80211_request_sched_scan_stop(sdata); -} - -static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_auth_request *req) -{ - /* - * [PLATA] we should also check on the hw to see if the OCB is supported.... - */ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if((sdata->local->hw.wiphy->dot11OCBActivated == 1) && (sdata->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - /* - * [PLATA] - we do not support the authentication mode if we are configured with OCBActivated (mode 802.11p) - */ - printk(KERN_ERR "ieee80211_auth: no auth in 802.11p"); - return -EOPNOTSUPP; - } - else { - return ieee80211_mgd_auth(IEEE80211_DEV_TO_SUB_IF(dev), req); - } -} - -static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_assoc_request *req) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if((sdata->local->hw.wiphy->dot11OCBActivated == 1) && (sdata->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - /* - * [PLATA] - we do not support the association mode if we are configured with OCBActivated (mode 802.11p) - */ - printk(KERN_ERR "ieee80211_assoc: no assoc in 802.11p"); - return -EOPNOTSUPP; - } - switch (ieee80211_get_channel_mode(local, sdata)) { - case CHAN_MODE_HOPPING: - return -EBUSY; - case CHAN_MODE_FIXED: - if (local->oper_channel == req->bss->channel) - break; - return -EBUSY; - case CHAN_MODE_UNDEFINED: - break; - } - - return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev), req); -} - -static int ieee80211_deauth(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_deauth_request *req) -{ - return ieee80211_mgd_deauth(IEEE80211_DEV_TO_SUB_IF(dev), req); -} - -static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_disassoc_request *req) -{ - return ieee80211_mgd_disassoc(IEEE80211_DEV_TO_SUB_IF(dev), req); -} - -static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_ibss_params *params) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if((sdata->local->hw.wiphy->dot11OCBActivated == 1) && (sdata->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - /* - * [PLATA] - As the OCBMode is used here in ADHOC mode, we just want to be sure we do not try to - * join an IBSS if wiht OCBActivated (mode 802.11p) - */ - printk(KERN_ERR "ieee80211_join_ibss: no ibss in 802.11p"); - return -EOPNOTSUPP; - } - - switch (ieee80211_get_channel_mode(local, sdata)) { - case CHAN_MODE_HOPPING: - return -EBUSY; - case CHAN_MODE_FIXED: - if (!params->channel_fixed) - return -EBUSY; - if (local->oper_channel == params->channel) - break; - return -EBUSY; - case CHAN_MODE_UNDEFINED: - break; - } - - return ieee80211_ibss_join(sdata, params); -} - -static int ieee80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - return ieee80211_ibss_leave(sdata); -} - -/* - * [PLATA] - should we add something to allow the change from OCBActivated from 0 to 1 and back? - */ -static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - int err; - - if (changed & WIPHY_PARAM_FRAG_THRESHOLD) { - err = drv_set_frag_threshold(local, wiphy->frag_threshold); - - if (err) - return err; - } - - if (changed & WIPHY_PARAM_COVERAGE_CLASS) { - err = drv_set_coverage_class(local, wiphy->coverage_class); - - if (err) - return err; - } - - if (changed & WIPHY_PARAM_RTS_THRESHOLD) { - err = drv_set_rts_threshold(local, wiphy->rts_threshold); - - if (err) - return err; - } - - if (changed & WIPHY_PARAM_RETRY_SHORT) - local->hw.conf.short_frame_max_tx_count = wiphy->retry_short; - if (changed & WIPHY_PARAM_RETRY_LONG) - local->hw.conf.long_frame_max_tx_count = wiphy->retry_long; - if (changed & - (WIPHY_PARAM_RETRY_SHORT | WIPHY_PARAM_RETRY_LONG)) - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS); - - return 0; -} - -static int ieee80211_set_tx_power(struct wiphy *wiphy, - enum nl80211_tx_power_setting type, int mbm) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - struct ieee80211_channel *chan = local->hw.conf.channel; - u32 changes = 0; - - switch (type) { - case NL80211_TX_POWER_AUTOMATIC: - local->user_power_level = -1; - break; - case NL80211_TX_POWER_LIMITED: - if (mbm < 0 || (mbm % 100)) - return -EOPNOTSUPP; - local->user_power_level = MBM_TO_DBM(mbm); - break; - case NL80211_TX_POWER_FIXED: - if (mbm < 0 || (mbm % 100)) - return -EOPNOTSUPP; - /* TODO: move to cfg80211 when it knows the channel */ - if (MBM_TO_DBM(mbm) > chan->max_power) - return -EINVAL; - local->user_power_level = MBM_TO_DBM(mbm); - break; - } - - ieee80211_hw_config(local, changes); - - return 0; -} - -static int ieee80211_get_tx_power(struct wiphy *wiphy, int *dbm) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - - *dbm = local->hw.conf.power_level; - - return 0; -} - -static int ieee80211_set_wds_peer(struct wiphy *wiphy, struct net_device *dev, - const u8 *addr) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - memcpy(&sdata->u.wds.remote_addr, addr, ETH_ALEN); - - return 0; -} - -static void ieee80211_rfkill_poll(struct wiphy *wiphy) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - - drv_rfkill_poll(local); -} - -#ifdef CONFIG_NL80211_TESTMODE -static int ieee80211_testmode_cmd(struct wiphy *wiphy, void *data, int len) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - - if (!local->ops->testmode_cmd) - return -EOPNOTSUPP; - - return local->ops->testmode_cmd(&local->hw, data, len); -} - -static int ieee80211_testmode_dump(struct wiphy *wiphy, - struct sk_buff *skb, - struct netlink_callback *cb, - void *data, int len) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - - if (!local->ops->testmode_dump) - return -EOPNOTSUPP; - - return local->ops->testmode_dump(&local->hw, skb, cb, data, len); -} -#endif - -int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata, - enum ieee80211_smps_mode smps_mode) -{ - const u8 *ap; - enum ieee80211_smps_mode old_req; - int err; - - lockdep_assert_held(&sdata->u.mgd.mtx); - - old_req = sdata->u.mgd.req_smps; - sdata->u.mgd.req_smps = smps_mode; - - if (old_req == smps_mode && - smps_mode != IEEE80211_SMPS_AUTOMATIC) - return 0; - - /* - * If not associated, or current association is not an HT - * association, there's no need to send an action frame. - */ - if (!sdata->u.mgd.associated || - sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) { - mutex_lock(&sdata->local->iflist_mtx); - ieee80211_recalc_smps(sdata->local); - mutex_unlock(&sdata->local->iflist_mtx); - return 0; - } - - ap = sdata->u.mgd.associated->bssid; - - if (smps_mode == IEEE80211_SMPS_AUTOMATIC) { - if (sdata->u.mgd.powersave) - smps_mode = IEEE80211_SMPS_DYNAMIC; - else - smps_mode = IEEE80211_SMPS_OFF; - } - - /* send SM PS frame to AP */ - err = ieee80211_send_smps_action(sdata, smps_mode, - ap, ap); - if (err) - sdata->u.mgd.req_smps = old_req; - - return err; -} - -static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, - bool enabled, int timeout) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); - - if (sdata->vif.type != NL80211_IFTYPE_STATION) - return -EOPNOTSUPP; - - if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) - return -EOPNOTSUPP; - - if (enabled == sdata->u.mgd.powersave && - timeout == local->dynamic_ps_forced_timeout) - return 0; - - sdata->u.mgd.powersave = enabled; - local->dynamic_ps_forced_timeout = timeout; - - /* no change, but if automatic follow powersave */ - mutex_lock(&sdata->u.mgd.mtx); - __ieee80211_request_smps(sdata, sdata->u.mgd.req_smps); - mutex_unlock(&sdata->u.mgd.mtx); - - if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); - - ieee80211_recalc_ps(local, -1); - - return 0; -} - -static int ieee80211_set_cqm_rssi_config(struct wiphy *wiphy, - struct net_device *dev, - s32 rssi_thold, u32 rssi_hyst) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_vif *vif = &sdata->vif; - struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; - - if (rssi_thold == bss_conf->cqm_rssi_thold && - rssi_hyst == bss_conf->cqm_rssi_hyst) - return 0; - - bss_conf->cqm_rssi_thold = rssi_thold; - bss_conf->cqm_rssi_hyst = rssi_hyst; - - /* tell the driver upon association, unless already associated */ - if (sdata->u.mgd.associated && - sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI) - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_CQM); - - return 0; -} - -static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, - struct net_device *dev, - const u8 *addr, - const struct cfg80211_bitrate_mask *mask) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); - int i, ret; - - if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) { - ret = drv_set_bitrate_mask(local, sdata, mask); - if (ret) - return ret; - } - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) { - sdata->rc_rateidx_mask[i] = mask->control[i].legacy; - memcpy(sdata->rc_rateidx_mcs_mask[i], mask->control[i].mcs, - sizeof(mask->control[i].mcs)); - } - - return 0; -} - -/* - * [PLATA] This method could be called to guarantee that we stay on the CCH forever... - */ -static int ieee80211_remain_on_channel_hw(struct ieee80211_local *local, - struct net_device *dev, - struct ieee80211_channel *chan, - enum nl80211_channel_type chantype, - unsigned int duration, u64 *cookie) -{ - int ret; - u32 random_cookie; - - lockdep_assert_held(&local->mtx); - - if (local->hw_roc_cookie) - return -EBUSY; - /* must be nonzero */ - random_cookie = random32() | 1; - - *cookie = random_cookie; - local->hw_roc_dev = dev; - local->hw_roc_cookie = random_cookie; - local->hw_roc_channel = chan; - local->hw_roc_channel_type = chantype; - local->hw_roc_duration = duration; - ret = drv_remain_on_channel(local, chan, chantype, duration); - if (ret) { - local->hw_roc_channel = NULL; - local->hw_roc_cookie = 0; - } - - return ret; -} - -/* - * [PLATA] This method could be called to guarantee that we stay on the CCH forever... - */ -static int ieee80211_remain_on_channel(struct wiphy *wiphy, - struct net_device *dev, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, - u64 *cookie) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - - if (local->ops->remain_on_channel) { - int ret; - - mutex_lock(&local->mtx); - ret = ieee80211_remain_on_channel_hw(local, dev, - chan, channel_type, - duration, cookie); - local->hw_roc_for_tx = false; - mutex_unlock(&local->mtx); - - return ret; - } - - return ieee80211_wk_remain_on_channel(sdata, chan, channel_type, - duration, cookie); -} - -static int ieee80211_cancel_remain_on_channel_hw(struct ieee80211_local *local, - u64 cookie) -{ - int ret; - - lockdep_assert_held(&local->mtx); - - if (local->hw_roc_cookie != cookie) - return -ENOENT; - - ret = drv_cancel_remain_on_channel(local); - if (ret) - return ret; - - local->hw_roc_cookie = 0; - local->hw_roc_channel = NULL; - - ieee80211_recalc_idle(local); - - return 0; -} - -static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy, - struct net_device *dev, - u64 cookie) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - - if (local->ops->cancel_remain_on_channel) { - int ret; - - mutex_lock(&local->mtx); - ret = ieee80211_cancel_remain_on_channel_hw(local, cookie); - mutex_unlock(&local->mtx); - - return ret; - } - - return ieee80211_wk_cancel_remain_on_channel(sdata, cookie); -} - -static enum work_done_result -ieee80211_offchan_tx_done(struct ieee80211_work *wk, struct sk_buff *skb) -{ - /* - * Use the data embedded in the work struct for reporting - * here so if the driver mangled the SKB before dropping - * it (which is the only way we really should get here) - * then we don't report mangled data. - * - * If there was no wait time, then by the time we get here - * the driver will likely not have reported the status yet, - * so in that case userspace will have to deal with it. - */ - - if (wk->offchan_tx.wait && !wk->offchan_tx.status) - cfg80211_mgmt_tx_status(wk->sdata->dev, - (unsigned long) wk->offchan_tx.frame, - wk->data, wk->data_len, false, GFP_KERNEL); - - return WORK_DONE_DESTROY; -} - -/* - * [PLATA] - method starting/controlling the TX of Action frames...not required for this version - */ -static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev, - struct ieee80211_channel *chan, bool offchan, - enum nl80211_channel_type channel_type, - bool channel_type_valid, unsigned int wait, - const u8 *buf, size_t len, bool no_cck, - bool dont_wait_for_ack, u64 *cookie) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct sta_info *sta; - struct ieee80211_work *wk; - const struct ieee80211_mgmt *mgmt = (void *)buf; - u32 flags; - bool is_offchan = false; - - if (dont_wait_for_ack) - flags = IEEE80211_TX_CTL_NO_ACK; - else - flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX | - IEEE80211_TX_CTL_REQ_TX_STATUS; - - /* Check that we are on the requested channel for transmission */ - if (chan != local->tmp_channel && - chan != local->oper_channel) - is_offchan = true; - if (channel_type_valid && - (channel_type != local->tmp_channel_type && - channel_type != local->_oper_channel_type)) - is_offchan = true; - - if (chan == local->hw_roc_channel) { - /* TODO: check channel type? */ - is_offchan = false; - flags |= IEEE80211_TX_CTL_TX_OFFCHAN; - } - - if (no_cck) - flags |= IEEE80211_TX_CTL_NO_CCK_RATE; - - if (is_offchan && !offchan) - return -EBUSY; - - switch (sdata->vif.type) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_P2P_GO: - case NL80211_IFTYPE_MESH_POINT: - if (!ieee80211_is_action(mgmt->frame_control) || - mgmt->u.action.category == WLAN_CATEGORY_PUBLIC) - break; - rcu_read_lock(); - sta = sta_info_get(sdata, mgmt->da); - rcu_read_unlock(); - if (!sta) - return -ENOLINK; - break; - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_P2P_CLIENT: - break; - default: - return -EOPNOTSUPP; - } - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + len); - if (!skb) - return -ENOMEM; - skb_reserve(skb, local->hw.extra_tx_headroom); - - memcpy(skb_put(skb, len), buf, len); - - IEEE80211_SKB_CB(skb)->flags = flags; - - skb->dev = sdata->dev; - - *cookie = (unsigned long) skb; - - if (is_offchan && local->ops->remain_on_channel) { - unsigned int duration; - int ret; - - mutex_lock(&local->mtx); - /* - * If the duration is zero, then the driver - * wouldn't actually do anything. Set it to - * 100 for now. - * - * TODO: cancel the off-channel operation - * when we get the SKB's TX status and - * the wait time was zero before. - */ - duration = 100; - if (wait) - duration = wait; - ret = ieee80211_remain_on_channel_hw(local, dev, chan, - channel_type, - duration, cookie); - if (ret) { - kfree_skb(skb); - mutex_unlock(&local->mtx); - return ret; - } - - local->hw_roc_for_tx = true; - local->hw_roc_duration = wait; - - /* - * queue up frame for transmission after - * ieee80211_ready_on_channel call - */ - - /* modify cookie to prevent API mismatches */ - *cookie ^= 2; - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_TX_OFFCHAN; - local->hw_roc_skb = skb; - local->hw_roc_skb_for_status = skb; - mutex_unlock(&local->mtx); - - return 0; - } - - /* - * Can transmit right away if the channel was the - * right one and there's no wait involved... If a - * wait is involved, we might otherwise not be on - * the right channel for long enough! - */ - /* - * [PLATA] either we guarantee we are always all three as true, or we set the flag for OCBActivated - * trying the latter... - * JHNOTE: we do not support action frames now: so we still block them - */ - /*if ((!is_offchan && !wait && !sdata->vif.bss_conf.idle) - || ((local->hw.wiphy->dot11OCBActivated == 1) && (local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED))) { - ieee80211_tx_skb(sdata, skb); - return 0; - }*/ - if (!is_offchan && !wait && !sdata->vif.bss_conf.idle) { - ieee80211_tx_skb(sdata, skb); - return 0; - } - - wk = kzalloc(sizeof(*wk) + len, GFP_KERNEL); - if (!wk) { - kfree_skb(skb); - return -ENOMEM; - } - - wk->type = IEEE80211_WORK_OFFCHANNEL_TX; - wk->chan = chan; - wk->chan_type = channel_type; - wk->sdata = sdata; - wk->done = ieee80211_offchan_tx_done; - wk->offchan_tx.frame = skb; - wk->offchan_tx.wait = wait; - wk->data_len = len; - memcpy(wk->data, buf, len); - - ieee80211_add_work(wk); - return 0; -} - -static int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, - struct net_device *dev, - u64 cookie) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - struct ieee80211_work *wk; - int ret = -ENOENT; - - mutex_lock(&local->mtx); - - if (local->ops->cancel_remain_on_channel) { - cookie ^= 2; - ret = ieee80211_cancel_remain_on_channel_hw(local, cookie); - - if (ret == 0) { - kfree_skb(local->hw_roc_skb); - local->hw_roc_skb = NULL; - local->hw_roc_skb_for_status = NULL; - } - - mutex_unlock(&local->mtx); - - return ret; - } - - list_for_each_entry(wk, &local->work_list, list) { - if (wk->sdata != sdata) - continue; - - if (wk->type != IEEE80211_WORK_OFFCHANNEL_TX) - continue; - - if (cookie != (unsigned long) wk->offchan_tx.frame) - continue; - - wk->timeout = jiffies; - - ieee80211_queue_work(&local->hw, &local->work_work); - ret = 0; - break; - } - mutex_unlock(&local->mtx); - - return ret; -} - -static void ieee80211_mgmt_frame_register(struct wiphy *wiphy, - struct net_device *dev, - u16 frame_type, bool reg) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - - if (frame_type != (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ)) - return; - - if (reg) - local->probe_req_reg++; - else - local->probe_req_reg--; - - ieee80211_queue_work(&local->hw, &local->reconfig_filter); -} - -static int ieee80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - - if (local->started) - return -EOPNOTSUPP; - - return drv_set_antenna(local, tx_ant, rx_ant); -} - -static int ieee80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - - return drv_get_antenna(local, tx_ant, rx_ant); -} - -static int ieee80211_set_ringparam(struct wiphy *wiphy, u32 tx, u32 rx) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - - return drv_set_ringparam(local, tx, rx); -} - -static void ieee80211_get_ringparam(struct wiphy *wiphy, - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - - drv_get_ringparam(local, tx, tx_max, rx, rx_max); -} - -static int ieee80211_set_rekey_data(struct wiphy *wiphy, - struct net_device *dev, - struct cfg80211_gtk_rekey_data *data) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if (!local->ops->set_rekey_data) - return -EOPNOTSUPP; - - drv_set_rekey_data(local, sdata, data); - - return 0; -} - -static void ieee80211_tdls_add_ext_capab(struct sk_buff *skb) -{ - u8 *pos = (void *)skb_put(skb, 7); - - *pos++ = WLAN_EID_EXT_CAPABILITY; - *pos++ = 5; /* len */ - *pos++ = 0x0; - *pos++ = 0x0; - *pos++ = 0x0; - *pos++ = 0x0; - *pos++ = WLAN_EXT_CAPA5_TDLS_ENABLED; -} - -static u16 ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - u16 capab; - - capab = 0; - if (local->oper_channel->band != IEEE80211_BAND_2GHZ) - return capab; - - if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE)) - capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME; - if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE)) - capab |= WLAN_CAPABILITY_SHORT_PREAMBLE; - - return capab; -} - -static void ieee80211_tdls_add_link_ie(struct sk_buff *skb, u8 *src_addr, - u8 *peer, u8 *bssid) -{ - struct ieee80211_tdls_lnkie *lnkid; - - lnkid = (void *)skb_put(skb, sizeof(struct ieee80211_tdls_lnkie)); - - lnkid->ie_type = WLAN_EID_LINK_ID; - lnkid->ie_len = sizeof(struct ieee80211_tdls_lnkie) - 2; - - memcpy(lnkid->bssid, bssid, ETH_ALEN); - memcpy(lnkid->init_sta, src_addr, ETH_ALEN); - memcpy(lnkid->resp_sta, peer, ETH_ALEN); -} - -static int -ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, - u8 *peer, u8 action_code, u8 dialog_token, - u16 status_code, struct sk_buff *skb) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_tdls_data *tf; - - tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); - - memcpy(tf->da, peer, ETH_ALEN); - memcpy(tf->sa, sdata->vif.addr, ETH_ALEN); - tf->ether_type = cpu_to_be16(ETH_P_TDLS); - tf->payload_type = WLAN_TDLS_SNAP_RFTYPE; - - switch (action_code) { - case WLAN_TDLS_SETUP_REQUEST: - tf->category = WLAN_CATEGORY_TDLS; - tf->action_code = WLAN_TDLS_SETUP_REQUEST; - - skb_put(skb, sizeof(tf->u.setup_req)); - tf->u.setup_req.dialog_token = dialog_token; - tf->u.setup_req.capability = - cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); - - ieee80211_add_srates_ie(&sdata->vif, skb); - ieee80211_add_ext_srates_ie(&sdata->vif, skb); - ieee80211_tdls_add_ext_capab(skb); - break; - case WLAN_TDLS_SETUP_RESPONSE: - tf->category = WLAN_CATEGORY_TDLS; - tf->action_code = WLAN_TDLS_SETUP_RESPONSE; - - skb_put(skb, sizeof(tf->u.setup_resp)); - tf->u.setup_resp.status_code = cpu_to_le16(status_code); - tf->u.setup_resp.dialog_token = dialog_token; - tf->u.setup_resp.capability = - cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); - - ieee80211_add_srates_ie(&sdata->vif, skb); - ieee80211_add_ext_srates_ie(&sdata->vif, skb); - ieee80211_tdls_add_ext_capab(skb); - break; - case WLAN_TDLS_SETUP_CONFIRM: - tf->category = WLAN_CATEGORY_TDLS; - tf->action_code = WLAN_TDLS_SETUP_CONFIRM; - - skb_put(skb, sizeof(tf->u.setup_cfm)); - tf->u.setup_cfm.status_code = cpu_to_le16(status_code); - tf->u.setup_cfm.dialog_token = dialog_token; - break; - case WLAN_TDLS_TEARDOWN: - tf->category = WLAN_CATEGORY_TDLS; - tf->action_code = WLAN_TDLS_TEARDOWN; - - skb_put(skb, sizeof(tf->u.teardown)); - tf->u.teardown.reason_code = cpu_to_le16(status_code); - break; - case WLAN_TDLS_DISCOVERY_REQUEST: - tf->category = WLAN_CATEGORY_TDLS; - tf->action_code = WLAN_TDLS_DISCOVERY_REQUEST; - - skb_put(skb, sizeof(tf->u.discover_req)); - tf->u.discover_req.dialog_token = dialog_token; - break; - default: - return -EINVAL; - } - - return 0; -} - -static int -ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev, - u8 *peer, u8 action_code, u8 dialog_token, - u16 status_code, struct sk_buff *skb) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_mgmt *mgmt; - - mgmt = (void *)skb_put(skb, 24); - memset(mgmt, 0, 24); - memcpy(mgmt->da, peer, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); - - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - - switch (action_code) { - case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: - skb_put(skb, 1 + sizeof(mgmt->u.action.u.tdls_discover_resp)); - mgmt->u.action.category = WLAN_CATEGORY_PUBLIC; - mgmt->u.action.u.tdls_discover_resp.action_code = - WLAN_PUB_ACTION_TDLS_DISCOVER_RES; - mgmt->u.action.u.tdls_discover_resp.dialog_token = - dialog_token; - mgmt->u.action.u.tdls_discover_resp.capability = - cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); - - ieee80211_add_srates_ie(&sdata->vif, skb); - ieee80211_add_ext_srates_ie(&sdata->vif, skb); - ieee80211_tdls_add_ext_capab(skb); - break; - default: - return -EINVAL; - } - - return 0; -} - -static int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, - u8 *peer, u8 action_code, u8 dialog_token, - u16 status_code, const u8 *extra_ies, - size_t extra_ies_len) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - struct ieee80211_tx_info *info; - struct sk_buff *skb = NULL; - bool send_direct; - int ret; - - if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) - return -ENOTSUPP; - - /* make sure we are in managed mode, and associated */ - if (sdata->vif.type != NL80211_IFTYPE_STATION || - !sdata->u.mgd.associated) - return -EINVAL; - -#ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG - printk(KERN_DEBUG "TDLS mgmt action %d peer %pM\n", action_code, peer); -#endif - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + - max(sizeof(struct ieee80211_mgmt), - sizeof(struct ieee80211_tdls_data)) + - 50 + /* supported rates */ - 7 + /* ext capab */ - extra_ies_len + - sizeof(struct ieee80211_tdls_lnkie)); - if (!skb) - return -ENOMEM; - - info = IEEE80211_SKB_CB(skb); - skb_reserve(skb, local->hw.extra_tx_headroom); - - switch (action_code) { - case WLAN_TDLS_SETUP_REQUEST: - case WLAN_TDLS_SETUP_RESPONSE: - case WLAN_TDLS_SETUP_CONFIRM: - case WLAN_TDLS_TEARDOWN: - case WLAN_TDLS_DISCOVERY_REQUEST: - ret = ieee80211_prep_tdls_encap_data(wiphy, dev, peer, - action_code, dialog_token, - status_code, skb); - send_direct = false; - break; - case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: - ret = ieee80211_prep_tdls_direct(wiphy, dev, peer, action_code, - dialog_token, status_code, - skb); - send_direct = true; - break; - default: - ret = -ENOTSUPP; - break; - } - - if (ret < 0) - goto fail; - - if (extra_ies_len) - memcpy(skb_put(skb, extra_ies_len), extra_ies, extra_ies_len); - - /* the TDLS link IE is always added last */ - switch (action_code) { - case WLAN_TDLS_SETUP_REQUEST: - case WLAN_TDLS_SETUP_CONFIRM: - case WLAN_TDLS_TEARDOWN: - case WLAN_TDLS_DISCOVERY_REQUEST: - /* we are the initiator */ - ieee80211_tdls_add_link_ie(skb, sdata->vif.addr, peer, - sdata->u.mgd.bssid); - break; - case WLAN_TDLS_SETUP_RESPONSE: - case WLAN_PUB_ACTION_TDLS_DISCOVER_RES: - /* we are the responder */ - ieee80211_tdls_add_link_ie(skb, peer, sdata->vif.addr, - sdata->u.mgd.bssid); - break; - default: - ret = -ENOTSUPP; - goto fail; - } - - if (send_direct) { - ieee80211_tx_skb(sdata, skb); - return 0; - } - - /* - * According to 802.11z: Setup req/resp are sent in AC_BK, otherwise - * we should default to AC_VI. - */ - switch (action_code) { - case WLAN_TDLS_SETUP_REQUEST: - case WLAN_TDLS_SETUP_RESPONSE: - skb_set_queue_mapping(skb, IEEE80211_AC_BK); - skb->priority = 2; - break; - default: - skb_set_queue_mapping(skb, IEEE80211_AC_VI); - skb->priority = 5; - break; - } - - /* disable bottom halves when entering the Tx path */ - local_bh_disable(); - ret = ieee80211_subif_start_xmit(skb, dev); - local_bh_enable(); - - return ret; - -fail: - dev_kfree_skb(skb); - return ret; -} - -static int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, - u8 *peer, enum nl80211_tdls_operation oper) -{ - struct sta_info *sta; - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - if (!(wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)) - return -ENOTSUPP; - - if (sdata->vif.type != NL80211_IFTYPE_STATION) - return -EINVAL; - -#ifdef CONFIG_MAC80211_VERBOSE_TDLS_DEBUG - printk(KERN_DEBUG "TDLS oper %d peer %pM\n", oper, peer); -#endif - - switch (oper) { - case NL80211_TDLS_ENABLE_LINK: - rcu_read_lock(); - sta = sta_info_get(sdata, peer); - if (!sta) { - rcu_read_unlock(); - return -ENOLINK; - } - - set_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH); - rcu_read_unlock(); - break; - case NL80211_TDLS_DISABLE_LINK: - return sta_info_destroy_addr(sdata, peer); - case NL80211_TDLS_TEARDOWN: - case NL80211_TDLS_SETUP: - case NL80211_TDLS_DISCOVERY_REQ: - /* We don't support in-driver setup/teardown/discovery */ - return -ENOTSUPP; - default: - return -ENOTSUPP; - } - - return 0; -} - -static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev, - const u8 *peer, u64 *cookie) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - struct ieee80211_qos_hdr *nullfunc; - struct sk_buff *skb; - int size = sizeof(*nullfunc); - __le16 fc; - bool qos; - struct ieee80211_tx_info *info; - struct sta_info *sta; - - rcu_read_lock(); - sta = sta_info_get(sdata, peer); - if (sta) { - qos = test_sta_flag(sta, WLAN_STA_WME); - rcu_read_unlock(); - } else { - rcu_read_unlock(); - return -ENOLINK; - } - - if (qos) { - fc = cpu_to_le16(IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_QOS_NULLFUNC | - IEEE80211_FCTL_FROMDS); - } else { - size -= 2; - fc = cpu_to_le16(IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_NULLFUNC | - IEEE80211_FCTL_FROMDS); - } - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + size); - if (!skb) - return -ENOMEM; - - skb->dev = dev; - - skb_reserve(skb, local->hw.extra_tx_headroom); - - nullfunc = (void *) skb_put(skb, size); - nullfunc->frame_control = fc; - nullfunc->duration_id = 0; - memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); - memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); - memcpy(nullfunc->addr3, sdata->vif.addr, ETH_ALEN); - nullfunc->seq_ctrl = 0; - - info = IEEE80211_SKB_CB(skb); - - info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS | - IEEE80211_TX_INTFL_NL80211_FRAME_TX; - - skb_set_queue_mapping(skb, IEEE80211_AC_VO); - skb->priority = 7; - if (qos) - nullfunc->qos_ctrl = cpu_to_le16(7); - - local_bh_disable(); - ieee80211_xmit(sdata, skb); - local_bh_enable(); - - *cookie = (unsigned long) skb; - return 0; -} - -static struct ieee80211_channel * -ieee80211_wiphy_get_channel(struct wiphy *wiphy) -{ - struct ieee80211_local *local = wiphy_priv(wiphy); - - return local->oper_channel; -} - -struct cfg80211_ops mac80211_config_ops = { - .add_virtual_intf = ieee80211_add_iface, - .del_virtual_intf = ieee80211_del_iface, - .change_virtual_intf = ieee80211_change_iface, - .add_key = ieee80211_add_key, - .del_key = ieee80211_del_key, - .get_key = ieee80211_get_key, - .set_default_key = ieee80211_config_default_key, - .set_default_mgmt_key = ieee80211_config_default_mgmt_key, - .start_ap = ieee80211_start_ap, - .change_beacon = ieee80211_change_beacon, - .stop_ap = ieee80211_stop_ap, - .add_station = ieee80211_add_station, - .del_station = ieee80211_del_station, - .change_station = ieee80211_change_station, - .get_station = ieee80211_get_station, - .dump_station = ieee80211_dump_station, - .dump_survey = ieee80211_dump_survey, -#ifdef CONFIG_MAC80211_MESH - .add_mpath = ieee80211_add_mpath, - .del_mpath = ieee80211_del_mpath, - .change_mpath = ieee80211_change_mpath, - .get_mpath = ieee80211_get_mpath, - .dump_mpath = ieee80211_dump_mpath, - .update_mesh_config = ieee80211_update_mesh_config, - .get_mesh_config = ieee80211_get_mesh_config, - .join_mesh = ieee80211_join_mesh, - .leave_mesh = ieee80211_leave_mesh, -#endif - .change_bss = ieee80211_change_bss, - .set_txq_params = ieee80211_set_txq_params, - .set_channel = ieee80211_set_channel, - .suspend = ieee80211_suspend, - .resume = ieee80211_resume, - .scan = ieee80211_scan, - .sched_scan_start = ieee80211_sched_scan_start, - .sched_scan_stop = ieee80211_sched_scan_stop, - .auth = ieee80211_auth, - .assoc = ieee80211_assoc, - .deauth = ieee80211_deauth, - .disassoc = ieee80211_disassoc, - .join_ibss = ieee80211_join_ibss, - .leave_ibss = ieee80211_leave_ibss, - .set_wiphy_params = ieee80211_set_wiphy_params, - .set_tx_power = ieee80211_set_tx_power, - .get_tx_power = ieee80211_get_tx_power, - .set_wds_peer = ieee80211_set_wds_peer, - .rfkill_poll = ieee80211_rfkill_poll, - CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) - CFG80211_TESTMODE_DUMP(ieee80211_testmode_dump) - .set_power_mgmt = ieee80211_set_power_mgmt, - .set_bitrate_mask = ieee80211_set_bitrate_mask, - .remain_on_channel = ieee80211_remain_on_channel, - .cancel_remain_on_channel = ieee80211_cancel_remain_on_channel, - .mgmt_tx = ieee80211_mgmt_tx, - .mgmt_tx_cancel_wait = ieee80211_mgmt_tx_cancel_wait, - .set_cqm_rssi_config = ieee80211_set_cqm_rssi_config, - .mgmt_frame_register = ieee80211_mgmt_frame_register, - .set_antenna = ieee80211_set_antenna, - .get_antenna = ieee80211_get_antenna, - .set_ringparam = ieee80211_set_ringparam, - .get_ringparam = ieee80211_get_ringparam, - .set_rekey_data = ieee80211_set_rekey_data, - .tdls_oper = ieee80211_tdls_oper, - .tdls_mgmt = ieee80211_tdls_mgmt, - .probe_client = ieee80211_probe_client, - .get_channel = ieee80211_wiphy_get_channel, - .set_noack_map = ieee80211_set_noack_map, -}; diff --git a/openairITS/mac/DOT11/net/mac80211/cfg.h b/openairITS/mac/DOT11/net/mac80211/cfg.h deleted file mode 100644 index 7d7879f5b00..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/cfg.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * mac80211 configuration hooks for cfg80211 - */ -#ifndef __CFG_H -#define __CFG_H - -extern struct cfg80211_ops mac80211_config_ops; - -#endif /* __CFG_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/chan.c b/openairITS/mac/DOT11/net/mac80211/chan.c deleted file mode 100644 index e00ce8c3e28..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/chan.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * mac80211 - channel management - */ - -#include <linux/nl80211.h> -#include <net/cfg80211.h> -#include "ieee80211_i.h" - -static enum ieee80211_chan_mode -__ieee80211_get_channel_mode(struct ieee80211_local *local, - struct ieee80211_sub_if_data *ignore) -{ - struct ieee80211_sub_if_data *sdata; - - lockdep_assert_held(&local->iflist_mtx); - - list_for_each_entry(sdata, &local->interfaces, list) { - if (sdata == ignore) - continue; - - if (!ieee80211_sdata_running(sdata)) - continue; - - switch (sdata->vif.type) { - case NL80211_IFTYPE_MONITOR: - continue; - case NL80211_IFTYPE_STATION: - if (!sdata->u.mgd.associated) - continue; - break; - case NL80211_IFTYPE_ADHOC: - if (!sdata->u.ibss.ssid_len) - continue; - if (!sdata->u.ibss.fixed_channel) - return CHAN_MODE_HOPPING; - break; - case NL80211_IFTYPE_AP_VLAN: - /* will also have _AP interface */ - continue; - case NL80211_IFTYPE_AP: - if (!sdata->u.ap.beacon) - continue; - break; - default: - break; - } - - return CHAN_MODE_FIXED; - } - - return CHAN_MODE_UNDEFINED; -} - -enum ieee80211_chan_mode -ieee80211_get_channel_mode(struct ieee80211_local *local, - struct ieee80211_sub_if_data *ignore) -{ - enum ieee80211_chan_mode mode; - - mutex_lock(&local->iflist_mtx); - mode = __ieee80211_get_channel_mode(local, ignore); - mutex_unlock(&local->iflist_mtx); - - return mode; -} - -bool ieee80211_set_channel_type(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - enum nl80211_channel_type chantype) -{ - struct ieee80211_sub_if_data *tmp; - enum nl80211_channel_type superchan = NL80211_CHAN_NO_HT; - bool result; - - mutex_lock(&local->iflist_mtx); - - list_for_each_entry(tmp, &local->interfaces, list) { - if (tmp == sdata) - continue; - - if (!ieee80211_sdata_running(tmp)) - continue; - - switch (tmp->vif.bss_conf.channel_type) { - case NL80211_CHAN_NO_HT: - case NL80211_CHAN_HT20: - if (superchan > tmp->vif.bss_conf.channel_type) - break; - - superchan = tmp->vif.bss_conf.channel_type; - break; - case NL80211_CHAN_HT40PLUS: - WARN_ON(superchan == NL80211_CHAN_HT40MINUS); - superchan = NL80211_CHAN_HT40PLUS; - break; - case NL80211_CHAN_HT40MINUS: - WARN_ON(superchan == NL80211_CHAN_HT40PLUS); - superchan = NL80211_CHAN_HT40MINUS; - break; - } - } - - switch (superchan) { - case NL80211_CHAN_NO_HT: - case NL80211_CHAN_HT20: - /* - * allow any change that doesn't go to no-HT - * (if it already is no-HT no change is needed) - */ - if (chantype == NL80211_CHAN_NO_HT) - break; - superchan = chantype; - break; - case NL80211_CHAN_HT40PLUS: - case NL80211_CHAN_HT40MINUS: - /* allow smaller bandwidth and same */ - if (chantype == NL80211_CHAN_NO_HT) - break; - if (chantype == NL80211_CHAN_HT20) - break; - if (superchan == chantype) - break; - result = false; - goto out; - } - - local->_oper_channel_type = superchan; - - if (sdata) - sdata->vif.bss_conf.channel_type = chantype; - - result = true; - out: - mutex_unlock(&local->iflist_mtx); - - return result; -} - -/* - * ieee80211_get_tx_channel_type returns the channel type we should - * use for packet transmission, given the channel capability and - * whatever regulatory flags we have been given. - */ -enum nl80211_channel_type ieee80211_get_tx_channel_type( - struct ieee80211_local *local, - enum nl80211_channel_type channel_type) -{ - switch (channel_type) { - case NL80211_CHAN_HT40PLUS: - if (local->hw.conf.channel->flags & - IEEE80211_CHAN_NO_HT40PLUS) - return NL80211_CHAN_HT20; - break; - case NL80211_CHAN_HT40MINUS: - if (local->hw.conf.channel->flags & - IEEE80211_CHAN_NO_HT40MINUS) - return NL80211_CHAN_HT20; - break; - default: - break; - } - return channel_type; -} diff --git a/openairITS/mac/DOT11/net/mac80211/debugfs.c b/openairITS/mac/DOT11/net/mac80211/debugfs.c deleted file mode 100644 index 778e5916d7c..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/debugfs.c +++ /dev/null @@ -1,347 +0,0 @@ - -/* - * mac80211 debugfs for wireless PHYs - * - * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> - * - * GPLv2 - * - */ - -#include <linux/debugfs.h> -#include <linux/rtnetlink.h> -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "rate.h" -#include "debugfs.h" - -#define DEBUGFS_FORMAT_BUFFER_SIZE 100 - -int mac80211_format_buffer(char __user *userbuf, size_t count, - loff_t *ppos, char *fmt, ...) -{ - va_list args; - char buf[DEBUGFS_FORMAT_BUFFER_SIZE]; - int res; - - va_start(args, fmt); - res = vscnprintf(buf, sizeof(buf), fmt, args); - va_end(args); - - return simple_read_from_buffer(userbuf, count, ppos, buf, res); -} - -#define DEBUGFS_READONLY_FILE_FN(name, fmt, value...) \ -static ssize_t name## _read(struct file *file, char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - struct ieee80211_local *local = file->private_data; \ - \ - return mac80211_format_buffer(userbuf, count, ppos, \ - fmt "\n", ##value); \ -} - -#define DEBUGFS_READONLY_FILE_OPS(name) \ -static const struct file_operations name## _ops = { \ - .read = name## _read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_READONLY_FILE(name, fmt, value...) \ - DEBUGFS_READONLY_FILE_FN(name, fmt, value) \ - DEBUGFS_READONLY_FILE_OPS(name) - -#define DEBUGFS_ADD(name) \ - debugfs_create_file(#name, 0400, phyd, local, &name## _ops); - -#define DEBUGFS_ADD_MODE(name, mode) \ - debugfs_create_file(#name, mode, phyd, local, &name## _ops); - - -DEBUGFS_READONLY_FILE(user_power, "%d", - local->user_power_level); -DEBUGFS_READONLY_FILE(power, "%d", - local->hw.conf.power_level); -DEBUGFS_READONLY_FILE(frequency, "%d", - local->hw.conf.channel->center_freq); -DEBUGFS_READONLY_FILE(total_ps_buffered, "%d", - local->total_ps_buffered); -DEBUGFS_READONLY_FILE(wep_iv, "%#08x", - local->wep_iv & 0xffffff); -DEBUGFS_READONLY_FILE(rate_ctrl_alg, "%s", - local->rate_ctrl ? local->rate_ctrl->ops->name : "hw/driver"); - -static ssize_t reset_write(struct file *file, const char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ieee80211_local *local = file->private_data; - - rtnl_lock(); - __ieee80211_suspend(&local->hw, NULL); - __ieee80211_resume(&local->hw); - rtnl_unlock(); - - return count; -} - -static const struct file_operations reset_ops = { - .write = reset_write, - .open = simple_open, - .llseek = noop_llseek, -}; - -static ssize_t channel_type_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ieee80211_local *local = file->private_data; - const char *buf; - - switch (local->hw.conf.channel_type) { - case NL80211_CHAN_NO_HT: - buf = "no ht\n"; - break; - case NL80211_CHAN_HT20: - buf = "ht20\n"; - break; - case NL80211_CHAN_HT40MINUS: - buf = "ht40-\n"; - break; - case NL80211_CHAN_HT40PLUS: - buf = "ht40+\n"; - break; - default: - buf = "???"; - break; - } - - return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); -} - -static ssize_t hwflags_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ieee80211_local *local = file->private_data; - int mxln = 500; - ssize_t rv; - char *buf = kzalloc(mxln, GFP_KERNEL); - int sf = 0; /* how many written so far */ - - if (!buf) - return 0; - - sf += snprintf(buf, mxln - sf, "0x%x\n", local->hw.flags); - if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) - sf += snprintf(buf + sf, mxln - sf, "HAS_RATE_CONTROL\n"); - if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) - sf += snprintf(buf + sf, mxln - sf, "RX_INCLUDES_FCS\n"); - if (local->hw.flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING) - sf += snprintf(buf + sf, mxln - sf, - "HOST_BCAST_PS_BUFFERING\n"); - if (local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE) - sf += snprintf(buf + sf, mxln - sf, - "2GHZ_SHORT_SLOT_INCAPABLE\n"); - if (local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE) - sf += snprintf(buf + sf, mxln - sf, - "2GHZ_SHORT_PREAMBLE_INCAPABLE\n"); - if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) - sf += snprintf(buf + sf, mxln - sf, "SIGNAL_UNSPEC\n"); - if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) - sf += snprintf(buf + sf, mxln - sf, "SIGNAL_DBM\n"); - if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) - sf += snprintf(buf + sf, mxln - sf, "NEED_DTIM_PERIOD\n"); - if (local->hw.flags & IEEE80211_HW_SPECTRUM_MGMT) - sf += snprintf(buf + sf, mxln - sf, "SPECTRUM_MGMT\n"); - if (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION) - sf += snprintf(buf + sf, mxln - sf, "AMPDU_AGGREGATION\n"); - if (local->hw.flags & IEEE80211_HW_SUPPORTS_PS) - sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_PS\n"); - if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) - sf += snprintf(buf + sf, mxln - sf, "PS_NULLFUNC_STACK\n"); - if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) - sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_DYNAMIC_PS\n"); - if (local->hw.flags & IEEE80211_HW_MFP_CAPABLE) - sf += snprintf(buf + sf, mxln - sf, "MFP_CAPABLE\n"); - if (local->hw.flags & IEEE80211_HW_SUPPORTS_STATIC_SMPS) - sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_STATIC_SMPS\n"); - if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS) - sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_DYNAMIC_SMPS\n"); - if (local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD) - sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_UAPSD\n"); - if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) - sf += snprintf(buf + sf, mxln - sf, "REPORTS_TX_ACK_STATUS\n"); - if (local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) - sf += snprintf(buf + sf, mxln - sf, "CONNECTION_MONITOR\n"); - if (local->hw.flags & IEEE80211_HW_SUPPORTS_PER_STA_GTK) - sf += snprintf(buf + sf, mxln - sf, "SUPPORTS_PER_STA_GTK\n"); - if (local->hw.flags & IEEE80211_HW_AP_LINK_PS) - sf += snprintf(buf + sf, mxln - sf, "AP_LINK_PS\n"); - if (local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW) - sf += snprintf(buf + sf, mxln - sf, "TX_AMPDU_SETUP_IN_HW\n"); - if (local->hw.flags & IEEE80211_HW_SCAN_WHILE_IDLE) - sf += snprintf(buf + sf, mxln - sf, "SCAN_WHILE_IDLE\n"); - - rv = simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf)); - kfree(buf); - return rv; -} - -static ssize_t queues_read(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct ieee80211_local *local = file->private_data; - unsigned long flags; - char buf[IEEE80211_MAX_QUEUES * 20]; - int q, res = 0; - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - for (q = 0; q < local->hw.queues; q++) - res += sprintf(buf + res, "%02d: %#.8lx/%d\n", q, - local->queue_stop_reasons[q], - skb_queue_len(&local->pending[q])); - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); - - return simple_read_from_buffer(user_buf, count, ppos, buf, res); -} - -DEBUGFS_READONLY_FILE_OPS(hwflags); -DEBUGFS_READONLY_FILE_OPS(channel_type); -DEBUGFS_READONLY_FILE_OPS(queues); - -/* statistics stuff */ - -static ssize_t format_devstat_counter(struct ieee80211_local *local, - char __user *userbuf, - size_t count, loff_t *ppos, - int (*printvalue)(struct ieee80211_low_level_stats *stats, char *buf, - int buflen)) -{ - struct ieee80211_low_level_stats stats; - char buf[20]; - int res; - - rtnl_lock(); - res = drv_get_stats(local, &stats); - rtnl_unlock(); - if (res) - return res; - res = printvalue(&stats, buf, sizeof(buf)); - return simple_read_from_buffer(userbuf, count, ppos, buf, res); -} - -#define DEBUGFS_DEVSTATS_FILE(name) \ -static int print_devstats_##name(struct ieee80211_low_level_stats *stats,\ - char *buf, int buflen) \ -{ \ - return scnprintf(buf, buflen, "%u\n", stats->name); \ -} \ -static ssize_t stats_ ##name## _read(struct file *file, \ - char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - return format_devstat_counter(file->private_data, \ - userbuf, \ - count, \ - ppos, \ - print_devstats_##name); \ -} \ - \ -static const struct file_operations stats_ ##name## _ops = { \ - .read = stats_ ##name## _read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -#define DEBUGFS_STATS_ADD(name, field) \ - debugfs_create_u32(#name, 0400, statsd, (u32 *) &field); -#define DEBUGFS_DEVSTATS_ADD(name) \ - debugfs_create_file(#name, 0400, statsd, local, &stats_ ##name## _ops); - -DEBUGFS_DEVSTATS_FILE(dot11ACKFailureCount); -DEBUGFS_DEVSTATS_FILE(dot11RTSFailureCount); -DEBUGFS_DEVSTATS_FILE(dot11FCSErrorCount); -DEBUGFS_DEVSTATS_FILE(dot11RTSSuccessCount); - -void debugfs_hw_add(struct ieee80211_local *local) -{ - struct dentry *phyd = local->hw.wiphy->debugfsdir; - struct dentry *statsd; - - if (!phyd) - return; - - local->debugfs.keys = debugfs_create_dir("keys", phyd); - - DEBUGFS_ADD(frequency); - DEBUGFS_ADD(total_ps_buffered); - DEBUGFS_ADD(wep_iv); - DEBUGFS_ADD(queues); - DEBUGFS_ADD_MODE(reset, 0200); - DEBUGFS_ADD(channel_type); - DEBUGFS_ADD(hwflags); - DEBUGFS_ADD(user_power); - DEBUGFS_ADD(power); - - statsd = debugfs_create_dir("statistics", phyd); - - /* if the dir failed, don't put all the other things into the root! */ - if (!statsd) - return; - - DEBUGFS_STATS_ADD(transmitted_fragment_count, - local->dot11TransmittedFragmentCount); - DEBUGFS_STATS_ADD(multicast_transmitted_frame_count, - local->dot11MulticastTransmittedFrameCount); - DEBUGFS_STATS_ADD(failed_count, local->dot11FailedCount); - DEBUGFS_STATS_ADD(retry_count, local->dot11RetryCount); - DEBUGFS_STATS_ADD(multiple_retry_count, - local->dot11MultipleRetryCount); - DEBUGFS_STATS_ADD(frame_duplicate_count, - local->dot11FrameDuplicateCount); - DEBUGFS_STATS_ADD(received_fragment_count, - local->dot11ReceivedFragmentCount); - DEBUGFS_STATS_ADD(multicast_received_frame_count, - local->dot11MulticastReceivedFrameCount); - DEBUGFS_STATS_ADD(transmitted_frame_count, - local->dot11TransmittedFrameCount); -#ifdef CONFIG_MAC80211_DEBUG_COUNTERS - DEBUGFS_STATS_ADD(tx_handlers_drop, local->tx_handlers_drop); - DEBUGFS_STATS_ADD(tx_handlers_queued, local->tx_handlers_queued); - DEBUGFS_STATS_ADD(tx_handlers_drop_unencrypted, - local->tx_handlers_drop_unencrypted); - DEBUGFS_STATS_ADD(tx_handlers_drop_fragment, - local->tx_handlers_drop_fragment); - DEBUGFS_STATS_ADD(tx_handlers_drop_wep, - local->tx_handlers_drop_wep); - DEBUGFS_STATS_ADD(tx_handlers_drop_not_assoc, - local->tx_handlers_drop_not_assoc); - DEBUGFS_STATS_ADD(tx_handlers_drop_unauth_port, - local->tx_handlers_drop_unauth_port); - DEBUGFS_STATS_ADD(rx_handlers_drop, local->rx_handlers_drop); - DEBUGFS_STATS_ADD(rx_handlers_queued, local->rx_handlers_queued); - DEBUGFS_STATS_ADD(rx_handlers_drop_nullfunc, - local->rx_handlers_drop_nullfunc); - DEBUGFS_STATS_ADD(rx_handlers_drop_defrag, - local->rx_handlers_drop_defrag); - DEBUGFS_STATS_ADD(rx_handlers_drop_short, - local->rx_handlers_drop_short); - DEBUGFS_STATS_ADD(rx_handlers_drop_passive_scan, - local->rx_handlers_drop_passive_scan); - DEBUGFS_STATS_ADD(tx_expand_skb_head, - local->tx_expand_skb_head); - DEBUGFS_STATS_ADD(tx_expand_skb_head_cloned, - local->tx_expand_skb_head_cloned); - DEBUGFS_STATS_ADD(rx_expand_skb_head, - local->rx_expand_skb_head); - DEBUGFS_STATS_ADD(rx_expand_skb_head2, - local->rx_expand_skb_head2); - DEBUGFS_STATS_ADD(rx_handlers_fragments, - local->rx_handlers_fragments); - DEBUGFS_STATS_ADD(tx_status_drop, - local->tx_status_drop); -#endif - DEBUGFS_DEVSTATS_ADD(dot11ACKFailureCount); - DEBUGFS_DEVSTATS_ADD(dot11RTSFailureCount); - DEBUGFS_DEVSTATS_ADD(dot11FCSErrorCount); - DEBUGFS_DEVSTATS_ADD(dot11RTSSuccessCount); -} diff --git a/openairITS/mac/DOT11/net/mac80211/debugfs.h b/openairITS/mac/DOT11/net/mac80211/debugfs.h deleted file mode 100644 index 9be4e6d71d0..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/debugfs.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __MAC80211_DEBUGFS_H -#define __MAC80211_DEBUGFS_H - -#ifdef CONFIG_MAC80211_DEBUGFS -extern void debugfs_hw_add(struct ieee80211_local *local); -extern int mac80211_format_buffer(char __user *userbuf, size_t count, - loff_t *ppos, char *fmt, ...); -#else -static inline void debugfs_hw_add(struct ieee80211_local *local) -{ -} -#endif - -#endif /* __MAC80211_DEBUGFS_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/debugfs_key.c b/openairITS/mac/DOT11/net/mac80211/debugfs_key.c deleted file mode 100644 index 7932767bb48..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/debugfs_key.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright 2003-2005 Devicescape Software, Inc. - * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> - * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/kobject.h> -#include <linux/slab.h> -#include "ieee80211_i.h" -#include "key.h" -#include "debugfs.h" -#include "debugfs_key.h" - -#define KEY_READ(name, prop, format_string) \ -static ssize_t key_##name##_read(struct file *file, \ - char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - struct ieee80211_key *key = file->private_data; \ - return mac80211_format_buffer(userbuf, count, ppos, \ - format_string, key->prop); \ -} -#define KEY_READ_D(name) KEY_READ(name, name, "%d\n") -#define KEY_READ_X(name) KEY_READ(name, name, "0x%x\n") - -#define KEY_OPS(name) \ -static const struct file_operations key_ ##name## _ops = { \ - .read = key_##name##_read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -} - -#define KEY_FILE(name, format) \ - KEY_READ_##format(name) \ - KEY_OPS(name) - -#define KEY_CONF_READ(name, format_string) \ - KEY_READ(conf_##name, conf.name, format_string) -#define KEY_CONF_READ_D(name) KEY_CONF_READ(name, "%d\n") - -#define KEY_CONF_OPS(name) \ -static const struct file_operations key_ ##name## _ops = { \ - .read = key_conf_##name##_read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -} - -#define KEY_CONF_FILE(name, format) \ - KEY_CONF_READ_##format(name) \ - KEY_CONF_OPS(name) - -KEY_CONF_FILE(keylen, D); -KEY_CONF_FILE(keyidx, D); -KEY_CONF_FILE(hw_key_idx, D); -KEY_FILE(flags, X); -KEY_FILE(tx_rx_count, D); -KEY_READ(ifindex, sdata->name, "%s\n"); -KEY_OPS(ifindex); - -static ssize_t key_algorithm_read(struct file *file, - char __user *userbuf, - size_t count, loff_t *ppos) -{ - char buf[15]; - struct ieee80211_key *key = file->private_data; - u32 c = key->conf.cipher; - - sprintf(buf, "%.2x-%.2x-%.2x:%d\n", - c >> 24, (c >> 16) & 0xff, (c >> 8) & 0xff, c & 0xff); - return simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf)); -} -KEY_OPS(algorithm); - -static ssize_t key_tx_spec_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - u64 pn; - char buf[20]; - int len; - struct ieee80211_key *key = file->private_data; - - switch (key->conf.cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - len = scnprintf(buf, sizeof(buf), "\n"); - break; - case WLAN_CIPHER_SUITE_TKIP: - len = scnprintf(buf, sizeof(buf), "%08x %04x\n", - key->u.tkip.tx.iv32, - key->u.tkip.tx.iv16); - break; - case WLAN_CIPHER_SUITE_CCMP: - pn = atomic64_read(&key->u.ccmp.tx_pn); - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n", - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24), - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - pn = atomic64_read(&key->u.aes_cmac.tx_pn); - len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n", - (u8)(pn >> 40), (u8)(pn >> 32), (u8)(pn >> 24), - (u8)(pn >> 16), (u8)(pn >> 8), (u8)pn); - break; - default: - return 0; - } - return simple_read_from_buffer(userbuf, count, ppos, buf, len); -} -KEY_OPS(tx_spec); - -static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct ieee80211_key *key = file->private_data; - char buf[14*NUM_RX_DATA_QUEUES+1], *p = buf; - int i, len; - const u8 *rpn; - - switch (key->conf.cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - len = scnprintf(buf, sizeof(buf), "\n"); - break; - case WLAN_CIPHER_SUITE_TKIP: - for (i = 0; i < NUM_RX_DATA_QUEUES; i++) - p += scnprintf(p, sizeof(buf)+buf-p, - "%08x %04x\n", - key->u.tkip.rx[i].iv32, - key->u.tkip.rx[i].iv16); - len = p - buf; - break; - case WLAN_CIPHER_SUITE_CCMP: - for (i = 0; i < NUM_RX_DATA_QUEUES + 1; i++) { - rpn = key->u.ccmp.rx_pn[i]; - p += scnprintf(p, sizeof(buf)+buf-p, - "%02x%02x%02x%02x%02x%02x\n", - rpn[0], rpn[1], rpn[2], - rpn[3], rpn[4], rpn[5]); - } - len = p - buf; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - rpn = key->u.aes_cmac.rx_pn; - p += scnprintf(p, sizeof(buf)+buf-p, - "%02x%02x%02x%02x%02x%02x\n", - rpn[0], rpn[1], rpn[2], - rpn[3], rpn[4], rpn[5]); - len = p - buf; - break; - default: - return 0; - } - return simple_read_from_buffer(userbuf, count, ppos, buf, len); -} -KEY_OPS(rx_spec); - -static ssize_t key_replays_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct ieee80211_key *key = file->private_data; - char buf[20]; - int len; - - switch (key->conf.cipher) { - case WLAN_CIPHER_SUITE_CCMP: - len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - len = scnprintf(buf, sizeof(buf), "%u\n", - key->u.aes_cmac.replays); - break; - default: - return 0; - } - return simple_read_from_buffer(userbuf, count, ppos, buf, len); -} -KEY_OPS(replays); - -static ssize_t key_icverrors_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct ieee80211_key *key = file->private_data; - char buf[20]; - int len; - - switch (key->conf.cipher) { - case WLAN_CIPHER_SUITE_AES_CMAC: - len = scnprintf(buf, sizeof(buf), "%u\n", - key->u.aes_cmac.icverrors); - break; - default: - return 0; - } - return simple_read_from_buffer(userbuf, count, ppos, buf, len); -} -KEY_OPS(icverrors); - -static ssize_t key_key_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct ieee80211_key *key = file->private_data; - int i, bufsize = 2 * key->conf.keylen + 2; - char *buf = kmalloc(bufsize, GFP_KERNEL); - char *p = buf; - ssize_t res; - - if (!buf) - return -ENOMEM; - - for (i = 0; i < key->conf.keylen; i++) - p += scnprintf(p, bufsize + buf - p, "%02x", key->conf.key[i]); - p += scnprintf(p, bufsize+buf-p, "\n"); - res = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); - kfree(buf); - return res; -} -KEY_OPS(key); - -#define DEBUGFS_ADD(name) \ - debugfs_create_file(#name, 0400, key->debugfs.dir, \ - key, &key_##name##_ops); - -void ieee80211_debugfs_key_add(struct ieee80211_key *key) -{ - static int keycount; - char buf[100]; - struct sta_info *sta; - - if (!key->local->debugfs.keys) - return; - - sprintf(buf, "%d", keycount); - key->debugfs.cnt = keycount; - keycount++; - key->debugfs.dir = debugfs_create_dir(buf, - key->local->debugfs.keys); - - if (!key->debugfs.dir) - return; - - sta = key->sta; - if (sta) { - sprintf(buf, "../../netdev:%s/stations/%pM", - sta->sdata->name, sta->sta.addr); - key->debugfs.stalink = - debugfs_create_symlink("station", key->debugfs.dir, buf); - } - - DEBUGFS_ADD(keylen); - DEBUGFS_ADD(flags); - DEBUGFS_ADD(keyidx); - DEBUGFS_ADD(hw_key_idx); - DEBUGFS_ADD(tx_rx_count); - DEBUGFS_ADD(algorithm); - DEBUGFS_ADD(tx_spec); - DEBUGFS_ADD(rx_spec); - DEBUGFS_ADD(replays); - DEBUGFS_ADD(icverrors); - DEBUGFS_ADD(key); - DEBUGFS_ADD(ifindex); -}; - -void ieee80211_debugfs_key_remove(struct ieee80211_key *key) -{ - if (!key) - return; - - debugfs_remove_recursive(key->debugfs.dir); - key->debugfs.dir = NULL; -} - -void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata) -{ - char buf[50]; - struct ieee80211_key *key; - - if (!sdata->debugfs.dir) - return; - - lockdep_assert_held(&sdata->local->key_mtx); - - if (sdata->default_unicast_key) { - key = key_mtx_dereference(sdata->local, - sdata->default_unicast_key); - sprintf(buf, "../keys/%d", key->debugfs.cnt); - sdata->debugfs.default_unicast_key = - debugfs_create_symlink("default_unicast_key", - sdata->debugfs.dir, buf); - } else { - debugfs_remove(sdata->debugfs.default_unicast_key); - sdata->debugfs.default_unicast_key = NULL; - } - - if (sdata->default_multicast_key) { - key = key_mtx_dereference(sdata->local, - sdata->default_multicast_key); - sprintf(buf, "../keys/%d", key->debugfs.cnt); - sdata->debugfs.default_multicast_key = - debugfs_create_symlink("default_multicast_key", - sdata->debugfs.dir, buf); - } else { - debugfs_remove(sdata->debugfs.default_multicast_key); - sdata->debugfs.default_multicast_key = NULL; - } -} - -void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) -{ - char buf[50]; - struct ieee80211_key *key; - - if (!sdata->debugfs.dir) - return; - - key = key_mtx_dereference(sdata->local, - sdata->default_mgmt_key); - if (key) { - sprintf(buf, "../keys/%d", key->debugfs.cnt); - sdata->debugfs.default_mgmt_key = - debugfs_create_symlink("default_mgmt_key", - sdata->debugfs.dir, buf); - } else - ieee80211_debugfs_key_remove_mgmt_default(sdata); -} - -void ieee80211_debugfs_key_remove_mgmt_default(struct ieee80211_sub_if_data *sdata) -{ - if (!sdata) - return; - - debugfs_remove(sdata->debugfs.default_mgmt_key); - sdata->debugfs.default_mgmt_key = NULL; -} - -void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, - struct sta_info *sta) -{ - debugfs_remove(key->debugfs.stalink); - key->debugfs.stalink = NULL; -} diff --git a/openairITS/mac/DOT11/net/mac80211/debugfs_key.h b/openairITS/mac/DOT11/net/mac80211/debugfs_key.h deleted file mode 100644 index 32adc77e9c7..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/debugfs_key.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __MAC80211_DEBUGFS_KEY_H -#define __MAC80211_DEBUGFS_KEY_H - -#ifdef CONFIG_MAC80211_DEBUGFS -void ieee80211_debugfs_key_add(struct ieee80211_key *key); -void ieee80211_debugfs_key_remove(struct ieee80211_key *key); -void ieee80211_debugfs_key_update_default(struct ieee80211_sub_if_data *sdata); -void ieee80211_debugfs_key_add_mgmt_default( - struct ieee80211_sub_if_data *sdata); -void ieee80211_debugfs_key_remove_mgmt_default( - struct ieee80211_sub_if_data *sdata); -void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, - struct sta_info *sta); -#else -static inline void ieee80211_debugfs_key_add(struct ieee80211_key *key) -{} -static inline void ieee80211_debugfs_key_remove(struct ieee80211_key *key) -{} -static inline void ieee80211_debugfs_key_update_default( - struct ieee80211_sub_if_data *sdata) -{} -static inline void ieee80211_debugfs_key_add_mgmt_default( - struct ieee80211_sub_if_data *sdata) -{} -static inline void ieee80211_debugfs_key_remove_mgmt_default( - struct ieee80211_sub_if_data *sdata) -{} -static inline void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, - struct sta_info *sta) -{} -#endif - -#endif /* __MAC80211_DEBUGFS_KEY_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/debugfs_netdev.c b/openairITS/mac/DOT11/net/mac80211/debugfs_netdev.c deleted file mode 100644 index 30f99c34484..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/debugfs_netdev.c +++ /dev/null @@ -1,721 +0,0 @@ -/* - * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> - * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/kernel.h> -#include <linux/device.h> -#include <linux/if.h> -#include <linux/interrupt.h> -#include <linux/netdevice.h> -#include <linux/rtnetlink.h> -#include <linux/slab.h> -#include <linux/notifier.h> -#include <net/mac80211.h> -#include <net/cfg80211.h> -#include "ieee80211_i.h" -#include "rate.h" -#include "debugfs.h" -#include "debugfs_netdev.h" -#include "driver-ops.h" - -static ssize_t ieee80211_if_read( - struct ieee80211_sub_if_data *sdata, - char __user *userbuf, - size_t count, loff_t *ppos, - ssize_t (*format)(const struct ieee80211_sub_if_data *, char *, int)) -{ - char buf[70]; - ssize_t ret = -EINVAL; - - read_lock(&dev_base_lock); - if (sdata->dev->reg_state == NETREG_REGISTERED) - ret = (*format)(sdata, buf, sizeof(buf)); - read_unlock(&dev_base_lock); - - if (ret >= 0) - ret = simple_read_from_buffer(userbuf, count, ppos, buf, ret); - - return ret; -} - -static ssize_t ieee80211_if_write( - struct ieee80211_sub_if_data *sdata, - const char __user *userbuf, - size_t count, loff_t *ppos, - ssize_t (*write)(struct ieee80211_sub_if_data *, const char *, int)) -{ - char buf[64]; - ssize_t ret; - - if (count >= sizeof(buf)) - return -E2BIG; - - if (copy_from_user(buf, userbuf, count)) - return -EFAULT; - buf[count] = '\0'; - - ret = -ENODEV; - rtnl_lock(); - if (sdata->dev->reg_state == NETREG_REGISTERED) - ret = (*write)(sdata, buf, count); - rtnl_unlock(); - - return ret; -} - -#define IEEE80211_IF_FMT(name, field, format_string) \ -static ssize_t ieee80211_if_fmt_##name( \ - const struct ieee80211_sub_if_data *sdata, char *buf, \ - int buflen) \ -{ \ - return scnprintf(buf, buflen, format_string, sdata->field); \ -} -#define IEEE80211_IF_FMT_DEC(name, field) \ - IEEE80211_IF_FMT(name, field, "%d\n") -#define IEEE80211_IF_FMT_HEX(name, field) \ - IEEE80211_IF_FMT(name, field, "%#x\n") -#define IEEE80211_IF_FMT_LHEX(name, field) \ - IEEE80211_IF_FMT(name, field, "%#lx\n") -#define IEEE80211_IF_FMT_SIZE(name, field) \ - IEEE80211_IF_FMT(name, field, "%zd\n") - -#define IEEE80211_IF_FMT_HEXARRAY(name, field) \ -static ssize_t ieee80211_if_fmt_##name( \ - const struct ieee80211_sub_if_data *sdata, \ - char *buf, int buflen) \ -{ \ - char *p = buf; \ - int i; \ - for (i = 0; i < sizeof(sdata->field); i++) { \ - p += scnprintf(p, buflen + buf - p, "%.2x ", \ - sdata->field[i]); \ - } \ - p += scnprintf(p, buflen + buf - p, "\n"); \ - return p - buf; \ -} - -#define IEEE80211_IF_FMT_ATOMIC(name, field) \ -static ssize_t ieee80211_if_fmt_##name( \ - const struct ieee80211_sub_if_data *sdata, \ - char *buf, int buflen) \ -{ \ - return scnprintf(buf, buflen, "%d\n", atomic_read(&sdata->field));\ -} - -#define IEEE80211_IF_FMT_MAC(name, field) \ -static ssize_t ieee80211_if_fmt_##name( \ - const struct ieee80211_sub_if_data *sdata, char *buf, \ - int buflen) \ -{ \ - return scnprintf(buf, buflen, "%pM\n", sdata->field); \ -} - -#define IEEE80211_IF_FMT_DEC_DIV_16(name, field) \ -static ssize_t ieee80211_if_fmt_##name( \ - const struct ieee80211_sub_if_data *sdata, \ - char *buf, int buflen) \ -{ \ - return scnprintf(buf, buflen, "%d\n", sdata->field / 16); \ -} - -#define __IEEE80211_IF_FILE(name, _write) \ -static ssize_t ieee80211_if_read_##name(struct file *file, \ - char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - return ieee80211_if_read(file->private_data, \ - userbuf, count, ppos, \ - ieee80211_if_fmt_##name); \ -} \ -static const struct file_operations name##_ops = { \ - .read = ieee80211_if_read_##name, \ - .write = (_write), \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -} - -#define __IEEE80211_IF_FILE_W(name) \ -static ssize_t ieee80211_if_write_##name(struct file *file, \ - const char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - return ieee80211_if_write(file->private_data, userbuf, count, \ - ppos, ieee80211_if_parse_##name); \ -} \ -__IEEE80211_IF_FILE(name, ieee80211_if_write_##name) - - -#define IEEE80211_IF_FILE(name, field, format) \ - IEEE80211_IF_FMT_##format(name, field) \ - __IEEE80211_IF_FILE(name, NULL) - -/* common attributes */ -IEEE80211_IF_FILE(drop_unencrypted, drop_unencrypted, DEC); -IEEE80211_IF_FILE(rc_rateidx_mask_2ghz, rc_rateidx_mask[IEEE80211_BAND_2GHZ], - HEX); -IEEE80211_IF_FILE(rc_rateidx_mask_5ghz, rc_rateidx_mask[IEEE80211_BAND_5GHZ], - HEX); -IEEE80211_IF_FILE(rc_rateidx_mcs_mask_2ghz, - rc_rateidx_mcs_mask[IEEE80211_BAND_2GHZ], HEXARRAY); -IEEE80211_IF_FILE(rc_rateidx_mcs_mask_5ghz, - rc_rateidx_mcs_mask[IEEE80211_BAND_5GHZ], HEXARRAY); - -IEEE80211_IF_FILE(flags, flags, HEX); -IEEE80211_IF_FILE(state, state, LHEX); -IEEE80211_IF_FILE(channel_type, vif.bss_conf.channel_type, DEC); - -/* STA attributes */ -IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC); -IEEE80211_IF_FILE(aid, u.mgd.aid, DEC); -IEEE80211_IF_FILE(last_beacon, u.mgd.last_beacon_signal, DEC); -IEEE80211_IF_FILE(ave_beacon, u.mgd.ave_beacon_signal, DEC_DIV_16); - -static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata, - enum ieee80211_smps_mode smps_mode) -{ - struct ieee80211_local *local = sdata->local; - int err; - - if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_STATIC_SMPS) && - smps_mode == IEEE80211_SMPS_STATIC) - return -EINVAL; - - /* auto should be dynamic if in PS mode */ - if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS) && - (smps_mode == IEEE80211_SMPS_DYNAMIC || - smps_mode == IEEE80211_SMPS_AUTOMATIC)) - return -EINVAL; - - /* supported only on managed interfaces for now */ - if (sdata->vif.type != NL80211_IFTYPE_STATION) - return -EOPNOTSUPP; - - mutex_lock(&sdata->u.mgd.mtx); - err = __ieee80211_request_smps(sdata, smps_mode); - mutex_unlock(&sdata->u.mgd.mtx); - - return err; -} - -static const char *smps_modes[IEEE80211_SMPS_NUM_MODES] = { - [IEEE80211_SMPS_AUTOMATIC] = "auto", - [IEEE80211_SMPS_OFF] = "off", - [IEEE80211_SMPS_STATIC] = "static", - [IEEE80211_SMPS_DYNAMIC] = "dynamic", -}; - -static ssize_t ieee80211_if_fmt_smps(const struct ieee80211_sub_if_data *sdata, - char *buf, int buflen) -{ - if (sdata->vif.type != NL80211_IFTYPE_STATION) - return -EOPNOTSUPP; - - return snprintf(buf, buflen, "request: %s\nused: %s\n", - smps_modes[sdata->u.mgd.req_smps], - smps_modes[sdata->u.mgd.ap_smps]); -} - -static ssize_t ieee80211_if_parse_smps(struct ieee80211_sub_if_data *sdata, - const char *buf, int buflen) -{ - enum ieee80211_smps_mode mode; - - for (mode = 0; mode < IEEE80211_SMPS_NUM_MODES; mode++) { - if (strncmp(buf, smps_modes[mode], buflen) == 0) { - int err = ieee80211_set_smps(sdata, mode); - if (!err) - return buflen; - return err; - } - } - - return -EINVAL; -} - -__IEEE80211_IF_FILE_W(smps); - -static ssize_t ieee80211_if_fmt_tkip_mic_test( - const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) -{ - return -EOPNOTSUPP; -} - -static int hwaddr_aton(const char *txt, u8 *addr) -{ - int i; - - for (i = 0; i < ETH_ALEN; i++) { - int a, b; - - a = hex_to_bin(*txt++); - if (a < 0) - return -1; - b = hex_to_bin(*txt++); - if (b < 0) - return -1; - *addr++ = (a << 4) | b; - if (i < 5 && *txt++ != ':') - return -1; - } - - return 0; -} - -static ssize_t ieee80211_if_parse_tkip_mic_test( - struct ieee80211_sub_if_data *sdata, const char *buf, int buflen) -{ - struct ieee80211_local *local = sdata->local; - u8 addr[ETH_ALEN]; - struct sk_buff *skb; - struct ieee80211_hdr *hdr; - __le16 fc; - - /* - * Assume colon-delimited MAC address with possible white space - * following. - */ - if (buflen < 3 * ETH_ALEN - 1) - return -EINVAL; - if (hwaddr_aton(buf, addr) < 0) - return -EINVAL; - - if (!ieee80211_sdata_running(sdata)) - return -ENOTCONN; - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + 24 + 100); - if (!skb) - return -ENOMEM; - skb_reserve(skb, local->hw.extra_tx_headroom); - - hdr = (struct ieee80211_hdr *) skb_put(skb, 24); - memset(hdr, 0, 24); - fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); - - switch (sdata->vif.type) { - case NL80211_IFTYPE_AP: - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); - /* DA BSSID SA */ - memcpy(hdr->addr1, addr, ETH_ALEN); - memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); - memcpy(hdr->addr3, sdata->vif.addr, ETH_ALEN); - break; - case NL80211_IFTYPE_STATION: - fc |= cpu_to_le16(IEEE80211_FCTL_TODS); - /* BSSID SA DA */ - if (sdata->vif.bss_conf.bssid == NULL) { - dev_kfree_skb(skb); - return -ENOTCONN; - } - memcpy(hdr->addr1, sdata->vif.bss_conf.bssid, ETH_ALEN); - memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); - memcpy(hdr->addr3, addr, ETH_ALEN); - break; - default: - dev_kfree_skb(skb); - return -EOPNOTSUPP; - } - hdr->frame_control = fc; - - /* - * Add some length to the test frame to make it look bit more valid. - * The exact contents does not matter since the recipient is required - * to drop this because of the Michael MIC failure. - */ - memset(skb_put(skb, 50), 0, 50); - - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_TKIP_MIC_FAILURE; - - ieee80211_tx_skb(sdata, skb); - - return buflen; -} - -__IEEE80211_IF_FILE_W(tkip_mic_test); - -static ssize_t ieee80211_if_fmt_uapsd_queues( - const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) -{ - const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - return snprintf(buf, buflen, "0x%x\n", ifmgd->uapsd_queues); -} - -static ssize_t ieee80211_if_parse_uapsd_queues( - struct ieee80211_sub_if_data *sdata, const char *buf, int buflen) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - u8 val; - int ret; - - ret = kstrtou8(buf, 0, &val); - if (ret) - return ret; - - if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) - return -ERANGE; - - ifmgd->uapsd_queues = val; - - return buflen; -} -__IEEE80211_IF_FILE_W(uapsd_queues); - -static ssize_t ieee80211_if_fmt_uapsd_max_sp_len( - const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) -{ - const struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - return snprintf(buf, buflen, "0x%x\n", ifmgd->uapsd_max_sp_len); -} - -static ssize_t ieee80211_if_parse_uapsd_max_sp_len( - struct ieee80211_sub_if_data *sdata, const char *buf, int buflen) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - unsigned long val; - int ret; - - ret = kstrtoul(buf, 0, &val); - if (ret) - return -EINVAL; - - if (val & ~IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK) - return -ERANGE; - - ifmgd->uapsd_max_sp_len = val; - - return buflen; -} -__IEEE80211_IF_FILE_W(uapsd_max_sp_len); - -/* AP attributes */ -IEEE80211_IF_FILE(num_sta_authorized, u.ap.num_sta_authorized, ATOMIC); -IEEE80211_IF_FILE(num_sta_ps, u.ap.num_sta_ps, ATOMIC); -IEEE80211_IF_FILE(dtim_count, u.ap.dtim_count, DEC); - -static ssize_t ieee80211_if_fmt_num_buffered_multicast( - const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) -{ - return scnprintf(buf, buflen, "%u\n", - skb_queue_len(&sdata->u.ap.ps_bc_buf)); -} -__IEEE80211_IF_FILE(num_buffered_multicast, NULL); - -/* IBSS attributes */ -static ssize_t ieee80211_if_fmt_tsf( - const struct ieee80211_sub_if_data *sdata, char *buf, int buflen) -{ - struct ieee80211_local *local = sdata->local; - u64 tsf; - - tsf = drv_get_tsf(local, (struct ieee80211_sub_if_data *)sdata); - - return scnprintf(buf, buflen, "0x%016llx\n", (unsigned long long) tsf); -} - -static ssize_t ieee80211_if_parse_tsf( - struct ieee80211_sub_if_data *sdata, const char *buf, int buflen) -{ - struct ieee80211_local *local = sdata->local; - unsigned long long tsf; - int ret; - - if (strncmp(buf, "reset", 5) == 0) { - if (local->ops->reset_tsf) { - drv_reset_tsf(local, sdata); - wiphy_info(local->hw.wiphy, "debugfs reset TSF\n"); - } - } else { - ret = kstrtoull(buf, 10, &tsf); - if (ret < 0) - return -EINVAL; - if (local->ops->set_tsf) { - drv_set_tsf(local, sdata, tsf); - wiphy_info(local->hw.wiphy, - "debugfs set TSF to %#018llx\n", tsf); - } - } - - return buflen; -} -__IEEE80211_IF_FILE_W(tsf); - - -/* WDS attributes */ -IEEE80211_IF_FILE(peer, u.wds.remote_addr, MAC); - -#ifdef CONFIG_MAC80211_MESH -/* Mesh stats attributes */ -IEEE80211_IF_FILE(fwded_mcast, u.mesh.mshstats.fwded_mcast, DEC); -IEEE80211_IF_FILE(fwded_unicast, u.mesh.mshstats.fwded_unicast, DEC); -IEEE80211_IF_FILE(fwded_frames, u.mesh.mshstats.fwded_frames, DEC); -IEEE80211_IF_FILE(dropped_frames_ttl, u.mesh.mshstats.dropped_frames_ttl, DEC); -IEEE80211_IF_FILE(dropped_frames_congestion, - u.mesh.mshstats.dropped_frames_congestion, DEC); -IEEE80211_IF_FILE(dropped_frames_no_route, - u.mesh.mshstats.dropped_frames_no_route, DEC); -IEEE80211_IF_FILE(estab_plinks, u.mesh.mshstats.estab_plinks, ATOMIC); - -/* Mesh parameters */ -IEEE80211_IF_FILE(dot11MeshMaxRetries, - u.mesh.mshcfg.dot11MeshMaxRetries, DEC); -IEEE80211_IF_FILE(dot11MeshRetryTimeout, - u.mesh.mshcfg.dot11MeshRetryTimeout, DEC); -IEEE80211_IF_FILE(dot11MeshConfirmTimeout, - u.mesh.mshcfg.dot11MeshConfirmTimeout, DEC); -IEEE80211_IF_FILE(dot11MeshHoldingTimeout, - u.mesh.mshcfg.dot11MeshHoldingTimeout, DEC); -IEEE80211_IF_FILE(dot11MeshTTL, u.mesh.mshcfg.dot11MeshTTL, DEC); -IEEE80211_IF_FILE(element_ttl, u.mesh.mshcfg.element_ttl, DEC); -IEEE80211_IF_FILE(auto_open_plinks, u.mesh.mshcfg.auto_open_plinks, DEC); -IEEE80211_IF_FILE(dot11MeshMaxPeerLinks, - u.mesh.mshcfg.dot11MeshMaxPeerLinks, DEC); -IEEE80211_IF_FILE(dot11MeshHWMPactivePathTimeout, - u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout, DEC); -IEEE80211_IF_FILE(dot11MeshHWMPpreqMinInterval, - u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval, DEC); -IEEE80211_IF_FILE(dot11MeshHWMPperrMinInterval, - u.mesh.mshcfg.dot11MeshHWMPperrMinInterval, DEC); -IEEE80211_IF_FILE(dot11MeshHWMPnetDiameterTraversalTime, - u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime, DEC); -IEEE80211_IF_FILE(dot11MeshHWMPmaxPREQretries, - u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries, DEC); -IEEE80211_IF_FILE(path_refresh_time, - u.mesh.mshcfg.path_refresh_time, DEC); -IEEE80211_IF_FILE(min_discovery_timeout, - u.mesh.mshcfg.min_discovery_timeout, DEC); -IEEE80211_IF_FILE(dot11MeshHWMPRootMode, - u.mesh.mshcfg.dot11MeshHWMPRootMode, DEC); -IEEE80211_IF_FILE(dot11MeshGateAnnouncementProtocol, - u.mesh.mshcfg.dot11MeshGateAnnouncementProtocol, DEC); -IEEE80211_IF_FILE(dot11MeshHWMPRannInterval, - u.mesh.mshcfg.dot11MeshHWMPRannInterval, DEC); -IEEE80211_IF_FILE(dot11MeshForwarding, u.mesh.mshcfg.dot11MeshForwarding, DEC); -IEEE80211_IF_FILE(rssi_threshold, u.mesh.mshcfg.rssi_threshold, DEC); -#endif - - -#define DEBUGFS_ADD(name) \ - debugfs_create_file(#name, 0400, sdata->debugfs.dir, \ - sdata, &name##_ops); - -#define DEBUGFS_ADD_MODE(name, mode) \ - debugfs_create_file(#name, mode, sdata->debugfs.dir, \ - sdata, &name##_ops); - -static void add_sta_files(struct ieee80211_sub_if_data *sdata) -{ - DEBUGFS_ADD(drop_unencrypted); - DEBUGFS_ADD(flags); - DEBUGFS_ADD(state); - DEBUGFS_ADD(channel_type); - DEBUGFS_ADD(rc_rateidx_mask_2ghz); - DEBUGFS_ADD(rc_rateidx_mask_5ghz); - DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz); - DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz); - - DEBUGFS_ADD(bssid); - DEBUGFS_ADD(aid); - DEBUGFS_ADD(last_beacon); - DEBUGFS_ADD(ave_beacon); - DEBUGFS_ADD_MODE(smps, 0600); - DEBUGFS_ADD_MODE(tkip_mic_test, 0200); - DEBUGFS_ADD_MODE(uapsd_queues, 0600); - DEBUGFS_ADD_MODE(uapsd_max_sp_len, 0600); -} - -static void add_ap_files(struct ieee80211_sub_if_data *sdata) -{ - DEBUGFS_ADD(drop_unencrypted); - DEBUGFS_ADD(flags); - DEBUGFS_ADD(state); - DEBUGFS_ADD(channel_type); - DEBUGFS_ADD(rc_rateidx_mask_2ghz); - DEBUGFS_ADD(rc_rateidx_mask_5ghz); - DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz); - DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz); - - DEBUGFS_ADD(num_sta_authorized); - DEBUGFS_ADD(num_sta_ps); - DEBUGFS_ADD(dtim_count); - DEBUGFS_ADD(num_buffered_multicast); - DEBUGFS_ADD_MODE(tkip_mic_test, 0200); -} - -static void add_ibss_files(struct ieee80211_sub_if_data *sdata) -{ - DEBUGFS_ADD(channel_type); - DEBUGFS_ADD(rc_rateidx_mask_2ghz); - DEBUGFS_ADD(rc_rateidx_mask_5ghz); - DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz); - DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz); - - DEBUGFS_ADD_MODE(tsf, 0600); -} - -static void add_wds_files(struct ieee80211_sub_if_data *sdata) -{ - DEBUGFS_ADD(drop_unencrypted); - DEBUGFS_ADD(flags); - DEBUGFS_ADD(state); - DEBUGFS_ADD(channel_type); - DEBUGFS_ADD(rc_rateidx_mask_2ghz); - DEBUGFS_ADD(rc_rateidx_mask_5ghz); - DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz); - DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz); - - DEBUGFS_ADD(peer); -} - -static void add_vlan_files(struct ieee80211_sub_if_data *sdata) -{ - DEBUGFS_ADD(drop_unencrypted); - DEBUGFS_ADD(flags); - DEBUGFS_ADD(state); - DEBUGFS_ADD(channel_type); - DEBUGFS_ADD(rc_rateidx_mask_2ghz); - DEBUGFS_ADD(rc_rateidx_mask_5ghz); - DEBUGFS_ADD(rc_rateidx_mcs_mask_2ghz); - DEBUGFS_ADD(rc_rateidx_mcs_mask_5ghz); -} - -static void add_monitor_files(struct ieee80211_sub_if_data *sdata) -{ - DEBUGFS_ADD(flags); - DEBUGFS_ADD(state); - DEBUGFS_ADD(channel_type); -} - -#ifdef CONFIG_MAC80211_MESH - -static void add_mesh_files(struct ieee80211_sub_if_data *sdata) -{ - DEBUGFS_ADD_MODE(tsf, 0600); -} - -static void add_mesh_stats(struct ieee80211_sub_if_data *sdata) -{ - struct dentry *dir = debugfs_create_dir("mesh_stats", - sdata->debugfs.dir); -#define MESHSTATS_ADD(name)\ - debugfs_create_file(#name, 0400, dir, sdata, &name##_ops); - - MESHSTATS_ADD(fwded_mcast); - MESHSTATS_ADD(fwded_unicast); - MESHSTATS_ADD(fwded_frames); - MESHSTATS_ADD(dropped_frames_ttl); - MESHSTATS_ADD(dropped_frames_no_route); - MESHSTATS_ADD(dropped_frames_congestion); - MESHSTATS_ADD(estab_plinks); -#undef MESHSTATS_ADD -} - -static void add_mesh_config(struct ieee80211_sub_if_data *sdata) -{ - struct dentry *dir = debugfs_create_dir("mesh_config", - sdata->debugfs.dir); - -#define MESHPARAMS_ADD(name) \ - debugfs_create_file(#name, 0600, dir, sdata, &name##_ops); - - MESHPARAMS_ADD(dot11MeshMaxRetries); - MESHPARAMS_ADD(dot11MeshRetryTimeout); - MESHPARAMS_ADD(dot11MeshConfirmTimeout); - MESHPARAMS_ADD(dot11MeshHoldingTimeout); - MESHPARAMS_ADD(dot11MeshTTL); - MESHPARAMS_ADD(element_ttl); - MESHPARAMS_ADD(auto_open_plinks); - MESHPARAMS_ADD(dot11MeshMaxPeerLinks); - MESHPARAMS_ADD(dot11MeshHWMPactivePathTimeout); - MESHPARAMS_ADD(dot11MeshHWMPpreqMinInterval); - MESHPARAMS_ADD(dot11MeshHWMPperrMinInterval); - MESHPARAMS_ADD(dot11MeshHWMPnetDiameterTraversalTime); - MESHPARAMS_ADD(dot11MeshHWMPmaxPREQretries); - MESHPARAMS_ADD(path_refresh_time); - MESHPARAMS_ADD(min_discovery_timeout); - MESHPARAMS_ADD(dot11MeshHWMPRootMode); - MESHPARAMS_ADD(dot11MeshHWMPRannInterval); - MESHPARAMS_ADD(dot11MeshGateAnnouncementProtocol); - MESHPARAMS_ADD(rssi_threshold); -#undef MESHPARAMS_ADD -} -#endif - -static void add_files(struct ieee80211_sub_if_data *sdata) -{ - if (!sdata->debugfs.dir) - return; - - switch (sdata->vif.type) { - case NL80211_IFTYPE_MESH_POINT: -#ifdef CONFIG_MAC80211_MESH - add_mesh_files(sdata); - add_mesh_stats(sdata); - add_mesh_config(sdata); -#endif - break; - case NL80211_IFTYPE_STATION: - add_sta_files(sdata); - break; - case NL80211_IFTYPE_ADHOC: - add_ibss_files(sdata); - break; - case NL80211_IFTYPE_AP: - add_ap_files(sdata); - break; - case NL80211_IFTYPE_WDS: - add_wds_files(sdata); - break; - case NL80211_IFTYPE_MONITOR: - add_monitor_files(sdata); - break; - case NL80211_IFTYPE_AP_VLAN: - add_vlan_files(sdata); - break; - default: - break; - } -} - -void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata) -{ - char buf[10+IFNAMSIZ]; - - sprintf(buf, "netdev:%s", sdata->name); - sdata->debugfs.dir = debugfs_create_dir(buf, - sdata->local->hw.wiphy->debugfsdir); - if (sdata->debugfs.dir) - sdata->debugfs.subdir_stations = debugfs_create_dir("stations", - sdata->debugfs.dir); - add_files(sdata); -} - -void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata) -{ - if (!sdata->debugfs.dir) - return; - - debugfs_remove_recursive(sdata->debugfs.dir); - sdata->debugfs.dir = NULL; -} - -void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata) -{ - struct dentry *dir; - char buf[10 + IFNAMSIZ]; - - dir = sdata->debugfs.dir; - - if (!dir) - return; - - sprintf(buf, "netdev:%s", sdata->name); - if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf)) - printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs " - "dir to %s\n", buf); -} diff --git a/openairITS/mac/DOT11/net/mac80211/debugfs_netdev.h b/openairITS/mac/DOT11/net/mac80211/debugfs_netdev.h deleted file mode 100644 index 79025e79f4d..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/debugfs_netdev.h +++ /dev/null @@ -1,22 +0,0 @@ -/* routines exported for debugfs handling */ - -#ifndef __IEEE80211_DEBUGFS_NETDEV_H -#define __IEEE80211_DEBUGFS_NETDEV_H - -#ifdef CONFIG_MAC80211_DEBUGFS -void ieee80211_debugfs_add_netdev(struct ieee80211_sub_if_data *sdata); -void ieee80211_debugfs_remove_netdev(struct ieee80211_sub_if_data *sdata); -void ieee80211_debugfs_rename_netdev(struct ieee80211_sub_if_data *sdata); -#else -static inline void ieee80211_debugfs_add_netdev( - struct ieee80211_sub_if_data *sdata) -{} -static inline void ieee80211_debugfs_remove_netdev( - struct ieee80211_sub_if_data *sdata) -{} -static inline void ieee80211_debugfs_rename_netdev( - struct ieee80211_sub_if_data *sdata) -{} -#endif - -#endif /* __IEEE80211_DEBUGFS_NETDEV_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/debugfs_sta.c b/openairITS/mac/DOT11/net/mac80211/debugfs_sta.c deleted file mode 100644 index 832b2da5e4c..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/debugfs_sta.c +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright 2003-2005 Devicescape Software, Inc. - * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> - * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/debugfs.h> -#include <linux/ieee80211.h> -#include "ieee80211_i.h" -#include "debugfs.h" -#include "debugfs_sta.h" -#include "sta_info.h" - -/* sta attributtes */ - -#define STA_READ(name, field, format_string) \ -static ssize_t sta_ ##name## _read(struct file *file, \ - char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - struct sta_info *sta = file->private_data; \ - return mac80211_format_buffer(userbuf, count, ppos, \ - format_string, sta->field); \ -} -#define STA_READ_D(name, field) STA_READ(name, field, "%d\n") -#define STA_READ_U(name, field) STA_READ(name, field, "%u\n") -#define STA_READ_S(name, field) STA_READ(name, field, "%s\n") - -#define STA_OPS(name) \ -static const struct file_operations sta_ ##name## _ops = { \ - .read = sta_##name##_read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -} - -#define STA_OPS_RW(name) \ -static const struct file_operations sta_ ##name## _ops = { \ - .read = sta_##name##_read, \ - .write = sta_##name##_write, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -} - -#define STA_FILE(name, field, format) \ - STA_READ_##format(name, field) \ - STA_OPS(name) - -STA_FILE(aid, sta.aid, D); -STA_FILE(dev, sdata->name, S); -STA_FILE(last_signal, last_signal, D); - -static ssize_t sta_flags_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - char buf[121]; - struct sta_info *sta = file->private_data; - -#define TEST(flg) \ - test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : "" - - int res = scnprintf(buf, sizeof(buf), - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", - TEST(AUTH), TEST(ASSOC), TEST(PS_STA), - TEST(PS_DRIVER), TEST(AUTHORIZED), - TEST(SHORT_PREAMBLE), - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT), - TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL), - TEST(UAPSD), TEST(SP), TEST(TDLS_PEER), - TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT), - TEST(INSERTED), TEST(RATE_CONTROL)); -#undef TEST - return simple_read_from_buffer(userbuf, count, ppos, buf, res); -} -STA_OPS(flags); - -static ssize_t sta_num_ps_buf_frames_read(struct file *file, - char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct sta_info *sta = file->private_data; - char buf[17*IEEE80211_NUM_ACS], *p = buf; - int ac; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - p += scnprintf(p, sizeof(buf)+buf-p, "AC%d: %d\n", ac, - skb_queue_len(&sta->ps_tx_buf[ac]) + - skb_queue_len(&sta->tx_filtered[ac])); - return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); -} -STA_OPS(num_ps_buf_frames); - -static ssize_t sta_inactive_ms_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct sta_info *sta = file->private_data; - return mac80211_format_buffer(userbuf, count, ppos, "%d\n", - jiffies_to_msecs(jiffies - sta->last_rx)); -} -STA_OPS(inactive_ms); - - -static ssize_t sta_connected_time_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct sta_info *sta = file->private_data; - struct timespec uptime; - struct tm result; - long connected_time_secs; - char buf[100]; - int res; - do_posix_clock_monotonic_gettime(&uptime); - connected_time_secs = uptime.tv_sec - sta->last_connected; - time_to_tm(connected_time_secs, 0, &result); - result.tm_year -= 70; - result.tm_mday -= 1; - res = scnprintf(buf, sizeof(buf), - "years - %ld\nmonths - %d\ndays - %d\nclock - %d:%d:%d\n\n", - result.tm_year, result.tm_mon, result.tm_mday, - result.tm_hour, result.tm_min, result.tm_sec); - return simple_read_from_buffer(userbuf, count, ppos, buf, res); -} -STA_OPS(connected_time); - - - -static ssize_t sta_last_seq_ctrl_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - char buf[15*NUM_RX_DATA_QUEUES], *p = buf; - int i; - struct sta_info *sta = file->private_data; - for (i = 0; i < NUM_RX_DATA_QUEUES; i++) - p += scnprintf(p, sizeof(buf)+buf-p, "%x ", - le16_to_cpu(sta->last_seq_ctrl[i])); - p += scnprintf(p, sizeof(buf)+buf-p, "\n"); - return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); -} -STA_OPS(last_seq_ctrl); - -static ssize_t sta_agg_status_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - char buf[71 + STA_TID_NUM * 40], *p = buf; - int i; - struct sta_info *sta = file->private_data; - struct tid_ampdu_rx *tid_rx; - struct tid_ampdu_tx *tid_tx; - - rcu_read_lock(); - - p += scnprintf(p, sizeof(buf) + buf - p, "next dialog_token: %#02x\n", - sta->ampdu_mlme.dialog_token_allocator + 1); - p += scnprintf(p, sizeof(buf) + buf - p, - "TID\t\tRX active\tDTKN\tSSN\t\tTX\tDTKN\tpending\n"); - - for (i = 0; i < STA_TID_NUM; i++) { - tid_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[i]); - tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[i]); - - p += scnprintf(p, sizeof(buf) + buf - p, "%02d", i); - p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", !!tid_rx); - p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x", - tid_rx ? tid_rx->dialog_token : 0); - p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.3x", - tid_rx ? tid_rx->ssn : 0); - - p += scnprintf(p, sizeof(buf) + buf - p, "\t\t%x", !!tid_tx); - p += scnprintf(p, sizeof(buf) + buf - p, "\t%#.2x", - tid_tx ? tid_tx->dialog_token : 0); - p += scnprintf(p, sizeof(buf) + buf - p, "\t%03d", - tid_tx ? skb_queue_len(&tid_tx->pending) : 0); - p += scnprintf(p, sizeof(buf) + buf - p, "\n"); - } - rcu_read_unlock(); - - return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); -} - -static ssize_t sta_agg_status_write(struct file *file, const char __user *userbuf, - size_t count, loff_t *ppos) -{ - char _buf[12], *buf = _buf; - struct sta_info *sta = file->private_data; - bool start, tx; - unsigned long tid; - int ret; - - if (count > sizeof(_buf)) - return -EINVAL; - - if (copy_from_user(buf, userbuf, count)) - return -EFAULT; - - buf[sizeof(_buf) - 1] = '\0'; - - if (strncmp(buf, "tx ", 3) == 0) { - buf += 3; - tx = true; - } else if (strncmp(buf, "rx ", 3) == 0) { - buf += 3; - tx = false; - } else - return -EINVAL; - - if (strncmp(buf, "start ", 6) == 0) { - buf += 6; - start = true; - if (!tx) - return -EINVAL; - } else if (strncmp(buf, "stop ", 5) == 0) { - buf += 5; - start = false; - } else - return -EINVAL; - - tid = simple_strtoul(buf, NULL, 0); - - if (tid >= STA_TID_NUM) - return -EINVAL; - - if (tx) { - if (start) - ret = ieee80211_start_tx_ba_session(&sta->sta, tid, 5000); - else - ret = ieee80211_stop_tx_ba_session(&sta->sta, tid); - } else { - __ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_RECIPIENT, - 3, true); - ret = 0; - } - - return ret ?: count; -} -STA_OPS_RW(agg_status); - -static ssize_t sta_ht_capa_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ -#define PRINT_HT_CAP(_cond, _str) \ - do { \ - if (_cond) \ - p += scnprintf(p, sizeof(buf)+buf-p, "\t" _str "\n"); \ - } while (0) - char buf[512], *p = buf; - int i; - struct sta_info *sta = file->private_data; - struct ieee80211_sta_ht_cap *htc = &sta->sta.ht_cap; - - p += scnprintf(p, sizeof(buf) + buf - p, "ht %ssupported\n", - htc->ht_supported ? "" : "not "); - if (htc->ht_supported) { - p += scnprintf(p, sizeof(buf)+buf-p, "cap: %#.4x\n", htc->cap); - - PRINT_HT_CAP((htc->cap & BIT(0)), "RX LDPC"); - PRINT_HT_CAP((htc->cap & BIT(1)), "HT20/HT40"); - PRINT_HT_CAP(!(htc->cap & BIT(1)), "HT20"); - - PRINT_HT_CAP(((htc->cap >> 2) & 0x3) == 0, "Static SM Power Save"); - PRINT_HT_CAP(((htc->cap >> 2) & 0x3) == 1, "Dynamic SM Power Save"); - PRINT_HT_CAP(((htc->cap >> 2) & 0x3) == 3, "SM Power Save disabled"); - - PRINT_HT_CAP((htc->cap & BIT(4)), "RX Greenfield"); - PRINT_HT_CAP((htc->cap & BIT(5)), "RX HT20 SGI"); - PRINT_HT_CAP((htc->cap & BIT(6)), "RX HT40 SGI"); - PRINT_HT_CAP((htc->cap & BIT(7)), "TX STBC"); - - PRINT_HT_CAP(((htc->cap >> 8) & 0x3) == 0, "No RX STBC"); - PRINT_HT_CAP(((htc->cap >> 8) & 0x3) == 1, "RX STBC 1-stream"); - PRINT_HT_CAP(((htc->cap >> 8) & 0x3) == 2, "RX STBC 2-streams"); - PRINT_HT_CAP(((htc->cap >> 8) & 0x3) == 3, "RX STBC 3-streams"); - - PRINT_HT_CAP((htc->cap & BIT(10)), "HT Delayed Block Ack"); - - PRINT_HT_CAP(!(htc->cap & BIT(11)), "Max AMSDU length: " - "3839 bytes"); - PRINT_HT_CAP((htc->cap & BIT(11)), "Max AMSDU length: " - "7935 bytes"); - - /* - * For beacons and probe response this would mean the BSS - * does or does not allow the usage of DSSS/CCK HT40. - * Otherwise it means the STA does or does not use - * DSSS/CCK HT40. - */ - PRINT_HT_CAP((htc->cap & BIT(12)), "DSSS/CCK HT40"); - PRINT_HT_CAP(!(htc->cap & BIT(12)), "No DSSS/CCK HT40"); - - /* BIT(13) is reserved */ - - PRINT_HT_CAP((htc->cap & BIT(14)), "40 MHz Intolerant"); - - PRINT_HT_CAP((htc->cap & BIT(15)), "L-SIG TXOP protection"); - - p += scnprintf(p, sizeof(buf)+buf-p, "ampdu factor/density: %d/%d\n", - htc->ampdu_factor, htc->ampdu_density); - p += scnprintf(p, sizeof(buf)+buf-p, "MCS mask:"); - - for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) - p += scnprintf(p, sizeof(buf)+buf-p, " %.2x", - htc->mcs.rx_mask[i]); - p += scnprintf(p, sizeof(buf)+buf-p, "\n"); - - /* If not set this is meaningless */ - if (le16_to_cpu(htc->mcs.rx_highest)) { - p += scnprintf(p, sizeof(buf)+buf-p, - "MCS rx highest: %d Mbps\n", - le16_to_cpu(htc->mcs.rx_highest)); - } - - p += scnprintf(p, sizeof(buf)+buf-p, "MCS tx params: %x\n", - htc->mcs.tx_params); - } - - return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); -} -STA_OPS(ht_capa); - -#define DEBUGFS_ADD(name) \ - debugfs_create_file(#name, 0400, \ - sta->debugfs.dir, sta, &sta_ ##name## _ops); - -#define DEBUGFS_ADD_COUNTER(name, field) \ - if (sizeof(sta->field) == sizeof(u32)) \ - debugfs_create_u32(#name, 0400, sta->debugfs.dir, \ - (u32 *) &sta->field); \ - else \ - debugfs_create_u64(#name, 0400, sta->debugfs.dir, \ - (u64 *) &sta->field); - -void ieee80211_sta_debugfs_add(struct sta_info *sta) -{ - struct dentry *stations_dir = sta->sdata->debugfs.subdir_stations; - u8 mac[3*ETH_ALEN]; - - sta->debugfs.add_has_run = true; - - if (!stations_dir) - return; - - snprintf(mac, sizeof(mac), "%pM", sta->sta.addr); - - /* - * This might fail due to a race condition: - * When mac80211 unlinks a station, the debugfs entries - * remain, but it is already possible to link a new - * station with the same address which triggers adding - * it to debugfs; therefore, if the old station isn't - * destroyed quickly enough the old station's debugfs - * dir might still be around. - */ - sta->debugfs.dir = debugfs_create_dir(mac, stations_dir); - if (!sta->debugfs.dir) - return; - - DEBUGFS_ADD(flags); - DEBUGFS_ADD(num_ps_buf_frames); - DEBUGFS_ADD(inactive_ms); - DEBUGFS_ADD(connected_time); - DEBUGFS_ADD(last_seq_ctrl); - DEBUGFS_ADD(agg_status); - DEBUGFS_ADD(dev); - DEBUGFS_ADD(last_signal); - DEBUGFS_ADD(ht_capa); - - DEBUGFS_ADD_COUNTER(rx_packets, rx_packets); - DEBUGFS_ADD_COUNTER(tx_packets, tx_packets); - DEBUGFS_ADD_COUNTER(rx_bytes, rx_bytes); - DEBUGFS_ADD_COUNTER(tx_bytes, tx_bytes); - DEBUGFS_ADD_COUNTER(rx_duplicates, num_duplicates); - DEBUGFS_ADD_COUNTER(rx_fragments, rx_fragments); - DEBUGFS_ADD_COUNTER(rx_dropped, rx_dropped); - DEBUGFS_ADD_COUNTER(tx_fragments, tx_fragments); - DEBUGFS_ADD_COUNTER(tx_filtered, tx_filtered_count); - DEBUGFS_ADD_COUNTER(tx_retry_failed, tx_retry_failed); - DEBUGFS_ADD_COUNTER(tx_retry_count, tx_retry_count); - DEBUGFS_ADD_COUNTER(wep_weak_iv_count, wep_weak_iv_count); -} - -void ieee80211_sta_debugfs_remove(struct sta_info *sta) -{ - debugfs_remove_recursive(sta->debugfs.dir); - sta->debugfs.dir = NULL; -} diff --git a/openairITS/mac/DOT11/net/mac80211/debugfs_sta.h b/openairITS/mac/DOT11/net/mac80211/debugfs_sta.h deleted file mode 100644 index 8b608903259..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/debugfs_sta.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __MAC80211_DEBUGFS_STA_H -#define __MAC80211_DEBUGFS_STA_H - -#include "sta_info.h" - -#ifdef CONFIG_MAC80211_DEBUGFS -void ieee80211_sta_debugfs_add(struct sta_info *sta); -void ieee80211_sta_debugfs_remove(struct sta_info *sta); -#else -static inline void ieee80211_sta_debugfs_add(struct sta_info *sta) {} -static inline void ieee80211_sta_debugfs_remove(struct sta_info *sta) {} -#endif - -#endif /* __MAC80211_DEBUGFS_STA_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/driver-ops.h b/openairITS/mac/DOT11/net/mac80211/driver-ops.h deleted file mode 100644 index 7f00fe2e8cc..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/driver-ops.h +++ /dev/null @@ -1,794 +0,0 @@ -#ifndef __MAC80211_DRIVER_OPS -#define __MAC80211_DRIVER_OPS - -#include <net/mac80211.h> -#include "ieee80211_i.h" -#include "driver-trace.h" - -static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata) -{ - WARN_ON(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER)); -} - -static inline struct ieee80211_sub_if_data * -get_bss_sdata(struct ieee80211_sub_if_data *sdata) -{ - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, - u.ap); - - return sdata; -} - -static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb) -{ - local->ops->tx(&local->hw, skb); -} - -static inline void drv_tx_frags(struct ieee80211_local *local, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct sk_buff_head *skbs) -{ - local->ops->tx_frags(&local->hw, vif, sta, skbs); -} - -static inline int drv_start(struct ieee80211_local *local) -{ - int ret; - - might_sleep(); - - trace_drv_start(local); - local->started = true; - smp_mb(); - ret = local->ops->start(&local->hw); - trace_drv_return_int(local, ret); - return ret; -} - -static inline void drv_stop(struct ieee80211_local *local) -{ - might_sleep(); - - trace_drv_stop(local); - local->ops->stop(&local->hw); - trace_drv_return_void(local); - - /* sync away all work on the tasklet before clearing started */ - tasklet_disable(&local->tasklet); - tasklet_enable(&local->tasklet); - - barrier(); - - local->started = false; -} - -#ifdef CONFIG_PM -static inline int drv_suspend(struct ieee80211_local *local, - struct cfg80211_wowlan *wowlan) -{ - int ret; - - might_sleep(); - - trace_drv_suspend(local); - ret = local->ops->suspend(&local->hw, wowlan); - trace_drv_return_int(local, ret); - return ret; -} - -static inline int drv_resume(struct ieee80211_local *local) -{ - int ret; - - might_sleep(); - - trace_drv_resume(local); - ret = local->ops->resume(&local->hw); - trace_drv_return_int(local, ret); - return ret; -} -#endif - -static inline int drv_add_interface(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata) -{ - int ret; - - might_sleep(); - - if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_AP_VLAN || - sdata->vif.type == NL80211_IFTYPE_MONITOR)) - return -EINVAL; - - trace_drv_add_interface(local, sdata); - ret = local->ops->add_interface(&local->hw, &sdata->vif); - trace_drv_return_int(local, ret); - - if (ret == 0) - sdata->flags |= IEEE80211_SDATA_IN_DRIVER; - - return ret; -} - -static inline int drv_change_interface(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - enum nl80211_iftype type, bool p2p) -{ - int ret; - - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_change_interface(local, sdata, type, p2p); - ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p); - trace_drv_return_int(local, ret); - return ret; -} - -static inline void drv_remove_interface(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata) -{ - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_remove_interface(local, sdata); - local->ops->remove_interface(&local->hw, &sdata->vif); - sdata->flags &= ~IEEE80211_SDATA_IN_DRIVER; - trace_drv_return_void(local); -} - -static inline int drv_config(struct ieee80211_local *local, u32 changed) -{ - int ret; - - might_sleep(); - - trace_drv_config(local, changed); - ret = local->ops->config(&local->hw, changed); - trace_drv_return_int(local, ret); - return ret; -} - -static inline void drv_bss_info_changed(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_bss_conf *info, - u32 changed) -{ - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_bss_info_changed(local, sdata, info, changed); - if (local->ops->bss_info_changed) - local->ops->bss_info_changed(&local->hw, &sdata->vif, info, changed); - trace_drv_return_void(local); -} - -static inline u64 drv_prepare_multicast(struct ieee80211_local *local, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - struct netdev_hw_addr_list *mc_list) -#else - int mc_count, - struct dev_addr_list *mc_list) -#endif -{ - u64 ret = 0; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - trace_drv_prepare_multicast(local, mc_list->count); -#else - trace_drv_prepare_multicast(local, mc_count); -#endif - - if (local->ops->prepare_multicast) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - ret = local->ops->prepare_multicast(&local->hw, mc_list); -#else - ret = local->ops->prepare_multicast(&local->hw, mc_count, - mc_list); -#endif - - trace_drv_return_u64(local, ret); - - return ret; -} - -static inline void drv_configure_filter(struct ieee80211_local *local, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast) -{ - might_sleep(); - - trace_drv_configure_filter(local, changed_flags, total_flags, - multicast); - local->ops->configure_filter(&local->hw, changed_flags, total_flags, - multicast); - trace_drv_return_void(local); -} - -static inline int drv_set_tim(struct ieee80211_local *local, - struct ieee80211_sta *sta, bool set) -{ - int ret = 0; - trace_drv_set_tim(local, sta, set); - if (local->ops->set_tim) - ret = local->ops->set_tim(&local->hw, sta, set); - trace_drv_return_int(local, ret); - return ret; -} - -static inline int drv_set_key(struct ieee80211_local *local, - enum set_key_cmd cmd, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) -{ - int ret; - - might_sleep(); - - sdata = get_bss_sdata(sdata); - check_sdata_in_driver(sdata); - - trace_drv_set_key(local, cmd, sdata, sta, key); - ret = local->ops->set_key(&local->hw, cmd, &sdata->vif, sta, key); - trace_drv_return_int(local, ret); - return ret; -} - -static inline void drv_update_tkip_key(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_key_conf *conf, - struct sta_info *sta, u32 iv32, - u16 *phase1key) -{ - struct ieee80211_sta *ista = NULL; - - if (sta) - ista = &sta->sta; - - sdata = get_bss_sdata(sdata); - check_sdata_in_driver(sdata); - - trace_drv_update_tkip_key(local, sdata, conf, ista, iv32); - if (local->ops->update_tkip_key) - local->ops->update_tkip_key(&local->hw, &sdata->vif, conf, - ista, iv32, phase1key); - trace_drv_return_void(local); -} - -static inline int drv_hw_scan(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct cfg80211_scan_request *req) -{ - int ret; - - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_hw_scan(local, sdata); - ret = local->ops->hw_scan(&local->hw, &sdata->vif, req); - trace_drv_return_int(local, ret); - return ret; -} - -static inline void drv_cancel_hw_scan(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata) -{ - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_cancel_hw_scan(local, sdata); - local->ops->cancel_hw_scan(&local->hw, &sdata->vif); - trace_drv_return_void(local); -} - -static inline int -drv_sched_scan_start(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct cfg80211_sched_scan_request *req, - struct ieee80211_sched_scan_ies *ies) -{ - int ret; - - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_sched_scan_start(local, sdata); - ret = local->ops->sched_scan_start(&local->hw, &sdata->vif, - req, ies); - trace_drv_return_int(local, ret); - return ret; -} - -static inline void drv_sched_scan_stop(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata) -{ - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_sched_scan_stop(local, sdata); - local->ops->sched_scan_stop(&local->hw, &sdata->vif); - trace_drv_return_void(local); -} - -static inline void drv_sw_scan_start(struct ieee80211_local *local) -{ - might_sleep(); - - trace_drv_sw_scan_start(local); - if (local->ops->sw_scan_start) - local->ops->sw_scan_start(&local->hw); - trace_drv_return_void(local); -} - -static inline void drv_sw_scan_complete(struct ieee80211_local *local) -{ - might_sleep(); - - trace_drv_sw_scan_complete(local); - if (local->ops->sw_scan_complete) - local->ops->sw_scan_complete(&local->hw); - trace_drv_return_void(local); -} - -static inline int drv_get_stats(struct ieee80211_local *local, - struct ieee80211_low_level_stats *stats) -{ - int ret = -EOPNOTSUPP; - - might_sleep(); - - if (local->ops->get_stats) - ret = local->ops->get_stats(&local->hw, stats); - trace_drv_get_stats(local, stats, ret); - - return ret; -} - -static inline void drv_get_tkip_seq(struct ieee80211_local *local, - u8 hw_key_idx, u32 *iv32, u16 *iv16) -{ - if (local->ops->get_tkip_seq) - local->ops->get_tkip_seq(&local->hw, hw_key_idx, iv32, iv16); - trace_drv_get_tkip_seq(local, hw_key_idx, iv32, iv16); -} - -static inline int drv_set_frag_threshold(struct ieee80211_local *local, - u32 value) -{ - int ret = 0; - - might_sleep(); - - trace_drv_set_frag_threshold(local, value); - if (local->ops->set_frag_threshold) - ret = local->ops->set_frag_threshold(&local->hw, value); - trace_drv_return_int(local, ret); - return ret; -} - -static inline int drv_set_rts_threshold(struct ieee80211_local *local, - u32 value) -{ - int ret = 0; - - might_sleep(); - - trace_drv_set_rts_threshold(local, value); - if (local->ops->set_rts_threshold) - ret = local->ops->set_rts_threshold(&local->hw, value); - trace_drv_return_int(local, ret); - return ret; -} - -static inline int drv_set_coverage_class(struct ieee80211_local *local, - u8 value) -{ - int ret = 0; - might_sleep(); - - trace_drv_set_coverage_class(local, value); - if (local->ops->set_coverage_class) - local->ops->set_coverage_class(&local->hw, value); - else - ret = -EOPNOTSUPP; - - trace_drv_return_int(local, ret); - return ret; -} - -static inline void drv_sta_notify(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - enum sta_notify_cmd cmd, - struct ieee80211_sta *sta) -{ - sdata = get_bss_sdata(sdata); - check_sdata_in_driver(sdata); - - trace_drv_sta_notify(local, sdata, cmd, sta); - if (local->ops->sta_notify) - local->ops->sta_notify(&local->hw, &sdata->vif, cmd, sta); - trace_drv_return_void(local); -} - -static inline int drv_sta_add(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta *sta) -{ - int ret = 0; - - might_sleep(); - - sdata = get_bss_sdata(sdata); - check_sdata_in_driver(sdata); - - trace_drv_sta_add(local, sdata, sta); - if (local->ops->sta_add) - ret = local->ops->sta_add(&local->hw, &sdata->vif, sta); - - trace_drv_return_int(local, ret); - - return ret; -} - -static inline void drv_sta_remove(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta *sta) -{ - might_sleep(); - - sdata = get_bss_sdata(sdata); - check_sdata_in_driver(sdata); - - trace_drv_sta_remove(local, sdata, sta); - if (local->ops->sta_remove) - local->ops->sta_remove(&local->hw, &sdata->vif, sta); - - trace_drv_return_void(local); -} - -static inline __must_check -int drv_sta_state(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct sta_info *sta, - enum ieee80211_sta_state old_state, - enum ieee80211_sta_state new_state) -{ - int ret = 0; - - might_sleep(); - - sdata = get_bss_sdata(sdata); - check_sdata_in_driver(sdata); - - trace_drv_sta_state(local, sdata, &sta->sta, old_state, new_state); - if (local->ops->sta_state) { - ret = local->ops->sta_state(&local->hw, &sdata->vif, &sta->sta, - old_state, new_state); - } else if (old_state == IEEE80211_STA_AUTH && - new_state == IEEE80211_STA_ASSOC) { - ret = drv_sta_add(local, sdata, &sta->sta); - if (ret == 0) - sta->uploaded = true; - } else if (old_state == IEEE80211_STA_ASSOC && - new_state == IEEE80211_STA_AUTH) { - drv_sta_remove(local, sdata, &sta->sta); - } - trace_drv_return_int(local, ret); - return ret; -} - -static inline int drv_conf_tx(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, u16 queue, - const struct ieee80211_tx_queue_params *params) -{ - int ret = -EOPNOTSUPP; - - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_conf_tx(local, sdata, queue, params); - if (local->ops->conf_tx) - ret = local->ops->conf_tx(&local->hw, &sdata->vif, - queue, params); - trace_drv_return_int(local, ret); - return ret; -} - -static inline u64 drv_get_tsf(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata) -{ - u64 ret = -1ULL; - - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_get_tsf(local, sdata); - if (local->ops->get_tsf) - ret = local->ops->get_tsf(&local->hw, &sdata->vif); - trace_drv_return_u64(local, ret); - return ret; -} - -static inline void drv_set_tsf(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - u64 tsf) -{ - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_set_tsf(local, sdata, tsf); - if (local->ops->set_tsf) - local->ops->set_tsf(&local->hw, &sdata->vif, tsf); - trace_drv_return_void(local); -} - -static inline void drv_reset_tsf(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata) -{ - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_reset_tsf(local, sdata); - if (local->ops->reset_tsf) - local->ops->reset_tsf(&local->hw, &sdata->vif); - trace_drv_return_void(local); -} - -static inline int drv_tx_last_beacon(struct ieee80211_local *local) -{ - int ret = 0; /* default unsuported op for less congestion */ - - might_sleep(); - - trace_drv_tx_last_beacon(local); - if (local->ops->tx_last_beacon) - ret = local->ops->tx_last_beacon(&local->hw); - trace_drv_return_int(local, ret); - return ret; -} - -static inline int drv_ampdu_action(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, - u16 *ssn, u8 buf_size) -{ - int ret = -EOPNOTSUPP; - - might_sleep(); - - sdata = get_bss_sdata(sdata); - check_sdata_in_driver(sdata); - - trace_drv_ampdu_action(local, sdata, action, sta, tid, ssn, buf_size); - - if (local->ops->ampdu_action) - ret = local->ops->ampdu_action(&local->hw, &sdata->vif, action, - sta, tid, ssn, buf_size); - - trace_drv_return_int(local, ret); - - return ret; -} - -static inline int drv_get_survey(struct ieee80211_local *local, int idx, - struct survey_info *survey) -{ - int ret = -EOPNOTSUPP; - - trace_drv_get_survey(local, idx, survey); - - if (local->ops->get_survey) - ret = local->ops->get_survey(&local->hw, idx, survey); - - trace_drv_return_int(local, ret); - - return ret; -} - -static inline void drv_rfkill_poll(struct ieee80211_local *local) -{ - might_sleep(); - - if (local->ops->rfkill_poll) - local->ops->rfkill_poll(&local->hw); -} - -static inline void drv_flush(struct ieee80211_local *local, bool drop) -{ - might_sleep(); - - trace_drv_flush(local, drop); - if (local->ops->flush) - local->ops->flush(&local->hw, drop); - trace_drv_return_void(local); -} - -static inline void drv_channel_switch(struct ieee80211_local *local, - struct ieee80211_channel_switch *ch_switch) -{ - might_sleep(); - - trace_drv_channel_switch(local, ch_switch); - local->ops->channel_switch(&local->hw, ch_switch); - trace_drv_return_void(local); -} - - -static inline int drv_set_antenna(struct ieee80211_local *local, - u32 tx_ant, u32 rx_ant) -{ - int ret = -EOPNOTSUPP; - might_sleep(); - if (local->ops->set_antenna) - ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant); - trace_drv_set_antenna(local, tx_ant, rx_ant, ret); - return ret; -} - -static inline int drv_get_antenna(struct ieee80211_local *local, - u32 *tx_ant, u32 *rx_ant) -{ - int ret = -EOPNOTSUPP; - might_sleep(); - if (local->ops->get_antenna) - ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant); - trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret); - return ret; -} - -static inline int drv_remain_on_channel(struct ieee80211_local *local, - struct ieee80211_channel *chan, - enum nl80211_channel_type chantype, - unsigned int duration) -{ - int ret; - - might_sleep(); - - trace_drv_remain_on_channel(local, chan, chantype, duration); - ret = local->ops->remain_on_channel(&local->hw, chan, chantype, - duration); - trace_drv_return_int(local, ret); - - return ret; -} - -static inline int drv_cancel_remain_on_channel(struct ieee80211_local *local) -{ - int ret; - - might_sleep(); - - trace_drv_cancel_remain_on_channel(local); - ret = local->ops->cancel_remain_on_channel(&local->hw); - trace_drv_return_int(local, ret); - - return ret; -} - -static inline int drv_set_ringparam(struct ieee80211_local *local, - u32 tx, u32 rx) -{ - int ret = -ENOTSUPP; - - might_sleep(); - - trace_drv_set_ringparam(local, tx, rx); - if (local->ops->set_ringparam) - ret = local->ops->set_ringparam(&local->hw, tx, rx); - trace_drv_return_int(local, ret); - - return ret; -} - -static inline void drv_get_ringparam(struct ieee80211_local *local, - u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max) -{ - might_sleep(); - - trace_drv_get_ringparam(local, tx, tx_max, rx, rx_max); - if (local->ops->get_ringparam) - local->ops->get_ringparam(&local->hw, tx, tx_max, rx, rx_max); - trace_drv_return_void(local); -} - -static inline bool drv_tx_frames_pending(struct ieee80211_local *local) -{ - bool ret = false; - - might_sleep(); - - trace_drv_tx_frames_pending(local); - if (local->ops->tx_frames_pending) - ret = local->ops->tx_frames_pending(&local->hw); - trace_drv_return_bool(local, ret); - - return ret; -} - -static inline int drv_set_bitrate_mask(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - const struct cfg80211_bitrate_mask *mask) -{ - int ret = -EOPNOTSUPP; - - might_sleep(); - - check_sdata_in_driver(sdata); - - trace_drv_set_bitrate_mask(local, sdata, mask); - if (local->ops->set_bitrate_mask) - ret = local->ops->set_bitrate_mask(&local->hw, - &sdata->vif, mask); - trace_drv_return_int(local, ret); - - return ret; -} - -static inline void drv_set_rekey_data(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct cfg80211_gtk_rekey_data *data) -{ - check_sdata_in_driver(sdata); - - trace_drv_set_rekey_data(local, sdata, data); - if (local->ops->set_rekey_data) - local->ops->set_rekey_data(&local->hw, &sdata->vif, data); - trace_drv_return_void(local); -} - -static inline void drv_rssi_callback(struct ieee80211_local *local, - const enum ieee80211_rssi_event event) -{ - trace_drv_rssi_callback(local, event); - if (local->ops->rssi_callback) - local->ops->rssi_callback(&local->hw, event); - trace_drv_return_void(local); -} - -static inline void -drv_release_buffered_frames(struct ieee80211_local *local, - struct sta_info *sta, u16 tids, int num_frames, - enum ieee80211_frame_release_type reason, - bool more_data) -{ - trace_drv_release_buffered_frames(local, &sta->sta, tids, num_frames, - reason, more_data); - if (local->ops->release_buffered_frames) - local->ops->release_buffered_frames(&local->hw, &sta->sta, tids, - num_frames, reason, - more_data); - trace_drv_return_void(local); -} - -static inline void -drv_allow_buffered_frames(struct ieee80211_local *local, - struct sta_info *sta, u16 tids, int num_frames, - enum ieee80211_frame_release_type reason, - bool more_data) -{ - trace_drv_allow_buffered_frames(local, &sta->sta, tids, num_frames, - reason, more_data); - if (local->ops->allow_buffered_frames) - local->ops->allow_buffered_frames(&local->hw, &sta->sta, - tids, num_frames, reason, - more_data); - trace_drv_return_void(local); -} -#endif /* __MAC80211_DRIVER_OPS */ diff --git a/openairITS/mac/DOT11/net/mac80211/driver-trace.c b/openairITS/mac/DOT11/net/mac80211/driver-trace.c deleted file mode 100644 index 8ed8711b1a6..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/driver-trace.c +++ /dev/null @@ -1,9 +0,0 @@ -/* bug in tracepoint.h, it should include this */ -#include <linux/module.h> - -/* sparse isn't too happy with all macros... */ -#ifndef __CHECKER__ -#include "driver-ops.h" -#define CREATE_TRACE_POINTS -#include "driver-trace.h" -#endif diff --git a/openairITS/mac/DOT11/net/mac80211/driver-trace.h b/openairITS/mac/DOT11/net/mac80211/driver-trace.h deleted file mode 100644 index 21d6f5290a1..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/driver-trace.h +++ /dev/null @@ -1,1559 +0,0 @@ -#if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ) -#define __MAC80211_DRIVER_TRACE - -#include <linux/tracepoint.h> -#include <net/mac80211.h> -#include "ieee80211_i.h" - -#undef TRACE_SYSTEM -#define TRACE_SYSTEM mac80211 - -#define MAXNAME 32 -#define LOCAL_ENTRY __array(char, wiphy_name, 32) -#define LOCAL_ASSIGN strlcpy(__entry->wiphy_name, wiphy_name(local->hw.wiphy), MAXNAME) -#define LOCAL_PR_FMT "%s" -#define LOCAL_PR_ARG __entry->wiphy_name - -#define STA_ENTRY __array(char, sta_addr, ETH_ALEN) -#define STA_ASSIGN (sta ? memcpy(__entry->sta_addr, sta->addr, ETH_ALEN) : memset(__entry->sta_addr, 0, ETH_ALEN)) -#define STA_PR_FMT " sta:%pM" -#define STA_PR_ARG __entry->sta_addr - -#define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \ - __field(bool, p2p) \ - __string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") -#define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \ - __entry->p2p = sdata->vif.p2p; \ - __assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>") -#define VIF_PR_FMT " vif:%s(%d%s)" -#define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : "" - -/* - * Tracing for driver callbacks. - */ - -DECLARE_EVENT_CLASS(local_only_evt, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local), - TP_STRUCT__entry( - LOCAL_ENTRY - ), - TP_fast_assign( - LOCAL_ASSIGN; - ), - TP_printk(LOCAL_PR_FMT, LOCAL_PR_ARG) -); - -DECLARE_EVENT_CLASS(local_sdata_addr_evt, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata), - TP_ARGS(local, sdata), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - __array(char, addr, 6) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - memcpy(__entry->addr, sdata->vif.addr, 6); - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT " addr:%pM", - LOCAL_PR_ARG, VIF_PR_ARG, __entry->addr - ) -); - -DECLARE_EVENT_CLASS(local_u32_evt, - TP_PROTO(struct ieee80211_local *local, u32 value), - TP_ARGS(local, value), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u32, value) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->value = value; - ), - - TP_printk( - LOCAL_PR_FMT " value:%d", - LOCAL_PR_ARG, __entry->value - ) -); - -DECLARE_EVENT_CLASS(local_sdata_evt, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata), - TP_ARGS(local, sdata), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT, - LOCAL_PR_ARG, VIF_PR_ARG - ) -); - -DEFINE_EVENT(local_only_evt, drv_return_void, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -TRACE_EVENT(drv_return_int, - TP_PROTO(struct ieee80211_local *local, int ret), - TP_ARGS(local, ret), - TP_STRUCT__entry( - LOCAL_ENTRY - __field(int, ret) - ), - TP_fast_assign( - LOCAL_ASSIGN; - __entry->ret = ret; - ), - TP_printk(LOCAL_PR_FMT " - %d", LOCAL_PR_ARG, __entry->ret) -); - -TRACE_EVENT(drv_return_bool, - TP_PROTO(struct ieee80211_local *local, bool ret), - TP_ARGS(local, ret), - TP_STRUCT__entry( - LOCAL_ENTRY - __field(bool, ret) - ), - TP_fast_assign( - LOCAL_ASSIGN; - __entry->ret = ret; - ), - TP_printk(LOCAL_PR_FMT " - %s", LOCAL_PR_ARG, (__entry->ret) ? - "true" : "false") -); - -TRACE_EVENT(drv_return_u64, - TP_PROTO(struct ieee80211_local *local, u64 ret), - TP_ARGS(local, ret), - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u64, ret) - ), - TP_fast_assign( - LOCAL_ASSIGN; - __entry->ret = ret; - ), - TP_printk(LOCAL_PR_FMT " - %llu", LOCAL_PR_ARG, __entry->ret) -); - -DEFINE_EVENT(local_only_evt, drv_start, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -DEFINE_EVENT(local_only_evt, drv_suspend, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -DEFINE_EVENT(local_only_evt, drv_resume, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -DEFINE_EVENT(local_only_evt, drv_stop, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -DEFINE_EVENT(local_sdata_addr_evt, drv_add_interface, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata), - TP_ARGS(local, sdata) -); - -TRACE_EVENT(drv_change_interface, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - enum nl80211_iftype type, bool p2p), - - TP_ARGS(local, sdata, type, p2p), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - __field(u32, new_type) - __field(bool, new_p2p) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - __entry->new_type = type; - __entry->new_p2p = p2p; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT " new type:%d%s", - LOCAL_PR_ARG, VIF_PR_ARG, __entry->new_type, - __entry->new_p2p ? "/p2p" : "" - ) -); - -DEFINE_EVENT(local_sdata_addr_evt, drv_remove_interface, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata), - TP_ARGS(local, sdata) -); - -TRACE_EVENT(drv_config, - TP_PROTO(struct ieee80211_local *local, - u32 changed), - - TP_ARGS(local, changed), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u32, changed) - __field(u32, flags) - __field(int, power_level) - __field(int, dynamic_ps_timeout) - __field(int, max_sleep_period) - __field(u16, listen_interval) - __field(u8, long_frame_max_tx_count) - __field(u8, short_frame_max_tx_count) - __field(int, center_freq) - __field(int, channel_type) - __field(int, smps) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->changed = changed; - __entry->flags = local->hw.conf.flags; - __entry->power_level = local->hw.conf.power_level; - __entry->dynamic_ps_timeout = local->hw.conf.dynamic_ps_timeout; - __entry->max_sleep_period = local->hw.conf.max_sleep_period; - __entry->listen_interval = local->hw.conf.listen_interval; - __entry->long_frame_max_tx_count = local->hw.conf.long_frame_max_tx_count; - __entry->short_frame_max_tx_count = local->hw.conf.short_frame_max_tx_count; - __entry->center_freq = local->hw.conf.channel->center_freq; - __entry->channel_type = local->hw.conf.channel_type; - __entry->smps = local->hw.conf.smps_mode; - ), - - TP_printk( - LOCAL_PR_FMT " ch:%#x freq:%d", - LOCAL_PR_ARG, __entry->changed, __entry->center_freq - ) -); - -TRACE_EVENT(drv_bss_info_changed, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_bss_conf *info, - u32 changed), - - TP_ARGS(local, sdata, info, changed), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - __field(bool, assoc) - __field(u16, aid) - __field(bool, cts) - __field(bool, shortpre) - __field(bool, shortslot) - __field(u8, dtimper) - __field(u16, bcnint) - __field(u16, assoc_cap) - __field(u64, timestamp) - __field(u32, basic_rates) - __field(u32, changed) - __field(bool, enable_beacon) - __field(u16, ht_operation_mode) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - __entry->changed = changed; - __entry->aid = info->aid; - __entry->assoc = info->assoc; - __entry->shortpre = info->use_short_preamble; - __entry->cts = info->use_cts_prot; - __entry->shortslot = info->use_short_slot; - __entry->dtimper = info->dtim_period; - __entry->bcnint = info->beacon_int; - __entry->assoc_cap = info->assoc_capability; - __entry->timestamp = info->last_tsf; - __entry->basic_rates = info->basic_rates; - __entry->enable_beacon = info->enable_beacon; - __entry->ht_operation_mode = info->ht_operation_mode; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT " changed:%#x", - LOCAL_PR_ARG, VIF_PR_ARG, __entry->changed - ) -); - -TRACE_EVENT(drv_prepare_multicast, - TP_PROTO(struct ieee80211_local *local, int mc_count), - - TP_ARGS(local, mc_count), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(int, mc_count) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->mc_count = mc_count; - ), - - TP_printk( - LOCAL_PR_FMT " prepare mc (%d)", - LOCAL_PR_ARG, __entry->mc_count - ) -); - -TRACE_EVENT(drv_configure_filter, - TP_PROTO(struct ieee80211_local *local, - unsigned int changed_flags, - unsigned int *total_flags, - u64 multicast), - - TP_ARGS(local, changed_flags, total_flags, multicast), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(unsigned int, changed) - __field(unsigned int, total) - __field(u64, multicast) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->changed = changed_flags; - __entry->total = *total_flags; - __entry->multicast = multicast; - ), - - TP_printk( - LOCAL_PR_FMT " changed:%#x total:%#x", - LOCAL_PR_ARG, __entry->changed, __entry->total - ) -); - -TRACE_EVENT(drv_set_tim, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sta *sta, bool set), - - TP_ARGS(local, sta, set), - - TP_STRUCT__entry( - LOCAL_ENTRY - STA_ENTRY - __field(bool, set) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - STA_ASSIGN; - __entry->set = set; - ), - - TP_printk( - LOCAL_PR_FMT STA_PR_FMT " set:%d", - LOCAL_PR_ARG, STA_PR_FMT, __entry->set - ) -); - -TRACE_EVENT(drv_set_key, - TP_PROTO(struct ieee80211_local *local, - enum set_key_cmd cmd, struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key), - - TP_ARGS(local, cmd, sdata, sta, key), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - STA_ENTRY - __field(u32, cipher) - __field(u8, hw_key_idx) - __field(u8, flags) - __field(s8, keyidx) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - STA_ASSIGN; - __entry->cipher = key->cipher; - __entry->flags = key->flags; - __entry->keyidx = key->keyidx; - __entry->hw_key_idx = key->hw_key_idx; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT, - LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG - ) -); - -TRACE_EVENT(drv_update_tkip_key, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_key_conf *conf, - struct ieee80211_sta *sta, u32 iv32), - - TP_ARGS(local, sdata, conf, sta, iv32), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - STA_ENTRY - __field(u32, iv32) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - STA_ASSIGN; - __entry->iv32 = iv32; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " iv32:%#x", - LOCAL_PR_ARG,VIF_PR_ARG,STA_PR_ARG, __entry->iv32 - ) -); - -DEFINE_EVENT(local_sdata_evt, drv_hw_scan, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata), - TP_ARGS(local, sdata) -); - -DEFINE_EVENT(local_sdata_evt, drv_cancel_hw_scan, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata), - TP_ARGS(local, sdata) -); - -DEFINE_EVENT(local_sdata_evt, drv_sched_scan_start, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata), - TP_ARGS(local, sdata) -); - -DEFINE_EVENT(local_sdata_evt, drv_sched_scan_stop, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata), - TP_ARGS(local, sdata) -); - -DEFINE_EVENT(local_only_evt, drv_sw_scan_start, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -DEFINE_EVENT(local_only_evt, drv_sw_scan_complete, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -TRACE_EVENT(drv_get_stats, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_low_level_stats *stats, - int ret), - - TP_ARGS(local, stats, ret), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(int, ret) - __field(unsigned int, ackfail) - __field(unsigned int, rtsfail) - __field(unsigned int, fcserr) - __field(unsigned int, rtssucc) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->ret = ret; - __entry->ackfail = stats->dot11ACKFailureCount; - __entry->rtsfail = stats->dot11RTSFailureCount; - __entry->fcserr = stats->dot11FCSErrorCount; - __entry->rtssucc = stats->dot11RTSSuccessCount; - ), - - TP_printk( - LOCAL_PR_FMT " ret:%d", - LOCAL_PR_ARG, __entry->ret - ) -); - -TRACE_EVENT(drv_get_tkip_seq, - TP_PROTO(struct ieee80211_local *local, - u8 hw_key_idx, u32 *iv32, u16 *iv16), - - TP_ARGS(local, hw_key_idx, iv32, iv16), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u8, hw_key_idx) - __field(u32, iv32) - __field(u16, iv16) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->hw_key_idx = hw_key_idx; - __entry->iv32 = *iv32; - __entry->iv16 = *iv16; - ), - - TP_printk( - LOCAL_PR_FMT, LOCAL_PR_ARG - ) -); - -DEFINE_EVENT(local_u32_evt, drv_set_frag_threshold, - TP_PROTO(struct ieee80211_local *local, u32 value), - TP_ARGS(local, value) -); - -DEFINE_EVENT(local_u32_evt, drv_set_rts_threshold, - TP_PROTO(struct ieee80211_local *local, u32 value), - TP_ARGS(local, value) -); - -TRACE_EVENT(drv_set_coverage_class, - TP_PROTO(struct ieee80211_local *local, u8 value), - - TP_ARGS(local, value), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u8, value) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->value = value; - ), - - TP_printk( - LOCAL_PR_FMT " value:%d", - LOCAL_PR_ARG, __entry->value - ) -); - -TRACE_EVENT(drv_sta_notify, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - enum sta_notify_cmd cmd, - struct ieee80211_sta *sta), - - TP_ARGS(local, sdata, cmd, sta), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - STA_ENTRY - __field(u32, cmd) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - STA_ASSIGN; - __entry->cmd = cmd; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " cmd:%d", - LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->cmd - ) -); - -TRACE_EVENT(drv_sta_state, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta *sta, - enum ieee80211_sta_state old_state, - enum ieee80211_sta_state new_state), - - TP_ARGS(local, sdata, sta, old_state, new_state), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - STA_ENTRY - __field(u32, old_state) - __field(u32, new_state) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - STA_ASSIGN; - __entry->old_state = old_state; - __entry->new_state = new_state; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " state: %d->%d", - LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, - __entry->old_state, __entry->new_state - ) -); - -TRACE_EVENT(drv_sta_add, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta *sta), - - TP_ARGS(local, sdata, sta), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - STA_ENTRY - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - STA_ASSIGN; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT, - LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG - ) -); - -TRACE_EVENT(drv_sta_remove, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta *sta), - - TP_ARGS(local, sdata, sta), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - STA_ENTRY - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - STA_ASSIGN; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT, - LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG - ) -); - -TRACE_EVENT(drv_conf_tx, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - u16 queue, - const struct ieee80211_tx_queue_params *params), - - TP_ARGS(local, sdata, queue, params), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - __field(u16, queue) - __field(u16, txop) - __field(u16, cw_min) - __field(u16, cw_max) - __field(u8, aifs) - __field(bool, uapsd) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - __entry->queue = queue; - __entry->txop = params->txop; - __entry->cw_max = params->cw_max; - __entry->cw_min = params->cw_min; - __entry->aifs = params->aifs; - __entry->uapsd = params->uapsd; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT " queue:%d", - LOCAL_PR_ARG, VIF_PR_ARG, __entry->queue - ) -); - -DEFINE_EVENT(local_sdata_evt, drv_get_tsf, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata), - TP_ARGS(local, sdata) -); - -TRACE_EVENT(drv_set_tsf, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - u64 tsf), - - TP_ARGS(local, sdata, tsf), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - __field(u64, tsf) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - __entry->tsf = tsf; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT " tsf:%llu", - LOCAL_PR_ARG, VIF_PR_ARG, (unsigned long long)__entry->tsf - ) -); - -DEFINE_EVENT(local_sdata_evt, drv_reset_tsf, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata), - TP_ARGS(local, sdata) -); - -DEFINE_EVENT(local_only_evt, drv_tx_last_beacon, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -TRACE_EVENT(drv_ampdu_action, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - enum ieee80211_ampdu_mlme_action action, - struct ieee80211_sta *sta, u16 tid, - u16 *ssn, u8 buf_size), - - TP_ARGS(local, sdata, action, sta, tid, ssn, buf_size), - - TP_STRUCT__entry( - LOCAL_ENTRY - STA_ENTRY - __field(u32, action) - __field(u16, tid) - __field(u16, ssn) - __field(u8, buf_size) - VIF_ENTRY - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - STA_ASSIGN; - __entry->action = action; - __entry->tid = tid; - __entry->ssn = ssn ? *ssn : 0; - __entry->buf_size = buf_size; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT STA_PR_FMT " action:%d tid:%d buf:%d", - LOCAL_PR_ARG, VIF_PR_ARG, STA_PR_ARG, __entry->action, - __entry->tid, __entry->buf_size - ) -); - -TRACE_EVENT(drv_get_survey, - TP_PROTO(struct ieee80211_local *local, int idx, - struct survey_info *survey), - - TP_ARGS(local, idx, survey), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(int, idx) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->idx = idx; - ), - - TP_printk( - LOCAL_PR_FMT " idx:%d", - LOCAL_PR_ARG, __entry->idx - ) -); - -TRACE_EVENT(drv_flush, - TP_PROTO(struct ieee80211_local *local, bool drop), - - TP_ARGS(local, drop), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(bool, drop) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->drop = drop; - ), - - TP_printk( - LOCAL_PR_FMT " drop:%d", - LOCAL_PR_ARG, __entry->drop - ) -); - -TRACE_EVENT(drv_channel_switch, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_channel_switch *ch_switch), - - TP_ARGS(local, ch_switch), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u64, timestamp) - __field(bool, block_tx) - __field(u16, freq) - __field(u8, count) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->timestamp = ch_switch->timestamp; - __entry->block_tx = ch_switch->block_tx; - __entry->freq = ch_switch->channel->center_freq; - __entry->count = ch_switch->count; - ), - - TP_printk( - LOCAL_PR_FMT " new freq:%u count:%d", - LOCAL_PR_ARG, __entry->freq, __entry->count - ) -); - -TRACE_EVENT(drv_set_antenna, - TP_PROTO(struct ieee80211_local *local, u32 tx_ant, u32 rx_ant, int ret), - - TP_ARGS(local, tx_ant, rx_ant, ret), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u32, tx_ant) - __field(u32, rx_ant) - __field(int, ret) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->tx_ant = tx_ant; - __entry->rx_ant = rx_ant; - __entry->ret = ret; - ), - - TP_printk( - LOCAL_PR_FMT " tx_ant:%d rx_ant:%d ret:%d", - LOCAL_PR_ARG, __entry->tx_ant, __entry->rx_ant, __entry->ret - ) -); - -TRACE_EVENT(drv_get_antenna, - TP_PROTO(struct ieee80211_local *local, u32 tx_ant, u32 rx_ant, int ret), - - TP_ARGS(local, tx_ant, rx_ant, ret), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u32, tx_ant) - __field(u32, rx_ant) - __field(int, ret) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->tx_ant = tx_ant; - __entry->rx_ant = rx_ant; - __entry->ret = ret; - ), - - TP_printk( - LOCAL_PR_FMT " tx_ant:%d rx_ant:%d ret:%d", - LOCAL_PR_ARG, __entry->tx_ant, __entry->rx_ant, __entry->ret - ) -); - -TRACE_EVENT(drv_remain_on_channel, - TP_PROTO(struct ieee80211_local *local, struct ieee80211_channel *chan, - enum nl80211_channel_type chantype, unsigned int duration), - - TP_ARGS(local, chan, chantype, duration), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(int, center_freq) - __field(int, channel_type) - __field(unsigned int, duration) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->center_freq = chan->center_freq; - __entry->channel_type = chantype; - __entry->duration = duration; - ), - - TP_printk( - LOCAL_PR_FMT " freq:%dMHz duration:%dms", - LOCAL_PR_ARG, __entry->center_freq, __entry->duration - ) -); - -DEFINE_EVENT(local_only_evt, drv_cancel_remain_on_channel, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -TRACE_EVENT(drv_offchannel_tx, - TP_PROTO(struct ieee80211_local *local, struct sk_buff *skb, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int wait), - - TP_ARGS(local, skb, chan, channel_type, wait), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(int, center_freq) - __field(int, channel_type) - __field(unsigned int, wait) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->center_freq = chan->center_freq; - __entry->channel_type = channel_type; - __entry->wait = wait; - ), - - TP_printk( - LOCAL_PR_FMT " freq:%dMHz, wait:%dms", - LOCAL_PR_ARG, __entry->center_freq, __entry->wait - ) -); - -TRACE_EVENT(drv_set_ringparam, - TP_PROTO(struct ieee80211_local *local, u32 tx, u32 rx), - - TP_ARGS(local, tx, rx), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u32, tx) - __field(u32, rx) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->tx = tx; - __entry->rx = rx; - ), - - TP_printk( - LOCAL_PR_FMT " tx:%d rx %d", - LOCAL_PR_ARG, __entry->tx, __entry->rx - ) -); - -TRACE_EVENT(drv_get_ringparam, - TP_PROTO(struct ieee80211_local *local, u32 *tx, u32 *tx_max, - u32 *rx, u32 *rx_max), - - TP_ARGS(local, tx, tx_max, rx, rx_max), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u32, tx) - __field(u32, tx_max) - __field(u32, rx) - __field(u32, rx_max) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->tx = *tx; - __entry->tx_max = *tx_max; - __entry->rx = *rx; - __entry->rx_max = *rx_max; - ), - - TP_printk( - LOCAL_PR_FMT " tx:%d tx_max %d rx %d rx_max %d", - LOCAL_PR_ARG, - __entry->tx, __entry->tx_max, __entry->rx, __entry->rx_max - ) -); - -DEFINE_EVENT(local_only_evt, drv_tx_frames_pending, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -DEFINE_EVENT(local_only_evt, drv_offchannel_tx_cancel_wait, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -TRACE_EVENT(drv_set_bitrate_mask, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - const struct cfg80211_bitrate_mask *mask), - - TP_ARGS(local, sdata, mask), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - __field(u32, legacy_2g) - __field(u32, legacy_5g) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - __entry->legacy_2g = mask->control[IEEE80211_BAND_2GHZ].legacy; - __entry->legacy_5g = mask->control[IEEE80211_BAND_5GHZ].legacy; - ), - - TP_printk( - LOCAL_PR_FMT VIF_PR_FMT " 2G Mask:0x%x 5G Mask:0x%x", - LOCAL_PR_ARG, VIF_PR_ARG, __entry->legacy_2g, __entry->legacy_5g - ) -); - -TRACE_EVENT(drv_set_rekey_data, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct cfg80211_gtk_rekey_data *data), - - TP_ARGS(local, sdata, data), - - TP_STRUCT__entry( - LOCAL_ENTRY - VIF_ENTRY - __array(u8, kek, NL80211_KEK_LEN) - __array(u8, kck, NL80211_KCK_LEN) - __array(u8, replay_ctr, NL80211_REPLAY_CTR_LEN) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - VIF_ASSIGN; - memcpy(__entry->kek, data->kek, NL80211_KEK_LEN); - memcpy(__entry->kck, data->kck, NL80211_KCK_LEN); - memcpy(__entry->replay_ctr, data->replay_ctr, - NL80211_REPLAY_CTR_LEN); - ), - - TP_printk(LOCAL_PR_FMT VIF_PR_FMT, - LOCAL_PR_ARG, VIF_PR_ARG) -); - -TRACE_EVENT(drv_rssi_callback, - TP_PROTO(struct ieee80211_local *local, - enum ieee80211_rssi_event rssi_event), - - TP_ARGS(local, rssi_event), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u32, rssi_event) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->rssi_event = rssi_event; - ), - - TP_printk( - LOCAL_PR_FMT " rssi_event:%d", - LOCAL_PR_ARG, __entry->rssi_event - ) -); - -DECLARE_EVENT_CLASS(release_evt, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sta *sta, - u16 tids, int num_frames, - enum ieee80211_frame_release_type reason, - bool more_data), - - TP_ARGS(local, sta, tids, num_frames, reason, more_data), - - TP_STRUCT__entry( - LOCAL_ENTRY - STA_ENTRY - __field(u16, tids) - __field(int, num_frames) - __field(int, reason) - __field(bool, more_data) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - STA_ASSIGN; - __entry->tids = tids; - __entry->num_frames = num_frames; - __entry->reason = reason; - __entry->more_data = more_data; - ), - - TP_printk( - LOCAL_PR_FMT STA_PR_FMT - " TIDs:0x%.4x frames:%d reason:%d more:%d", - LOCAL_PR_ARG, STA_PR_ARG, __entry->tids, __entry->num_frames, - __entry->reason, __entry->more_data - ) -); - -DEFINE_EVENT(release_evt, drv_release_buffered_frames, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sta *sta, - u16 tids, int num_frames, - enum ieee80211_frame_release_type reason, - bool more_data), - - TP_ARGS(local, sta, tids, num_frames, reason, more_data) -); - -DEFINE_EVENT(release_evt, drv_allow_buffered_frames, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sta *sta, - u16 tids, int num_frames, - enum ieee80211_frame_release_type reason, - bool more_data), - - TP_ARGS(local, sta, tids, num_frames, reason, more_data) -); - -/* - * Tracing for API calls that drivers call. - */ - -TRACE_EVENT(api_start_tx_ba_session, - TP_PROTO(struct ieee80211_sta *sta, u16 tid), - - TP_ARGS(sta, tid), - - TP_STRUCT__entry( - STA_ENTRY - __field(u16, tid) - ), - - TP_fast_assign( - STA_ASSIGN; - __entry->tid = tid; - ), - - TP_printk( - STA_PR_FMT " tid:%d", - STA_PR_ARG, __entry->tid - ) -); - -TRACE_EVENT(api_start_tx_ba_cb, - TP_PROTO(struct ieee80211_sub_if_data *sdata, const u8 *ra, u16 tid), - - TP_ARGS(sdata, ra, tid), - - TP_STRUCT__entry( - VIF_ENTRY - __array(u8, ra, ETH_ALEN) - __field(u16, tid) - ), - - TP_fast_assign( - VIF_ASSIGN; - memcpy(__entry->ra, ra, ETH_ALEN); - __entry->tid = tid; - ), - - TP_printk( - VIF_PR_FMT " ra:%pM tid:%d", - VIF_PR_ARG, __entry->ra, __entry->tid - ) -); - -TRACE_EVENT(api_stop_tx_ba_session, - TP_PROTO(struct ieee80211_sta *sta, u16 tid), - - TP_ARGS(sta, tid), - - TP_STRUCT__entry( - STA_ENTRY - __field(u16, tid) - ), - - TP_fast_assign( - STA_ASSIGN; - __entry->tid = tid; - ), - - TP_printk( - STA_PR_FMT " tid:%d", - STA_PR_ARG, __entry->tid - ) -); - -TRACE_EVENT(api_stop_tx_ba_cb, - TP_PROTO(struct ieee80211_sub_if_data *sdata, const u8 *ra, u16 tid), - - TP_ARGS(sdata, ra, tid), - - TP_STRUCT__entry( - VIF_ENTRY - __array(u8, ra, ETH_ALEN) - __field(u16, tid) - ), - - TP_fast_assign( - VIF_ASSIGN; - memcpy(__entry->ra, ra, ETH_ALEN); - __entry->tid = tid; - ), - - TP_printk( - VIF_PR_FMT " ra:%pM tid:%d", - VIF_PR_ARG, __entry->ra, __entry->tid - ) -); - -DEFINE_EVENT(local_only_evt, api_restart_hw, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -TRACE_EVENT(api_beacon_loss, - TP_PROTO(struct ieee80211_sub_if_data *sdata), - - TP_ARGS(sdata), - - TP_STRUCT__entry( - VIF_ENTRY - ), - - TP_fast_assign( - VIF_ASSIGN; - ), - - TP_printk( - VIF_PR_FMT, - VIF_PR_ARG - ) -); - -TRACE_EVENT(api_connection_loss, - TP_PROTO(struct ieee80211_sub_if_data *sdata), - - TP_ARGS(sdata), - - TP_STRUCT__entry( - VIF_ENTRY - ), - - TP_fast_assign( - VIF_ASSIGN; - ), - - TP_printk( - VIF_PR_FMT, - VIF_PR_ARG - ) -); - -TRACE_EVENT(api_cqm_rssi_notify, - TP_PROTO(struct ieee80211_sub_if_data *sdata, - enum nl80211_cqm_rssi_threshold_event rssi_event), - - TP_ARGS(sdata, rssi_event), - - TP_STRUCT__entry( - VIF_ENTRY - __field(u32, rssi_event) - ), - - TP_fast_assign( - VIF_ASSIGN; - __entry->rssi_event = rssi_event; - ), - - TP_printk( - VIF_PR_FMT " event:%d", - VIF_PR_ARG, __entry->rssi_event - ) -); - -TRACE_EVENT(api_scan_completed, - TP_PROTO(struct ieee80211_local *local, bool aborted), - - TP_ARGS(local, aborted), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(bool, aborted) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->aborted = aborted; - ), - - TP_printk( - LOCAL_PR_FMT " aborted:%d", - LOCAL_PR_ARG, __entry->aborted - ) -); - -TRACE_EVENT(api_sched_scan_results, - TP_PROTO(struct ieee80211_local *local), - - TP_ARGS(local), - - TP_STRUCT__entry( - LOCAL_ENTRY - ), - - TP_fast_assign( - LOCAL_ASSIGN; - ), - - TP_printk( - LOCAL_PR_FMT, LOCAL_PR_ARG - ) -); - -TRACE_EVENT(api_sched_scan_stopped, - TP_PROTO(struct ieee80211_local *local), - - TP_ARGS(local), - - TP_STRUCT__entry( - LOCAL_ENTRY - ), - - TP_fast_assign( - LOCAL_ASSIGN; - ), - - TP_printk( - LOCAL_PR_FMT, LOCAL_PR_ARG - ) -); - -TRACE_EVENT(api_sta_block_awake, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sta *sta, bool block), - - TP_ARGS(local, sta, block), - - TP_STRUCT__entry( - LOCAL_ENTRY - STA_ENTRY - __field(bool, block) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - STA_ASSIGN; - __entry->block = block; - ), - - TP_printk( - LOCAL_PR_FMT STA_PR_FMT " block:%d", - LOCAL_PR_ARG, STA_PR_FMT, __entry->block - ) -); - -TRACE_EVENT(api_chswitch_done, - TP_PROTO(struct ieee80211_sub_if_data *sdata, bool success), - - TP_ARGS(sdata, success), - - TP_STRUCT__entry( - VIF_ENTRY - __field(bool, success) - ), - - TP_fast_assign( - VIF_ASSIGN; - __entry->success = success; - ), - - TP_printk( - VIF_PR_FMT " success=%d", - VIF_PR_ARG, __entry->success - ) -); - -DEFINE_EVENT(local_only_evt, api_ready_on_channel, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -DEFINE_EVENT(local_only_evt, api_remain_on_channel_expired, - TP_PROTO(struct ieee80211_local *local), - TP_ARGS(local) -); - -TRACE_EVENT(api_gtk_rekey_notify, - TP_PROTO(struct ieee80211_sub_if_data *sdata, - const u8 *bssid, const u8 *replay_ctr), - - TP_ARGS(sdata, bssid, replay_ctr), - - TP_STRUCT__entry( - VIF_ENTRY - __array(u8, bssid, ETH_ALEN) - __array(u8, replay_ctr, NL80211_REPLAY_CTR_LEN) - ), - - TP_fast_assign( - VIF_ASSIGN; - memcpy(__entry->bssid, bssid, ETH_ALEN); - memcpy(__entry->replay_ctr, replay_ctr, NL80211_REPLAY_CTR_LEN); - ), - - TP_printk(VIF_PR_FMT, VIF_PR_ARG) -); - -TRACE_EVENT(api_enable_rssi_reports, - TP_PROTO(struct ieee80211_sub_if_data *sdata, - int rssi_min_thold, int rssi_max_thold), - - TP_ARGS(sdata, rssi_min_thold, rssi_max_thold), - - TP_STRUCT__entry( - VIF_ENTRY - __field(int, rssi_min_thold) - __field(int, rssi_max_thold) - ), - - TP_fast_assign( - VIF_ASSIGN; - __entry->rssi_min_thold = rssi_min_thold; - __entry->rssi_max_thold = rssi_max_thold; - ), - - TP_printk( - VIF_PR_FMT " rssi_min_thold =%d, rssi_max_thold = %d", - VIF_PR_ARG, __entry->rssi_min_thold, __entry->rssi_max_thold - ) -); - -TRACE_EVENT(api_eosp, - TP_PROTO(struct ieee80211_local *local, - struct ieee80211_sta *sta), - - TP_ARGS(local, sta), - - TP_STRUCT__entry( - LOCAL_ENTRY - STA_ENTRY - ), - - TP_fast_assign( - LOCAL_ASSIGN; - STA_ASSIGN; - ), - - TP_printk( - LOCAL_PR_FMT STA_PR_FMT, - LOCAL_PR_ARG, STA_PR_FMT - ) -); - -/* - * Tracing for internal functions - * (which may also be called in response to driver calls) - */ - -TRACE_EVENT(wake_queue, - TP_PROTO(struct ieee80211_local *local, u16 queue, - enum queue_stop_reason reason), - - TP_ARGS(local, queue, reason), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u16, queue) - __field(u32, reason) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->queue = queue; - __entry->reason = reason; - ), - - TP_printk( - LOCAL_PR_FMT " queue:%d, reason:%d", - LOCAL_PR_ARG, __entry->queue, __entry->reason - ) -); - -TRACE_EVENT(stop_queue, - TP_PROTO(struct ieee80211_local *local, u16 queue, - enum queue_stop_reason reason), - - TP_ARGS(local, queue, reason), - - TP_STRUCT__entry( - LOCAL_ENTRY - __field(u16, queue) - __field(u32, reason) - ), - - TP_fast_assign( - LOCAL_ASSIGN; - __entry->queue = queue; - __entry->reason = reason; - ), - - TP_printk( - LOCAL_PR_FMT " queue:%d, reason:%d", - LOCAL_PR_ARG, __entry->queue, __entry->reason - ) -); -#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */ - -#undef TRACE_INCLUDE_PATH -#define TRACE_INCLUDE_PATH . -#undef TRACE_INCLUDE_FILE -#define TRACE_INCLUDE_FILE driver-trace -#include <trace/define_trace.h> diff --git a/openairITS/mac/DOT11/net/mac80211/event.c b/openairITS/mac/DOT11/net/mac80211/event.c deleted file mode 100644 index 01ae759518f..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/event.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * mac80211 - events - */ -#include <net/cfg80211.h> -#include "ieee80211_i.h" - -/* - * Indicate a failed Michael MIC to userspace. If the caller knows the TSC of - * the frame that generated the MIC failure (i.e., if it was provided by the - * driver or is still in the frame), it should provide that information. - */ -void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, - struct ieee80211_hdr *hdr, const u8 *tsc, - gfp_t gfp) -{ - cfg80211_michael_mic_failure(sdata->dev, hdr->addr2, - (hdr->addr1[0] & 0x01) ? - NL80211_KEYTYPE_GROUP : - NL80211_KEYTYPE_PAIRWISE, - keyidx, tsc, gfp); -} diff --git a/openairITS/mac/DOT11/net/mac80211/ht.c b/openairITS/mac/DOT11/net/mac80211/ht.c deleted file mode 100644 index f25fff7607d..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/ht.c +++ /dev/null @@ -1,407 +0,0 @@ -/* - * HT handling - * - * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi> - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007, Michael Wu <flamingice@sourmilk.net> - * Copyright 2007-2010, Intel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/ieee80211.h> -#include <linux/export.h> -#include <net/mac80211.h> -#include "ieee80211_i.h" -#include "rate.h" - -bool ieee80111_cfg_override_disables_ht40(struct ieee80211_sub_if_data *sdata) -{ - const __le16 flg = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40); - if ((sdata->u.mgd.ht_capa_mask.cap_info & flg) && - !(sdata->u.mgd.ht_capa.cap_info & flg)) - return true; - return false; -} - -static void __check_htcap_disable(struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta_ht_cap *ht_cap, - u16 flag) -{ - __le16 le_flag = cpu_to_le16(flag); - if (sdata->u.mgd.ht_capa_mask.cap_info & le_flag) { - if (!(sdata->u.mgd.ht_capa.cap_info & le_flag)) - ht_cap->cap &= ~flag; - } -} - -void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta_ht_cap *ht_cap) -{ - u8 *scaps = (u8 *)(&sdata->u.mgd.ht_capa.mcs.rx_mask); - u8 *smask = (u8 *)(&sdata->u.mgd.ht_capa_mask.mcs.rx_mask); - int i; - - if (sdata->vif.type != NL80211_IFTYPE_STATION) { - /* AP interfaces call this code when adding new stations, - * so just silently ignore non station interfaces. - */ - return; - } - - /* NOTE: If you add more over-rides here, update register_hw - * ht_capa_mod_msk logic in main.c as well. - * And, if this method can ever change ht_cap.ht_supported, fix - * the check in ieee80211_add_ht_ie. - */ - - /* check for HT over-rides, MCS rates first. */ - for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) { - u8 m = smask[i]; - ht_cap->mcs.rx_mask[i] &= ~m; /* turn off all masked bits */ - /* Add back rates that are supported */ - ht_cap->mcs.rx_mask[i] |= (m & scaps[i]); - } - - /* Force removal of HT-40 capabilities? */ - __check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_SUP_WIDTH_20_40); - __check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_SGI_40); - - /* Allow user to disable the max-AMSDU bit. */ - __check_htcap_disable(sdata, ht_cap, IEEE80211_HT_CAP_MAX_AMSDU); - - /* Allow user to decrease AMPDU factor */ - if (sdata->u.mgd.ht_capa_mask.ampdu_params_info & - IEEE80211_HT_AMPDU_PARM_FACTOR) { - u8 n = sdata->u.mgd.ht_capa.ampdu_params_info - & IEEE80211_HT_AMPDU_PARM_FACTOR; - if (n < ht_cap->ampdu_factor) - ht_cap->ampdu_factor = n; - } - - /* Allow the user to increase AMPDU density. */ - if (sdata->u.mgd.ht_capa_mask.ampdu_params_info & - IEEE80211_HT_AMPDU_PARM_DENSITY) { - u8 n = (sdata->u.mgd.ht_capa.ampdu_params_info & - IEEE80211_HT_AMPDU_PARM_DENSITY) - >> IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; - if (n > ht_cap->ampdu_density) - ht_cap->ampdu_density = n; - } -} - - -void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata, - struct ieee80211_supported_band *sband, - struct ieee80211_ht_cap *ht_cap_ie, - struct ieee80211_sta_ht_cap *ht_cap) -{ - u8 ampdu_info, tx_mcs_set_cap; - int i, max_tx_streams; - - BUG_ON(!ht_cap); - - memset(ht_cap, 0, sizeof(*ht_cap)); - - if (!ht_cap_ie || !sband->ht_cap.ht_supported) - return; - - ht_cap->ht_supported = true; - - /* - * The bits listed in this expression should be - * the same for the peer and us, if the station - * advertises more then we can't use those thus - * we mask them out. - */ - ht_cap->cap = le16_to_cpu(ht_cap_ie->cap_info) & - (sband->ht_cap.cap | - ~(IEEE80211_HT_CAP_LDPC_CODING | - IEEE80211_HT_CAP_SUP_WIDTH_20_40 | - IEEE80211_HT_CAP_GRN_FLD | - IEEE80211_HT_CAP_SGI_20 | - IEEE80211_HT_CAP_SGI_40 | - IEEE80211_HT_CAP_DSSSCCK40)); - /* - * The STBC bits are asymmetric -- if we don't have - * TX then mask out the peer's RX and vice versa. - */ - if (!(sband->ht_cap.cap & IEEE80211_HT_CAP_TX_STBC)) - ht_cap->cap &= ~IEEE80211_HT_CAP_RX_STBC; - if (!(sband->ht_cap.cap & IEEE80211_HT_CAP_RX_STBC)) - ht_cap->cap &= ~IEEE80211_HT_CAP_TX_STBC; - - ampdu_info = ht_cap_ie->ampdu_params_info; - ht_cap->ampdu_factor = - ampdu_info & IEEE80211_HT_AMPDU_PARM_FACTOR; - ht_cap->ampdu_density = - (ampdu_info & IEEE80211_HT_AMPDU_PARM_DENSITY) >> 2; - - /* own MCS TX capabilities */ - tx_mcs_set_cap = sband->ht_cap.mcs.tx_params; - - /* Copy peer MCS TX capabilities, the driver might need them. */ - ht_cap->mcs.tx_params = ht_cap_ie->mcs.tx_params; - - /* can we TX with MCS rates? */ - if (!(tx_mcs_set_cap & IEEE80211_HT_MCS_TX_DEFINED)) - return; - - /* Counting from 0, therefore +1 */ - if (tx_mcs_set_cap & IEEE80211_HT_MCS_TX_RX_DIFF) - max_tx_streams = - ((tx_mcs_set_cap & IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK) - >> IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT) + 1; - else - max_tx_streams = IEEE80211_HT_MCS_TX_MAX_STREAMS; - - /* - * 802.11n-2009 20.3.5 / 20.6 says: - * - indices 0 to 7 and 32 are single spatial stream - * - 8 to 31 are multiple spatial streams using equal modulation - * [8..15 for two streams, 16..23 for three and 24..31 for four] - * - remainder are multiple spatial streams using unequal modulation - */ - for (i = 0; i < max_tx_streams; i++) - ht_cap->mcs.rx_mask[i] = - sband->ht_cap.mcs.rx_mask[i] & ht_cap_ie->mcs.rx_mask[i]; - - if (tx_mcs_set_cap & IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION) - for (i = IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE; - i < IEEE80211_HT_MCS_MASK_LEN; i++) - ht_cap->mcs.rx_mask[i] = - sband->ht_cap.mcs.rx_mask[i] & - ht_cap_ie->mcs.rx_mask[i]; - - /* handle MCS rate 32 too */ - if (sband->ht_cap.mcs.rx_mask[32/8] & ht_cap_ie->mcs.rx_mask[32/8] & 1) - ht_cap->mcs.rx_mask[32/8] |= 1; - - /* - * If user has specified capability over-rides, take care - * of that here. - */ - ieee80211_apply_htcap_overrides(sdata, ht_cap); -} - -void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx) -{ - int i; - - cancel_work_sync(&sta->ampdu_mlme.work); - - for (i = 0; i < STA_TID_NUM; i++) { - __ieee80211_stop_tx_ba_session(sta, i, WLAN_BACK_INITIATOR, tx); - __ieee80211_stop_rx_ba_session(sta, i, WLAN_BACK_RECIPIENT, - WLAN_REASON_QSTA_LEAVE_QBSS, tx); - } -} - -void ieee80211_ba_session_work(struct work_struct *work) -{ - struct sta_info *sta = - container_of(work, struct sta_info, ampdu_mlme.work); - struct tid_ampdu_tx *tid_tx; - int tid; - - /* - * When this flag is set, new sessions should be - * blocked, and existing sessions will be torn - * down by the code that set the flag, so this - * need not run. - */ - if (test_sta_flag(sta, WLAN_STA_BLOCK_BA)) - return; - - mutex_lock(&sta->ampdu_mlme.mtx); - for (tid = 0; tid < STA_TID_NUM; tid++) { - if (test_and_clear_bit(tid, sta->ampdu_mlme.tid_rx_timer_expired)) - ___ieee80211_stop_rx_ba_session( - sta, tid, WLAN_BACK_RECIPIENT, - WLAN_REASON_QSTA_TIMEOUT, true); - - if (test_and_clear_bit(tid, - sta->ampdu_mlme.tid_rx_stop_requested)) - ___ieee80211_stop_rx_ba_session( - sta, tid, WLAN_BACK_RECIPIENT, - WLAN_REASON_UNSPECIFIED, true); - - tid_tx = sta->ampdu_mlme.tid_start_tx[tid]; - if (tid_tx) { - /* - * Assign it over to the normal tid_tx array - * where it "goes live". - */ - spin_lock_bh(&sta->lock); - - sta->ampdu_mlme.tid_start_tx[tid] = NULL; - /* could there be a race? */ - if (sta->ampdu_mlme.tid_tx[tid]) - kfree(tid_tx); - else - ieee80211_assign_tid_tx(sta, tid, tid_tx); - spin_unlock_bh(&sta->lock); - - ieee80211_tx_ba_session_handle_start(sta, tid); - continue; - } - - tid_tx = rcu_dereference_protected_tid_tx(sta, tid); - if (tid_tx && test_and_clear_bit(HT_AGG_STATE_WANT_STOP, - &tid_tx->state)) - ___ieee80211_stop_tx_ba_session(sta, tid, - WLAN_BACK_INITIATOR, - true); - } - mutex_unlock(&sta->ampdu_mlme.mtx); -} - -void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, - const u8 *da, u16 tid, - u16 initiator, u16 reason_code) -{ - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - u16 params; - - skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom); - if (!skb) - return; - - skb_reserve(skb, local->hw.extra_tx_headroom); - mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); - memset(mgmt, 0, 24); - memcpy(mgmt->da, da, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - if (sdata->vif.type == NL80211_IFTYPE_AP || - sdata->vif.type == NL80211_IFTYPE_AP_VLAN || - sdata->vif.type == NL80211_IFTYPE_MESH_POINT) - memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); - else if (sdata->vif.type == NL80211_IFTYPE_STATION) - memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); - else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) - memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN); - - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - - skb_put(skb, 1 + sizeof(mgmt->u.action.u.delba)); - - mgmt->u.action.category = WLAN_CATEGORY_BACK; - mgmt->u.action.u.delba.action_code = WLAN_ACTION_DELBA; - params = (u16)(initiator << 11); /* bit 11 initiator */ - params |= (u16)(tid << 12); /* bit 15:12 TID number */ - - mgmt->u.action.u.delba.params = cpu_to_le16(params); - mgmt->u.action.u.delba.reason_code = cpu_to_le16(reason_code); - - ieee80211_tx_skb_tid(sdata, skb, tid); -} - -void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, - struct sta_info *sta, - struct ieee80211_mgmt *mgmt, size_t len) -{ - u16 tid, params; - u16 initiator; - - params = le16_to_cpu(mgmt->u.action.u.delba.params); - tid = (params & IEEE80211_DELBA_PARAM_TID_MASK) >> 12; - initiator = (params & IEEE80211_DELBA_PARAM_INITIATOR_MASK) >> 11; - -#ifdef CONFIG_MAC80211_HT_DEBUG - if (net_ratelimit()) - printk(KERN_DEBUG "delba from %pM (%s) tid %d reason code %d\n", - mgmt->sa, initiator ? "initiator" : "recipient", tid, - le16_to_cpu(mgmt->u.action.u.delba.reason_code)); -#endif /* CONFIG_MAC80211_HT_DEBUG */ - - if (initiator == WLAN_BACK_INITIATOR) - __ieee80211_stop_rx_ba_session(sta, tid, WLAN_BACK_INITIATOR, 0, - true); - else - __ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_RECIPIENT, - true); -} - -int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, - enum ieee80211_smps_mode smps, const u8 *da, - const u8 *bssid) -{ - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *action_frame; - - /* 27 = header + category + action + smps mode */ - skb = dev_alloc_skb(27 + local->hw.extra_tx_headroom); - if (!skb) - return -ENOMEM; - - skb_reserve(skb, local->hw.extra_tx_headroom); - action_frame = (void *)skb_put(skb, 27); - memcpy(action_frame->da, da, ETH_ALEN); - memcpy(action_frame->sa, sdata->dev->dev_addr, ETH_ALEN); - memcpy(action_frame->bssid, bssid, ETH_ALEN); - action_frame->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - action_frame->u.action.category = WLAN_CATEGORY_HT; - action_frame->u.action.u.ht_smps.action = WLAN_HT_ACTION_SMPS; - switch (smps) { - case IEEE80211_SMPS_AUTOMATIC: - case IEEE80211_SMPS_NUM_MODES: - WARN_ON(1); - case IEEE80211_SMPS_OFF: - action_frame->u.action.u.ht_smps.smps_control = - WLAN_HT_SMPS_CONTROL_DISABLED; - break; - case IEEE80211_SMPS_STATIC: - action_frame->u.action.u.ht_smps.smps_control = - WLAN_HT_SMPS_CONTROL_STATIC; - break; - case IEEE80211_SMPS_DYNAMIC: - action_frame->u.action.u.ht_smps.smps_control = - WLAN_HT_SMPS_CONTROL_DYNAMIC; - break; - } - - /* we'll do more on status of this frame */ - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; - ieee80211_tx_skb(sdata, skb); - - return 0; -} - -void ieee80211_request_smps_work(struct work_struct *work) -{ - struct ieee80211_sub_if_data *sdata = - container_of(work, struct ieee80211_sub_if_data, - u.mgd.request_smps_work); - - mutex_lock(&sdata->u.mgd.mtx); - __ieee80211_request_smps(sdata, sdata->u.mgd.driver_smps_mode); - mutex_unlock(&sdata->u.mgd.mtx); -} - -void ieee80211_request_smps(struct ieee80211_vif *vif, - enum ieee80211_smps_mode smps_mode) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - - if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) - return; - - if (WARN_ON(smps_mode == IEEE80211_SMPS_OFF)) - smps_mode = IEEE80211_SMPS_AUTOMATIC; - - sdata->u.mgd.driver_smps_mode = smps_mode; - - ieee80211_queue_work(&sdata->local->hw, - &sdata->u.mgd.request_smps_work); -} -/* this might change ... don't want non-open drivers using it */ -EXPORT_SYMBOL_GPL(ieee80211_request_smps); diff --git a/openairITS/mac/DOT11/net/mac80211/ibss.c b/openairITS/mac/DOT11/net/mac80211/ibss.c deleted file mode 100644 index 88dcfe625b2..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/ibss.c +++ /dev/null @@ -1,1223 +0,0 @@ -/* - * IBSS mode implementation - * Copyright 2003-2008, Jouni Malinen <j@w1.fi> - * Copyright 2004, Instant802 Networks, Inc. - * Copyright 2005, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007, Michael Wu <flamingice@sourmilk.net> - * Copyright 2009, Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/delay.h> -#include <linux/slab.h> -#include <linux/if_ether.h> -#include <linux/skbuff.h> -#include <linux/if_arp.h> -#include <linux/etherdevice.h> -#include <linux/rtnetlink.h> -#include <net/mac80211.h> - -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "rate.h" - -#define IEEE80211_SCAN_INTERVAL (2 * HZ) -#define IEEE80211_SCAN_INTERVAL_SLOW (15 * HZ) -#define IEEE80211_IBSS_JOIN_TIMEOUT (7 * HZ) - -#define IEEE80211_IBSS_MERGE_INTERVAL (30 * HZ) -#define IEEE80211_IBSS_INACTIVITY_LIMIT (60 * HZ) - -#define IEEE80211_IBSS_MAX_STA_ENTRIES 128 - - -static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, - const u8 *bssid, const int beacon_int, - struct ieee80211_channel *chan, - const u32 basic_rates, - const u16 capability, u64 tsf) -{ - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct ieee80211_local *local = sdata->local; - int rates, i; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - u8 *pos; - struct ieee80211_supported_band *sband; - struct cfg80211_bss *bss; - u32 bss_change; - u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; - enum nl80211_channel_type channel_type; - - lockdep_assert_held(&ifibss->mtx); - - /* Reset own TSF to allow time synchronization work. */ - drv_reset_tsf(local, sdata); - - skb = ifibss->skb; - RCU_INIT_POINTER(ifibss->presp, NULL); - synchronize_rcu(); - skb->data = skb->head; - skb->len = 0; - skb_reset_tail_pointer(skb); - skb_reserve(skb, sdata->local->hw.extra_tx_headroom); - - if (compare_ether_addr(ifibss->bssid, bssid)) - sta_info_flush(sdata->local, sdata); - - /* if merging, indicate to driver that we leave the old IBSS */ - if (sdata->vif.bss_conf.ibss_joined) { - sdata->vif.bss_conf.ibss_joined = false; - netif_carrier_off(sdata->dev); - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IBSS); - } - - memcpy(ifibss->bssid, bssid, ETH_ALEN); - - sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; - - local->oper_channel = chan; - channel_type = ifibss->channel_type; - if (channel_type > NL80211_CHAN_HT20 && - !cfg80211_can_beacon_sec_chan(local->hw.wiphy, chan, channel_type)) - channel_type = NL80211_CHAN_HT20; - if (!ieee80211_set_channel_type(local, sdata, channel_type)) { - /* can only fail due to HT40+/- mismatch */ - channel_type = NL80211_CHAN_HT20; - WARN_ON(!ieee80211_set_channel_type(local, sdata, - NL80211_CHAN_HT20)); - } - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); - - sband = local->hw.wiphy->bands[chan->band]; - - /* build supported rates array */ - pos = supp_rates; - for (i = 0; i < sband->n_bitrates; i++) { - int rate = sband->bitrates[i].bitrate; - u8 basic = 0; - if (basic_rates & BIT(i)) - basic = 0x80; - *pos++ = basic | (u8) (rate / 5); - } - - /* Build IBSS probe response */ - mgmt = (void *) skb_put(skb, 24 + sizeof(mgmt->u.beacon)); - memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_PROBE_RESP); - memset(mgmt->da, 0xff, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - memcpy(mgmt->bssid, ifibss->bssid, ETH_ALEN); - mgmt->u.beacon.beacon_int = cpu_to_le16(beacon_int); - mgmt->u.beacon.timestamp = cpu_to_le64(tsf); - mgmt->u.beacon.capab_info = cpu_to_le16(capability); - - pos = skb_put(skb, 2 + ifibss->ssid_len); - *pos++ = WLAN_EID_SSID; - *pos++ = ifibss->ssid_len; - memcpy(pos, ifibss->ssid, ifibss->ssid_len); - - rates = sband->n_bitrates; - if (rates > 8) - rates = 8; - pos = skb_put(skb, 2 + rates); - *pos++ = WLAN_EID_SUPP_RATES; - *pos++ = rates; - memcpy(pos, supp_rates, rates); - - if (sband->band == IEEE80211_BAND_2GHZ) { - pos = skb_put(skb, 2 + 1); - *pos++ = WLAN_EID_DS_PARAMS; - *pos++ = 1; - *pos++ = ieee80211_frequency_to_channel(chan->center_freq); - } - - pos = skb_put(skb, 2 + 2); - *pos++ = WLAN_EID_IBSS_PARAMS; - *pos++ = 2; - /* FIX: set ATIM window based on scan results */ - *pos++ = 0; - *pos++ = 0; - - if (sband->n_bitrates > 8) { - rates = sband->n_bitrates - 8; - pos = skb_put(skb, 2 + rates); - *pos++ = WLAN_EID_EXT_SUPP_RATES; - *pos++ = rates; - memcpy(pos, &supp_rates[8], rates); - } - - if (ifibss->ie_len) - memcpy(skb_put(skb, ifibss->ie_len), - ifibss->ie, ifibss->ie_len); - - /* add HT capability and information IEs */ - if (channel_type && sband->ht_cap.ht_supported) { - pos = skb_put(skb, 4 + - sizeof(struct ieee80211_ht_cap) + - sizeof(struct ieee80211_ht_info)); - pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, - sband->ht_cap.cap); - pos = ieee80211_ie_build_ht_info(pos, - &sband->ht_cap, - chan, - channel_type); - } - - if (local->hw.queues >= 4) { - pos = skb_put(skb, 9); - *pos++ = WLAN_EID_VENDOR_SPECIFIC; - *pos++ = 7; /* len */ - *pos++ = 0x00; /* Microsoft OUI 00:50:F2 */ - *pos++ = 0x50; - *pos++ = 0xf2; - *pos++ = 2; /* WME */ - *pos++ = 0; /* WME info */ - *pos++ = 1; /* WME ver */ - *pos++ = 0; /* U-APSD no in use */ - } - - rcu_assign_pointer(ifibss->presp, skb); - - sdata->vif.bss_conf.beacon_int = beacon_int; - sdata->vif.bss_conf.basic_rates = basic_rates; - bss_change = BSS_CHANGED_BEACON_INT; - bss_change |= ieee80211_reset_erp_info(sdata); - bss_change |= BSS_CHANGED_BSSID; - bss_change |= BSS_CHANGED_BEACON; - bss_change |= BSS_CHANGED_BEACON_ENABLED; - bss_change |= BSS_CHANGED_BASIC_RATES; - bss_change |= BSS_CHANGED_HT; - bss_change |= BSS_CHANGED_IBSS; - sdata->vif.bss_conf.ibss_joined = true; - ieee80211_bss_info_change_notify(sdata, bss_change); - - ieee80211_sta_def_wmm_params(sdata, sband->n_bitrates, supp_rates); - - ifibss->state = IEEE80211_IBSS_MLME_JOINED; - mod_timer(&ifibss->timer, - round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL)); - - bss = cfg80211_inform_bss_frame(local->hw.wiphy, local->hw.conf.channel, - mgmt, skb->len, 0, GFP_KERNEL); - cfg80211_put_bss(bss); - netif_carrier_on(sdata->dev); - cfg80211_ibss_joined(sdata->dev, ifibss->bssid, GFP_KERNEL); -} - -static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, - struct ieee80211_bss *bss) -{ - struct cfg80211_bss *cbss = - container_of((void *)bss, struct cfg80211_bss, priv); - struct ieee80211_supported_band *sband; - u32 basic_rates; - int i, j; - u16 beacon_int = cbss->beacon_interval; - - lockdep_assert_held(&sdata->u.ibss.mtx); - - if (beacon_int < 10) - beacon_int = 10; - - sband = sdata->local->hw.wiphy->bands[cbss->channel->band]; - - basic_rates = 0; - - for (i = 0; i < bss->supp_rates_len; i++) { - int rate = (bss->supp_rates[i] & 0x7f) * 5; - bool is_basic = !!(bss->supp_rates[i] & 0x80); - - for (j = 0; j < sband->n_bitrates; j++) { - if (sband->bitrates[j].bitrate == rate) { - if (is_basic) - basic_rates |= BIT(j); - break; - } - } - } - - __ieee80211_sta_join_ibss(sdata, cbss->bssid, - beacon_int, - cbss->channel, - basic_rates, - cbss->capability, - cbss->tsf); -} - -static struct sta_info *ieee80211_ibss_finish_sta(struct sta_info *sta, - bool auth) - __acquires(RCU) -{ - struct ieee80211_sub_if_data *sdata = sta->sdata; - u8 addr[ETH_ALEN]; - - memcpy(addr, sta->sta.addr, ETH_ALEN); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(sdata->local->hw.wiphy, - "Adding new IBSS station %pM (dev=%s)\n", - addr, sdata->name); -#endif - - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); - /* authorize the station only if the network is not RSN protected. If - * not wait for the userspace to authorize it */ - if (!sta->sdata->u.ibss.control_port) - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); - - rate_control_rate_init(sta); - - /* If it fails, maybe we raced another insertion? */ - if (sta_info_insert_rcu(sta)) - return sta_info_get(sdata, addr); - if (auth) { -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG "TX Auth SA=%pM DA=%pM BSSID=%pM" - "(auth_transaction=1)\n", sdata->vif.addr, - sdata->u.ibss.bssid, addr); -#endif - ieee80211_send_auth(sdata, 1, WLAN_AUTH_OPEN, NULL, 0, - addr, sdata->u.ibss.bssid, NULL, 0, 0); - } - return sta; -} - -static struct sta_info * -ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, - const u8 *bssid, const u8 *addr, - u32 supp_rates, bool auth) - __acquires(RCU) -{ - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - int band = local->hw.conf.channel->band; - - /* - * XXX: Consider removing the least recently used entry and - * allow new one to be added. - */ - if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { - if (net_ratelimit()) - printk(KERN_DEBUG "%s: No room for a new IBSS STA entry %pM\n", - sdata->name, addr); - rcu_read_lock(); - return NULL; - } - - if (ifibss->state == IEEE80211_IBSS_MLME_SEARCH) { - rcu_read_lock(); - return NULL; - } - - if (compare_ether_addr(bssid, sdata->u.ibss.bssid)) { - rcu_read_lock(); - return NULL; - } - - sta = sta_info_alloc(sdata, addr, GFP_KERNEL); - if (!sta) { - rcu_read_lock(); - return NULL; - } - - sta->last_rx = jiffies; - - /* make sure mandatory rates are always added */ - sta->sta.supp_rates[band] = supp_rates | - ieee80211_mandatory_rates(local, band); - - return ieee80211_ibss_finish_sta(sta, auth); -} - -static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - size_t len) -{ - u16 auth_alg, auth_transaction; - - lockdep_assert_held(&sdata->u.ibss.mtx); - - if (len < 24 + 6) - return; - - auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); - auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); - - if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1) - return; -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG "%s: RX Auth SA=%pM DA=%pM BSSID=%pM." - "(auth_transaction=%d)\n", - sdata->name, mgmt->sa, mgmt->da, mgmt->bssid, auth_transaction); -#endif - sta_info_destroy_addr(sdata, mgmt->sa); - ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, 0, false); - rcu_read_unlock(); - - /* - * IEEE 802.11 standard does not require authentication in IBSS - * networks and most implementations do not seem to use it. - * However, try to reply to authentication attempts if someone - * has actually implemented this. - */ - ieee80211_send_auth(sdata, 2, WLAN_AUTH_OPEN, NULL, 0, - mgmt->sa, sdata->u.ibss.bssid, NULL, 0, 0); -} - -static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - size_t len, - struct ieee80211_rx_status *rx_status, - struct ieee802_11_elems *elems, - bool beacon) -{ - struct ieee80211_local *local = sdata->local; - int freq; - struct cfg80211_bss *cbss; - struct ieee80211_bss *bss; - struct sta_info *sta; - struct ieee80211_channel *channel; - u64 beacon_timestamp, rx_timestamp; - u32 supp_rates = 0; - enum ieee80211_band band = rx_status->band; - struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band]; - bool rates_updated = false; - - if (elems->ds_params && elems->ds_params_len == 1) - freq = ieee80211_channel_to_frequency(elems->ds_params[0], - band); - else - freq = rx_status->freq; - - channel = ieee80211_get_channel(local->hw.wiphy, freq); - - if (!channel || channel->flags & IEEE80211_CHAN_DISABLED) - return; - - if (sdata->vif.type == NL80211_IFTYPE_ADHOC && - compare_ether_addr(mgmt->bssid, sdata->u.ibss.bssid) == 0) { - - rcu_read_lock(); - sta = sta_info_get(sdata, mgmt->sa); - - if (elems->supp_rates) { - supp_rates = ieee80211_sta_get_rates(local, elems, - band); - if (sta) { - u32 prev_rates; - - prev_rates = sta->sta.supp_rates[band]; - /* make sure mandatory rates are always added */ - sta->sta.supp_rates[band] = supp_rates | - ieee80211_mandatory_rates(local, band); - - if (sta->sta.supp_rates[band] != prev_rates) { -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG - "%s: updated supp_rates set " - "for %pM based on beacon" - "/probe_resp (0x%x -> 0x%x)\n", - sdata->name, sta->sta.addr, - prev_rates, - sta->sta.supp_rates[band]); -#endif - rates_updated = true; - } - } else { - rcu_read_unlock(); - sta = ieee80211_ibss_add_sta(sdata, mgmt->bssid, - mgmt->sa, supp_rates, true); - } - } - - if (sta && elems->wmm_info) - set_sta_flag(sta, WLAN_STA_WME); - - if (sta && elems->ht_info_elem && elems->ht_cap_elem && - sdata->u.ibss.channel_type != NL80211_CHAN_NO_HT) { - /* we both use HT */ - struct ieee80211_sta_ht_cap sta_ht_cap_new; - enum nl80211_channel_type channel_type = - ieee80211_ht_info_to_channel_type( - elems->ht_info_elem); - - ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, - elems->ht_cap_elem, - &sta_ht_cap_new); - - /* - * fall back to HT20 if we don't use or use - * the other extension channel - */ - if ((channel_type == NL80211_CHAN_HT40MINUS || - channel_type == NL80211_CHAN_HT40PLUS) && - channel_type != sdata->u.ibss.channel_type) - sta_ht_cap_new.cap &= - ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; - - if (memcmp(&sta->sta.ht_cap, &sta_ht_cap_new, - sizeof(sta_ht_cap_new))) { - memcpy(&sta->sta.ht_cap, &sta_ht_cap_new, - sizeof(sta_ht_cap_new)); - rates_updated = true; - } - } - - if (sta && rates_updated) - rate_control_rate_init(sta); - - rcu_read_unlock(); - } - - bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems, - channel, beacon); - if (!bss) - return; - - cbss = container_of((void *)bss, struct cfg80211_bss, priv); - - /* was just updated in ieee80211_bss_info_update */ - beacon_timestamp = cbss->tsf; - - /* check if we need to merge IBSS */ - - /* we use a fixed BSSID */ - if (sdata->u.ibss.fixed_bssid) - goto put_bss; - - /* not an IBSS */ - if (!(cbss->capability & WLAN_CAPABILITY_IBSS)) - goto put_bss; - - /* different channel */ - if (cbss->channel != local->oper_channel) - goto put_bss; - - /* different SSID */ - if (elems->ssid_len != sdata->u.ibss.ssid_len || - memcmp(elems->ssid, sdata->u.ibss.ssid, - sdata->u.ibss.ssid_len)) - goto put_bss; - - /* same BSSID */ - if (compare_ether_addr(cbss->bssid, sdata->u.ibss.bssid) == 0) - goto put_bss; - - if (rx_status->flag & RX_FLAG_MACTIME_MPDU) { - /* - * For correct IBSS merging we need mactime; since mactime is - * defined as the time the first data symbol of the frame hits - * the PHY, and the timestamp of the beacon is defined as "the - * time that the data symbol containing the first bit of the - * timestamp is transmitted to the PHY plus the transmitting - * STA's delays through its local PHY from the MAC-PHY - * interface to its interface with the WM" (802.11 11.1.2) - * - equals the time this bit arrives at the receiver - we have - * to take into account the offset between the two. - * - * E.g. at 1 MBit that means mactime is 192 usec earlier - * (=24 bytes * 8 usecs/byte) than the beacon timestamp. - */ - int rate; - - if (rx_status->flag & RX_FLAG_HT) - rate = 65; /* TODO: HT rates */ - else - rate = local->hw.wiphy->bands[band]-> - bitrates[rx_status->rate_idx].bitrate; - - rx_timestamp = rx_status->mactime + (24 * 8 * 10 / rate); - } else { - /* - * second best option: get current TSF - * (will return -1 if not supported) - */ - rx_timestamp = drv_get_tsf(local, sdata); - } - -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG "RX beacon SA=%pM BSSID=" - "%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n", - mgmt->sa, mgmt->bssid, - (unsigned long long)rx_timestamp, - (unsigned long long)beacon_timestamp, - (unsigned long long)(rx_timestamp - beacon_timestamp), - jiffies); -#endif - - if (beacon_timestamp > rx_timestamp) { -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG "%s: beacon TSF higher than " - "local TSF - IBSS merge with BSSID %pM\n", - sdata->name, mgmt->bssid); -#endif - ieee80211_sta_join_ibss(sdata, bss); - supp_rates = ieee80211_sta_get_rates(local, elems, band); - ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, - supp_rates, true); - rcu_read_unlock(); - } - - put_bss: - ieee80211_rx_bss_put(local, bss); -} - -/* - * [PLATA] - This method creates a IBSS station, in the case the STA did not exist upon reception of a packet - * - Yet, this is only used in the context of BSS (iBSS), as when communicating in OCB mode, we do not maintain local sta info - * - hint - the remote sta are also not created and stored when BSS or iBSS using a wildcard BSSID... - */ -void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, - const u8 *bssid, const u8 *addr, - u32 supp_rates) -{ - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - int band = local->hw.conf.channel->band; - - /* - * XXX: Consider removing the least recently used entry and - * allow new one to be added. - */ - if (local->num_sta >= IEEE80211_IBSS_MAX_STA_ENTRIES) { - if (net_ratelimit()) - printk(KERN_DEBUG "%s: No room for a new IBSS STA entry %pM\n", - sdata->name, addr); - return; - } - - if (ifibss->state == IEEE80211_IBSS_MLME_SEARCH) - return; - - if (compare_ether_addr(bssid, sdata->u.ibss.bssid)) // [PLATA] if we guarantee a wildcard BSSID in packets and in the STA, we should exit here... - else, it means the IBSS sta does not exist - return; - - sta = sta_info_alloc(sdata, addr, GFP_ATOMIC); - if (!sta) - return; - - sta->last_rx = jiffies; - - /* make sure mandatory rates are always added */ - sta->sta.supp_rates[band] = supp_rates | - ieee80211_mandatory_rates(local, band); - - spin_lock(&ifibss->incomplete_lock); - list_add(&sta->list, &ifibss->incomplete_stations); - spin_unlock(&ifibss->incomplete_lock); - ieee80211_queue_work(&local->hw, &sdata->work); -} - -static int ieee80211_sta_active_ibss(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - int active = 0; - struct sta_info *sta; - - lockdep_assert_held(&sdata->u.ibss.mtx); - - rcu_read_lock(); - - list_for_each_entry_rcu(sta, &local->sta_list, list) { - if (sta->sdata == sdata && - time_after(sta->last_rx + IEEE80211_IBSS_MERGE_INTERVAL, - jiffies)) { - active++; - break; - } - } - - rcu_read_unlock(); - - return active; -} - -/* - * This function is called with state == IEEE80211_IBSS_MLME_JOINED - */ - -static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - - lockdep_assert_held(&ifibss->mtx); - - mod_timer(&ifibss->timer, - round_jiffies(jiffies + IEEE80211_IBSS_MERGE_INTERVAL)); - - ieee80211_sta_expire(sdata, IEEE80211_IBSS_INACTIVITY_LIMIT); - - if (time_before(jiffies, ifibss->last_scan_completed + - IEEE80211_IBSS_MERGE_INTERVAL)) - return; - - if (ieee80211_sta_active_ibss(sdata)) - return; - - if (ifibss->fixed_channel) - return; - - printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other " - "IBSS networks with same SSID (merge)\n", sdata->name); - - ieee80211_request_internal_scan(sdata, - ifibss->ssid, ifibss->ssid_len, NULL); -} - -static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - u8 bssid[ETH_ALEN]; - u16 capability; - int i; - - lockdep_assert_held(&ifibss->mtx); - - if (ifibss->fixed_bssid) { - memcpy(bssid, ifibss->bssid, ETH_ALEN); - } else { - /* Generate random, not broadcast, locally administered BSSID. Mix in - * own MAC address to make sure that devices that do not have proper - * random number generator get different BSSID. */ - get_random_bytes(bssid, ETH_ALEN); - for (i = 0; i < ETH_ALEN; i++) - bssid[i] ^= sdata->vif.addr[i]; - bssid[0] &= ~0x01; - bssid[0] |= 0x02; - } - - printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n", - sdata->name, bssid); - - capability = WLAN_CAPABILITY_IBSS; - - if (ifibss->privacy) - capability |= WLAN_CAPABILITY_PRIVACY; - else - sdata->drop_unencrypted = 0; - - __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int, - ifibss->channel, ifibss->basic_rates, - capability, 0); -} - -/* - * This function is called with state == IEEE80211_IBSS_MLME_SEARCH - */ - -static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct ieee80211_local *local = sdata->local; - struct cfg80211_bss *cbss; - struct ieee80211_channel *chan = NULL; - const u8 *bssid = NULL; - int active_ibss; - u16 capability; - - lockdep_assert_held(&ifibss->mtx); - - active_ibss = ieee80211_sta_active_ibss(sdata); -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n", - sdata->name, active_ibss); -#endif /* CONFIG_MAC80211_IBSS_DEBUG */ - - if (active_ibss) - return; - - capability = WLAN_CAPABILITY_IBSS; - if (ifibss->privacy) - capability |= WLAN_CAPABILITY_PRIVACY; - if (ifibss->fixed_bssid) - bssid = ifibss->bssid; - if (ifibss->fixed_channel) - chan = ifibss->channel; - if (!is_zero_ether_addr(ifibss->bssid)) - bssid = ifibss->bssid; - cbss = cfg80211_get_bss(local->hw.wiphy, chan, bssid, - ifibss->ssid, ifibss->ssid_len, - WLAN_CAPABILITY_IBSS | WLAN_CAPABILITY_PRIVACY, - capability); - - if (cbss) { - struct ieee80211_bss *bss; - - bss = (void *)cbss->priv; -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG " sta_find_ibss: selected %pM current " - "%pM\n", cbss->bssid, ifibss->bssid); -#endif /* CONFIG_MAC80211_IBSS_DEBUG */ - - printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM" - " based on configured SSID\n", - sdata->name, cbss->bssid); - - ieee80211_sta_join_ibss(sdata, bss); - ieee80211_rx_bss_put(local, bss); - return; - } - -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG " did not try to join ibss\n"); -#endif /* CONFIG_MAC80211_IBSS_DEBUG */ - - /* Selected IBSS not found in current scan results - try to scan */ - if (time_after(jiffies, ifibss->last_scan_completed + - IEEE80211_SCAN_INTERVAL)) { - printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to " - "join\n", sdata->name); - - ieee80211_request_internal_scan(sdata, - ifibss->ssid, ifibss->ssid_len, - ifibss->fixed_channel ? ifibss->channel : NULL); - } else { - int interval = IEEE80211_SCAN_INTERVAL; - - if (time_after(jiffies, ifibss->ibss_join_req + - IEEE80211_IBSS_JOIN_TIMEOUT)) { - if (!(local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS)) { - ieee80211_sta_create_ibss(sdata); - return; - } - printk(KERN_DEBUG "%s: IBSS not allowed on" - " %d MHz\n", sdata->name, - local->hw.conf.channel->center_freq); - - /* No IBSS found - decrease scan interval and continue - * scanning. */ - interval = IEEE80211_SCAN_INTERVAL_SLOW; - } - - mod_timer(&ifibss->timer, - round_jiffies(jiffies + interval)); - } -} - -static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, - struct sk_buff *req) -{ - struct ieee80211_mgmt *mgmt = (void *)req->data; - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct ieee80211_local *local = sdata->local; - int tx_last_beacon, len = req->len; - struct sk_buff *skb; - struct ieee80211_mgmt *resp; - struct sk_buff *presp; - u8 *pos, *end; - - lockdep_assert_held(&ifibss->mtx); - - presp = rcu_dereference_protected(ifibss->presp, - lockdep_is_held(&ifibss->mtx)); - - if (ifibss->state != IEEE80211_IBSS_MLME_JOINED || - len < 24 + 2 || !presp) - return; - - tx_last_beacon = drv_tx_last_beacon(local); - -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG "%s: RX ProbeReq SA=%pM DA=%pM BSSID=%pM" - " (tx_last_beacon=%d)\n", - sdata->name, mgmt->sa, mgmt->da, - mgmt->bssid, tx_last_beacon); -#endif /* CONFIG_MAC80211_IBSS_DEBUG */ - - if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) - return; - - if (compare_ether_addr(mgmt->bssid, ifibss->bssid) != 0 && - !is_broadcast_ether_addr(mgmt->bssid)) - return; - - end = ((u8 *) mgmt) + len; - pos = mgmt->u.probe_req.variable; - if (pos[0] != WLAN_EID_SSID || - pos + 2 + pos[1] > end) { -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG "%s: Invalid SSID IE in ProbeReq " - "from %pM\n", - sdata->name, mgmt->sa); -#endif - return; - } - if (pos[1] != 0 && - (pos[1] != ifibss->ssid_len || - memcmp(pos + 2, ifibss->ssid, ifibss->ssid_len))) { - /* Ignore ProbeReq for foreign SSID */ - return; - } - - /* Reply with ProbeResp */ - skb = skb_copy(presp, GFP_KERNEL); - if (!skb) - return; - - resp = (struct ieee80211_mgmt *) skb->data; - memcpy(resp->da, mgmt->sa, ETH_ALEN); -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG "%s: Sending ProbeResp to %pM\n", - sdata->name, resp->da); -#endif /* CONFIG_MAC80211_IBSS_DEBUG */ - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - ieee80211_tx_skb(sdata, skb); -} - -static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - size_t len, - struct ieee80211_rx_status *rx_status) -{ - size_t baselen; - struct ieee802_11_elems elems; - - baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; - if (baselen > len) - return; - - ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen, - &elems); - - ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false); -} - -static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - size_t len, - struct ieee80211_rx_status *rx_status) -{ - size_t baselen; - struct ieee802_11_elems elems; - - /* Process beacon from the current BSS */ - baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; - if (baselen > len) - return; - - ieee802_11_parse_elems(mgmt->u.beacon.variable, len - baselen, &elems); - - ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, true); -} - -void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb) -{ - struct ieee80211_rx_status *rx_status; - struct ieee80211_mgmt *mgmt; - u16 fc; - - rx_status = IEEE80211_SKB_RXCB(skb); - mgmt = (struct ieee80211_mgmt *) skb->data; - fc = le16_to_cpu(mgmt->frame_control); - - mutex_lock(&sdata->u.ibss.mtx); - - if (!sdata->u.ibss.ssid_len) - goto mgmt_out; /* not ready to merge yet */ - - switch (fc & IEEE80211_FCTL_STYPE) { - case IEEE80211_STYPE_PROBE_REQ: - ieee80211_rx_mgmt_probe_req(sdata, skb); - break; - case IEEE80211_STYPE_PROBE_RESP: - ieee80211_rx_mgmt_probe_resp(sdata, mgmt, skb->len, - rx_status); - break; - case IEEE80211_STYPE_BEACON: - ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len, - rx_status); - break; - case IEEE80211_STYPE_AUTH: - ieee80211_rx_mgmt_auth_ibss(sdata, mgmt, skb->len); - break; - } - - mgmt_out: - mutex_unlock(&sdata->u.ibss.mtx); -} - -void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct sta_info *sta; - - mutex_lock(&ifibss->mtx); - - /* - * Work could be scheduled after scan or similar - * when we aren't even joined (or trying) with a - * network. - */ - if (!ifibss->ssid_len) - goto out; - - spin_lock_bh(&ifibss->incomplete_lock); - while (!list_empty(&ifibss->incomplete_stations)) { - sta = list_first_entry(&ifibss->incomplete_stations, - struct sta_info, list); - list_del(&sta->list); - spin_unlock_bh(&ifibss->incomplete_lock); - - ieee80211_ibss_finish_sta(sta, true); - rcu_read_unlock(); - spin_lock_bh(&ifibss->incomplete_lock); - } - spin_unlock_bh(&ifibss->incomplete_lock); - - switch (ifibss->state) { - case IEEE80211_IBSS_MLME_SEARCH: - ieee80211_sta_find_ibss(sdata); - break; - case IEEE80211_IBSS_MLME_JOINED: - ieee80211_sta_merge_ibss(sdata); - break; - default: - WARN_ON(1); - break; - } - - out: - mutex_unlock(&ifibss->mtx); -} - -static void ieee80211_ibss_timer(unsigned long data) -{ - struct ieee80211_sub_if_data *sdata = - (struct ieee80211_sub_if_data *) data; - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct ieee80211_local *local = sdata->local; - - if (local->quiescing) { - ifibss->timer_running = true; - return; - } - - ieee80211_queue_work(&local->hw, &sdata->work); -} - -#ifdef CONFIG_PM -void ieee80211_ibss_quiesce(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - - if (del_timer_sync(&ifibss->timer)) - ifibss->timer_running = true; -} - -void ieee80211_ibss_restart(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - - if (ifibss->timer_running) { - add_timer(&ifibss->timer); - ifibss->timer_running = false; - } -} -#endif - -void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - - setup_timer(&ifibss->timer, ieee80211_ibss_timer, - (unsigned long) sdata); - mutex_init(&ifibss->mtx); - INIT_LIST_HEAD(&ifibss->incomplete_stations); - spin_lock_init(&ifibss->incomplete_lock); -} - -/* scan finished notification */ -void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local) -{ - struct ieee80211_sub_if_data *sdata; - - mutex_lock(&local->iflist_mtx); - list_for_each_entry(sdata, &local->interfaces, list) { - if (!ieee80211_sdata_running(sdata)) - continue; - if (sdata->vif.type != NL80211_IFTYPE_ADHOC) - continue; - sdata->u.ibss.last_scan_completed = jiffies; - ieee80211_queue_work(&local->hw, &sdata->work); - } - mutex_unlock(&local->iflist_mtx); -} - -int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, - struct cfg80211_ibss_params *params) -{ - struct sk_buff *skb; - u32 changed = 0; - - skb = dev_alloc_skb(sdata->local->hw.extra_tx_headroom + - sizeof(struct ieee80211_hdr_3addr) + - 12 /* struct ieee80211_mgmt.u.beacon */ + - 2 + IEEE80211_MAX_SSID_LEN /* max SSID */ + - 2 + 8 /* max Supported Rates */ + - 3 /* max DS params */ + - 4 /* IBSS params */ + - 2 + (IEEE80211_MAX_SUPP_RATES - 8) + - 2 + sizeof(struct ieee80211_ht_cap) + - 2 + sizeof(struct ieee80211_ht_info) + - params->ie_len); - if (!skb) - return -ENOMEM; - - mutex_lock(&sdata->u.ibss.mtx); - - if (params->bssid) { - memcpy(sdata->u.ibss.bssid, params->bssid, ETH_ALEN); - sdata->u.ibss.fixed_bssid = true; - } else - sdata->u.ibss.fixed_bssid = false; - - sdata->u.ibss.privacy = params->privacy; - sdata->u.ibss.control_port = params->control_port; - sdata->u.ibss.basic_rates = params->basic_rates; - memcpy(sdata->vif.bss_conf.mcast_rate, params->mcast_rate, - sizeof(params->mcast_rate)); - - sdata->vif.bss_conf.beacon_int = params->beacon_interval; - - sdata->u.ibss.channel = params->channel; - sdata->u.ibss.channel_type = params->channel_type; - sdata->u.ibss.fixed_channel = params->channel_fixed; - - /* fix ourselves to that channel now already */ - if (params->channel_fixed) { - sdata->local->oper_channel = params->channel; - if (!ieee80211_set_channel_type(sdata->local, sdata, - params->channel_type)) { - mutex_unlock(&sdata->u.ibss.mtx); - kfree_skb(skb); - return -EINVAL; - } - } - - if (params->ie) { - sdata->u.ibss.ie = kmemdup(params->ie, params->ie_len, - GFP_KERNEL); - if (sdata->u.ibss.ie) - sdata->u.ibss.ie_len = params->ie_len; - } - - sdata->u.ibss.skb = skb; - sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH; - sdata->u.ibss.ibss_join_req = jiffies; - - memcpy(sdata->u.ibss.ssid, params->ssid, IEEE80211_MAX_SSID_LEN); - sdata->u.ibss.ssid_len = params->ssid_len; - - mutex_unlock(&sdata->u.ibss.mtx); - - mutex_lock(&sdata->local->mtx); - ieee80211_recalc_idle(sdata->local); - mutex_unlock(&sdata->local->mtx); - - /* - * 802.11n-2009 9.13.3.1: In an IBSS, the HT Protection field is - * reserved, but an HT STA shall protect HT transmissions as though - * the HT Protection field were set to non-HT mixed mode. - * - * In an IBSS, the RIFS Mode field of the HT Operation element is - * also reserved, but an HT STA shall operate as though this field - * were set to 1. - */ - - sdata->vif.bss_conf.ht_operation_mode |= - IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED - | IEEE80211_HT_PARAM_RIFS_MODE; - - changed |= BSS_CHANGED_HT; - ieee80211_bss_info_change_notify(sdata, changed); - - ieee80211_queue_work(&sdata->local->hw, &sdata->work); - - return 0; -} - -int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata) -{ - struct sk_buff *skb; - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct ieee80211_local *local = sdata->local; - struct cfg80211_bss *cbss; - u16 capability; - int active_ibss; - struct sta_info *sta; - - mutex_lock(&sdata->u.ibss.mtx); - - sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH; - memset(sdata->u.ibss.bssid, 0, ETH_ALEN); - sdata->u.ibss.ssid_len = 0; - - active_ibss = ieee80211_sta_active_ibss(sdata); - - if (!active_ibss && !is_zero_ether_addr(ifibss->bssid)) { - capability = WLAN_CAPABILITY_IBSS; - - if (ifibss->privacy) - capability |= WLAN_CAPABILITY_PRIVACY; - - cbss = cfg80211_get_bss(local->hw.wiphy, ifibss->channel, - ifibss->bssid, ifibss->ssid, - ifibss->ssid_len, WLAN_CAPABILITY_IBSS | - WLAN_CAPABILITY_PRIVACY, - capability); - - if (cbss) { - cfg80211_unlink_bss(local->hw.wiphy, cbss); - cfg80211_put_bss(cbss); - } - } - - sta_info_flush(sdata->local, sdata); - - spin_lock_bh(&ifibss->incomplete_lock); - while (!list_empty(&ifibss->incomplete_stations)) { - sta = list_first_entry(&ifibss->incomplete_stations, - struct sta_info, list); - list_del(&sta->list); - spin_unlock_bh(&ifibss->incomplete_lock); - - sta_info_free(local, sta); - spin_lock_bh(&ifibss->incomplete_lock); - } - spin_unlock_bh(&ifibss->incomplete_lock); - - netif_carrier_off(sdata->dev); - - /* remove beacon */ - kfree(sdata->u.ibss.ie); - skb = rcu_dereference_protected(sdata->u.ibss.presp, - lockdep_is_held(&sdata->u.ibss.mtx)); - RCU_INIT_POINTER(sdata->u.ibss.presp, NULL); - sdata->vif.bss_conf.ibss_joined = false; - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED | - BSS_CHANGED_IBSS); - synchronize_rcu(); - kfree_skb(skb); - - skb_queue_purge(&sdata->skb_queue); - - del_timer_sync(&sdata->u.ibss.timer); - - mutex_unlock(&sdata->u.ibss.mtx); - - mutex_lock(&local->mtx); - ieee80211_recalc_idle(sdata->local); - mutex_unlock(&local->mtx); - - return 0; -} diff --git a/openairITS/mac/DOT11/net/mac80211/ieee80211_i.h b/openairITS/mac/DOT11/net/mac80211/ieee80211_i.h deleted file mode 100644 index ba9c8154115..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/ieee80211_i.h +++ /dev/null @@ -1,1529 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef IEEE80211_I_H -#define IEEE80211_I_H - -#include <linux/kernel.h> -#include <linux/device.h> -#include <linux/if_ether.h> -#include <linux/interrupt.h> -#include <linux/list.h> -#include <linux/netdevice.h> -#include <linux/skbuff.h> -#include <linux/workqueue.h> -#include <linux/types.h> -#include <linux/spinlock.h> -#include <linux/etherdevice.h> -#include <linux/leds.h> -#include <linux/idr.h> -#include <net/ieee80211_radiotap.h> -#include <net/cfg80211.h> -#include <net/mac80211.h> -#include "key.h" -#include "sta_info.h" - -struct ieee80211_local; - -/* Maximum number of broadcast/multicast frames to buffer when some of the - * associated stations are using power saving. */ -#define AP_MAX_BC_BUFFER 128 - -/* Maximum number of frames buffered to all STAs, including multicast frames. - * Note: increasing this limit increases the potential memory requirement. Each - * frame can be up to about 2 kB long. */ -#define TOTAL_MAX_TX_BUFFER 512 - -/* Required encryption head and tailroom */ -#define IEEE80211_ENCRYPT_HEADROOM 8 -#define IEEE80211_ENCRYPT_TAILROOM 18 - -/* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent - * reception of at least three fragmented frames. This limit can be increased - * by changing this define, at the cost of slower frame reassembly and - * increased memory use (about 2 kB of RAM per entry). */ -#define IEEE80211_FRAGMENT_MAX 4 - -#define TU_TO_EXP_TIME(x) (jiffies + usecs_to_jiffies((x) * 1024)) - -#define IEEE80211_DEFAULT_UAPSD_QUEUES \ - (IEEE80211_WMM_IE_STA_QOSINFO_AC_BK | \ - IEEE80211_WMM_IE_STA_QOSINFO_AC_BE | \ - IEEE80211_WMM_IE_STA_QOSINFO_AC_VI | \ - IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) - -#define IEEE80211_DEFAULT_MAX_SP_LEN \ - IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL - -struct ieee80211_fragment_entry { - unsigned long first_frag_time; - unsigned int seq; - unsigned int rx_queue; - unsigned int last_frag; - unsigned int extra_len; - struct sk_buff_head skb_list; - int ccmp; /* Whether fragments were encrypted with CCMP */ - u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ -}; - - -struct ieee80211_bss { - /* don't want to look up all the time */ - size_t ssid_len; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - - u8 dtim_period; - - bool wmm_used; - bool uapsd_supported; - - unsigned long last_probe_resp; - -#ifdef CONFIG_MAC80211_MESH - u8 *mesh_id; - size_t mesh_id_len; - u8 *mesh_cfg; -#endif - -#define IEEE80211_MAX_SUPP_RATES 32 - u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; - size_t supp_rates_len; - - /* - * During association, we save an ERP value from a probe response so - * that we can feed ERP info to the driver when handling the - * association completes. these fields probably won't be up-to-date - * otherwise, you probably don't want to use them. - */ - bool has_erp_value; - u8 erp_value; - - /* Keep track of the corruption of the last beacon/probe response. */ - u8 corrupt_data; - - /* Keep track of what bits of information we have valid info for. */ - u8 valid_data; -}; - -/** - * enum ieee80211_corrupt_data_flags - BSS data corruption flags - * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted - * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted - * - * These are bss flags that are attached to a bss in the - * @corrupt_data field of &struct ieee80211_bss. - */ -enum ieee80211_bss_corrupt_data_flags { - IEEE80211_BSS_CORRUPT_BEACON = BIT(0), - IEEE80211_BSS_CORRUPT_PROBE_RESP = BIT(1) -}; - -/** - * enum ieee80211_valid_data_flags - BSS valid data flags - * @IEEE80211_BSS_VALID_DTIM: DTIM data was gathered from non-corrupt IE - * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE - * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE - * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE - * - * These are bss flags that are attached to a bss in the - * @valid_data field of &struct ieee80211_bss. They show which parts - * of the data structure were recieved as a result of an un-corrupted - * beacon/probe response. - */ -enum ieee80211_bss_valid_data_flags { - IEEE80211_BSS_VALID_DTIM = BIT(0), - IEEE80211_BSS_VALID_WMM = BIT(1), - IEEE80211_BSS_VALID_RATES = BIT(2), - IEEE80211_BSS_VALID_ERP = BIT(3) -}; - -static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss) -{ -#ifdef CONFIG_MAC80211_MESH - return bss->mesh_cfg; -#endif - return NULL; -} - -static inline u8 *bss_mesh_id(struct ieee80211_bss *bss) -{ -#ifdef CONFIG_MAC80211_MESH - return bss->mesh_id; -#endif - return NULL; -} - -static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss) -{ -#ifdef CONFIG_MAC80211_MESH - return bss->mesh_id_len; -#endif - return 0; -} - - -typedef unsigned __bitwise__ ieee80211_tx_result; -#define TX_CONTINUE ((__force ieee80211_tx_result) 0u) -#define TX_DROP ((__force ieee80211_tx_result) 1u) -#define TX_QUEUED ((__force ieee80211_tx_result) 2u) - -#define IEEE80211_TX_UNICAST BIT(1) -#define IEEE80211_TX_PS_BUFFERED BIT(2) - -struct ieee80211_tx_data { - struct sk_buff *skb; - struct sk_buff_head skbs; - struct ieee80211_local *local; - struct ieee80211_sub_if_data *sdata; - struct sta_info *sta; - struct ieee80211_key *key; - - struct ieee80211_channel *channel; - - unsigned int flags; -}; - - -typedef unsigned __bitwise__ ieee80211_rx_result; -#define RX_CONTINUE ((__force ieee80211_rx_result) 0u) -#define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) -#define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) -#define RX_QUEUED ((__force ieee80211_rx_result) 3u) - -/** - * enum ieee80211_packet_rx_flags - packet RX flags - * @IEEE80211_RX_RA_MATCH: frame is destined to interface currently processed - * (incl. multicast frames) - * @IEEE80211_RX_IN_SCAN: received while scanning - * @IEEE80211_RX_FRAGMENTED: fragmented frame - * @IEEE80211_RX_AMSDU: a-MSDU packet - * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed - * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering - * - * These are per-frame flags that are attached to a frame in the - * @rx_flags field of &struct ieee80211_rx_status. - */ -enum ieee80211_packet_rx_flags { - IEEE80211_RX_IN_SCAN = BIT(0), - IEEE80211_RX_RA_MATCH = BIT(1), - IEEE80211_RX_FRAGMENTED = BIT(2), - IEEE80211_RX_AMSDU = BIT(3), - IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4), - IEEE80211_RX_DEFERRED_RELEASE = BIT(5), -}; - -/** - * enum ieee80211_rx_flags - RX data flags - * - * @IEEE80211_RX_CMNTR: received on cooked monitor already - * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported - * to cfg80211_report_obss_beacon(). - * - * These flags are used across handling multiple interfaces - * for a single frame. - */ -enum ieee80211_rx_flags { - IEEE80211_RX_CMNTR = BIT(0), - IEEE80211_RX_BEACON_REPORTED = BIT(1), -}; - -/* - * struct ieee80211_rx_data - receiver structure - * - */ -struct ieee80211_rx_data { - struct sk_buff *skb; - struct ieee80211_local *local; - struct ieee80211_sub_if_data *sdata; - struct sta_info *sta; - struct ieee80211_key *key; - - unsigned int flags; - - /* - * Index into sequence numbers array, 0..16 - * since the last (16) is used for non-QoS, - * will be 16 on non-QoS frames. - */ - int seqno_idx; - - /* - * Index into the security IV/PN arrays, 0..16 - * since the last (16) is used for CCMP-encrypted - * management frames, will be set to 16 on mgmt - * frames and 0 on non-QoS frames. - */ - int security_idx; - - u32 tkip_iv32; - u16 tkip_iv16; -}; - -struct beacon_data { - u8 *head, *tail; - int head_len, tail_len; - struct rcu_head rcu_head; -}; - -struct ieee80211_if_ap { - struct beacon_data __rcu *beacon; - struct sk_buff __rcu *probe_resp; - - struct list_head vlans; - - /* yes, this looks ugly, but guarantees that we can later use - * bitmap_empty :) - * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ - u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]; - struct sk_buff_head ps_bc_buf; - atomic_t num_sta_ps; /* number of stations in PS mode */ - atomic_t num_sta_authorized; /* number of authorized stations */ - int dtim_count; - bool dtim_bc_mc; -}; - -struct ieee80211_if_wds { - struct sta_info *sta; - u8 remote_addr[ETH_ALEN]; -}; - -struct ieee80211_if_vlan { - struct list_head list; - - /* used for all tx if the VLAN is configured to 4-addr mode */ - struct sta_info __rcu *sta; -}; - -struct mesh_stats { - __u32 fwded_mcast; /* Mesh forwarded multicast frames */ - __u32 fwded_unicast; /* Mesh forwarded unicast frames */ - __u32 fwded_frames; /* Mesh total forwarded frames */ - __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ - __u32 dropped_frames_no_route; /* Not transmitted, no route found */ - __u32 dropped_frames_congestion;/* Not forwarded due to congestion */ - atomic_t estab_plinks; -}; - -#define PREQ_Q_F_START 0x1 -#define PREQ_Q_F_REFRESH 0x2 -struct mesh_preq_queue { - struct list_head list; - u8 dst[ETH_ALEN]; - u8 flags; -}; - -enum ieee80211_work_type { - IEEE80211_WORK_ABORT, - IEEE80211_WORK_REMAIN_ON_CHANNEL, - IEEE80211_WORK_OFFCHANNEL_TX, -}; - -/** - * enum work_done_result - indicates what to do after work was done - * - * @WORK_DONE_DESTROY: This work item is no longer needed, destroy. - * @WORK_DONE_REQUEUE: This work item was reset to be reused, and - * should be requeued. - */ -enum work_done_result { - WORK_DONE_DESTROY, - WORK_DONE_REQUEUE, -}; - -struct ieee80211_work { - struct list_head list; - - struct rcu_head rcu_head; - - struct ieee80211_sub_if_data *sdata; - - enum work_done_result (*done)(struct ieee80211_work *wk, - struct sk_buff *skb); - - struct ieee80211_channel *chan; - enum nl80211_channel_type chan_type; - - unsigned long timeout; - enum ieee80211_work_type type; - - bool started; - - union { - struct { - u32 duration; - } remain; - struct { - struct sk_buff *frame; - u32 wait; - bool status; - } offchan_tx; - }; - - size_t data_len; - u8 data[]; -}; - -/* flags used in struct ieee80211_if_managed.flags */ -enum ieee80211_sta_flags { - IEEE80211_STA_BEACON_POLL = BIT(0), - IEEE80211_STA_CONNECTION_POLL = BIT(1), - IEEE80211_STA_CONTROL_PORT = BIT(2), - IEEE80211_STA_DISABLE_11N = BIT(4), - IEEE80211_STA_CSA_RECEIVED = BIT(5), - IEEE80211_STA_MFP_ENABLED = BIT(6), - IEEE80211_STA_UAPSD_ENABLED = BIT(7), - IEEE80211_STA_NULLFUNC_ACKED = BIT(8), - IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9), -}; - -struct ieee80211_mgd_auth_data { - struct cfg80211_bss *bss; - unsigned long timeout; - int tries; - u16 algorithm, expected_transaction; - - u8 key[WLAN_KEY_LEN_WEP104]; - u8 key_len, key_idx; - bool done; - - size_t ie_len; - u8 ie[]; -}; - -struct ieee80211_mgd_assoc_data { - struct cfg80211_bss *bss; - const u8 *supp_rates; - const u8 *ht_information_ie; - - unsigned long timeout; - int tries; - - u16 capability; - u8 prev_bssid[ETH_ALEN]; - u8 ssid[IEEE80211_MAX_SSID_LEN]; - u8 ssid_len; - u8 supp_rates_len; - bool wmm, uapsd; - bool have_beacon; - bool sent_assoc; - bool synced; - - size_t ie_len; - u8 ie[]; -}; - -struct ieee80211_if_managed { - struct timer_list timer; - struct timer_list conn_mon_timer; - struct timer_list bcn_mon_timer; - struct timer_list chswitch_timer; - struct work_struct monitor_work; - struct work_struct chswitch_work; - struct work_struct beacon_connection_loss_work; - - unsigned long beacon_timeout; - unsigned long probe_timeout; - int probe_send_count; - bool nullfunc_failed; - - struct mutex mtx; - struct cfg80211_bss *associated; - struct ieee80211_mgd_auth_data *auth_data; - struct ieee80211_mgd_assoc_data *assoc_data; - - u8 bssid[ETH_ALEN]; - - u16 aid; - - unsigned long timers_running; /* used for quiesce/restart */ - bool powersave; /* powersave requested for this iface */ - bool broken_ap; /* AP is broken -- turn off powersave */ - enum ieee80211_smps_mode req_smps, /* requested smps mode */ - ap_smps, /* smps mode AP thinks we're in */ - driver_smps_mode; /* smps mode request */ - - struct work_struct request_smps_work; - - unsigned int flags; - - bool beacon_crc_valid; - u32 beacon_crc; - - enum { - IEEE80211_MFP_DISABLED, - IEEE80211_MFP_OPTIONAL, - IEEE80211_MFP_REQUIRED - } mfp; /* management frame protection */ - - /* - * Bitmask of enabled u-apsd queues, - * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association - * to take effect. - */ - unsigned int uapsd_queues; - - /* - * Maximum number of buffered frames AP can deliver during a - * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar. - * Needs a new association to take effect. - */ - unsigned int uapsd_max_sp_len; - - int wmm_last_param_set; - - u8 use_4addr; - - /* Signal strength from the last Beacon frame in the current BSS. */ - int last_beacon_signal; - - /* - * Weighted average of the signal strength from Beacon frames in the - * current BSS. This is in units of 1/16 of the signal unit to maintain - * accuracy and to speed up calculations, i.e., the value need to be - * divided by 16 to get the actual value. - */ - int ave_beacon_signal; - - /* - * Number of Beacon frames used in ave_beacon_signal. This can be used - * to avoid generating less reliable cqm events that would be based - * only on couple of received frames. - */ - unsigned int count_beacon_signal; - - /* - * Last Beacon frame signal strength average (ave_beacon_signal / 16) - * that triggered a cqm event. 0 indicates that no event has been - * generated for the current association. - */ - int last_cqm_event_signal; - - /* - * State variables for keeping track of RSSI of the AP currently - * connected to and informing driver when RSSI has gone - * below/above a certain threshold. - */ - int rssi_min_thold, rssi_max_thold; - int last_ave_beacon_signal; - - struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ - struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ -}; - -struct ieee80211_if_ibss { - struct timer_list timer; - - struct mutex mtx; - - unsigned long last_scan_completed; - - u32 basic_rates; - - bool timer_running; - - bool fixed_bssid; - bool fixed_channel; - bool privacy; - - bool control_port; - - u8 bssid[ETH_ALEN] __aligned(2); - u8 ssid[IEEE80211_MAX_SSID_LEN]; - u8 ssid_len, ie_len; - u8 *ie; - struct ieee80211_channel *channel; - enum nl80211_channel_type channel_type; - - unsigned long ibss_join_req; - /* probe response/beacon for IBSS */ - struct sk_buff __rcu *presp; - struct sk_buff *skb; - - spinlock_t incomplete_lock; - struct list_head incomplete_stations; - - enum { - IEEE80211_IBSS_MLME_SEARCH, - IEEE80211_IBSS_MLME_JOINED, - } state; -}; - -struct ieee80211_if_mesh { - struct timer_list housekeeping_timer; - struct timer_list mesh_path_timer; - struct timer_list mesh_path_root_timer; - - unsigned long timers_running; - - unsigned long wrkq_flags; - - u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; - size_t mesh_id_len; - /* Active Path Selection Protocol Identifier */ - u8 mesh_pp_id; - /* Active Path Selection Metric Identifier */ - u8 mesh_pm_id; - /* Congestion Control Mode Identifier */ - u8 mesh_cc_id; - /* Synchronization Protocol Identifier */ - u8 mesh_sp_id; - /* Authentication Protocol Identifier */ - u8 mesh_auth_id; - /* Local mesh Sequence Number */ - u32 sn; - /* Last used PREQ ID */ - u32 preq_id; - atomic_t mpaths; - /* Timestamp of last SN update */ - unsigned long last_sn_update; - /* Time when it's ok to send next PERR */ - unsigned long next_perr; - /* Timestamp of last PREQ sent */ - unsigned long last_preq; - struct mesh_rmc *rmc; - spinlock_t mesh_preq_queue_lock; - struct mesh_preq_queue preq_queue; - int preq_queue_len; - struct mesh_stats mshstats; - struct mesh_config mshcfg; - u32 mesh_seqnum; - bool accepting_plinks; - int num_gates; - const u8 *ie; - u8 ie_len; - enum { - IEEE80211_MESH_SEC_NONE = 0x0, - IEEE80211_MESH_SEC_AUTHED = 0x1, - IEEE80211_MESH_SEC_SECURED = 0x2, - } security; -}; - -#ifdef CONFIG_MAC80211_MESH -#define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ - do { (msh)->mshstats.name++; } while (0) -#else -#define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ - do { } while (0) -#endif - -/** - * enum ieee80211_sub_if_data_flags - virtual interface flags - * - * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets - * @IEEE80211_SDATA_PROMISC: interface is promisc - * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode - * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between - * associated stations and deliver multicast frames both - * back to wireless media and to the local net stack. - * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume. - * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver - */ -enum ieee80211_sub_if_data_flags { - IEEE80211_SDATA_ALLMULTI = BIT(0), - IEEE80211_SDATA_PROMISC = BIT(1), - IEEE80211_SDATA_OPERATING_GMODE = BIT(2), - IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3), - IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4), - IEEE80211_SDATA_IN_DRIVER = BIT(5), -}; - -/** - * enum ieee80211_sdata_state_bits - virtual interface state bits - * @SDATA_STATE_RUNNING: virtual interface is up & running; this - * mirrors netif_running() but is separate for interface type - * change handling while the interface is up - * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel - * mode, so queues are stopped - */ -enum ieee80211_sdata_state_bits { - SDATA_STATE_RUNNING, - SDATA_STATE_OFFCHANNEL, -}; - -struct ieee80211_sub_if_data { - struct list_head list; - - struct wireless_dev wdev; - - /* keys */ - struct list_head key_list; - - /* count for keys needing tailroom space allocation */ - int crypto_tx_tailroom_needed_cnt; - - struct net_device *dev; - struct ieee80211_local *local; - - unsigned int flags; - - unsigned long state; - - int drop_unencrypted; - - char name[IFNAMSIZ]; - - /* - * keep track of whether the HT opmode (stored in - * vif.bss_info.ht_operation_mode) is valid. - */ - bool ht_opmode_valid; - - /* to detect idle changes */ - bool old_idle; - - /* Fragment table for host-based reassembly */ - struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; - unsigned int fragment_next; - - /* TID bitmap for NoAck policy */ - u16 noack_map; - - struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS]; - struct ieee80211_key __rcu *default_unicast_key; - struct ieee80211_key __rcu *default_multicast_key; - struct ieee80211_key __rcu *default_mgmt_key; - - u16 sequence_number; - __be16 control_port_protocol; - bool control_port_no_encrypt; - - struct ieee80211_tx_queue_params tx_conf[IEEE80211_MAX_QUEUES]; - - struct work_struct work; - struct sk_buff_head skb_queue; - - bool arp_filter_state; - - /* - * AP this belongs to: self in AP mode and - * corresponding AP in VLAN mode, NULL for - * all others (might be needed later in IBSS) - */ - struct ieee80211_if_ap *bss; - - /* bitmap of allowed (non-MCS) rate indexes for rate control */ - u32 rc_rateidx_mask[IEEE80211_NUM_BANDS]; - u8 rc_rateidx_mcs_mask[IEEE80211_NUM_BANDS][IEEE80211_HT_MCS_MASK_LEN]; - - /* - * [PLATA] - TODO - check if we need to add a new struct as we need to be in one of the different states..and in OCB, none of them applies. - */ - union { - struct ieee80211_if_ap ap; - struct ieee80211_if_wds wds; - struct ieee80211_if_vlan vlan; - struct ieee80211_if_managed mgd; - struct ieee80211_if_ibss ibss; - struct ieee80211_if_mesh mesh; - u32 mntr_flags; - } u; - -#ifdef CONFIG_MAC80211_DEBUGFS - struct { - struct dentry *dir; - struct dentry *subdir_stations; - struct dentry *default_unicast_key; - struct dentry *default_multicast_key; - struct dentry *default_mgmt_key; - } debugfs; -#endif - /* must be last, dynamically sized area in this! */ - struct ieee80211_vif vif; -}; - -static inline -struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) -{ - return container_of(p, struct ieee80211_sub_if_data, vif); -} - -enum sdata_queue_type { - IEEE80211_SDATA_QUEUE_TYPE_FRAME = 0, - IEEE80211_SDATA_QUEUE_AGG_START = 1, - IEEE80211_SDATA_QUEUE_AGG_STOP = 2, -}; - -enum { - IEEE80211_RX_MSG = 1, - IEEE80211_TX_STATUS_MSG = 2, - IEEE80211_EOSP_MSG = 3, -}; - -struct skb_eosp_msg_data { - u8 sta[ETH_ALEN], iface[ETH_ALEN]; -}; - -enum queue_stop_reason { - IEEE80211_QUEUE_STOP_REASON_DRIVER, - IEEE80211_QUEUE_STOP_REASON_PS, - IEEE80211_QUEUE_STOP_REASON_CSA, - IEEE80211_QUEUE_STOP_REASON_AGGREGATION, - IEEE80211_QUEUE_STOP_REASON_SUSPEND, - IEEE80211_QUEUE_STOP_REASON_SKB_ADD, - IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE, -}; - -#ifdef CONFIG_MAC80211_LEDS -struct tpt_led_trigger { - struct led_trigger trig; - char name[32]; - const struct ieee80211_tpt_blink *blink_table; - unsigned int blink_table_len; - struct timer_list timer; - unsigned long prev_traffic; - unsigned long tx_bytes, rx_bytes; - unsigned int active, want; - bool running; -}; -#endif - -/** - * mac80211 scan flags - currently active scan mode - * - * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as - * well be on the operating channel - * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to - * determine if we are on the operating channel or not - * @SCAN_COMPLETED: Set for our scan work function when the driver reported - * that the scan completed. - * @SCAN_ABORTED: Set for our scan work function when the driver reported - * a scan complete for an aborted scan. - */ -enum { - SCAN_SW_SCANNING, - SCAN_HW_SCANNING, - SCAN_COMPLETED, - SCAN_ABORTED, -}; - -/** - * enum mac80211_scan_state - scan state machine states - * - * @SCAN_DECISION: Main entry point to the scan state machine, this state - * determines if we should keep on scanning or switch back to the - * operating channel - * @SCAN_SET_CHANNEL: Set the next channel to be scanned - * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses - * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to - * send out data - * @SCAN_RESUME: Resume the scan and scan the next channel - */ -enum mac80211_scan_state { - SCAN_DECISION, - SCAN_SET_CHANNEL, - SCAN_SEND_PROBE, - SCAN_SUSPEND, - SCAN_RESUME, -}; - -struct ieee80211_local { - /* embed the driver visible part. - * don't cast (use the static inlines below), but we keep - * it first anyway so they become a no-op */ - struct ieee80211_hw hw; - - const struct ieee80211_ops *ops; - - /* - * work stuff, potentially off-channel (in the future) - */ - struct list_head work_list; - struct timer_list work_timer; - struct work_struct work_work; - - /* - * private workqueue to mac80211. mac80211 makes this accessible - * via ieee80211_queue_work() - */ - struct workqueue_struct *workqueue; - - unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES]; - /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */ - spinlock_t queue_stop_reason_lock; - - int open_count; - int monitors, cooked_mntrs; - /* number of interfaces with corresponding FIF_ flags */ - int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll, - fif_probe_req; - int probe_req_reg; - unsigned int filter_flags; /* FIF_* */ - - bool wiphy_ciphers_allocated; - - /* protects the aggregated multicast list and filter calls */ - spinlock_t filter_lock; - - /* used for uploading changed mc list */ - struct work_struct reconfig_filter; - - /* used to reconfigure hardware SM PS */ - struct work_struct recalc_smps; - - /* aggregated multicast list */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - struct netdev_hw_addr_list mc_list; -#else - struct dev_addr_list *mc_list; - int mc_count; -#endif - - bool tim_in_locked_section; /* see ieee80211_beacon_get() */ - - /* - * suspended is true if we finished all the suspend _and_ we have - * not yet come up from resume. This is to be used by mac80211 - * to ensure driver sanity during suspend and mac80211's own - * sanity. It can eventually be used for WoW as well. - */ - bool suspended; - - /* - * Resuming is true while suspended, but when we're reprogramming the - * hardware -- at that time it's allowed to use ieee80211_queue_work() - * again even though some other parts of the stack are still suspended - * and we still drop received frames to avoid waking the stack. - */ - bool resuming; - - /* - * quiescing is true during the suspend process _only_ to - * ease timer cancelling etc. - */ - bool quiescing; - - /* device is started */ - bool started; - - /* wowlan is enabled -- don't reconfig on resume */ - bool wowlan; - - int tx_headroom; /* required headroom for hardware/radiotap */ - - /* Tasklet and skb queue to process calls from IRQ mode. All frames - * added to skb_queue will be processed, but frames in - * skb_queue_unreliable may be dropped if the total length of these - * queues increases over the limit. */ -#define IEEE80211_IRQSAFE_QUEUE_LIMIT 128 - struct tasklet_struct tasklet; - struct sk_buff_head skb_queue; - struct sk_buff_head skb_queue_unreliable; - - /* - * Internal FIFO queue which is shared between multiple rx path - * stages. Its main task is to provide a serialization mechanism, - * so all rx handlers can enjoy having exclusive access to their - * private data structures. - */ - struct sk_buff_head rx_skb_queue; - bool running_rx_handler; /* protected by rx_skb_queue.lock */ - - /* Station data */ - /* - * The mutex only protects the list, hash table and - * counter, reads are done with RCU. - */ - struct mutex sta_mtx; - spinlock_t tim_lock; - unsigned long num_sta; - struct list_head sta_list; - struct sta_info __rcu *sta_hash[STA_HASH_SIZE]; - struct timer_list sta_cleanup; - int sta_generation; - - struct sk_buff_head pending[IEEE80211_MAX_QUEUES]; - struct tasklet_struct tx_pending_tasklet; - - atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES]; - - /* number of interfaces with corresponding IFF_ flags */ - atomic_t iff_allmultis, iff_promiscs; - - struct rate_control_ref *rate_ctrl; - - struct crypto_cipher *wep_tx_tfm; - struct crypto_cipher *wep_rx_tfm; - u32 wep_iv; - - /* see iface.c */ - struct list_head interfaces; - struct mutex iflist_mtx; - - /* - * Key mutex, protects sdata's key_list and sta_info's - * key pointers (write access, they're RCU.) - */ - struct mutex key_mtx; - - /* mutex for scan and work locking */ - struct mutex mtx; - - /* Scanning and BSS list */ - unsigned long scanning; - struct cfg80211_ssid scan_ssid; - struct cfg80211_scan_request *int_scan_req; - struct cfg80211_scan_request *scan_req, *hw_scan_req; - struct ieee80211_channel *scan_channel; - enum ieee80211_band hw_scan_band; - int scan_channel_idx; - int scan_ies_len; - - bool sched_scanning; - struct ieee80211_sched_scan_ies sched_scan_ies; - struct work_struct sched_scan_stopped_work; - - unsigned long leave_oper_channel_time; - enum mac80211_scan_state next_scan_state; - struct delayed_work scan_work; - struct ieee80211_sub_if_data *scan_sdata; - enum nl80211_channel_type _oper_channel_type; - struct ieee80211_channel *oper_channel, *csa_channel; - - /* Temporary remain-on-channel for off-channel operations */ - struct ieee80211_channel *tmp_channel; - enum nl80211_channel_type tmp_channel_type; - - /* SNMP counters */ - /* dot11CountersTable */ - u32 dot11TransmittedFragmentCount; - u32 dot11MulticastTransmittedFrameCount; - u32 dot11FailedCount; - u32 dot11RetryCount; - u32 dot11MultipleRetryCount; - u32 dot11FrameDuplicateCount; - u32 dot11ReceivedFragmentCount; - u32 dot11MulticastReceivedFrameCount; - u32 dot11TransmittedFrameCount; - -#ifdef CONFIG_MAC80211_LEDS - int tx_led_counter, rx_led_counter; - struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; - struct tpt_led_trigger *tpt_led_trigger; - char tx_led_name[32], rx_led_name[32], - assoc_led_name[32], radio_led_name[32]; -#endif - -#ifdef CONFIG_MAC80211_DEBUG_COUNTERS - /* TX/RX handler statistics */ - unsigned int tx_handlers_drop; - unsigned int tx_handlers_queued; - unsigned int tx_handlers_drop_unencrypted; - unsigned int tx_handlers_drop_fragment; - unsigned int tx_handlers_drop_wep; - unsigned int tx_handlers_drop_not_assoc; - unsigned int tx_handlers_drop_unauth_port; - unsigned int rx_handlers_drop; - unsigned int rx_handlers_queued; - unsigned int rx_handlers_drop_nullfunc; - unsigned int rx_handlers_drop_defrag; - unsigned int rx_handlers_drop_short; - unsigned int rx_handlers_drop_passive_scan; - unsigned int tx_expand_skb_head; - unsigned int tx_expand_skb_head_cloned; - unsigned int rx_expand_skb_head; - unsigned int rx_expand_skb_head2; - unsigned int rx_handlers_fragments; - unsigned int tx_status_drop; -#define I802_DEBUG_INC(c) (c)++ -#else /* CONFIG_MAC80211_DEBUG_COUNTERS */ -#define I802_DEBUG_INC(c) do { } while (0) -#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ - - - int total_ps_buffered; /* total number of all buffered unicast and - * multicast packets for power saving stations - */ - unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */ - - bool pspolling; - bool offchannel_ps_enabled; - /* - * PS can only be enabled when we have exactly one managed - * interface (and monitors) in PS, this then points there. - */ - struct ieee80211_sub_if_data *ps_sdata; - struct work_struct dynamic_ps_enable_work; - struct work_struct dynamic_ps_disable_work; - struct timer_list dynamic_ps_timer; - struct notifier_block network_latency_notifier; - struct notifier_block ifa_notifier; - - /* - * The dynamic ps timeout configured from user space via WEXT - - * this will override whatever chosen by mac80211 internally. - */ - int dynamic_ps_forced_timeout; - int dynamic_ps_user_timeout; - bool disable_dynamic_ps; - - int user_power_level; /* in dBm */ - int power_constr_level; /* in dBm */ - - enum ieee80211_smps_mode smps_mode; - - struct work_struct restart_work; - -#ifdef CONFIG_MAC80211_DEBUGFS - struct local_debugfsdentries { - struct dentry *rcdir; - struct dentry *keys; - } debugfs; -#endif - - struct ieee80211_channel *hw_roc_channel; - struct net_device *hw_roc_dev; - struct sk_buff *hw_roc_skb, *hw_roc_skb_for_status; - struct work_struct hw_roc_start, hw_roc_done; - enum nl80211_channel_type hw_roc_channel_type; - unsigned int hw_roc_duration; - u32 hw_roc_cookie; - bool hw_roc_for_tx; - - struct idr ack_status_frames; - spinlock_t ack_status_lock; - - /* dummy netdev for use w/ NAPI */ - struct net_device napi_dev; - - struct napi_struct napi; -}; - -static inline struct ieee80211_sub_if_data * -IEEE80211_DEV_TO_SUB_IF(struct net_device *dev) -{ - return netdev_priv(dev); -} - -/* this struct represents 802.11n's RA/TID combination */ -struct ieee80211_ra_tid { - u8 ra[ETH_ALEN]; - u16 tid; -}; - -/* Parsed Information Elements */ -struct ieee802_11_elems { - u8 *ie_start; - size_t total_len; - - /* pointers to IEs */ - u8 *ssid; - u8 *supp_rates; - u8 *fh_params; - u8 *ds_params; - u8 *cf_params; - struct ieee80211_tim_ie *tim; - u8 *ibss_params; - u8 *challenge; - u8 *wpa; - u8 *rsn; - u8 *erp_info; - u8 *ext_supp_rates; - u8 *wmm_info; - u8 *wmm_param; - struct ieee80211_ht_cap *ht_cap_elem; - struct ieee80211_ht_info *ht_info_elem; - struct ieee80211_meshconf_ie *mesh_config; - u8 *mesh_id; - u8 *peering; - u8 *preq; - u8 *prep; - u8 *perr; - struct ieee80211_rann_ie *rann; - u8 *ch_switch_elem; - u8 *country_elem; - u8 *pwr_constr_elem; - u8 *quiet_elem; /* first quite element */ - u8 *timeout_int; - - /* length of them, respectively */ - u8 ssid_len; - u8 supp_rates_len; - u8 fh_params_len; - u8 ds_params_len; - u8 cf_params_len; - u8 tim_len; - u8 ibss_params_len; - u8 challenge_len; - u8 wpa_len; - u8 rsn_len; - u8 erp_info_len; - u8 ext_supp_rates_len; - u8 wmm_info_len; - u8 wmm_param_len; - u8 mesh_id_len; - u8 peering_len; - u8 preq_len; - u8 prep_len; - u8 perr_len; - u8 ch_switch_elem_len; - u8 country_elem_len; - u8 pwr_constr_elem_len; - u8 quiet_elem_len; - u8 num_of_quiet_elem; /* can be more the one */ - u8 timeout_int_len; - - /* whether a parse error occurred while retrieving these elements */ - bool parse_error; -}; - -static inline struct ieee80211_local *hw_to_local( - struct ieee80211_hw *hw) -{ - return container_of(hw, struct ieee80211_local, hw); -} - -/* - * checks if the BSS ID is identical OR if the wildcard BSSID has been used - */ -static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) -{ - return compare_ether_addr(raddr, addr) == 0 || - is_broadcast_ether_addr(raddr); -} - - -int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); -void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); -void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, - u32 changed); -void ieee80211_configure_filter(struct ieee80211_local *local); -u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); - -/* STA code */ -void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); -int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, - struct cfg80211_auth_request *req); -int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, - struct cfg80211_assoc_request *req); -int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, - struct cfg80211_deauth_request *req); -int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, - struct cfg80211_disassoc_request *req); -void ieee80211_send_pspoll(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata); -void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency); -int ieee80211_max_network_latency(struct notifier_block *nb, - unsigned long data, void *dummy); -int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); -void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, - struct ieee80211_channel_sw_ie *sw_elem, - struct ieee80211_bss *bss, - u64 timestamp); -void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata); -void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata); -void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); -void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb); -void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); -void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); -void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata); - -/* IBSS code */ -void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); -void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata); -void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, - const u8 *bssid, const u8 *addr, u32 supp_rates); -int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, - struct cfg80211_ibss_params *params); -int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata); -void ieee80211_ibss_quiesce(struct ieee80211_sub_if_data *sdata); -void ieee80211_ibss_restart(struct ieee80211_sub_if_data *sdata); -void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata); -void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb); - -/* mesh code */ -void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata); -void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb); - -/* scan/BSS handling */ -void ieee80211_scan_work(struct work_struct *work); -int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, - const u8 *ssid, u8 ssid_len, - struct ieee80211_channel *chan); -int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, - struct cfg80211_scan_request *req); -void ieee80211_scan_cancel(struct ieee80211_local *local); -ieee80211_rx_result -ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb); - -void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); -struct ieee80211_bss * -ieee80211_bss_info_update(struct ieee80211_local *local, - struct ieee80211_rx_status *rx_status, - struct ieee80211_mgmt *mgmt, - size_t len, - struct ieee802_11_elems *elems, - struct ieee80211_channel *channel, - bool beacon); -struct ieee80211_bss * -ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, - u8 *ssid, u8 ssid_len); -void ieee80211_rx_bss_put(struct ieee80211_local *local, - struct ieee80211_bss *bss); - -/* scheduled scan handling */ -int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, - struct cfg80211_sched_scan_request *req); -int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata); -void ieee80211_sched_scan_stopped_work(struct work_struct *work); - -/* off-channel helpers */ -void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, - bool offchannel_ps_enable); -void ieee80211_offchannel_return(struct ieee80211_local *local, - bool offchannel_ps_disable); -void ieee80211_hw_roc_setup(struct ieee80211_local *local); - -/* interface handling */ -int ieee80211_iface_init(void); -void ieee80211_iface_exit(void); -int ieee80211_if_add(struct ieee80211_local *local, const char *name, - struct net_device **new_dev, enum nl80211_iftype type, - struct vif_params *params); -int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, - enum nl80211_iftype type); -void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); -void ieee80211_remove_interfaces(struct ieee80211_local *local); -u32 __ieee80211_recalc_idle(struct ieee80211_local *local); -void ieee80211_recalc_idle(struct ieee80211_local *local); -void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, - const int offset); - -static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) -{ - return test_bit(SDATA_STATE_RUNNING, &sdata->state); -} - -/* tx handling */ -void ieee80211_clear_tx_pending(struct ieee80211_local *local); -void ieee80211_tx_pending(unsigned long data); -netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, - struct net_device *dev); -netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, - struct net_device *dev); - -/* HT */ -bool ieee80111_cfg_override_disables_ht40(struct ieee80211_sub_if_data *sdata); -void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, - struct ieee80211_sta_ht_cap *ht_cap); -void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata, - struct ieee80211_supported_band *sband, - struct ieee80211_ht_cap *ht_cap_ie, - struct ieee80211_sta_ht_cap *ht_cap); -void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, - const u8 *da, u16 tid, - u16 initiator, u16 reason_code); -int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, - enum ieee80211_smps_mode smps, const u8 *da, - const u8 *bssid); -void ieee80211_request_smps_work(struct work_struct *work); - -void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, - u16 initiator, u16 reason, bool stop); -void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, - u16 initiator, u16 reason, bool stop); -void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx); -void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, - struct sta_info *sta, - struct ieee80211_mgmt *mgmt, size_t len); -void ieee80211_process_addba_resp(struct ieee80211_local *local, - struct sta_info *sta, - struct ieee80211_mgmt *mgmt, - size_t len); -void ieee80211_process_addba_request(struct ieee80211_local *local, - struct sta_info *sta, - struct ieee80211_mgmt *mgmt, - size_t len); - -int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, - enum ieee80211_back_parties initiator, - bool tx); -int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, - enum ieee80211_back_parties initiator, - bool tx); -void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid); -void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid); -void ieee80211_ba_session_work(struct work_struct *work); -void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid); -void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid); - -/* Spectrum management */ -void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - size_t len); - -/* Suspend/resume and hw reconfiguration */ -int ieee80211_reconfig(struct ieee80211_local *local); -void ieee80211_stop_device(struct ieee80211_local *local); - -#ifdef CONFIG_PM -int __ieee80211_suspend(struct ieee80211_hw *hw, - struct cfg80211_wowlan *wowlan); - -static inline int __ieee80211_resume(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), - "%s: resume with hardware scan still in progress\n", - wiphy_name(hw->wiphy)); - - return ieee80211_reconfig(hw_to_local(hw)); -} -#else -static inline int __ieee80211_suspend(struct ieee80211_hw *hw, - struct cfg80211_wowlan *wowlan) -{ - return 0; -} - -static inline int __ieee80211_resume(struct ieee80211_hw *hw) -{ - return 0; -} -#endif - -/* utility functions/constants */ -extern void *mac80211_wiphy_privid; /* for wiphy privid */ -u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, - enum nl80211_iftype type); -int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, - int rate, int erp, int short_preamble); -void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, - struct ieee80211_hdr *hdr, const u8 *tsc, - gfp_t gfp); -void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, - bool bss_notify); -void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb); - -void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb, int tid); -static void inline ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb) -{ - /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */ - ieee80211_tx_skb_tid(sdata, skb, 7); -} - -void ieee802_11_parse_elems(u8 *start, size_t len, - struct ieee802_11_elems *elems); -u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, - struct ieee802_11_elems *elems, - u64 filter, u32 crc); -u32 ieee80211_mandatory_rates(struct ieee80211_local *local, - enum ieee80211_band band); - -void ieee80211_dynamic_ps_enable_work(struct work_struct *work); -void ieee80211_dynamic_ps_disable_work(struct work_struct *work); -void ieee80211_dynamic_ps_timer(unsigned long data); -void ieee80211_send_nullfunc(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - int powersave); -void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, - struct ieee80211_hdr *hdr); -void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, - struct ieee80211_hdr *hdr, bool ack); -void ieee80211_beacon_connection_loss_work(struct work_struct *work); - -void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, - enum queue_stop_reason reason); -void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, - enum queue_stop_reason reason); -void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, - enum queue_stop_reason reason); -void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, - enum queue_stop_reason reason); -void ieee80211_add_pending_skb(struct ieee80211_local *local, - struct sk_buff *skb); -void ieee80211_add_pending_skbs(struct ieee80211_local *local, - struct sk_buff_head *skbs); -void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local, - struct sk_buff_head *skbs, - void (*fn)(void *data), void *data); - -void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, - u16 transaction, u16 auth_alg, - u8 *extra, size_t extra_len, const u8 *bssid, - const u8 *da, const u8 *key, u8 key_len, u8 key_idx); -int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, - const u8 *ie, size_t ie_len, - enum ieee80211_band band, u32 rate_mask, - u8 channel); -struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, - u8 *dst, u32 ratemask, - const u8 *ssid, size_t ssid_len, - const u8 *ie, size_t ie_len, - bool directed); -void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, - const u8 *ssid, size_t ssid_len, - const u8 *ie, size_t ie_len, - u32 ratemask, bool directed, bool no_cck); - -void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, - const size_t supp_rates_len, - const u8 *supp_rates); -u32 ieee80211_sta_get_rates(struct ieee80211_local *local, - struct ieee802_11_elems *elems, - enum ieee80211_band band); -int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata, - enum ieee80211_smps_mode smps_mode); -void ieee80211_recalc_smps(struct ieee80211_local *local); - -size_t ieee80211_ie_split(const u8 *ies, size_t ielen, - const u8 *ids, int n_ids, size_t offset); -size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset); -u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, - u16 cap); -u8 *ieee80211_ie_build_ht_info(u8 *pos, - struct ieee80211_sta_ht_cap *ht_cap, - struct ieee80211_channel *channel, - enum nl80211_channel_type channel_type); - -/* internal work items */ -void ieee80211_work_init(struct ieee80211_local *local); -void ieee80211_add_work(struct ieee80211_work *wk); -void free_work(struct ieee80211_work *wk); -void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata); -int ieee80211_wk_remain_on_channel(struct ieee80211_sub_if_data *sdata, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, u64 *cookie); -int ieee80211_wk_cancel_remain_on_channel( - struct ieee80211_sub_if_data *sdata, u64 cookie); - -/* channel management */ -enum ieee80211_chan_mode { - CHAN_MODE_UNDEFINED, - CHAN_MODE_HOPPING, - CHAN_MODE_FIXED, -}; - -enum ieee80211_chan_mode -ieee80211_get_channel_mode(struct ieee80211_local *local, - struct ieee80211_sub_if_data *ignore); -bool ieee80211_set_channel_type(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - enum nl80211_channel_type chantype); -enum nl80211_channel_type -ieee80211_ht_info_to_channel_type(struct ieee80211_ht_info *ht_info); -enum nl80211_channel_type ieee80211_get_tx_channel_type( - struct ieee80211_local *local, - enum nl80211_channel_type channel_type); - -#ifdef CONFIG_MAC80211_NOINLINE -#define debug_noinline noinline -#else -#define debug_noinline -#endif - -#endif /* IEEE80211_I_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/iface.c b/openairITS/mac/DOT11/net/mac80211/iface.c deleted file mode 100644 index 80a90f68f18..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/iface.c +++ /dev/null @@ -1,1473 +0,0 @@ -/* - * Interface handling (except master interface) - * - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> - * Copyright 2008, Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include <linux/slab.h> -#include <linux/kernel.h> -#include <linux/if_arp.h> -#include <linux/netdevice.h> -#include <linux/rtnetlink.h> -#include <net/mac80211.h> -#include <net/ieee80211_radiotap.h> -#include "ieee80211_i.h" -#include "sta_info.h" -#include "debugfs_netdev.h" -#include "mesh.h" -#include "led.h" -#include "driver-ops.h" -#include "wme.h" -#include "rate.h" - -/** - * DOC: Interface list locking - * - * The interface list in each struct ieee80211_local is protected - * three-fold: - * - * (1) modifications may only be done under the RTNL - * (2) modifications and readers are protected against each other by - * the iflist_mtx. - * (3) modifications are done in an RCU manner so atomic readers - * can traverse the list in RCU-safe blocks. - * - * As a consequence, reads (traversals) of the list can be protected - * by either the RTNL, the iflist_mtx or RCU. - */ - - -static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) -{ - int meshhdrlen; - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - meshhdrlen = (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) ? 5 : 0; - - /* FIX: what would be proper limits for MTU? - * This interface uses 802.3 frames. */ - if (new_mtu < 256 || - new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) { - return -EINVAL; - } - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "%s: setting MTU %d\n", dev->name, new_mtu); -#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ - dev->mtu = new_mtu; - return 0; -} - -static int ieee80211_change_mac(struct net_device *dev, void *addr) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct sockaddr *sa = addr; - int ret; - - if (ieee80211_sdata_running(sdata)) - return -EBUSY; - - ret = eth_mac_addr(dev, sa); - - if (ret == 0) - memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN); - - return ret; -} - -static inline int identical_mac_addr_allowed(int type1, int type2) -{ - return type1 == NL80211_IFTYPE_MONITOR || - type2 == NL80211_IFTYPE_MONITOR || - (type1 == NL80211_IFTYPE_AP && type2 == NL80211_IFTYPE_WDS) || - (type1 == NL80211_IFTYPE_WDS && - (type2 == NL80211_IFTYPE_WDS || - type2 == NL80211_IFTYPE_AP)) || - (type1 == NL80211_IFTYPE_AP && type2 == NL80211_IFTYPE_AP_VLAN) || - (type1 == NL80211_IFTYPE_AP_VLAN && - (type2 == NL80211_IFTYPE_AP || - type2 == NL80211_IFTYPE_AP_VLAN)); -} - -static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, - enum nl80211_iftype iftype) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_sub_if_data *nsdata; - struct net_device *dev = sdata->dev; - - ASSERT_RTNL(); - - /* we hold the RTNL here so can safely walk the list */ - list_for_each_entry(nsdata, &local->interfaces, list) { - struct net_device *ndev = nsdata->dev; - - if (ndev != dev && ieee80211_sdata_running(nsdata)) { - /* - * Allow only a single IBSS interface to be up at any - * time. This is restricted because beacon distribution - * cannot work properly if both are in the same IBSS. - * - * To remove this restriction we'd have to disallow them - * from setting the same SSID on different IBSS interfaces - * belonging to the same hardware. Then, however, we're - * faced with having to adopt two different TSF timers... - */ - if (iftype == NL80211_IFTYPE_ADHOC && - nsdata->vif.type == NL80211_IFTYPE_ADHOC) - return -EBUSY; - - /* - * The remaining checks are only performed for interfaces - * with the same MAC address. - */ - if (compare_ether_addr(dev->dev_addr, ndev->dev_addr)) - continue; - - /* - * check whether it may have the same address - */ - if (!identical_mac_addr_allowed(iftype, - nsdata->vif.type)) - return -ENOTUNIQ; - - /* - * can only add VLANs to enabled APs - */ - if (iftype == NL80211_IFTYPE_AP_VLAN && - nsdata->vif.type == NL80211_IFTYPE_AP) - sdata->bss = &nsdata->u.ap; - } - } - - return 0; -} - -void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, - const int offset) -{ - struct ieee80211_local *local = sdata->local; - u32 flags = sdata->u.mntr_flags; - -#define ADJUST(_f, _s) do { \ - if (flags & MONITOR_FLAG_##_f) \ - local->fif_##_s += offset; \ - } while (0) - - ADJUST(FCSFAIL, fcsfail); - ADJUST(PLCPFAIL, plcpfail); - ADJUST(CONTROL, control); - ADJUST(CONTROL, pspoll); - ADJUST(OTHER_BSS, other_bss); - -#undef ADJUST -} - -/* - * NOTE: Be very careful when changing this function, it must NOT return - * an error on interface type changes that have been pre-checked, so most - * checks should be in ieee80211_check_concurrent_iface. - */ -static int ieee80211_do_open(struct net_device *dev, bool coming_up) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - u32 changed = 0; - int res; - u32 hw_reconf_flags = 0; - - switch (sdata->vif.type) { - case NL80211_IFTYPE_WDS: - if (!is_valid_ether_addr(sdata->u.wds.remote_addr)) - return -ENOLINK; - break; - case NL80211_IFTYPE_AP_VLAN: { - struct ieee80211_sub_if_data *master; - - if (!sdata->bss) - return -ENOLINK; - - list_add(&sdata->u.vlan.list, &sdata->bss->vlans); - - master = container_of(sdata->bss, - struct ieee80211_sub_if_data, u.ap); - sdata->control_port_protocol = - master->control_port_protocol; - sdata->control_port_no_encrypt = - master->control_port_no_encrypt; - break; - } - case NL80211_IFTYPE_AP: - sdata->bss = &sdata->u.ap; - break; - case NL80211_IFTYPE_MESH_POINT: - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_ADHOC: - /* no special treatment */ - break; - case NL80211_IFTYPE_UNSPECIFIED: - case NUM_NL80211_IFTYPES: - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - /* cannot happen */ - WARN_ON(1); - break; - } - - if (local->open_count == 0) { - res = drv_start(local); - if (res) - goto err_del_bss; - if (local->ops->napi_poll) - napi_enable(&local->napi); - /* we're brought up, everything changes */ - hw_reconf_flags = ~0; - ieee80211_led_radio(local, true); - ieee80211_mod_tpt_led_trig(local, - IEEE80211_TPT_LEDTRIG_FL_RADIO, 0); - } - - /* - * Copy the hopefully now-present MAC address to - * this interface, if it has the special null one. - */ - if (is_zero_ether_addr(dev->dev_addr)) { - memcpy(dev->dev_addr, - local->hw.wiphy->perm_addr, - ETH_ALEN); - memcpy(dev->perm_addr, dev->dev_addr, ETH_ALEN); - - if (!is_valid_ether_addr(dev->dev_addr)) { - if (!local->open_count) - drv_stop(local); - return -EADDRNOTAVAIL; - } - } - - switch (sdata->vif.type) { - case NL80211_IFTYPE_AP_VLAN: - /* no need to tell driver */ - break; - case NL80211_IFTYPE_MONITOR: - if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { - local->cooked_mntrs++; - break; - } - - /* must be before the call to ieee80211_configure_filter */ - local->monitors++; - if (local->monitors == 1) { - local->hw.conf.flags |= IEEE80211_CONF_MONITOR; - hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR; - } - - ieee80211_adjust_monitor_flags(sdata, 1); - ieee80211_configure_filter(local); - - netif_carrier_on(dev); - break; - default: - if (coming_up) { - res = drv_add_interface(local, sdata); - if (res) - goto err_stop; - } - - if (sdata->vif.type == NL80211_IFTYPE_AP) { - local->fif_pspoll++; - local->fif_probe_req++; - - ieee80211_configure_filter(local); - } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { - local->fif_probe_req++; - } - - changed |= ieee80211_reset_erp_info(sdata); - ieee80211_bss_info_change_notify(sdata, changed); - - /* - * [PLATA] we should still check that the driver supports the OCBMode... - */ - //if (sdata->vif.type == NL80211_IFTYPE_STATION || - // (sdata->vif.type == NL80211_IFTYPE_ADHOC) && ((local->hw->wiphy.dot11OCBActivated == 0) || !(local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED))) - if ((sdata->vif.type == NL80211_IFTYPE_STATION)||((sdata->vif.type == NL80211_IFTYPE_ADHOC)&&(local->hw.wiphy->dot11OCBActivated==0))) - netif_carrier_off(dev); - else - netif_carrier_on(dev); - - /* - * set default queue parameters so drivers don't - * need to initialise the hardware if the hardware - * doesn't start up with sane defaults - */ - ieee80211_set_wmm_default(sdata, true); - } - - set_bit(SDATA_STATE_RUNNING, &sdata->state); - - if (sdata->vif.type == NL80211_IFTYPE_WDS) { - /* Create STA entry for the WDS peer */ - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, - GFP_KERNEL); - if (!sta) { - res = -ENOMEM; - goto err_del_interface; - } - - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); - - res = sta_info_insert(sta); - if (res) { - /* STA has been freed */ - goto err_del_interface; - } - - rate_control_rate_init(sta); - } - - /* - * set_multicast_list will be invoked by the networking core - * which will check whether any increments here were done in - * error and sync them down to the hardware as filter flags. - */ - if (sdata->flags & IEEE80211_SDATA_ALLMULTI) - atomic_inc(&local->iff_allmultis); - - if (sdata->flags & IEEE80211_SDATA_PROMISC) - atomic_inc(&local->iff_promiscs); - - mutex_lock(&local->mtx); - hw_reconf_flags |= __ieee80211_recalc_idle(local); - mutex_unlock(&local->mtx); - - if (coming_up) - local->open_count++; - - if (hw_reconf_flags) - ieee80211_hw_config(local, hw_reconf_flags); - - ieee80211_recalc_ps(local, -1); - - netif_tx_start_all_queues(dev); - - return 0; - err_del_interface: - drv_remove_interface(local, sdata); - err_stop: - if (!local->open_count) - drv_stop(local); - err_del_bss: - sdata->bss = NULL; - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - list_del(&sdata->u.vlan.list); - clear_bit(SDATA_STATE_RUNNING, &sdata->state); - return res; -} - -static int ieee80211_open(struct net_device *dev) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - int err; - - /* fail early if user set an invalid address */ - if (!is_valid_ether_addr(dev->dev_addr)) - return -EADDRNOTAVAIL; - - err = ieee80211_check_concurrent_iface(sdata, sdata->vif.type); - if (err) - return err; - - return ieee80211_do_open(dev, true); -} - -static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, - bool going_down) -{ - struct ieee80211_local *local = sdata->local; - unsigned long flags; - struct sk_buff *skb, *tmp; - u32 hw_reconf_flags = 0; - int i; - enum nl80211_channel_type orig_ct; - - clear_bit(SDATA_STATE_RUNNING, &sdata->state); - - if (local->scan_sdata == sdata) - ieee80211_scan_cancel(local); - - /* - * Stop TX on this interface first. - */ - netif_tx_stop_all_queues(sdata->dev); - - /* - * Purge work for this interface. - */ - ieee80211_work_purge(sdata); - - /* - * Remove all stations associated with this interface. - * - * This must be done before calling ops->remove_interface() - * because otherwise we can later invoke ops->sta_notify() - * whenever the STAs are removed, and that invalidates driver - * assumptions about always getting a vif pointer that is valid - * (because if we remove a STA after ops->remove_interface() - * the driver will have removed the vif info already!) - * - * This is relevant only in AP, WDS and mesh modes, since in - * all other modes we've already removed all stations when - * disconnecting etc. - */ - sta_info_flush(local, sdata); - - /* - * Don't count this interface for promisc/allmulti while it - * is down. dev_mc_unsync() will invoke set_multicast_list - * on the master interface which will sync these down to the - * hardware as filter flags. - */ - if (sdata->flags & IEEE80211_SDATA_ALLMULTI) - atomic_dec(&local->iff_allmultis); - - if (sdata->flags & IEEE80211_SDATA_PROMISC) - atomic_dec(&local->iff_promiscs); - - if (sdata->vif.type == NL80211_IFTYPE_AP) { - local->fif_pspoll--; - local->fif_probe_req--; - } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { - local->fif_probe_req--; - } - - netif_addr_lock_bh(sdata->dev); - spin_lock_bh(&local->filter_lock); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - __hw_addr_unsync(&local->mc_list, &sdata->dev->mc, - sdata->dev->addr_len); -#else - __dev_addr_unsync(&local->mc_list, &local->mc_count, - &sdata->dev->mc_list, &sdata->dev->mc_count); -#endif - spin_unlock_bh(&local->filter_lock); - netif_addr_unlock_bh(sdata->dev); - - ieee80211_configure_filter(local); - - del_timer_sync(&local->dynamic_ps_timer); - cancel_work_sync(&local->dynamic_ps_enable_work); - - /* APs need special treatment */ - if (sdata->vif.type == NL80211_IFTYPE_AP) { - struct ieee80211_sub_if_data *vlan, *tmpsdata; - struct beacon_data *old_beacon = - rtnl_dereference(sdata->u.ap.beacon); - struct sk_buff *old_probe_resp = - rtnl_dereference(sdata->u.ap.probe_resp); - - /* sdata_running will return false, so this will disable */ - ieee80211_bss_info_change_notify(sdata, - BSS_CHANGED_BEACON_ENABLED); - - /* remove beacon and probe response */ - RCU_INIT_POINTER(sdata->u.ap.beacon, NULL); - RCU_INIT_POINTER(sdata->u.ap.probe_resp, NULL); - synchronize_rcu(); - kfree(old_beacon); - kfree_skb(old_probe_resp); - - /* down all dependent devices, that is VLANs */ - list_for_each_entry_safe(vlan, tmpsdata, &sdata->u.ap.vlans, - u.vlan.list) - dev_close(vlan->dev); - WARN_ON(!list_empty(&sdata->u.ap.vlans)); - - /* free all potentially still buffered bcast frames */ - local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps_bc_buf); - skb_queue_purge(&sdata->u.ap.ps_bc_buf); - } - - if (going_down) - local->open_count--; - - switch (sdata->vif.type) { - case NL80211_IFTYPE_AP_VLAN: - list_del(&sdata->u.vlan.list); - /* no need to tell driver */ - break; - case NL80211_IFTYPE_MONITOR: - if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { - local->cooked_mntrs--; - break; - } - - local->monitors--; - if (local->monitors == 0) { - local->hw.conf.flags &= ~IEEE80211_CONF_MONITOR; - hw_reconf_flags |= IEEE80211_CONF_CHANGE_MONITOR; - } - - ieee80211_adjust_monitor_flags(sdata, -1); - ieee80211_configure_filter(local); - break; - default: - flush_work(&sdata->work); - /* - * When we get here, the interface is marked down. - * Call synchronize_rcu() to wait for the RX path - * should it be using the interface and enqueuing - * frames at this very time on another CPU. - */ - synchronize_rcu(); - skb_queue_purge(&sdata->skb_queue); - - /* - * Disable beaconing here for mesh only, AP and IBSS - * are already taken care of. - */ - if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) - ieee80211_bss_info_change_notify(sdata, - BSS_CHANGED_BEACON_ENABLED); - - /* - * Free all remaining keys, there shouldn't be any, - * except maybe group keys in AP more or WDS? - */ - ieee80211_free_keys(sdata); - - if (going_down) - drv_remove_interface(local, sdata); - } - - sdata->bss = NULL; - - mutex_lock(&local->mtx); - hw_reconf_flags |= __ieee80211_recalc_idle(local); - mutex_unlock(&local->mtx); - - ieee80211_recalc_ps(local, -1); - - if (local->open_count == 0) { - if (local->ops->napi_poll) - napi_disable(&local->napi); - ieee80211_clear_tx_pending(local); - ieee80211_stop_device(local); - - /* no reconfiguring after stop! */ - hw_reconf_flags = 0; - } - - /* Re-calculate channel-type, in case there are multiple vifs - * on different channel types. - */ - orig_ct = local->_oper_channel_type; - ieee80211_set_channel_type(local, NULL, NL80211_CHAN_NO_HT); - - /* do after stop to avoid reconfiguring when we stop anyway */ - if (hw_reconf_flags || (orig_ct != local->_oper_channel_type)) - ieee80211_hw_config(local, hw_reconf_flags); - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - for (i = 0; i < IEEE80211_MAX_QUEUES; i++) { - skb_queue_walk_safe(&local->pending[i], skb, tmp) { - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - if (info->control.vif == &sdata->vif) { - __skb_unlink(skb, &local->pending[i]); - dev_kfree_skb_irq(skb); - } - } - } - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); -} - -static int ieee80211_stop(struct net_device *dev) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - ieee80211_do_stop(sdata, true); - - return 0; -} - -static void ieee80211_set_multicast_list(struct net_device *dev) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - int allmulti, promisc, sdata_allmulti, sdata_promisc; - - allmulti = !!(dev->flags & IFF_ALLMULTI); - promisc = !!(dev->flags & IFF_PROMISC); - sdata_allmulti = !!(sdata->flags & IEEE80211_SDATA_ALLMULTI); - sdata_promisc = !!(sdata->flags & IEEE80211_SDATA_PROMISC); - - if (allmulti != sdata_allmulti) { - if (dev->flags & IFF_ALLMULTI) - atomic_inc(&local->iff_allmultis); - else - atomic_dec(&local->iff_allmultis); - sdata->flags ^= IEEE80211_SDATA_ALLMULTI; - } - - if (promisc != sdata_promisc) { - if (dev->flags & IFF_PROMISC) - atomic_inc(&local->iff_promiscs); - else - atomic_dec(&local->iff_promiscs); - sdata->flags ^= IEEE80211_SDATA_PROMISC; - } - spin_lock_bh(&local->filter_lock); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - __hw_addr_sync(&local->mc_list, &dev->mc, dev->addr_len); -#else - __dev_addr_sync(&local->mc_list, &local->mc_count, - &dev->mc_list, &dev->mc_count); -#endif - spin_unlock_bh(&local->filter_lock); - ieee80211_queue_work(&local->hw, &local->reconfig_filter); -} - -/* - * Called when the netdev is removed or, by the code below, before - * the interface type changes. - */ -static void ieee80211_teardown_sdata(struct net_device *dev) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - int flushed; - int i; - - /* free extra data */ - ieee80211_free_keys(sdata); - - ieee80211_debugfs_remove_netdev(sdata); - - for (i = 0; i < IEEE80211_FRAGMENT_MAX; i++) - __skb_queue_purge(&sdata->fragments[i].skb_list); - sdata->fragment_next = 0; - - if (ieee80211_vif_is_mesh(&sdata->vif)) - mesh_rmc_free(sdata); - else if (sdata->vif.type == NL80211_IFTYPE_STATION) - ieee80211_mgd_teardown(sdata); - - flushed = sta_info_flush(local, sdata); - WARN_ON(flushed); -} - -static u16 ieee80211_netdev_select_queue(struct net_device *dev, - struct sk_buff *skb) -{ - return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb); -} - -static const struct net_device_ops ieee80211_dataif_ops = { - .ndo_open = ieee80211_open, - .ndo_stop = ieee80211_stop, - .ndo_uninit = ieee80211_teardown_sdata, - .ndo_start_xmit = ieee80211_subif_start_xmit, - .ndo_set_rx_mode = ieee80211_set_multicast_list, - .ndo_change_mtu = ieee80211_change_mtu, - .ndo_set_mac_address = ieee80211_change_mac, - .ndo_select_queue = ieee80211_netdev_select_queue, -}; - -static u16 ieee80211_monitor_select_queue(struct net_device *dev, - struct sk_buff *skb) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - struct ieee80211_hdr *hdr; - struct ieee80211_radiotap_header *rtap = (void *)skb->data; - - if (local->hw.queues < 4) - return 0; - - if (skb->len < 4 || - skb->len < le16_to_cpu(rtap->it_len) + 2 /* frame control */) - return 0; /* doesn't matter, frame will be dropped */ - - hdr = (void *)((u8 *)skb->data + le16_to_cpu(rtap->it_len)); - - return ieee80211_select_queue_80211(local, skb, hdr); -} - -static const struct net_device_ops ieee80211_monitorif_ops = { - .ndo_open = ieee80211_open, - .ndo_stop = ieee80211_stop, - .ndo_uninit = ieee80211_teardown_sdata, - .ndo_start_xmit = ieee80211_monitor_start_xmit, - .ndo_set_rx_mode = ieee80211_set_multicast_list, - .ndo_change_mtu = ieee80211_change_mtu, - .ndo_set_mac_address = eth_mac_addr, - .ndo_select_queue = ieee80211_monitor_select_queue, -}; - -static void ieee80211_if_setup(struct net_device *dev) -{ - ether_setup(dev); - dev->priv_flags &= ~IFF_TX_SKB_SHARING; - netdev_attach_ops(dev, &ieee80211_dataif_ops); -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) - /* Do we need this ? */ - /* we will validate the address ourselves in ->open */ - dev->validate_addr = NULL; -#endif - dev->destructor = free_netdev; -} - -static void ieee80211_iface_work(struct work_struct *work) -{ - struct ieee80211_sub_if_data *sdata = - container_of(work, struct ieee80211_sub_if_data, work); - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct sta_info *sta; - struct ieee80211_ra_tid *ra_tid; - - if (!ieee80211_sdata_running(sdata)) - return; - - if (local->scanning) - return; - - /* - * ieee80211_queue_work() should have picked up most cases, - * here we'll pick the rest. - */ - if (WARN(local->suspended, - "interface work scheduled while going to suspend\n")) - return; - - /* first process frames */ - while ((skb = skb_dequeue(&sdata->skb_queue))) { - struct ieee80211_mgmt *mgmt = (void *)skb->data; - - if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_START) { - ra_tid = (void *)&skb->cb; - ieee80211_start_tx_ba_cb(&sdata->vif, ra_tid->ra, - ra_tid->tid); - } else if (skb->pkt_type == IEEE80211_SDATA_QUEUE_AGG_STOP) { - ra_tid = (void *)&skb->cb; - ieee80211_stop_tx_ba_cb(&sdata->vif, ra_tid->ra, - ra_tid->tid); - } else if (ieee80211_is_action(mgmt->frame_control) && - mgmt->u.action.category == WLAN_CATEGORY_BACK) { - int len = skb->len; - - mutex_lock(&local->sta_mtx); - sta = sta_info_get_bss(sdata, mgmt->sa); - if (sta) { - switch (mgmt->u.action.u.addba_req.action_code) { - case WLAN_ACTION_ADDBA_REQ: - ieee80211_process_addba_request( - local, sta, mgmt, len); - break; - case WLAN_ACTION_ADDBA_RESP: - ieee80211_process_addba_resp(local, sta, - mgmt, len); - break; - case WLAN_ACTION_DELBA: - ieee80211_process_delba(sdata, sta, - mgmt, len); - break; - default: - WARN_ON(1); - break; - } - } - mutex_unlock(&local->sta_mtx); - } else if (ieee80211_is_data_qos(mgmt->frame_control)) { - struct ieee80211_hdr *hdr = (void *)mgmt; - /* - * So the frame isn't mgmt, but frame_control - * is at the right place anyway, of course, so - * the if statement is correct. - * - * Warn if we have other data frame types here, - * they must not get here. - */ - WARN_ON(hdr->frame_control & - cpu_to_le16(IEEE80211_STYPE_NULLFUNC)); - WARN_ON(!(hdr->seq_ctrl & - cpu_to_le16(IEEE80211_SCTL_FRAG))); - /* - * This was a fragment of a frame, received while - * a block-ack session was active. That cannot be - * right, so terminate the session. - */ - mutex_lock(&local->sta_mtx); - sta = sta_info_get_bss(sdata, mgmt->sa); - if (sta) { - u16 tid = *ieee80211_get_qos_ctl(hdr) & - IEEE80211_QOS_CTL_TID_MASK; - - __ieee80211_stop_rx_ba_session( - sta, tid, WLAN_BACK_RECIPIENT, - WLAN_REASON_QSTA_REQUIRE_SETUP, - true); - } - mutex_unlock(&local->sta_mtx); - } else switch (sdata->vif.type) { - case NL80211_IFTYPE_STATION: - ieee80211_sta_rx_queued_mgmt(sdata, skb); - break; - case NL80211_IFTYPE_ADHOC: - ieee80211_ibss_rx_queued_mgmt(sdata, skb); - break; - case NL80211_IFTYPE_MESH_POINT: - if (!ieee80211_vif_is_mesh(&sdata->vif)) - break; - ieee80211_mesh_rx_queued_mgmt(sdata, skb); - break; - default: - WARN(1, "frame for unexpected interface type"); - break; - } - - kfree_skb(skb); - } - - /* then other type-dependent work */ - switch (sdata->vif.type) { - case NL80211_IFTYPE_STATION: - ieee80211_sta_work(sdata); - break; - case NL80211_IFTYPE_ADHOC: - /* - * [PLATA] std work operation for the mounted ADHOC interface. We bypass it if OCB is activated - */ - if ((local->hw.wiphy->dot11OCBActivated == 0) || !(local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) - ieee80211_ibss_work(sdata); - break; - case NL80211_IFTYPE_MESH_POINT: - if (!ieee80211_vif_is_mesh(&sdata->vif)) - break; - ieee80211_mesh_work(sdata); - break; - default: - break; - } -} - - -/* - * Helper function to initialise an interface to a specific type. - */ -static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, - enum nl80211_iftype type) -{ - /* clear type-dependent union */ - memset(&sdata->u, 0, sizeof(sdata->u)); - - /* and set some type-dependent values */ - sdata->vif.type = type; - sdata->vif.p2p = false; - netdev_attach_ops(sdata->dev, &ieee80211_dataif_ops); - sdata->wdev.iftype = type; - - sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE); - sdata->control_port_no_encrypt = false; - - sdata->noack_map = 0; - - /* only monitor differs */ - sdata->dev->type = ARPHRD_ETHER; - - skb_queue_head_init(&sdata->skb_queue); - INIT_WORK(&sdata->work, ieee80211_iface_work); - - switch (type) { - case NL80211_IFTYPE_P2P_GO: - type = NL80211_IFTYPE_AP; - sdata->vif.type = type; - sdata->vif.p2p = true; - /* fall through */ - case NL80211_IFTYPE_AP: - skb_queue_head_init(&sdata->u.ap.ps_bc_buf); - INIT_LIST_HEAD(&sdata->u.ap.vlans); - break; - case NL80211_IFTYPE_P2P_CLIENT: - type = NL80211_IFTYPE_STATION; - sdata->vif.type = type; - sdata->vif.p2p = true; - /* fall through */ - case NL80211_IFTYPE_STATION: - ieee80211_sta_setup_sdata(sdata); - break; - case NL80211_IFTYPE_ADHOC: - ieee80211_ibss_setup_sdata(sdata); - break; - case NL80211_IFTYPE_MESH_POINT: - if (ieee80211_vif_is_mesh(&sdata->vif)) - ieee80211_mesh_init_sdata(sdata); - break; - case NL80211_IFTYPE_MONITOR: - sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP; - netdev_attach_ops(sdata->dev, &ieee80211_monitorif_ops); - sdata->u.mntr_flags = MONITOR_FLAG_CONTROL | - MONITOR_FLAG_OTHER_BSS; - break; - case NL80211_IFTYPE_WDS: - case NL80211_IFTYPE_AP_VLAN: - break; - case NL80211_IFTYPE_UNSPECIFIED: - case NUM_NL80211_IFTYPES: - BUG(); - break; - } - - ieee80211_debugfs_add_netdev(sdata); -} - -static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, - enum nl80211_iftype type) -{ - struct ieee80211_local *local = sdata->local; - int ret, err; - enum nl80211_iftype internal_type = type; - bool p2p = false; - - ASSERT_RTNL(); - - if (!local->ops->change_interface) - return -EBUSY; - - switch (sdata->vif.type) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - /* - * Could maybe also all others here? - * Just not sure how that interacts - * with the RX/config path e.g. for - * mesh. - */ - break; - default: - return -EBUSY; - } - - switch (type) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_ADHOC: - /* - * Could probably support everything - * but WDS here (WDS do_open can fail - * under memory pressure, which this - * code isn't prepared to handle). - */ - break; - case NL80211_IFTYPE_P2P_CLIENT: - p2p = true; - internal_type = NL80211_IFTYPE_STATION; - break; - case NL80211_IFTYPE_P2P_GO: - p2p = true; - internal_type = NL80211_IFTYPE_AP; - break; - default: - return -EBUSY; - } - - ret = ieee80211_check_concurrent_iface(sdata, internal_type); - if (ret) - return ret; - - ieee80211_do_stop(sdata, false); - - ieee80211_teardown_sdata(sdata->dev); - - ret = drv_change_interface(local, sdata, internal_type, p2p); - if (ret) - type = sdata->vif.type; - - ieee80211_setup_sdata(sdata, type); - - err = ieee80211_do_open(sdata->dev, false); - WARN(err, "type change: do_open returned %d", err); - - return ret; -} - -int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, - enum nl80211_iftype type) -{ - int ret; - - ASSERT_RTNL(); - - if (type == ieee80211_vif_type_p2p(&sdata->vif)) - return 0; - - /* Setting ad-hoc mode on non-IBSS channel is not supported. */ - if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS && - type == NL80211_IFTYPE_ADHOC) - return -EOPNOTSUPP; - - if (ieee80211_sdata_running(sdata)) { - ret = ieee80211_runtime_change_iftype(sdata, type); - if (ret) - return ret; - } else { - /* Purge and reset type-dependent state. */ - ieee80211_teardown_sdata(sdata->dev); - ieee80211_setup_sdata(sdata, type); - } - - /* reset some values that shouldn't be kept across type changes */ - sdata->vif.bss_conf.basic_rates = - ieee80211_mandatory_rates(sdata->local, - sdata->local->hw.conf.channel->band); - sdata->drop_unencrypted = 0; - if (type == NL80211_IFTYPE_STATION) - sdata->u.mgd.use_4addr = false; - - return 0; -} - -static void ieee80211_assign_perm_addr(struct ieee80211_local *local, - struct net_device *dev, - enum nl80211_iftype type) -{ - struct ieee80211_sub_if_data *sdata; - u64 mask, start, addr, val, inc; - u8 *m; - u8 tmp_addr[ETH_ALEN]; - int i; - - /* default ... something at least */ - memcpy(dev->perm_addr, local->hw.wiphy->perm_addr, ETH_ALEN); - - if (is_zero_ether_addr(local->hw.wiphy->addr_mask) && - local->hw.wiphy->n_addresses <= 1) - return; - - - mutex_lock(&local->iflist_mtx); - - switch (type) { - case NL80211_IFTYPE_MONITOR: - /* doesn't matter */ - break; - case NL80211_IFTYPE_WDS: - case NL80211_IFTYPE_AP_VLAN: - /* match up with an AP interface */ - list_for_each_entry(sdata, &local->interfaces, list) { - if (sdata->vif.type != NL80211_IFTYPE_AP) - continue; - memcpy(dev->perm_addr, sdata->vif.addr, ETH_ALEN); - break; - } - /* keep default if no AP interface present */ - break; - default: - /* assign a new address if possible -- try n_addresses first */ - for (i = 0; i < local->hw.wiphy->n_addresses; i++) { - bool used = false; - - list_for_each_entry(sdata, &local->interfaces, list) { - if (memcmp(local->hw.wiphy->addresses[i].addr, - sdata->vif.addr, ETH_ALEN) == 0) { - used = true; - break; - } - } - - if (!used) { - memcpy(dev->perm_addr, - local->hw.wiphy->addresses[i].addr, - ETH_ALEN); - break; - } - } - - /* try mask if available */ - if (is_zero_ether_addr(local->hw.wiphy->addr_mask)) - break; - - m = local->hw.wiphy->addr_mask; - mask = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | - ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | - ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); - - if (__ffs64(mask) + hweight64(mask) != fls64(mask)) { - /* not a contiguous mask ... not handled now! */ - printk(KERN_DEBUG "not contiguous\n"); - break; - } - - m = local->hw.wiphy->perm_addr; - start = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | - ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | - ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); - - inc = 1ULL<<__ffs64(mask); - val = (start & mask); - addr = (start & ~mask) | (val & mask); - do { - bool used = false; - - tmp_addr[5] = addr >> 0*8; - tmp_addr[4] = addr >> 1*8; - tmp_addr[3] = addr >> 2*8; - tmp_addr[2] = addr >> 3*8; - tmp_addr[1] = addr >> 4*8; - tmp_addr[0] = addr >> 5*8; - - val += inc; - - list_for_each_entry(sdata, &local->interfaces, list) { - if (memcmp(tmp_addr, sdata->vif.addr, - ETH_ALEN) == 0) { - used = true; - break; - } - } - - if (!used) { - memcpy(dev->perm_addr, tmp_addr, ETH_ALEN); - break; - } - addr = (start & ~mask) | (val & mask); - } while (addr != start); - - break; - } - - mutex_unlock(&local->iflist_mtx); -} - -int ieee80211_if_add(struct ieee80211_local *local, const char *name, - struct net_device **new_dev, enum nl80211_iftype type, - struct vif_params *params) -{ - struct net_device *ndev; - struct ieee80211_sub_if_data *sdata = NULL; - int ret, i; - - ASSERT_RTNL(); - - ndev = alloc_netdev_mqs(sizeof(*sdata) + local->hw.vif_data_size, - name, ieee80211_if_setup, local->hw.queues, 1); - if (!ndev) - return -ENOMEM; - dev_net_set(ndev, wiphy_net(local->hw.wiphy)); - -/* This is an optimization, just ignore for older kernels */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)) - ndev->needed_headroom = local->tx_headroom + - 4*6 /* four MAC addresses */ - + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */ - + 6 /* mesh */ - + 8 /* rfc1042/bridge tunnel */ - - ETH_HLEN /* ethernet hard_header_len */ - + IEEE80211_ENCRYPT_HEADROOM; - ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM; -#endif - - ret = dev_alloc_name(ndev, ndev->name); - if (ret < 0) - goto fail; - - ieee80211_assign_perm_addr(local, ndev, type); - memcpy(ndev->dev_addr, ndev->perm_addr, ETH_ALEN); - SET_NETDEV_DEV(ndev, wiphy_dev(local->hw.wiphy)); - - /* don't use IEEE80211_DEV_TO_SUB_IF because it checks too much */ - sdata = netdev_priv(ndev); - ndev->ieee80211_ptr = &sdata->wdev; - memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN); - memcpy(sdata->name, ndev->name, IFNAMSIZ); - - /* initialise type-independent data */ - sdata->wdev.wiphy = local->hw.wiphy; - sdata->local = local; - sdata->dev = ndev; -#ifdef CONFIG_INET - sdata->arp_filter_state = true; -#endif - - for (i = 0; i < IEEE80211_FRAGMENT_MAX; i++) - skb_queue_head_init(&sdata->fragments[i].skb_list); - - INIT_LIST_HEAD(&sdata->key_list); - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) { - struct ieee80211_supported_band *sband; - sband = local->hw.wiphy->bands[i]; - sdata->rc_rateidx_mask[i] = - sband ? (1 << sband->n_bitrates) - 1 : 0; - if (sband) - memcpy(sdata->rc_rateidx_mcs_mask[i], - sband->ht_cap.mcs.rx_mask, - sizeof(sdata->rc_rateidx_mcs_mask[i])); - else - memset(sdata->rc_rateidx_mcs_mask[i], 0, - sizeof(sdata->rc_rateidx_mcs_mask[i])); - } - - /* setup type-dependent data */ - ieee80211_setup_sdata(sdata, type); - - if (params) { - ndev->ieee80211_ptr->use_4addr = params->use_4addr; - if (type == NL80211_IFTYPE_STATION) - sdata->u.mgd.use_4addr = params->use_4addr; - } - - ret = register_netdevice(ndev); - if (ret) - goto fail; - - mutex_lock(&local->iflist_mtx); - list_add_tail_rcu(&sdata->list, &local->interfaces); - mutex_unlock(&local->iflist_mtx); - - if (new_dev) - *new_dev = ndev; - - return 0; - - fail: - free_netdev(ndev); - return ret; -} - -void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) -{ - ASSERT_RTNL(); - - mutex_lock(&sdata->local->iflist_mtx); - list_del_rcu(&sdata->list); - mutex_unlock(&sdata->local->iflist_mtx); - - if (ieee80211_vif_is_mesh(&sdata->vif)) - mesh_path_flush_by_iface(sdata); - - synchronize_rcu(); - unregister_netdevice(sdata->dev); -} - -/* - * Remove all interfaces, may only be called at hardware unregistration - * time because it doesn't do RCU-safe list removals. - */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)) -void ieee80211_remove_interfaces(struct ieee80211_local *local) -{ - struct ieee80211_sub_if_data *sdata, *tmp; - LIST_HEAD(unreg_list); - - ASSERT_RTNL(); - - mutex_lock(&local->iflist_mtx); - list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { - list_del(&sdata->list); - - if (ieee80211_vif_is_mesh(&sdata->vif)) - mesh_path_flush_by_iface(sdata); - - unregister_netdevice_queue(sdata->dev, &unreg_list); - } - mutex_unlock(&local->iflist_mtx); - unregister_netdevice_many(&unreg_list); - list_del(&unreg_list); -} -#else -void ieee80211_remove_interfaces(struct ieee80211_local *local) -{ - struct ieee80211_sub_if_data *sdata, *tmp; - - ASSERT_RTNL(); - - list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { - mutex_lock(&local->iflist_mtx); - list_del(&sdata->list); - mutex_unlock(&local->iflist_mtx); - - unregister_netdevice(sdata->dev); - } -} -#endif - -static u32 ieee80211_idle_off(struct ieee80211_local *local, - const char *reason) -{ - if (!(local->hw.conf.flags & IEEE80211_CONF_IDLE)) - return 0; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(local->hw.wiphy, "device no longer idle - %s\n", reason); -#endif - - local->hw.conf.flags &= ~IEEE80211_CONF_IDLE; - return IEEE80211_CONF_CHANGE_IDLE; -} - -static u32 ieee80211_idle_on(struct ieee80211_local *local) -{ - if (local->hw.conf.flags & IEEE80211_CONF_IDLE) - return 0; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(local->hw.wiphy, "device now idle\n"); -#endif - - drv_flush(local, false); - - local->hw.conf.flags |= IEEE80211_CONF_IDLE; - return IEEE80211_CONF_CHANGE_IDLE; -} - -u32 __ieee80211_recalc_idle(struct ieee80211_local *local) -{ - struct ieee80211_sub_if_data *sdata; - int count = 0; - bool working = false, scanning = false, hw_roc = false; - struct ieee80211_work *wk; - unsigned int led_trig_start = 0, led_trig_stop = 0; - -#ifdef CONFIG_PROVE_LOCKING - WARN_ON(debug_locks && !lockdep_rtnl_is_held() && - !lockdep_is_held(&local->iflist_mtx)); -#endif - lockdep_assert_held(&local->mtx); - - list_for_each_entry(sdata, &local->interfaces, list) { - if (!ieee80211_sdata_running(sdata)) { - sdata->vif.bss_conf.idle = true; - continue; - } - - sdata->old_idle = sdata->vif.bss_conf.idle; - - /* do not count disabled managed interfaces */ - if (sdata->vif.type == NL80211_IFTYPE_STATION && - !sdata->u.mgd.associated && - !sdata->u.mgd.auth_data && - !sdata->u.mgd.assoc_data) { - sdata->vif.bss_conf.idle = true; - continue; - } - /* do not count unused IBSS interfaces */ - if (sdata->vif.type == NL80211_IFTYPE_ADHOC && - !sdata->u.ibss.ssid_len) { - sdata->vif.bss_conf.idle = true; - continue; - } - /* count everything else */ - sdata->vif.bss_conf.idle = false; - count++; - } - - list_for_each_entry(wk, &local->work_list, list) { - working = true; - wk->sdata->vif.bss_conf.idle = false; - } - - if (local->scan_sdata && - !(local->hw.flags & IEEE80211_HW_SCAN_WHILE_IDLE)) { - scanning = true; - local->scan_sdata->vif.bss_conf.idle = false; - } - - if (local->hw_roc_channel) - hw_roc = true; - - list_for_each_entry(sdata, &local->interfaces, list) { - if (sdata->vif.type == NL80211_IFTYPE_MONITOR || - sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - continue; - if (sdata->old_idle == sdata->vif.bss_conf.idle) - continue; - if (!ieee80211_sdata_running(sdata)) - continue; - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IDLE); - } - - if (working || scanning || hw_roc) - led_trig_start |= IEEE80211_TPT_LEDTRIG_FL_WORK; - else - led_trig_stop |= IEEE80211_TPT_LEDTRIG_FL_WORK; - - if (count) - led_trig_start |= IEEE80211_TPT_LEDTRIG_FL_CONNECTED; - else - led_trig_stop |= IEEE80211_TPT_LEDTRIG_FL_CONNECTED; - - ieee80211_mod_tpt_led_trig(local, led_trig_start, led_trig_stop); - - if (hw_roc) - return ieee80211_idle_off(local, "hw remain-on-channel"); - if (working) - return ieee80211_idle_off(local, "working"); - if (scanning) - return ieee80211_idle_off(local, "scanning"); - if (!count) - return ieee80211_idle_on(local); - else - return ieee80211_idle_off(local, "in use"); - - return 0; -} - -void ieee80211_recalc_idle(struct ieee80211_local *local) -{ - u32 chg; - - mutex_lock(&local->iflist_mtx); - chg = __ieee80211_recalc_idle(local); - mutex_unlock(&local->iflist_mtx); - if (chg) - ieee80211_hw_config(local, chg); -} - -static int netdev_notify(struct notifier_block *nb, - unsigned long state, - void *ndev) -{ - struct net_device *dev = ndev; - struct ieee80211_sub_if_data *sdata; - - if (state != NETDEV_CHANGENAME) - return 0; - - if (!dev->ieee80211_ptr || !dev->ieee80211_ptr->wiphy) - return 0; - - if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) - return 0; - - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - memcpy(sdata->name, dev->name, IFNAMSIZ); - - ieee80211_debugfs_rename_netdev(sdata); - return 0; -} - -static struct notifier_block mac80211_netdev_notifier = { - .notifier_call = netdev_notify, -}; - -int ieee80211_iface_init(void) -{ - return register_netdevice_notifier(&mac80211_netdev_notifier); -} - -void ieee80211_iface_exit(void) -{ - unregister_netdevice_notifier(&mac80211_netdev_notifier); -} diff --git a/openairITS/mac/DOT11/net/mac80211/key.c b/openairITS/mac/DOT11/net/mac80211/key.c deleted file mode 100644 index b4dc61464af..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/key.c +++ /dev/null @@ -1,702 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007-2008 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/if_ether.h> -#include <linux/etherdevice.h> -#include <linux/list.h> -#include <linux/rcupdate.h> -#include <linux/rtnetlink.h> -#include <linux/slab.h> -#include <linux/export.h> -#include <net/mac80211.h> -#include <asm/unaligned.h> -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "debugfs_key.h" -#include "aes_ccm.h" -#include "aes_cmac.h" - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)) -#include <asm/unaligned.h> -#endif - -/** - * DOC: Key handling basics - * - * Key handling in mac80211 is done based on per-interface (sub_if_data) - * keys and per-station keys. Since each station belongs to an interface, - * each station key also belongs to that interface. - * - * Hardware acceleration is done on a best-effort basis for algorithms - * that are implemented in software, for each key the hardware is asked - * to enable that key for offloading but if it cannot do that the key is - * simply kept for software encryption (unless it is for an algorithm - * that isn't implemented in software). - * There is currently no way of knowing whether a key is handled in SW - * or HW except by looking into debugfs. - * - * All key management is internally protected by a mutex. Within all - * other parts of mac80211, key references are, just as STA structure - * references, protected by RCU. Note, however, that some things are - * unprotected, namely the key->sta dereferences within the hardware - * acceleration functions. This means that sta_info_destroy() must - * remove the key which waits for an RCU grace period. - */ - -static const u8 bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; - -static void assert_key_lock(struct ieee80211_local *local) -{ - lockdep_assert_held(&local->key_mtx); -} - -static void increment_tailroom_need_count(struct ieee80211_sub_if_data *sdata) -{ - /* - * When this count is zero, SKB resizing for allocating tailroom - * for IV or MMIC is skipped. But, this check has created two race - * cases in xmit path while transiting from zero count to one: - * - * 1. SKB resize was skipped because no key was added but just before - * the xmit key is added and SW encryption kicks off. - * - * 2. SKB resize was skipped because all the keys were hw planted but - * just before xmit one of the key is deleted and SW encryption kicks - * off. - * - * In both the above case SW encryption will find not enough space for - * tailroom and exits with WARN_ON. (See WARN_ONs at wpa.c) - * - * Solution has been explained at - * http://mid.gmane.org/1308590980.4322.19.camel@jlt3.sipsolutions.net - */ - - if (!sdata->crypto_tx_tailroom_needed_cnt++) { - /* - * Flush all XMIT packets currently using HW encryption or no - * encryption at all if the count transition is from 0 -> 1. - */ - synchronize_net(); - } -} - -static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) -{ - struct ieee80211_sub_if_data *sdata; - struct sta_info *sta; - int ret; - - might_sleep(); - - if (!key->local->ops->set_key) - goto out_unsupported; - - assert_key_lock(key->local); - - sta = key->sta; - - /* - * If this is a per-STA GTK, check if it - * is supported; if not, return. - */ - if (sta && !(key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE) && - !(key->local->hw.flags & IEEE80211_HW_SUPPORTS_PER_STA_GTK)) - goto out_unsupported; - - if (sta && !sta->uploaded) - goto out_unsupported; - - sdata = key->sdata; - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { - /* - * The driver doesn't know anything about VLAN interfaces. - * Hence, don't send GTKs for VLAN interfaces to the driver. - */ - if (!(key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE)) - goto out_unsupported; - } - - ret = drv_set_key(key->local, SET_KEY, sdata, - sta ? &sta->sta : NULL, &key->conf); - - if (!ret) { - key->flags |= KEY_FLAG_UPLOADED_TO_HARDWARE; - - if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || - (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) || - (key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))) - sdata->crypto_tx_tailroom_needed_cnt--; - - WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) && - (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)); - - return 0; - } - - if (ret != -ENOSPC && ret != -EOPNOTSUPP) - wiphy_err(key->local->hw.wiphy, - "failed to set key (%d, %pM) to hardware (%d)\n", - key->conf.keyidx, - sta ? sta->sta.addr : bcast_addr, ret); - - out_unsupported: - switch (key->conf.cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - case WLAN_CIPHER_SUITE_TKIP: - case WLAN_CIPHER_SUITE_CCMP: - case WLAN_CIPHER_SUITE_AES_CMAC: - /* all of these we can do in software */ - return 0; - default: - return -EINVAL; - } -} - -static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key) -{ - struct ieee80211_sub_if_data *sdata; - struct sta_info *sta; - int ret; - - might_sleep(); - - if (!key || !key->local->ops->set_key) - return; - - assert_key_lock(key->local); - - if (!(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) - return; - - sta = key->sta; - sdata = key->sdata; - - if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || - (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) || - (key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))) - increment_tailroom_need_count(sdata); - - ret = drv_set_key(key->local, DISABLE_KEY, sdata, - sta ? &sta->sta : NULL, &key->conf); - - if (ret) - wiphy_err(key->local->hw.wiphy, - "failed to remove key (%d, %pM) from hardware (%d)\n", - key->conf.keyidx, - sta ? sta->sta.addr : bcast_addr, ret); - - key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; -} - -void ieee80211_key_removed(struct ieee80211_key_conf *key_conf) -{ - struct ieee80211_key *key; - - key = container_of(key_conf, struct ieee80211_key, conf); - - might_sleep(); - assert_key_lock(key->local); - - key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE; - - /* - * Flush TX path to avoid attempts to use this key - * after this function returns. Until then, drivers - * must be prepared to handle the key. - */ - synchronize_rcu(); -} -EXPORT_SYMBOL_GPL(ieee80211_key_removed); - -static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, - int idx, bool uni, bool multi) -{ - struct ieee80211_key *key = NULL; - - assert_key_lock(sdata->local); - - if (idx >= 0 && idx < NUM_DEFAULT_KEYS) - key = key_mtx_dereference(sdata->local, sdata->keys[idx]); - - if (uni) - rcu_assign_pointer(sdata->default_unicast_key, key); - if (multi) - rcu_assign_pointer(sdata->default_multicast_key, key); - - ieee80211_debugfs_key_update_default(sdata); -} - -void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx, - bool uni, bool multi) -{ - mutex_lock(&sdata->local->key_mtx); - __ieee80211_set_default_key(sdata, idx, uni, multi); - mutex_unlock(&sdata->local->key_mtx); -} - -static void -__ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, int idx) -{ - struct ieee80211_key *key = NULL; - - assert_key_lock(sdata->local); - - if (idx >= NUM_DEFAULT_KEYS && - idx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) - key = key_mtx_dereference(sdata->local, sdata->keys[idx]); - - rcu_assign_pointer(sdata->default_mgmt_key, key); - - ieee80211_debugfs_key_update_default(sdata); -} - -void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, - int idx) -{ - mutex_lock(&sdata->local->key_mtx); - __ieee80211_set_default_mgmt_key(sdata, idx); - mutex_unlock(&sdata->local->key_mtx); -} - - -static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata, - struct sta_info *sta, - bool pairwise, - struct ieee80211_key *old, - struct ieee80211_key *new) -{ - int idx; - bool defunikey, defmultikey, defmgmtkey; - - if (new) - list_add_tail(&new->list, &sdata->key_list); - - if (sta && pairwise) { - rcu_assign_pointer(sta->ptk, new); - } else if (sta) { - if (old) - idx = old->conf.keyidx; - else - idx = new->conf.keyidx; - rcu_assign_pointer(sta->gtk[idx], new); - } else { - WARN_ON(new && old && new->conf.keyidx != old->conf.keyidx); - - if (old) - idx = old->conf.keyidx; - else - idx = new->conf.keyidx; - - defunikey = old && - old == key_mtx_dereference(sdata->local, - sdata->default_unicast_key); - defmultikey = old && - old == key_mtx_dereference(sdata->local, - sdata->default_multicast_key); - defmgmtkey = old && - old == key_mtx_dereference(sdata->local, - sdata->default_mgmt_key); - - if (defunikey && !new) - __ieee80211_set_default_key(sdata, -1, true, false); - if (defmultikey && !new) - __ieee80211_set_default_key(sdata, -1, false, true); - if (defmgmtkey && !new) - __ieee80211_set_default_mgmt_key(sdata, -1); - - rcu_assign_pointer(sdata->keys[idx], new); - if (defunikey && new) - __ieee80211_set_default_key(sdata, new->conf.keyidx, - true, false); - if (defmultikey && new) - __ieee80211_set_default_key(sdata, new->conf.keyidx, - false, true); - if (defmgmtkey && new) - __ieee80211_set_default_mgmt_key(sdata, - new->conf.keyidx); - } - - if (old) - list_del(&old->list); -} - -struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, - const u8 *key_data, - size_t seq_len, const u8 *seq) -{ - struct ieee80211_key *key; - int i, j, err; - - BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS); - - key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL); - if (!key) - return ERR_PTR(-ENOMEM); - - /* - * Default to software encryption; we'll later upload the - * key to the hardware if possible. - */ - key->conf.flags = 0; - key->flags = 0; - - key->conf.cipher = cipher; - key->conf.keyidx = idx; - key->conf.keylen = key_len; - switch (cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - key->conf.iv_len = WEP_IV_LEN; - key->conf.icv_len = WEP_ICV_LEN; - break; - case WLAN_CIPHER_SUITE_TKIP: - key->conf.iv_len = TKIP_IV_LEN; - key->conf.icv_len = TKIP_ICV_LEN; - if (seq) { - for (i = 0; i < NUM_RX_DATA_QUEUES; i++) { - key->u.tkip.rx[i].iv32 = - get_unaligned_le32(&seq[2]); - key->u.tkip.rx[i].iv16 = - get_unaligned_le16(seq); - } - } - spin_lock_init(&key->u.tkip.txlock); - break; - case WLAN_CIPHER_SUITE_CCMP: - key->conf.iv_len = CCMP_HDR_LEN; - key->conf.icv_len = CCMP_MIC_LEN; - if (seq) { - for (i = 0; i < NUM_RX_DATA_QUEUES + 1; i++) - for (j = 0; j < CCMP_PN_LEN; j++) - key->u.ccmp.rx_pn[i][j] = - seq[CCMP_PN_LEN - j - 1]; - } - /* - * Initialize AES key state here as an optimization so that - * it does not need to be initialized for every packet. - */ - key->u.ccmp.tfm = ieee80211_aes_key_setup_encrypt(key_data); - if (IS_ERR(key->u.ccmp.tfm)) { - err = PTR_ERR(key->u.ccmp.tfm); - kfree(key); - return ERR_PTR(err); - } - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - key->conf.iv_len = 0; - key->conf.icv_len = sizeof(struct ieee80211_mmie); - if (seq) - for (j = 0; j < 6; j++) - key->u.aes_cmac.rx_pn[j] = seq[6 - j - 1]; - /* - * Initialize AES key state here as an optimization so that - * it does not need to be initialized for every packet. - */ - key->u.aes_cmac.tfm = - ieee80211_aes_cmac_key_setup(key_data); - if (IS_ERR(key->u.aes_cmac.tfm)) { - err = PTR_ERR(key->u.aes_cmac.tfm); - kfree(key); - return ERR_PTR(err); - } - break; - } - memcpy(key->conf.key, key_data, key_len); - INIT_LIST_HEAD(&key->list); - - return key; -} - -static void __ieee80211_key_destroy(struct ieee80211_key *key) -{ - if (!key) - return; - - /* - * Synchronize so the TX path can no longer be using - * this key before we free/remove it. - */ - synchronize_rcu(); - - if (key->local) - ieee80211_key_disable_hw_accel(key); - - if (key->conf.cipher == WLAN_CIPHER_SUITE_CCMP) - ieee80211_aes_key_free(key->u.ccmp.tfm); - if (key->conf.cipher == WLAN_CIPHER_SUITE_AES_CMAC) - ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm); - if (key->local) { - ieee80211_debugfs_key_remove(key); - key->sdata->crypto_tx_tailroom_needed_cnt--; - } - - kfree(key); -} - -int ieee80211_key_link(struct ieee80211_key *key, - struct ieee80211_sub_if_data *sdata, - struct sta_info *sta) -{ - struct ieee80211_key *old_key; - int idx, ret; - bool pairwise; - - BUG_ON(!sdata); - BUG_ON(!key); - - pairwise = key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE; - idx = key->conf.keyidx; - key->local = sdata->local; - key->sdata = sdata; - key->sta = sta; - - if (sta) { - /* - * some hardware cannot handle TKIP with QoS, so - * we indicate whether QoS could be in use. - */ - if (test_sta_flag(sta, WLAN_STA_WME)) - key->conf.flags |= IEEE80211_KEY_FLAG_WMM_STA; - } else { - if (sdata->vif.type == NL80211_IFTYPE_STATION) { - struct sta_info *ap; - - /* - * We're getting a sta pointer in, so must be under - * appropriate locking for sta_info_get(). - */ - - /* same here, the AP could be using QoS */ - ap = sta_info_get(key->sdata, key->sdata->u.mgd.bssid); - if (ap) { - if (test_sta_flag(ap, WLAN_STA_WME)) - key->conf.flags |= - IEEE80211_KEY_FLAG_WMM_STA; - } - } - } - - mutex_lock(&sdata->local->key_mtx); - - if (sta && pairwise) - old_key = key_mtx_dereference(sdata->local, sta->ptk); - else if (sta) - old_key = key_mtx_dereference(sdata->local, sta->gtk[idx]); - else - old_key = key_mtx_dereference(sdata->local, sdata->keys[idx]); - - increment_tailroom_need_count(sdata); - - __ieee80211_key_replace(sdata, sta, pairwise, old_key, key); - __ieee80211_key_destroy(old_key); - - ieee80211_debugfs_key_add(key); - - ret = ieee80211_key_enable_hw_accel(key); - - mutex_unlock(&sdata->local->key_mtx); - - return ret; -} - -void __ieee80211_key_free(struct ieee80211_key *key) -{ - if (!key) - return; - - /* - * Replace key with nothingness if it was ever used. - */ - if (key->sdata) - __ieee80211_key_replace(key->sdata, key->sta, - key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE, - key, NULL); - __ieee80211_key_destroy(key); -} - -void ieee80211_key_free(struct ieee80211_local *local, - struct ieee80211_key *key) -{ - mutex_lock(&local->key_mtx); - __ieee80211_key_free(key); - mutex_unlock(&local->key_mtx); -} - -void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_key *key; - - ASSERT_RTNL(); - - if (WARN_ON(!ieee80211_sdata_running(sdata))) - return; - - mutex_lock(&sdata->local->key_mtx); - - sdata->crypto_tx_tailroom_needed_cnt = 0; - - list_for_each_entry(key, &sdata->key_list, list) { - increment_tailroom_need_count(sdata); - ieee80211_key_enable_hw_accel(key); - } - - mutex_unlock(&sdata->local->key_mtx); -} - -void ieee80211_iter_keys(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - void (*iter)(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct ieee80211_key_conf *key, - void *data), - void *iter_data) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_key *key; - struct ieee80211_sub_if_data *sdata; - - ASSERT_RTNL(); - - mutex_lock(&local->key_mtx); - if (vif) { - sdata = vif_to_sdata(vif); - list_for_each_entry(key, &sdata->key_list, list) - iter(hw, &sdata->vif, - key->sta ? &key->sta->sta : NULL, - &key->conf, iter_data); - } else { - list_for_each_entry(sdata, &local->interfaces, list) - list_for_each_entry(key, &sdata->key_list, list) - iter(hw, &sdata->vif, - key->sta ? &key->sta->sta : NULL, - &key->conf, iter_data); - } - mutex_unlock(&local->key_mtx); -} -EXPORT_SYMBOL(ieee80211_iter_keys); - -void ieee80211_disable_keys(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_key *key; - - ASSERT_RTNL(); - - mutex_lock(&sdata->local->key_mtx); - - list_for_each_entry(key, &sdata->key_list, list) - ieee80211_key_disable_hw_accel(key); - - mutex_unlock(&sdata->local->key_mtx); -} - -void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_key *key, *tmp; - - mutex_lock(&sdata->local->key_mtx); - - ieee80211_debugfs_key_remove_mgmt_default(sdata); - - list_for_each_entry_safe(key, tmp, &sdata->key_list, list) - __ieee80211_key_free(key); - - ieee80211_debugfs_key_update_default(sdata); - - mutex_unlock(&sdata->local->key_mtx); -} - - -void ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid, - const u8 *replay_ctr, gfp_t gfp) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - - trace_api_gtk_rekey_notify(sdata, bssid, replay_ctr); - - cfg80211_gtk_rekey_notify(sdata->dev, bssid, replay_ctr, gfp); -} -EXPORT_SYMBOL_GPL(ieee80211_gtk_rekey_notify); - -void ieee80211_get_key_tx_seq(struct ieee80211_key_conf *keyconf, - struct ieee80211_key_seq *seq) -{ - struct ieee80211_key *key; - u64 pn64; - - if (WARN_ON(!(keyconf->flags & IEEE80211_KEY_FLAG_GENERATE_IV))) - return; - - key = container_of(keyconf, struct ieee80211_key, conf); - - switch (key->conf.cipher) { - case WLAN_CIPHER_SUITE_TKIP: - seq->tkip.iv32 = key->u.tkip.tx.iv32; - seq->tkip.iv16 = key->u.tkip.tx.iv16; - break; - case WLAN_CIPHER_SUITE_CCMP: - pn64 = atomic64_read(&key->u.ccmp.tx_pn); - seq->ccmp.pn[5] = pn64; - seq->ccmp.pn[4] = pn64 >> 8; - seq->ccmp.pn[3] = pn64 >> 16; - seq->ccmp.pn[2] = pn64 >> 24; - seq->ccmp.pn[1] = pn64 >> 32; - seq->ccmp.pn[0] = pn64 >> 40; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - pn64 = atomic64_read(&key->u.aes_cmac.tx_pn); - seq->ccmp.pn[5] = pn64; - seq->ccmp.pn[4] = pn64 >> 8; - seq->ccmp.pn[3] = pn64 >> 16; - seq->ccmp.pn[2] = pn64 >> 24; - seq->ccmp.pn[1] = pn64 >> 32; - seq->ccmp.pn[0] = pn64 >> 40; - break; - default: - WARN_ON(1); - } -} -EXPORT_SYMBOL(ieee80211_get_key_tx_seq); - -void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, - int tid, struct ieee80211_key_seq *seq) -{ - struct ieee80211_key *key; - const u8 *pn; - - key = container_of(keyconf, struct ieee80211_key, conf); - - switch (key->conf.cipher) { - case WLAN_CIPHER_SUITE_TKIP: - if (WARN_ON(tid < 0 || tid >= NUM_RX_DATA_QUEUES)) - return; - seq->tkip.iv32 = key->u.tkip.rx[tid].iv32; - seq->tkip.iv16 = key->u.tkip.rx[tid].iv16; - break; - case WLAN_CIPHER_SUITE_CCMP: - if (WARN_ON(tid < -1 || tid >= NUM_RX_DATA_QUEUES)) - return; - if (tid < 0) - pn = key->u.ccmp.rx_pn[NUM_RX_DATA_QUEUES]; - else - pn = key->u.ccmp.rx_pn[tid]; - memcpy(seq->ccmp.pn, pn, CCMP_PN_LEN); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - if (WARN_ON(tid != 0)) - return; - pn = key->u.aes_cmac.rx_pn; - memcpy(seq->aes_cmac.pn, pn, CMAC_PN_LEN); - break; - } -} -EXPORT_SYMBOL(ieee80211_get_key_rx_seq); diff --git a/openairITS/mac/DOT11/net/mac80211/key.h b/openairITS/mac/DOT11/net/mac80211/key.h deleted file mode 100644 index 7d4e31f037d..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/key.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2002-2004, Instant802 Networks, Inc. - * Copyright 2005, Devicescape Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef IEEE80211_KEY_H -#define IEEE80211_KEY_H - -#include <linux/types.h> -#include <linux/list.h> -#include <linux/crypto.h> -#include <linux/rcupdate.h> -#include <net/mac80211.h> - -#define NUM_DEFAULT_KEYS 4 -#define NUM_DEFAULT_MGMT_KEYS 2 - -#define WEP_IV_LEN 4 -#define WEP_ICV_LEN 4 -#define ALG_CCMP_KEY_LEN 16 -#define CCMP_HDR_LEN 8 -#define CCMP_MIC_LEN 8 -#define CCMP_TK_LEN 16 -#define CCMP_PN_LEN 6 -#define TKIP_IV_LEN 8 -#define TKIP_ICV_LEN 4 -#define CMAC_PN_LEN 6 - -#define NUM_RX_DATA_QUEUES 16 - -struct ieee80211_local; -struct ieee80211_sub_if_data; -struct sta_info; - -/** - * enum ieee80211_internal_key_flags - internal key flags - * - * @KEY_FLAG_UPLOADED_TO_HARDWARE: Indicates that this key is present - * in the hardware for TX crypto hardware acceleration. - * @KEY_FLAG_TAINTED: Key is tainted and packets should be dropped. - */ -enum ieee80211_internal_key_flags { - KEY_FLAG_UPLOADED_TO_HARDWARE = BIT(0), - KEY_FLAG_TAINTED = BIT(1), -}; - -enum ieee80211_internal_tkip_state { - TKIP_STATE_NOT_INIT, - TKIP_STATE_PHASE1_DONE, - TKIP_STATE_PHASE1_HW_UPLOADED, -}; - -struct tkip_ctx { - u32 iv32; /* current iv32 */ - u16 iv16; /* current iv16 */ - u16 p1k[5]; /* p1k cache */ - u32 p1k_iv32; /* iv32 for which p1k computed */ - enum ieee80211_internal_tkip_state state; -}; - -struct ieee80211_key { - struct ieee80211_local *local; - struct ieee80211_sub_if_data *sdata; - struct sta_info *sta; - - /* for sdata list */ - struct list_head list; - - /* protected by key mutex */ - unsigned int flags; - - union { - struct { - /* protects tx context */ - spinlock_t txlock; - - /* last used TSC */ - struct tkip_ctx tx; - - /* last received RSC */ - struct tkip_ctx rx[NUM_RX_DATA_QUEUES]; - } tkip; - struct { - atomic64_t tx_pn; - /* - * Last received packet number. The first - * NUM_RX_DATA_QUEUES counters are used with Data - * frames and the last counter is used with Robust - * Management frames. - */ - u8 rx_pn[NUM_RX_DATA_QUEUES + 1][CCMP_PN_LEN]; - struct crypto_cipher *tfm; - u32 replays; /* dot11RSNAStatsCCMPReplays */ - } ccmp; - struct { - atomic64_t tx_pn; - u8 rx_pn[CMAC_PN_LEN]; - struct crypto_cipher *tfm; - u32 replays; /* dot11RSNAStatsCMACReplays */ - u32 icverrors; /* dot11RSNAStatsCMACICVErrors */ - } aes_cmac; - } u; - - /* number of times this key has been used */ - int tx_rx_count; - -#ifdef CONFIG_MAC80211_DEBUGFS - struct { - struct dentry *stalink; - struct dentry *dir; - int cnt; - } debugfs; -#endif - - /* - * key config, must be last because it contains key - * material as variable length member - */ - struct ieee80211_key_conf conf; -}; - -struct ieee80211_key *ieee80211_key_alloc(u32 cipher, int idx, size_t key_len, - const u8 *key_data, - size_t seq_len, const u8 *seq); -/* - * Insert a key into data structures (sdata, sta if necessary) - * to make it used, free old key. - */ -int __must_check ieee80211_key_link(struct ieee80211_key *key, - struct ieee80211_sub_if_data *sdata, - struct sta_info *sta); -void __ieee80211_key_free(struct ieee80211_key *key); -void ieee80211_key_free(struct ieee80211_local *local, - struct ieee80211_key *key); -void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx, - bool uni, bool multi); -void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, - int idx); -void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata); -void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata); -void ieee80211_disable_keys(struct ieee80211_sub_if_data *sdata); - -#define key_mtx_dereference(local, ref) \ - rcu_dereference_protected(ref, lockdep_is_held(&((local)->key_mtx))) - -#endif /* IEEE80211_KEY_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/led.c b/openairITS/mac/DOT11/net/mac80211/led.c deleted file mode 100644 index 1bf7903496f..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/led.c +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright 2006, Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -/* just for IFNAMSIZ */ -#include <linux/if.h> -#include <linux/slab.h> -#include <linux/export.h> -#include "led.h" - -void ieee80211_led_rx(struct ieee80211_local *local) -{ - if (unlikely(!local->rx_led)) - return; - if (local->rx_led_counter++ % 2 == 0) - led_trigger_event(local->rx_led, LED_OFF); - else - led_trigger_event(local->rx_led, LED_FULL); -} - -/* q is 1 if a packet was enqueued, 0 if it has been transmitted */ -void ieee80211_led_tx(struct ieee80211_local *local, int q) -{ - if (unlikely(!local->tx_led)) - return; - /* not sure how this is supposed to work ... */ - local->tx_led_counter += 2*q-1; - if (local->tx_led_counter % 2 == 0) - led_trigger_event(local->tx_led, LED_OFF); - else - led_trigger_event(local->tx_led, LED_FULL); -} - -void ieee80211_led_assoc(struct ieee80211_local *local, bool associated) -{ - if (unlikely(!local->assoc_led)) - return; - if (associated) - led_trigger_event(local->assoc_led, LED_FULL); - else - led_trigger_event(local->assoc_led, LED_OFF); -} - -void ieee80211_led_radio(struct ieee80211_local *local, bool enabled) -{ - if (unlikely(!local->radio_led)) - return; - if (enabled) - led_trigger_event(local->radio_led, LED_FULL); - else - led_trigger_event(local->radio_led, LED_OFF); -} - -void ieee80211_led_names(struct ieee80211_local *local) -{ - snprintf(local->rx_led_name, sizeof(local->rx_led_name), - "%srx", wiphy_name(local->hw.wiphy)); - snprintf(local->tx_led_name, sizeof(local->tx_led_name), - "%stx", wiphy_name(local->hw.wiphy)); - snprintf(local->assoc_led_name, sizeof(local->assoc_led_name), - "%sassoc", wiphy_name(local->hw.wiphy)); - snprintf(local->radio_led_name, sizeof(local->radio_led_name), - "%sradio", wiphy_name(local->hw.wiphy)); -} - -void ieee80211_led_init(struct ieee80211_local *local) -{ - local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); - if (local->rx_led) { - local->rx_led->name = local->rx_led_name; - if (led_trigger_register(local->rx_led)) { - kfree(local->rx_led); - local->rx_led = NULL; - } - } - - local->tx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); - if (local->tx_led) { - local->tx_led->name = local->tx_led_name; - if (led_trigger_register(local->tx_led)) { - kfree(local->tx_led); - local->tx_led = NULL; - } - } - - local->assoc_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); - if (local->assoc_led) { - local->assoc_led->name = local->assoc_led_name; - if (led_trigger_register(local->assoc_led)) { - kfree(local->assoc_led); - local->assoc_led = NULL; - } - } - - local->radio_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); - if (local->radio_led) { - local->radio_led->name = local->radio_led_name; - if (led_trigger_register(local->radio_led)) { - kfree(local->radio_led); - local->radio_led = NULL; - } - } - - if (local->tpt_led_trigger) { - if (led_trigger_register(&local->tpt_led_trigger->trig)) { - kfree(local->tpt_led_trigger); - local->tpt_led_trigger = NULL; - } - } -} - -void ieee80211_led_exit(struct ieee80211_local *local) -{ - if (local->radio_led) { - led_trigger_unregister(local->radio_led); - kfree(local->radio_led); - } - if (local->assoc_led) { - led_trigger_unregister(local->assoc_led); - kfree(local->assoc_led); - } - if (local->tx_led) { - led_trigger_unregister(local->tx_led); - kfree(local->tx_led); - } - if (local->rx_led) { - led_trigger_unregister(local->rx_led); - kfree(local->rx_led); - } - - if (local->tpt_led_trigger) { - led_trigger_unregister(&local->tpt_led_trigger->trig); - kfree(local->tpt_led_trigger); - } -} - -char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - return local->radio_led_name; -} -EXPORT_SYMBOL(__ieee80211_get_radio_led_name); - -char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - return local->assoc_led_name; -} -EXPORT_SYMBOL(__ieee80211_get_assoc_led_name); - -char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - return local->tx_led_name; -} -EXPORT_SYMBOL(__ieee80211_get_tx_led_name); - -char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - return local->rx_led_name; -} -EXPORT_SYMBOL(__ieee80211_get_rx_led_name); - -static unsigned long tpt_trig_traffic(struct ieee80211_local *local, - struct tpt_led_trigger *tpt_trig) -{ - unsigned long traffic, delta; - - traffic = tpt_trig->tx_bytes + tpt_trig->rx_bytes; - - delta = traffic - tpt_trig->prev_traffic; - tpt_trig->prev_traffic = traffic; - return DIV_ROUND_UP(delta, 1024 / 8); -} - -static void tpt_trig_timer(unsigned long data) -{ - struct ieee80211_local *local = (void *)data; - struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; - struct led_classdev *led_cdev; - unsigned long on, off, tpt; - int i; - - if (!tpt_trig->running) - return; - - mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ)); - - tpt = tpt_trig_traffic(local, tpt_trig); - - /* default to just solid on */ - on = 1; - off = 0; - - for (i = tpt_trig->blink_table_len - 1; i >= 0; i--) { - if (tpt_trig->blink_table[i].throughput < 0 || - tpt > tpt_trig->blink_table[i].throughput) { - off = tpt_trig->blink_table[i].blink_time / 2; - on = tpt_trig->blink_table[i].blink_time - off; - break; - } - } - - read_lock(&tpt_trig->trig.leddev_list_lock); - list_for_each_entry(led_cdev, &tpt_trig->trig.led_cdevs, trig_list) - led_blink_set(led_cdev, &on, &off); - read_unlock(&tpt_trig->trig.leddev_list_lock); -} - -char *__ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, - unsigned int flags, - const struct ieee80211_tpt_blink *blink_table, - unsigned int blink_table_len) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct tpt_led_trigger *tpt_trig; - - if (WARN_ON(local->tpt_led_trigger)) - return NULL; - - tpt_trig = kzalloc(sizeof(struct tpt_led_trigger), GFP_KERNEL); - if (!tpt_trig) - return NULL; - - snprintf(tpt_trig->name, sizeof(tpt_trig->name), - "%stpt", wiphy_name(local->hw.wiphy)); - - tpt_trig->trig.name = tpt_trig->name; - - tpt_trig->blink_table = blink_table; - tpt_trig->blink_table_len = blink_table_len; - tpt_trig->want = flags; - - setup_timer(&tpt_trig->timer, tpt_trig_timer, (unsigned long)local); - - local->tpt_led_trigger = tpt_trig; - - return tpt_trig->name; -} -EXPORT_SYMBOL(__ieee80211_create_tpt_led_trigger); - -static void ieee80211_start_tpt_led_trig(struct ieee80211_local *local) -{ - struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; - - if (tpt_trig->running) - return; - - /* reset traffic */ - tpt_trig_traffic(local, tpt_trig); - tpt_trig->running = true; - - tpt_trig_timer((unsigned long)local); - mod_timer(&tpt_trig->timer, round_jiffies(jiffies + HZ)); -} - -static void ieee80211_stop_tpt_led_trig(struct ieee80211_local *local) -{ - struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; - struct led_classdev *led_cdev; - - if (!tpt_trig->running) - return; - - tpt_trig->running = false; - del_timer_sync(&tpt_trig->timer); - - read_lock(&tpt_trig->trig.leddev_list_lock); - list_for_each_entry(led_cdev, &tpt_trig->trig.led_cdevs, trig_list) - led_brightness_set(led_cdev, LED_OFF); - read_unlock(&tpt_trig->trig.leddev_list_lock); -} - -void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, - unsigned int types_on, unsigned int types_off) -{ - struct tpt_led_trigger *tpt_trig = local->tpt_led_trigger; - bool allowed; - - WARN_ON(types_on & types_off); - - if (!tpt_trig) - return; - - tpt_trig->active &= ~types_off; - tpt_trig->active |= types_on; - - /* - * Regardless of wanted state, we shouldn't blink when - * the radio is disabled -- this can happen due to some - * code ordering issues with __ieee80211_recalc_idle() - * being called before the radio is started. - */ - allowed = tpt_trig->active & IEEE80211_TPT_LEDTRIG_FL_RADIO; - - if (!allowed || !(tpt_trig->active & tpt_trig->want)) - ieee80211_stop_tpt_led_trig(local); - else - ieee80211_start_tpt_led_trig(local); -} diff --git a/openairITS/mac/DOT11/net/mac80211/led.h b/openairITS/mac/DOT11/net/mac80211/led.h deleted file mode 100644 index e0275d9befa..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/led.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2006, Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/list.h> -#include <linux/spinlock.h> -#include <linux/leds.h> -#include "ieee80211_i.h" - -#ifdef CONFIG_MAC80211_LEDS -void ieee80211_led_rx(struct ieee80211_local *local); -void ieee80211_led_tx(struct ieee80211_local *local, int q); -void ieee80211_led_assoc(struct ieee80211_local *local, - bool associated); -void ieee80211_led_radio(struct ieee80211_local *local, - bool enabled); -void ieee80211_led_names(struct ieee80211_local *local); -void ieee80211_led_init(struct ieee80211_local *local); -void ieee80211_led_exit(struct ieee80211_local *local); -void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, - unsigned int types_on, unsigned int types_off); -#else -static inline void ieee80211_led_rx(struct ieee80211_local *local) -{ -} -static inline void ieee80211_led_tx(struct ieee80211_local *local, int q) -{ -} -static inline void ieee80211_led_assoc(struct ieee80211_local *local, - bool associated) -{ -} -static inline void ieee80211_led_radio(struct ieee80211_local *local, - bool enabled) -{ -} -static inline void ieee80211_led_names(struct ieee80211_local *local) -{ -} -static inline void ieee80211_led_init(struct ieee80211_local *local) -{ -} -static inline void ieee80211_led_exit(struct ieee80211_local *local) -{ -} -static inline void ieee80211_mod_tpt_led_trig(struct ieee80211_local *local, - unsigned int types_on, - unsigned int types_off) -{ -} -#endif - -static inline void -ieee80211_tpt_led_trig_tx(struct ieee80211_local *local, __le16 fc, int bytes) -{ -#ifdef CONFIG_MAC80211_LEDS - if (local->tpt_led_trigger && ieee80211_is_data(fc)) - local->tpt_led_trigger->tx_bytes += bytes; -#endif -} - -static inline void -ieee80211_tpt_led_trig_rx(struct ieee80211_local *local, __le16 fc, int bytes) -{ -#ifdef CONFIG_MAC80211_LEDS - if (local->tpt_led_trigger && ieee80211_is_data(fc)) - local->tpt_led_trigger->rx_bytes += bytes; -#endif -} diff --git a/openairITS/mac/DOT11/net/mac80211/main.c b/openairITS/mac/DOT11/net/mac80211/main.c deleted file mode 100644 index d3c6aebdbe0..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/main.c +++ /dev/null @@ -1,1124 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <net/mac80211.h> -#include <linux/module.h> -#include <linux/init.h> -#include <linux/netdevice.h> -#include <linux/types.h> -#include <linux/slab.h> -#include <linux/skbuff.h> -#include <linux/etherdevice.h> -#include <linux/if_arp.h> -#include <linux/rtnetlink.h> -#include <linux/bitmap.h> -#include <linux/pm_qos.h> -#include <linux/inetdevice.h> -#include <net/net_namespace.h> -#include <net/cfg80211.h> - -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "rate.h" -#include "mesh.h" -#include "wep.h" -#include "led.h" -#include "cfg.h" -#include "debugfs.h" - -static struct lock_class_key ieee80211_rx_skb_queue_class; - -void ieee80211_configure_filter(struct ieee80211_local *local) -{ - u64 mc; - unsigned int changed_flags; - unsigned int new_flags = 0; - - if (atomic_read(&local->iff_promiscs)) - new_flags |= FIF_PROMISC_IN_BSS; - - if (atomic_read(&local->iff_allmultis)) - new_flags |= FIF_ALLMULTI; - - if (local->monitors || test_bit(SCAN_SW_SCANNING, &local->scanning)) - new_flags |= FIF_BCN_PRBRESP_PROMISC; - - if (local->fif_probe_req || local->probe_req_reg) - new_flags |= FIF_PROBE_REQ; - - if (local->fif_fcsfail) - new_flags |= FIF_FCSFAIL; - - if (local->fif_plcpfail) - new_flags |= FIF_PLCPFAIL; - - if (local->fif_control) - new_flags |= FIF_CONTROL; - - if (local->fif_other_bss) - new_flags |= FIF_OTHER_BSS; - - if (local->fif_pspoll) - new_flags |= FIF_PSPOLL; - - spin_lock_bh(&local->filter_lock); - changed_flags = local->filter_flags ^ new_flags; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - mc = drv_prepare_multicast(local, &local->mc_list); -#else - mc = drv_prepare_multicast(local, local->mc_count, local->mc_list); -#endif - spin_unlock_bh(&local->filter_lock); - - /* be a bit nasty */ - new_flags |= (1<<31); - - drv_configure_filter(local, changed_flags, &new_flags, mc); - - WARN_ON(new_flags & (1<<31)); - - local->filter_flags = new_flags & ~(1<<31); -} - -static void ieee80211_reconfig_filter(struct work_struct *work) -{ - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, reconfig_filter); - - ieee80211_configure_filter(local); -} - -int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) -{ - struct ieee80211_channel *chan; - int ret = 0; - int power; - enum nl80211_channel_type channel_type; - u32 offchannel_flag; - - might_sleep(); - - offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; - if (local->scan_channel) { - chan = local->scan_channel; - /* If scanning on oper channel, use whatever channel-type - * is currently in use. - */ - if (chan == local->oper_channel) - channel_type = local->_oper_channel_type; - else - channel_type = NL80211_CHAN_NO_HT; - } else if (local->tmp_channel) { - chan = local->tmp_channel; - channel_type = local->tmp_channel_type; - } else { - chan = local->oper_channel; - channel_type = local->_oper_channel_type; - } - - if (chan != local->oper_channel || - channel_type != local->_oper_channel_type) - local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; - else - local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL; - - offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; - - if (offchannel_flag || chan != local->hw.conf.channel || - channel_type != local->hw.conf.channel_type) { - local->hw.conf.channel = chan; - local->hw.conf.channel_type = channel_type; - changed |= IEEE80211_CONF_CHANGE_CHANNEL; - } - - if (!conf_is_ht(&local->hw.conf)) { - /* - * mac80211.h documents that this is only valid - * when the channel is set to an HT type, and - * that otherwise STATIC is used. - */ - local->hw.conf.smps_mode = IEEE80211_SMPS_STATIC; - } else if (local->hw.conf.smps_mode != local->smps_mode) { - local->hw.conf.smps_mode = local->smps_mode; - changed |= IEEE80211_CONF_CHANGE_SMPS; - } - - if (test_bit(SCAN_SW_SCANNING, &local->scanning) || - test_bit(SCAN_HW_SCANNING, &local->scanning)) - power = chan->max_power; - else - power = local->power_constr_level ? - min(chan->max_power, - (chan->max_reg_power - local->power_constr_level)) : - chan->max_power; - - if (local->user_power_level >= 0) - power = min(power, local->user_power_level); - - if (local->hw.conf.power_level != power) { - changed |= IEEE80211_CONF_CHANGE_POWER; - local->hw.conf.power_level = power; - } - - if (changed && local->open_count) { - ret = drv_config(local, changed); - /* - * Goal: - * HW reconfiguration should never fail, the driver has told - * us what it can support so it should live up to that promise. - * - * Current status: - * rfkill is not integrated with mac80211 and a - * configuration command can thus fail if hardware rfkill - * is enabled - * - * FIXME: integrate rfkill with mac80211 and then add this - * WARN_ON() back - * - */ - /* WARN_ON(ret); */ - } - - return ret; -} - -void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, - u32 changed) -{ - struct ieee80211_local *local = sdata->local; - static const u8 zero[ETH_ALEN] = { 0 }; - - if (!changed) - return; - - if (sdata->vif.type == NL80211_IFTYPE_STATION) { - sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid; - } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) - sdata->vif.bss_conf.bssid = sdata->u.ibss.bssid; - else if (sdata->vif.type == NL80211_IFTYPE_AP) - sdata->vif.bss_conf.bssid = sdata->vif.addr; - else if (sdata->vif.type == NL80211_IFTYPE_WDS) - sdata->vif.bss_conf.bssid = NULL; - else if (ieee80211_vif_is_mesh(&sdata->vif)) { - sdata->vif.bss_conf.bssid = zero; - } else { - WARN_ON(1); - return; - } - - switch (sdata->vif.type) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_WDS: - case NL80211_IFTYPE_MESH_POINT: - break; - default: - /* do not warn to simplify caller in scan.c */ - changed &= ~BSS_CHANGED_BEACON_ENABLED; - if (WARN_ON(changed & BSS_CHANGED_BEACON)) - return; - break; - } - - if (changed & BSS_CHANGED_BEACON_ENABLED) { - if (local->quiescing || !ieee80211_sdata_running(sdata) || - test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) { - sdata->vif.bss_conf.enable_beacon = false; - } else { - /* - * Beacon should be enabled, but AP mode must - * check whether there is a beacon configured. - */ - switch (sdata->vif.type) { - case NL80211_IFTYPE_AP: - sdata->vif.bss_conf.enable_beacon = - !!sdata->u.ap.beacon; - break; - case NL80211_IFTYPE_ADHOC: - sdata->vif.bss_conf.enable_beacon = - !!sdata->u.ibss.presp; - break; -#ifdef CONFIG_MAC80211_MESH - case NL80211_IFTYPE_MESH_POINT: - sdata->vif.bss_conf.enable_beacon = - !!sdata->u.mesh.mesh_id_len; - break; -#endif - default: - /* not reached */ - WARN_ON(1); - break; - } - } - } - - drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed); -} - -u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata) -{ - sdata->vif.bss_conf.use_cts_prot = false; - sdata->vif.bss_conf.use_short_preamble = false; - sdata->vif.bss_conf.use_short_slot = false; - return BSS_CHANGED_ERP_CTS_PROT | - BSS_CHANGED_ERP_PREAMBLE | - BSS_CHANGED_ERP_SLOT; -} - -static void ieee80211_tasklet_handler(unsigned long data) -{ - struct ieee80211_local *local = (struct ieee80211_local *) data; - struct sta_info *sta, *tmp; - struct skb_eosp_msg_data *eosp_data; - struct sk_buff *skb; - - while ((skb = skb_dequeue(&local->skb_queue)) || - (skb = skb_dequeue(&local->skb_queue_unreliable))) { - switch (skb->pkt_type) { - case IEEE80211_RX_MSG: - /* Clear skb->pkt_type in order to not confuse kernel - * netstack. */ - skb->pkt_type = 0; - ieee80211_rx(&local->hw, skb); - break; - case IEEE80211_TX_STATUS_MSG: - skb->pkt_type = 0; - ieee80211_tx_status(&local->hw, skb); - break; - case IEEE80211_EOSP_MSG: - eosp_data = (void *)skb->cb; - for_each_sta_info(local, eosp_data->sta, sta, tmp) { - /* skip wrong virtual interface */ - if (memcmp(eosp_data->iface, - sta->sdata->vif.addr, ETH_ALEN)) - continue; - clear_sta_flag(sta, WLAN_STA_SP); - break; - } - dev_kfree_skb(skb); - break; - default: - WARN(1, "mac80211: Packet is of unknown type %d\n", - skb->pkt_type); - dev_kfree_skb(skb); - break; - } - } -} - -static void ieee80211_restart_work(struct work_struct *work) -{ - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, restart_work); - - /* wait for scan work complete */ - flush_workqueue(local->workqueue); - - mutex_lock(&local->mtx); - WARN(test_bit(SCAN_HW_SCANNING, &local->scanning) || - local->sched_scanning, - "%s called with hardware scan in progress\n", __func__); - mutex_unlock(&local->mtx); - - rtnl_lock(); - ieee80211_scan_cancel(local); - ieee80211_reconfig(local); - rtnl_unlock(); -} - -void ieee80211_restart_hw(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - trace_api_restart_hw(local); - - wiphy_info(hw->wiphy, - "Hardware restart was requested\n"); - - /* use this reason, ieee80211_reconfig will unblock it */ - ieee80211_stop_queues_by_reason(hw, - IEEE80211_QUEUE_STOP_REASON_SUSPEND); - - schedule_work(&local->restart_work); -} -EXPORT_SYMBOL(ieee80211_restart_hw); - -static void ieee80211_recalc_smps_work(struct work_struct *work) -{ - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, recalc_smps); - - mutex_lock(&local->iflist_mtx); - ieee80211_recalc_smps(local); - mutex_unlock(&local->iflist_mtx); -} - -#ifdef CONFIG_INET -static int ieee80211_ifa_changed(struct notifier_block *nb, - unsigned long data, void *arg) -{ - struct in_ifaddr *ifa = arg; - struct ieee80211_local *local = - container_of(nb, struct ieee80211_local, - ifa_notifier); - struct net_device *ndev = ifa->ifa_dev->dev; - struct wireless_dev *wdev = ndev->ieee80211_ptr; - struct in_device *idev; - struct ieee80211_sub_if_data *sdata; - struct ieee80211_bss_conf *bss_conf; - struct ieee80211_if_managed *ifmgd; - int c = 0; - - /* Make sure it's our interface that got changed */ - if (!wdev) - return NOTIFY_DONE; - - if (wdev->wiphy != local->hw.wiphy) - return NOTIFY_DONE; - - sdata = IEEE80211_DEV_TO_SUB_IF(ndev); - bss_conf = &sdata->vif.bss_conf; - - /* ARP filtering is only supported in managed mode */ - if (sdata->vif.type != NL80211_IFTYPE_STATION) - return NOTIFY_DONE; - - idev = __in_dev_get_rtnl(sdata->dev); - if (!idev) - return NOTIFY_DONE; - - ifmgd = &sdata->u.mgd; - mutex_lock(&ifmgd->mtx); - - /* Copy the addresses to the bss_conf list */ - ifa = idev->ifa_list; - while (c < IEEE80211_BSS_ARP_ADDR_LIST_LEN && ifa) { - bss_conf->arp_addr_list[c] = ifa->ifa_address; - ifa = ifa->ifa_next; - c++; - } - - /* If not all addresses fit the list, disable filtering */ - if (ifa) { - sdata->arp_filter_state = false; - c = 0; - } else { - sdata->arp_filter_state = true; - } - bss_conf->arp_addr_cnt = c; - - /* Configure driver only if associated (which also implies it is up) */ - if (ifmgd->associated) { - bss_conf->arp_filter_enabled = sdata->arp_filter_state; - ieee80211_bss_info_change_notify(sdata, - BSS_CHANGED_ARP_FILTER); - } - - mutex_unlock(&ifmgd->mtx); - - return NOTIFY_DONE; -} -#endif - -static int ieee80211_napi_poll(struct napi_struct *napi, int budget) -{ - struct ieee80211_local *local = - container_of(napi, struct ieee80211_local, napi); - - return local->ops->napi_poll(&local->hw, budget); -} - -void ieee80211_napi_schedule(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - napi_schedule(&local->napi); -} -EXPORT_SYMBOL(ieee80211_napi_schedule); - -void ieee80211_napi_complete(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - napi_complete(&local->napi); -} -EXPORT_SYMBOL(ieee80211_napi_complete); - -/* There isn't a lot of sense in it, but you can transmit anything you like */ -static const struct ieee80211_txrx_stypes -ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = { - [NL80211_IFTYPE_ADHOC] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4), - }, - [NL80211_IFTYPE_STATION] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4), - }, - [NL80211_IFTYPE_AP] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_DISASSOC >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | - BIT(IEEE80211_STYPE_DEAUTH >> 4) | - BIT(IEEE80211_STYPE_ACTION >> 4), - }, - [NL80211_IFTYPE_AP_VLAN] = { - /* copy AP */ - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_DISASSOC >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | - BIT(IEEE80211_STYPE_DEAUTH >> 4) | - BIT(IEEE80211_STYPE_ACTION >> 4), - }, - [NL80211_IFTYPE_P2P_CLIENT] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4), - }, - [NL80211_IFTYPE_P2P_GO] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | - BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | - BIT(IEEE80211_STYPE_DISASSOC >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | - BIT(IEEE80211_STYPE_DEAUTH >> 4) | - BIT(IEEE80211_STYPE_ACTION >> 4), - }, - [NL80211_IFTYPE_MESH_POINT] = { - .tx = 0xffff, - .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | - BIT(IEEE80211_STYPE_AUTH >> 4) | - BIT(IEEE80211_STYPE_DEAUTH >> 4), - }, -}; - -static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = { - .ampdu_params_info = IEEE80211_HT_AMPDU_PARM_FACTOR | - IEEE80211_HT_AMPDU_PARM_DENSITY, - - .cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40 | - IEEE80211_HT_CAP_MAX_AMSDU | - IEEE80211_HT_CAP_SGI_40), - .mcs = { - .rx_mask = { 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, }, - }, -}; - -/* - * [PLATA] scan mode here? - */ -struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, - const struct ieee80211_ops *ops) -{ - struct ieee80211_local *local; - int priv_size, i; - struct wiphy *wiphy; - - if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove))) - return NULL; - - /* Ensure 32-byte alignment of our private data and hw private data. - * We use the wiphy priv data for both our ieee80211_local and for - * the driver's private data - * - * In memory it'll be like this: - * - * +-------------------------+ - * | struct wiphy | - * +-------------------------+ - * | struct ieee80211_local | - * +-------------------------+ - * | driver's private data | - * +-------------------------+ - * - */ - priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len; - - wiphy = wiphy_new(&mac80211_config_ops, priv_size); - - if (!wiphy) - return NULL; - - wiphy->mgmt_stypes = ieee80211_default_mgmt_stypes; - - wiphy->privid = mac80211_wiphy_privid; - - wiphy->flags |= WIPHY_FLAG_NETNS_OK | - WIPHY_FLAG_4ADDR_AP | - WIPHY_FLAG_4ADDR_STATION | - WIPHY_FLAG_REPORTS_OBSS | - WIPHY_FLAG_OFFCHAN_TX | - WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; - - wiphy->features = NL80211_FEATURE_SK_TX_STATUS | - NL80211_FEATURE_HT_IBSS; - - if (!ops->set_key) - wiphy->flags |= WIPHY_FLAG_IBSS_RSN; - - wiphy->bss_priv_size = sizeof(struct ieee80211_bss); - - local = wiphy_priv(wiphy); - - local->hw.wiphy = wiphy; - - local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN); - - BUG_ON(!ops->tx && !ops->tx_frags); - BUG_ON(!ops->start); - BUG_ON(!ops->stop); - BUG_ON(!ops->config); - BUG_ON(!ops->add_interface); - BUG_ON(!ops->remove_interface); - BUG_ON(!ops->configure_filter); - local->ops = ops; - - /* set up some defaults */ - local->hw.queues = 1; - local->hw.max_rates = 1; - local->hw.max_report_rates = 0; - local->hw.max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; - local->hw.max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF; - local->hw.conf.long_frame_max_tx_count = wiphy->retry_long; - local->hw.conf.short_frame_max_tx_count = wiphy->retry_short; - local->user_power_level = -1; - wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask; - - INIT_LIST_HEAD(&local->interfaces); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - - __hw_addr_init(&local->mc_list); - -#endif - mutex_init(&local->iflist_mtx); - mutex_init(&local->mtx); - - mutex_init(&local->key_mtx); - spin_lock_init(&local->filter_lock); - spin_lock_init(&local->queue_stop_reason_lock); - - /* - * The rx_skb_queue is only accessed from tasklets, - * but other SKB queues are used from within IRQ - * context. Therefore, this one needs a different - * locking class so our direct, non-irq-safe use of - * the queue's lock doesn't throw lockdep warnings. - */ - skb_queue_head_init_class(&local->rx_skb_queue, - &ieee80211_rx_skb_queue_class); - - /* - * [PLATA] scan_work called here. So we bypass it if OCB is activated - */ - if ((local->hw.wiphy->dot11OCBActivated == 0) || !(local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) - INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work); - - ieee80211_work_init(local); - - INIT_WORK(&local->restart_work, ieee80211_restart_work); - - INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter); - INIT_WORK(&local->recalc_smps, ieee80211_recalc_smps_work); - local->smps_mode = IEEE80211_SMPS_OFF; - - INIT_WORK(&local->dynamic_ps_enable_work, - ieee80211_dynamic_ps_enable_work); - INIT_WORK(&local->dynamic_ps_disable_work, - ieee80211_dynamic_ps_disable_work); - setup_timer(&local->dynamic_ps_timer, - ieee80211_dynamic_ps_timer, (unsigned long) local); - - INIT_WORK(&local->sched_scan_stopped_work, - ieee80211_sched_scan_stopped_work); - - spin_lock_init(&local->ack_status_lock); - idr_init(&local->ack_status_frames); - /* preallocate at least one entry */ - idr_pre_get(&local->ack_status_frames, GFP_KERNEL); - - sta_info_init(local); - - for (i = 0; i < IEEE80211_MAX_QUEUES; i++) { - skb_queue_head_init(&local->pending[i]); - atomic_set(&local->agg_queue_stop[i], 0); - } - tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending, - (unsigned long)local); - - tasklet_init(&local->tasklet, - ieee80211_tasklet_handler, - (unsigned long) local); - - skb_queue_head_init(&local->skb_queue); - skb_queue_head_init(&local->skb_queue_unreliable); - - /* init dummy netdev for use w/ NAPI */ - init_dummy_netdev(&local->napi_dev); - - ieee80211_led_names(local); - - ieee80211_hw_roc_setup(local); - - return &local->hw; -} -EXPORT_SYMBOL(ieee80211_alloc_hw); - -int ieee80211_register_hw(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - int result, i; - enum ieee80211_band band; - int channels, max_bitrates; - bool supp_ht; - static const u32 cipher_suites[] = { - /* keep WEP first, it may be removed below */ - WLAN_CIPHER_SUITE_WEP40, - WLAN_CIPHER_SUITE_WEP104, - WLAN_CIPHER_SUITE_TKIP, - WLAN_CIPHER_SUITE_CCMP, - - /* keep last -- depends on hw flags! */ - WLAN_CIPHER_SUITE_AES_CMAC - }; - - if ((hw->wiphy->wowlan.flags || hw->wiphy->wowlan.n_patterns) -#ifdef CONFIG_PM - && (!local->ops->suspend || !local->ops->resume) -#endif - ) - return -EINVAL; - - if ((hw->flags & IEEE80211_HW_SCAN_WHILE_IDLE) && !local->ops->hw_scan) - return -EINVAL; - - if (hw->max_report_rates == 0) - hw->max_report_rates = hw->max_rates; - - /* - * generic code guarantees at least one band, - * set this very early because much code assumes - * that hw.conf.channel is assigned - */ - channels = 0; - max_bitrates = 0; - supp_ht = false; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - struct ieee80211_supported_band *sband; - - sband = local->hw.wiphy->bands[band]; - if (!sband) - continue; - if (!local->oper_channel) { - /* init channel we're on */ - local->hw.conf.channel = - local->oper_channel = &sband->channels[0]; - local->hw.conf.channel_type = NL80211_CHAN_NO_HT; - } - channels += sband->n_channels; - - if (max_bitrates < sband->n_bitrates) - max_bitrates = sband->n_bitrates; - supp_ht = supp_ht || sband->ht_cap.ht_supported; - } - - local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) + - sizeof(void *) * channels, GFP_KERNEL); - if (!local->int_scan_req) - return -ENOMEM; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - if (!local->hw.wiphy->bands[band]) - continue; - local->int_scan_req->rates[band] = (u32) -1; - } - - /* if low-level driver supports AP, we also support VLAN */ - if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { - hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); - hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN); - } - - /* mac80211 always supports monitor */ - hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); - hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR); - - /* - * mac80211 doesn't support more than 1 channel, and also not more - * than one IBSS interface - */ - for (i = 0; i < hw->wiphy->n_iface_combinations; i++) { - const struct ieee80211_iface_combination *c; - int j; - - c = &hw->wiphy->iface_combinations[i]; - - if (c->num_different_channels > 1) - return -EINVAL; - - for (j = 0; j < c->n_limits; j++) - if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) && - c->limits[j].max > 1) - return -EINVAL; - } - -#ifndef CONFIG_MAC80211_MESH - /* mesh depends on Kconfig, but drivers should set it if they want */ - local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT); -#endif - - /* if the underlying driver supports mesh, mac80211 will (at least) - * provide routing of mesh authentication frames to userspace */ - if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_MESH_POINT)) - local->hw.wiphy->flags |= WIPHY_FLAG_MESH_AUTH; - - /* mac80211 supports control port protocol changing */ - local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL; - - if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) - local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; - else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) - local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; - - WARN((local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD) - && (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK), - "U-APSD not supported with HW_PS_NULLFUNC_STACK\n"); - - /* - * Calculate scan IE length -- we need this to alloc - * memory and to subtract from the driver limit. It - * includes the DS Params, (extended) supported rates, and HT - * information -- SSID is the driver's responsibility. - */ - local->scan_ies_len = 4 + max_bitrates /* (ext) supp rates */ + - 3 /* DS Params */; - if (supp_ht) - local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap); - - if (!local->ops->hw_scan) { - /* For hw_scan, driver needs to set these up. */ - local->hw.wiphy->max_scan_ssids = 4; - local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; - } - - /* - * If the driver supports any scan IEs, then assume the - * limit includes the IEs mac80211 will add, otherwise - * leave it at zero and let the driver sort it out; we - * still pass our IEs to the driver but userspace will - * not be allowed to in that case. - */ - if (local->hw.wiphy->max_scan_ie_len) - local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len; - - /* Set up cipher suites unless driver already did */ - if (!local->hw.wiphy->cipher_suites) { - local->hw.wiphy->cipher_suites = cipher_suites; - local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); - if (!(local->hw.flags & IEEE80211_HW_MFP_CAPABLE)) - local->hw.wiphy->n_cipher_suites--; - } - if (IS_ERR(local->wep_tx_tfm) || IS_ERR(local->wep_rx_tfm)) { - if (local->hw.wiphy->cipher_suites == cipher_suites) { - local->hw.wiphy->cipher_suites += 2; - local->hw.wiphy->n_cipher_suites -= 2; - } else { - u32 *suites; - int r, w = 0; - - /* Filter out WEP */ - - suites = kmemdup( - local->hw.wiphy->cipher_suites, - sizeof(u32) * local->hw.wiphy->n_cipher_suites, - GFP_KERNEL); - if (!suites) - return -ENOMEM; - for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) { - u32 suite = local->hw.wiphy->cipher_suites[r]; - if (suite == WLAN_CIPHER_SUITE_WEP40 || - suite == WLAN_CIPHER_SUITE_WEP104) - continue; - suites[w++] = suite; - } - local->hw.wiphy->cipher_suites = suites; - local->hw.wiphy->n_cipher_suites = w; - local->wiphy_ciphers_allocated = true; - } - } - - if (!local->ops->remain_on_channel) - local->hw.wiphy->max_remain_on_channel_duration = 5000; - - if (local->ops->sched_scan_start) - local->hw.wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; - - /* mac80211 based drivers don't support internal TDLS setup */ - if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) - local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP; - - result = wiphy_register(local->hw.wiphy); - if (result < 0) - goto fail_wiphy_register; - - /* - * We use the number of queues for feature tests (QoS, HT) internally - * so restrict them appropriately. - */ - if (hw->queues > IEEE80211_MAX_QUEUES) - hw->queues = IEEE80211_MAX_QUEUES; - - local->workqueue = - alloc_ordered_workqueue(wiphy_name(local->hw.wiphy), 0); - if (!local->workqueue) { - result = -ENOMEM; - goto fail_workqueue; - } - - /* - * The hardware needs headroom for sending the frame, - * and we need some headroom for passing the frame to monitor - * interfaces, but never both at the same time. - */ - local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, - IEEE80211_TX_STATUS_HEADROOM); - - debugfs_hw_add(local); - - /* - * if the driver doesn't specify a max listen interval we - * use 5 which should be a safe default - */ - if (local->hw.max_listen_interval == 0) - local->hw.max_listen_interval = 5; - - local->hw.conf.listen_interval = local->hw.max_listen_interval; - - local->dynamic_ps_forced_timeout = -1; - - result = ieee80211_wep_init(local); - if (result < 0) - wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n", - result); - - ieee80211_led_init(local); - - rtnl_lock(); - - result = ieee80211_init_rate_ctrl_alg(local, - hw->rate_control_algorithm); - if (result < 0) { - wiphy_debug(local->hw.wiphy, - "Failed to initialize rate control algorithm\n"); - goto fail_rate; - } - - /* add one default STA interface if supported */ - if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { - result = ieee80211_if_add(local, "wlan%d", NULL, - NL80211_IFTYPE_STATION, NULL); - if (result) - wiphy_warn(local->hw.wiphy, - "Failed to add default virtual iface\n"); - } - - rtnl_unlock(); - - local->network_latency_notifier.notifier_call = - ieee80211_max_network_latency; - result = pm_qos_add_notifier(PM_QOS_NETWORK_LATENCY, - &local->network_latency_notifier); - if (result) { - rtnl_lock(); - goto fail_pm_qos; - } - -#ifdef CONFIG_INET - local->ifa_notifier.notifier_call = ieee80211_ifa_changed; - result = register_inetaddr_notifier(&local->ifa_notifier); - if (result) - goto fail_ifa; -#endif - - netif_napi_add(&local->napi_dev, &local->napi, ieee80211_napi_poll, - local->hw.napi_weight); - - return 0; - -#ifdef CONFIG_INET - fail_ifa: - pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY, - &local->network_latency_notifier); - rtnl_lock(); -#endif - fail_pm_qos: - ieee80211_led_exit(local); - ieee80211_remove_interfaces(local); - fail_rate: - rtnl_unlock(); - ieee80211_wep_free(local); - sta_info_stop(local); - destroy_workqueue(local->workqueue); - fail_workqueue: - wiphy_unregister(local->hw.wiphy); - fail_wiphy_register: - if (local->wiphy_ciphers_allocated) - kfree(local->hw.wiphy->cipher_suites); - kfree(local->int_scan_req); - return result; -} -EXPORT_SYMBOL(ieee80211_register_hw); - -void ieee80211_unregister_hw(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - tasklet_kill(&local->tx_pending_tasklet); - tasklet_kill(&local->tasklet); - - pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY, - &local->network_latency_notifier); -#ifdef CONFIG_INET - unregister_inetaddr_notifier(&local->ifa_notifier); -#endif - - rtnl_lock(); - - /* - * At this point, interface list manipulations are fine - * because the driver cannot be handing us frames any - * more and the tasklet is killed. - */ - ieee80211_remove_interfaces(local); - - rtnl_unlock(); - - /* - * Now all work items will be gone, but the - * timer might still be armed, so delete it - */ - del_timer_sync(&local->work_timer); - - cancel_work_sync(&local->restart_work); - cancel_work_sync(&local->reconfig_filter); - - ieee80211_clear_tx_pending(local); - rate_control_deinitialize(local); - - if (skb_queue_len(&local->skb_queue) || - skb_queue_len(&local->skb_queue_unreliable)) - wiphy_warn(local->hw.wiphy, "skb_queue not empty\n"); - skb_queue_purge(&local->skb_queue); - skb_queue_purge(&local->skb_queue_unreliable); - skb_queue_purge(&local->rx_skb_queue); - - destroy_workqueue(local->workqueue); - wiphy_unregister(local->hw.wiphy); - sta_info_stop(local); - ieee80211_wep_free(local); - ieee80211_led_exit(local); - kfree(local->int_scan_req); -} -EXPORT_SYMBOL(ieee80211_unregister_hw); - -static int ieee80211_free_ack_frame(int id, void *p, void *data) -{ - WARN_ONCE(1, "Have pending ack frames!\n"); - kfree_skb(p); - return 0; -} - -void ieee80211_free_hw(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - mutex_destroy(&local->iflist_mtx); - mutex_destroy(&local->mtx); - - if (local->wiphy_ciphers_allocated) - kfree(local->hw.wiphy->cipher_suites); - - idr_for_each(&local->ack_status_frames, - ieee80211_free_ack_frame, NULL); - idr_destroy(&local->ack_status_frames); - - wiphy_free(local->hw.wiphy); -} -EXPORT_SYMBOL(ieee80211_free_hw); - -static int __init ieee80211_init(void) -{ - struct sk_buff *skb; - int ret; - - BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb)); - BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) + - IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb)); - - ret = rc80211_minstrel_init(); - if (ret) - return ret; - - ret = rc80211_minstrel_ht_init(); - if (ret) - goto err_minstrel; - - ret = rc80211_pid_init(); - if (ret) - goto err_pid; - - ret = ieee80211_iface_init(); - if (ret) - goto err_netdev; - - return 0; - err_netdev: - rc80211_pid_exit(); - err_pid: - rc80211_minstrel_ht_exit(); - err_minstrel: - rc80211_minstrel_exit(); - - return ret; -} - -static void __exit ieee80211_exit(void) -{ - rc80211_pid_exit(); - rc80211_minstrel_ht_exit(); - rc80211_minstrel_exit(); - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) - flush_scheduled_work(); -#endif - - if (mesh_allocated) - ieee80211s_stop(); - - ieee80211_iface_exit(); - - rcu_barrier(); -} - - -subsys_initcall(ieee80211_init); -module_exit(ieee80211_exit); - -MODULE_DESCRIPTION("IEEE 802.11 subsystem"); -MODULE_LICENSE("GPL"); diff --git a/openairITS/mac/DOT11/net/mac80211/mesh.c b/openairITS/mac/DOT11/net/mac80211/mesh.c deleted file mode 100644 index e5fbb7cf356..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/mesh.c +++ /dev/null @@ -1,764 +0,0 @@ -/* - * Copyright (c) 2008, 2009 open80211s Ltd. - * Authors: Luis Carlos Cobo <luisca@cozybit.com> - * Javier Cardona <javier@cozybit.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/slab.h> -#include <asm/unaligned.h> -#include "ieee80211_i.h" -#include "mesh.h" - -#define MESHCONF_CAPAB_ACCEPT_PLINKS 0x01 -#define MESHCONF_CAPAB_FORWARDING 0x08 - -#define TMR_RUNNING_HK 0 -#define TMR_RUNNING_MP 1 -#define TMR_RUNNING_MPR 2 - -int mesh_allocated; -static struct kmem_cache *rm_cache; - -#ifdef CONFIG_MAC80211_MESH -bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt) -{ - return (mgmt->u.action.u.mesh_action.action_code == - WLAN_MESH_ACTION_HWMP_PATH_SELECTION); -} -#else -bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt) -{ return false; } -#endif - -void ieee80211s_init(void) -{ - mesh_pathtbl_init(); - mesh_allocated = 1; - rm_cache = kmem_cache_create("mesh_rmc", sizeof(struct rmc_entry), - 0, 0, NULL); -} - -void ieee80211s_stop(void) -{ - mesh_pathtbl_unregister(); - kmem_cache_destroy(rm_cache); -} - -static void ieee80211_mesh_housekeeping_timer(unsigned long data) -{ - struct ieee80211_sub_if_data *sdata = (void *) data; - struct ieee80211_local *local = sdata->local; - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - - set_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags); - - if (local->quiescing) { - set_bit(TMR_RUNNING_HK, &ifmsh->timers_running); - return; - } - - ieee80211_queue_work(&local->hw, &sdata->work); -} - -/** - * mesh_matches_local - check if the config of a mesh point matches ours - * - * @ie: information elements of a management frame from the mesh peer - * @sdata: local mesh subif - * - * This function checks if the mesh configuration of a mesh point matches the - * local mesh configuration, i.e. if both nodes belong to the same mesh network. - */ -bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct ieee80211_local *local = sdata->local; - - /* - * As support for each feature is added, check for matching - * - On mesh config capabilities - * - Power Save Support En - * - Sync support enabled - * - Sync support active - * - Sync support required from peer - * - MDA enabled - * - Power management control on fc - */ - if (!(ifmsh->mesh_id_len == ie->mesh_id_len && - memcmp(ifmsh->mesh_id, ie->mesh_id, ie->mesh_id_len) == 0 && - (ifmsh->mesh_pp_id == ie->mesh_config->meshconf_psel) && - (ifmsh->mesh_pm_id == ie->mesh_config->meshconf_pmetric) && - (ifmsh->mesh_cc_id == ie->mesh_config->meshconf_congest) && - (ifmsh->mesh_sp_id == ie->mesh_config->meshconf_synch) && - (ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth))) - goto mismatch; - - /* disallow peering with mismatched channel types for now */ - if (ie->ht_info_elem && - (local->_oper_channel_type != - ieee80211_ht_info_to_channel_type(ie->ht_info_elem))) - goto mismatch; - - return true; -mismatch: - return false; -} - -/** - * mesh_peer_accepts_plinks - check if an mp is willing to establish peer links - * - * @ie: information elements of a management frame from the mesh peer - */ -bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie) -{ - return (ie->mesh_config->meshconf_cap & - MESHCONF_CAPAB_ACCEPT_PLINKS) != 0; -} - -/** - * mesh_accept_plinks_update: update accepting_plink in local mesh beacons - * - * @sdata: mesh interface in which mesh beacons are going to be updated - */ -void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata) -{ - bool free_plinks; - - /* In case mesh_plink_free_count > 0 and mesh_plinktbl_capacity == 0, - * the mesh interface might be able to establish plinks with peers that - * are already on the table but are not on PLINK_ESTAB state. However, - * in general the mesh interface is not accepting peer link requests - * from new peers, and that must be reflected in the beacon - */ - free_plinks = mesh_plink_availables(sdata); - - if (free_plinks != sdata->u.mesh.accepting_plinks) - ieee80211_mesh_housekeeping_timer((unsigned long) sdata); -} - -int mesh_rmc_init(struct ieee80211_sub_if_data *sdata) -{ - int i; - - sdata->u.mesh.rmc = kmalloc(sizeof(struct mesh_rmc), GFP_KERNEL); - if (!sdata->u.mesh.rmc) - return -ENOMEM; - sdata->u.mesh.rmc->idx_mask = RMC_BUCKETS - 1; - for (i = 0; i < RMC_BUCKETS; i++) - INIT_LIST_HEAD(&sdata->u.mesh.rmc->bucket[i].list); - return 0; -} - -void mesh_rmc_free(struct ieee80211_sub_if_data *sdata) -{ - struct mesh_rmc *rmc = sdata->u.mesh.rmc; - struct rmc_entry *p, *n; - int i; - - if (!sdata->u.mesh.rmc) - return; - - for (i = 0; i < RMC_BUCKETS; i++) - list_for_each_entry_safe(p, n, &rmc->bucket[i].list, list) { - list_del(&p->list); - kmem_cache_free(rm_cache, p); - } - - kfree(rmc); - sdata->u.mesh.rmc = NULL; -} - -/** - * mesh_rmc_check - Check frame in recent multicast cache and add if absent. - * - * @sa: source address - * @mesh_hdr: mesh_header - * - * Returns: 0 if the frame is not in the cache, nonzero otherwise. - * - * Checks using the source address and the mesh sequence number if we have - * received this frame lately. If the frame is not in the cache, it is added to - * it. - */ -int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, - struct ieee80211_sub_if_data *sdata) -{ - struct mesh_rmc *rmc = sdata->u.mesh.rmc; - u32 seqnum = 0; - int entries = 0; - u8 idx; - struct rmc_entry *p, *n; - - /* Don't care about endianness since only match matters */ - memcpy(&seqnum, &mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum)); - idx = le32_to_cpu(mesh_hdr->seqnum) & rmc->idx_mask; - list_for_each_entry_safe(p, n, &rmc->bucket[idx].list, list) { - ++entries; - if (time_after(jiffies, p->exp_time) || - (entries == RMC_QUEUE_MAX_LEN)) { - list_del(&p->list); - kmem_cache_free(rm_cache, p); - --entries; - } else if ((seqnum == p->seqnum) && - (compare_ether_addr(sa, p->sa) == 0)) - return -1; - } - - p = kmem_cache_alloc(rm_cache, GFP_ATOMIC); - if (!p) - return 0; - - p->seqnum = seqnum; - p->exp_time = jiffies + RMC_TIMEOUT; - memcpy(p->sa, sa, ETH_ALEN); - list_add(&p->list, &rmc->bucket[idx].list); - return 0; -} - -int -mesh_add_meshconf_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - u8 *pos, neighbors; - u8 meshconf_len = sizeof(struct ieee80211_meshconf_ie); - - if (skb_tailroom(skb) < 2 + meshconf_len) - return -ENOMEM; - - pos = skb_put(skb, 2 + meshconf_len); - *pos++ = WLAN_EID_MESH_CONFIG; - *pos++ = meshconf_len; - - /* Active path selection protocol ID */ - *pos++ = ifmsh->mesh_pp_id; - /* Active path selection metric ID */ - *pos++ = ifmsh->mesh_pm_id; - /* Congestion control mode identifier */ - *pos++ = ifmsh->mesh_cc_id; - /* Synchronization protocol identifier */ - *pos++ = ifmsh->mesh_sp_id; - /* Authentication Protocol identifier */ - *pos++ = ifmsh->mesh_auth_id; - /* Mesh Formation Info - number of neighbors */ - neighbors = atomic_read(&ifmsh->mshstats.estab_plinks); - /* Number of neighbor mesh STAs or 15 whichever is smaller */ - neighbors = (neighbors > 15) ? 15 : neighbors; - *pos++ = neighbors << 1; - /* Mesh capability */ - ifmsh->accepting_plinks = mesh_plink_availables(sdata); - *pos = MESHCONF_CAPAB_FORWARDING; - *pos++ |= ifmsh->accepting_plinks ? - MESHCONF_CAPAB_ACCEPT_PLINKS : 0x00; - *pos++ = 0x00; - - return 0; -} - -int -mesh_add_meshid_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - u8 *pos; - - if (skb_tailroom(skb) < 2 + ifmsh->mesh_id_len) - return -ENOMEM; - - pos = skb_put(skb, 2 + ifmsh->mesh_id_len); - *pos++ = WLAN_EID_MESH_ID; - *pos++ = ifmsh->mesh_id_len; - if (ifmsh->mesh_id_len) - memcpy(pos, ifmsh->mesh_id, ifmsh->mesh_id_len); - - return 0; -} - -int -mesh_add_vendor_ies(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - u8 offset, len; - const u8 *data; - - if (!ifmsh->ie || !ifmsh->ie_len) - return 0; - - /* fast-forward to vendor IEs */ - offset = ieee80211_ie_split_vendor(ifmsh->ie, ifmsh->ie_len, 0); - - if (offset) { - len = ifmsh->ie_len - offset; - data = ifmsh->ie + offset; - if (skb_tailroom(skb) < len) - return -ENOMEM; - memcpy(skb_put(skb, len), data, len); - } - - return 0; -} - -int -mesh_add_rsn_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - u8 len = 0; - const u8 *data; - - if (!ifmsh->ie || !ifmsh->ie_len) - return 0; - - /* find RSN IE */ - data = ifmsh->ie; - while (data < ifmsh->ie + ifmsh->ie_len) { - if (*data == WLAN_EID_RSN) { - len = data[1] + 2; - break; - } - data++; - } - - if (len) { - if (skb_tailroom(skb) < len) - return -ENOMEM; - memcpy(skb_put(skb, len), data, len); - } - - return 0; -} - -int mesh_add_ds_params_ie(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_supported_band *sband; - u8 *pos; - - if (skb_tailroom(skb) < 3) - return -ENOMEM; - - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - if (sband->band == IEEE80211_BAND_2GHZ) { - pos = skb_put(skb, 2 + 1); - *pos++ = WLAN_EID_DS_PARAMS; - *pos++ = 1; - *pos++ = ieee80211_frequency_to_channel(local->hw.conf.channel->center_freq); - } - - return 0; -} - -int mesh_add_ht_cap_ie(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_supported_band *sband; - u8 *pos; - - sband = local->hw.wiphy->bands[local->oper_channel->band]; - if (!sband->ht_cap.ht_supported || - local->_oper_channel_type == NL80211_CHAN_NO_HT) - return 0; - - if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_cap)) - return -ENOMEM; - - pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_cap)); - ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, sband->ht_cap.cap); - - return 0; -} - -int mesh_add_ht_info_ie(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_channel *channel = local->oper_channel; - enum nl80211_channel_type channel_type = local->_oper_channel_type; - struct ieee80211_supported_band *sband = - local->hw.wiphy->bands[channel->band]; - struct ieee80211_sta_ht_cap *ht_cap = &sband->ht_cap; - u8 *pos; - - if (!ht_cap->ht_supported || channel_type == NL80211_CHAN_NO_HT) - return 0; - - if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_ht_info)) - return -ENOMEM; - - pos = skb_put(skb, 2 + sizeof(struct ieee80211_ht_info)); - ieee80211_ie_build_ht_info(pos, ht_cap, channel, channel_type); - - return 0; -} -static void ieee80211_mesh_path_timer(unsigned long data) -{ - struct ieee80211_sub_if_data *sdata = - (struct ieee80211_sub_if_data *) data; - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct ieee80211_local *local = sdata->local; - - if (local->quiescing) { - set_bit(TMR_RUNNING_MP, &ifmsh->timers_running); - return; - } - - ieee80211_queue_work(&local->hw, &sdata->work); -} - -static void ieee80211_mesh_path_root_timer(unsigned long data) -{ - struct ieee80211_sub_if_data *sdata = - (struct ieee80211_sub_if_data *) data; - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct ieee80211_local *local = sdata->local; - - set_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags); - - if (local->quiescing) { - set_bit(TMR_RUNNING_MPR, &ifmsh->timers_running); - return; - } - - ieee80211_queue_work(&local->hw, &sdata->work); -} - -void ieee80211_mesh_root_setup(struct ieee80211_if_mesh *ifmsh) -{ - if (ifmsh->mshcfg.dot11MeshHWMPRootMode) - set_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags); - else { - clear_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags); - /* stop running timer */ - del_timer_sync(&ifmsh->mesh_path_root_timer); - } -} - -/** - * ieee80211_fill_mesh_addresses - fill addresses of a locally originated mesh frame - * @hdr: 802.11 frame header - * @fc: frame control field - * @meshda: destination address in the mesh - * @meshsa: source address address in the mesh. Same as TA, as frame is - * locally originated. - * - * Return the length of the 802.11 (does not include a mesh control header) - */ -int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc, - const u8 *meshda, const u8 *meshsa) -{ - if (is_multicast_ether_addr(meshda)) { - *fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); - /* DA TA SA */ - memcpy(hdr->addr1, meshda, ETH_ALEN); - memcpy(hdr->addr2, meshsa, ETH_ALEN); - memcpy(hdr->addr3, meshsa, ETH_ALEN); - return 24; - } else { - *fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); - /* RA TA DA SA */ - memset(hdr->addr1, 0, ETH_ALEN); /* RA is resolved later */ - memcpy(hdr->addr2, meshsa, ETH_ALEN); - memcpy(hdr->addr3, meshda, ETH_ALEN); - memcpy(hdr->addr4, meshsa, ETH_ALEN); - return 30; - } -} - -/** - * ieee80211_new_mesh_header - create a new mesh header - * @meshhdr: uninitialized mesh header - * @sdata: mesh interface to be used - * @addr4or5: 1st address in the ae header, which may correspond to address 4 - * (if addr6 is NULL) or address 5 (if addr6 is present). It may - * be NULL. - * @addr6: 2nd address in the ae header, which corresponds to addr6 of the - * mesh frame - * - * Return the header length. - */ -int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr, - struct ieee80211_sub_if_data *sdata, char *addr4or5, - char *addr6) -{ - int aelen = 0; - BUG_ON(!addr4or5 && addr6); - memset(meshhdr, 0, sizeof(*meshhdr)); - meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL; - put_unaligned(cpu_to_le32(sdata->u.mesh.mesh_seqnum), &meshhdr->seqnum); - sdata->u.mesh.mesh_seqnum++; - if (addr4or5 && !addr6) { - meshhdr->flags |= MESH_FLAGS_AE_A4; - aelen += ETH_ALEN; - memcpy(meshhdr->eaddr1, addr4or5, ETH_ALEN); - } else if (addr4or5 && addr6) { - meshhdr->flags |= MESH_FLAGS_AE_A5_A6; - aelen += 2 * ETH_ALEN; - memcpy(meshhdr->eaddr1, addr4or5, ETH_ALEN); - memcpy(meshhdr->eaddr2, addr6, ETH_ALEN); - } - return 6 + aelen; -} - -static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata, - struct ieee80211_if_mesh *ifmsh) -{ - bool free_plinks; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "%s: running mesh housekeeping\n", - sdata->name); -#endif - - ieee80211_sta_expire(sdata, IEEE80211_MESH_PEER_INACTIVITY_LIMIT); - mesh_path_expire(sdata); - - free_plinks = mesh_plink_availables(sdata); - if (free_plinks != sdata->u.mesh.accepting_plinks) - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON); - - mod_timer(&ifmsh->housekeeping_timer, - round_jiffies(jiffies + IEEE80211_MESH_HOUSEKEEPING_INTERVAL)); -} - -static void ieee80211_mesh_rootpath(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - - mesh_path_tx_root_frame(sdata); - mod_timer(&ifmsh->mesh_path_root_timer, - round_jiffies(TU_TO_EXP_TIME( - ifmsh->mshcfg.dot11MeshHWMPRannInterval))); -} - -#ifdef CONFIG_PM -void ieee80211_mesh_quiesce(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - - /* use atomic bitops in case all timers fire at the same time */ - - if (del_timer_sync(&ifmsh->housekeeping_timer)) - set_bit(TMR_RUNNING_HK, &ifmsh->timers_running); - if (del_timer_sync(&ifmsh->mesh_path_timer)) - set_bit(TMR_RUNNING_MP, &ifmsh->timers_running); - if (del_timer_sync(&ifmsh->mesh_path_root_timer)) - set_bit(TMR_RUNNING_MPR, &ifmsh->timers_running); -} - -void ieee80211_mesh_restart(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - - if (test_and_clear_bit(TMR_RUNNING_HK, &ifmsh->timers_running)) - add_timer(&ifmsh->housekeeping_timer); - if (test_and_clear_bit(TMR_RUNNING_MP, &ifmsh->timers_running)) - add_timer(&ifmsh->mesh_path_timer); - if (test_and_clear_bit(TMR_RUNNING_MPR, &ifmsh->timers_running)) - add_timer(&ifmsh->mesh_path_root_timer); - ieee80211_mesh_root_setup(ifmsh); -} -#endif - -void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct ieee80211_local *local = sdata->local; - - local->fif_other_bss++; - /* mesh ifaces must set allmulti to forward mcast traffic */ - atomic_inc(&local->iff_allmultis); - ieee80211_configure_filter(local); - - ifmsh->mesh_cc_id = 0; /* Disabled */ - ifmsh->mesh_sp_id = 0; /* Neighbor Offset */ - ifmsh->mesh_auth_id = 0; /* Disabled */ - set_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags); - ieee80211_mesh_root_setup(ifmsh); - ieee80211_queue_work(&local->hw, &sdata->work); - sdata->vif.bss_conf.beacon_int = MESH_DEFAULT_BEACON_INTERVAL; - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON | - BSS_CHANGED_BEACON_ENABLED | - BSS_CHANGED_BEACON_INT); -} - -void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - - ifmsh->mesh_id_len = 0; - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); - sta_info_flush(local, NULL); - - del_timer_sync(&sdata->u.mesh.housekeeping_timer); - del_timer_sync(&sdata->u.mesh.mesh_path_root_timer); - /* - * If the timer fired while we waited for it, it will have - * requeued the work. Now the work will be running again - * but will not rearm the timer again because it checks - * whether the interface is running, which, at this point, - * it no longer is. - */ - cancel_work_sync(&sdata->work); - - local->fif_other_bss--; - atomic_dec(&local->iff_allmultis); - ieee80211_configure_filter(local); -} - -static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, - u16 stype, - struct ieee80211_mgmt *mgmt, - size_t len, - struct ieee80211_rx_status *rx_status) -{ - struct ieee80211_local *local = sdata->local; - struct ieee802_11_elems elems; - struct ieee80211_channel *channel; - u32 supp_rates = 0; - size_t baselen; - int freq; - enum ieee80211_band band = rx_status->band; - - /* ignore ProbeResp to foreign address */ - if (stype == IEEE80211_STYPE_PROBE_RESP && - compare_ether_addr(mgmt->da, sdata->vif.addr)) - return; - - baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; - if (baselen > len) - return; - - ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen, - &elems); - - /* ignore beacons from secure mesh peers if our security is off */ - if (elems.rsn_len && sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) - return; - - if (elems.ds_params && elems.ds_params_len == 1) - freq = ieee80211_channel_to_frequency(elems.ds_params[0], band); - else - freq = rx_status->freq; - - channel = ieee80211_get_channel(local->hw.wiphy, freq); - - if (!channel || channel->flags & IEEE80211_CHAN_DISABLED) - return; - - if (elems.mesh_id && elems.mesh_config && - mesh_matches_local(&elems, sdata)) { - supp_rates = ieee80211_sta_get_rates(local, &elems, band); - mesh_neighbour_update(mgmt->sa, supp_rates, sdata, &elems); - } -} - -static void ieee80211_mesh_rx_mgmt_action(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - size_t len, - struct ieee80211_rx_status *rx_status) -{ - switch (mgmt->u.action.category) { - case WLAN_CATEGORY_SELF_PROTECTED: - switch (mgmt->u.action.u.self_prot.action_code) { - case WLAN_SP_MESH_PEERING_OPEN: - case WLAN_SP_MESH_PEERING_CLOSE: - case WLAN_SP_MESH_PEERING_CONFIRM: - mesh_rx_plink_frame(sdata, mgmt, len, rx_status); - break; - } - break; - case WLAN_CATEGORY_MESH_ACTION: - if (mesh_action_is_path_sel(mgmt)) - mesh_rx_path_sel_frame(sdata, mgmt, len); - break; - } -} - -void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb) -{ - struct ieee80211_rx_status *rx_status; - struct ieee80211_mgmt *mgmt; - u16 stype; - - rx_status = IEEE80211_SKB_RXCB(skb); - mgmt = (struct ieee80211_mgmt *) skb->data; - stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE; - - switch (stype) { - case IEEE80211_STYPE_PROBE_RESP: - case IEEE80211_STYPE_BEACON: - ieee80211_mesh_rx_bcn_presp(sdata, stype, mgmt, skb->len, - rx_status); - break; - case IEEE80211_STYPE_ACTION: - ieee80211_mesh_rx_mgmt_action(sdata, mgmt, skb->len, rx_status); - break; - } -} - -void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - - if (ifmsh->preq_queue_len && - time_after(jiffies, - ifmsh->last_preq + msecs_to_jiffies(ifmsh->mshcfg.dot11MeshHWMPpreqMinInterval))) - mesh_path_start_discovery(sdata); - - if (test_and_clear_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags)) - mesh_mpath_table_grow(); - - if (test_and_clear_bit(MESH_WORK_GROW_MPP_TABLE, &ifmsh->wrkq_flags)) - mesh_mpp_table_grow(); - - if (test_and_clear_bit(MESH_WORK_HOUSEKEEPING, &ifmsh->wrkq_flags)) - ieee80211_mesh_housekeeping(sdata, ifmsh); - - if (test_and_clear_bit(MESH_WORK_ROOT, &ifmsh->wrkq_flags)) - ieee80211_mesh_rootpath(sdata); -} - -void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) -{ - struct ieee80211_sub_if_data *sdata; - - rcu_read_lock(); - list_for_each_entry_rcu(sdata, &local->interfaces, list) - if (ieee80211_vif_is_mesh(&sdata->vif)) - ieee80211_queue_work(&local->hw, &sdata->work); - rcu_read_unlock(); -} - -void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - - setup_timer(&ifmsh->housekeeping_timer, - ieee80211_mesh_housekeeping_timer, - (unsigned long) sdata); - - ifmsh->accepting_plinks = true; - ifmsh->preq_id = 0; - ifmsh->sn = 0; - ifmsh->num_gates = 0; - atomic_set(&ifmsh->mpaths, 0); - mesh_rmc_init(sdata); - ifmsh->last_preq = jiffies; - ifmsh->next_perr = jiffies; - /* Allocate all mesh structures when creating the first mesh interface. */ - if (!mesh_allocated) - ieee80211s_init(); - setup_timer(&ifmsh->mesh_path_timer, - ieee80211_mesh_path_timer, - (unsigned long) sdata); - setup_timer(&ifmsh->mesh_path_root_timer, - ieee80211_mesh_path_root_timer, - (unsigned long) sdata); - INIT_LIST_HEAD(&ifmsh->preq_queue.list); - spin_lock_init(&ifmsh->mesh_preq_queue_lock); -} diff --git a/openairITS/mac/DOT11/net/mac80211/mesh.h b/openairITS/mac/DOT11/net/mac80211/mesh.h deleted file mode 100644 index 8d53b71378e..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/mesh.h +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Copyright (c) 2008, 2009 open80211s Ltd. - * Authors: Luis Carlos Cobo <luisca@cozybit.com> - * Javier Cardona <javier@cozybit.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef IEEE80211S_H -#define IEEE80211S_H - -#include <linux/types.h> -#include <linux/jhash.h> -#include "ieee80211_i.h" - - -/* Data structures */ - -/** - * enum mesh_path_flags - mac80211 mesh path flags - * - * - * - * @MESH_PATH_ACTIVE: the mesh path can be used for forwarding - * @MESH_PATH_RESOLVING: the discovery process is running for this mesh path - * @MESH_PATH_SN_VALID: the mesh path contains a valid destination sequence - * number - * @MESH_PATH_FIXED: the mesh path has been manually set and should not be - * modified - * @MESH_PATH_RESOLVED: the mesh path can has been resolved - * @MESH_PATH_REQ_QUEUED: there is an unsent path request for this destination - * already queued up, waiting for the discovery process to start. - * - * MESH_PATH_RESOLVED is used by the mesh path timer to - * decide when to stop or cancel the mesh path discovery. - */ -enum mesh_path_flags { - MESH_PATH_ACTIVE = BIT(0), - MESH_PATH_RESOLVING = BIT(1), - MESH_PATH_SN_VALID = BIT(2), - MESH_PATH_FIXED = BIT(3), - MESH_PATH_RESOLVED = BIT(4), - MESH_PATH_REQ_QUEUED = BIT(5), -}; - -/** - * enum mesh_deferred_task_flags - mac80211 mesh deferred tasks - * - * - * - * @MESH_WORK_HOUSEKEEPING: run the periodic mesh housekeeping tasks - * @MESH_WORK_GROW_MPATH_TABLE: the mesh path table is full and needs - * to grow. - * @MESH_WORK_GROW_MPP_TABLE: the mesh portals table is full and needs to - * grow - * @MESH_WORK_ROOT: the mesh root station needs to send a frame - */ -enum mesh_deferred_task_flags { - MESH_WORK_HOUSEKEEPING, - MESH_WORK_GROW_MPATH_TABLE, - MESH_WORK_GROW_MPP_TABLE, - MESH_WORK_ROOT, -}; - -/** - * struct mesh_path - mac80211 mesh path structure - * - * @dst: mesh path destination mac address - * @sdata: mesh subif - * @next_hop: mesh neighbor to which frames for this destination will be - * forwarded - * @timer: mesh path discovery timer - * @frame_queue: pending queue for frames sent to this destination while the - * path is unresolved - * @sn: target sequence number - * @metric: current metric to this destination - * @hop_count: hops to destination - * @exp_time: in jiffies, when the path will expire or when it expired - * @discovery_timeout: timeout (lapse in jiffies) used for the last discovery - * retry - * @discovery_retries: number of discovery retries - * @flags: mesh path flags, as specified on &enum mesh_path_flags - * @state_lock: mesh path state lock used to protect changes to the - * mpath itself. No need to take this lock when adding or removing - * an mpath to a hash bucket on a path table. - * @rann_snd_addr: the RANN sender address - * @is_root: the destination station of this path is a root node - * @is_gate: the destination station of this path is a mesh gate - * - * - * The combination of dst and sdata is unique in the mesh path table. Since the - * next_hop STA is only protected by RCU as well, deleting the STA must also - * remove/substitute the mesh_path structure and wait until that is no longer - * reachable before destroying the STA completely. - */ -struct mesh_path { - u8 dst[ETH_ALEN]; - u8 mpp[ETH_ALEN]; /* used for MPP or MAP */ - struct ieee80211_sub_if_data *sdata; - struct sta_info __rcu *next_hop; - struct timer_list timer; - struct sk_buff_head frame_queue; - struct rcu_head rcu; - u32 sn; - u32 metric; - u8 hop_count; - unsigned long exp_time; - u32 discovery_timeout; - u8 discovery_retries; - enum mesh_path_flags flags; - spinlock_t state_lock; - u8 rann_snd_addr[ETH_ALEN]; - bool is_root; - bool is_gate; -}; - -/** - * struct mesh_table - * - * @hash_buckets: array of hash buckets of the table - * @hashwlock: array of locks to protect write operations, one per bucket - * @hash_mask: 2^size_order - 1, used to compute hash idx - * @hash_rnd: random value used for hash computations - * @entries: number of entries in the table - * @free_node: function to free nodes of the table - * @copy_node: function to copy nodes of the table - * @size_order: determines size of the table, there will be 2^size_order hash - * buckets - * @mean_chain_len: maximum average length for the hash buckets' list, if it is - * reached, the table will grow - * @known_gates: list of known mesh gates and their mpaths by the station. The - * gate's mpath may or may not be resolved and active. - * - * rcu_head: RCU head to free the table - */ -struct mesh_table { - /* Number of buckets will be 2^N */ - struct hlist_head *hash_buckets; - spinlock_t *hashwlock; /* One per bucket, for add/del */ - unsigned int hash_mask; /* (2^size_order) - 1 */ - __u32 hash_rnd; /* Used for hash generation */ - atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */ - void (*free_node) (struct hlist_node *p, bool free_leafs); - int (*copy_node) (struct hlist_node *p, struct mesh_table *newtbl); - int size_order; - int mean_chain_len; - struct hlist_head *known_gates; - spinlock_t gates_lock; - - struct rcu_head rcu_head; -}; - -/* Recent multicast cache */ -/* RMC_BUCKETS must be a power of 2, maximum 256 */ -#define RMC_BUCKETS 256 -#define RMC_QUEUE_MAX_LEN 4 -#define RMC_TIMEOUT (3 * HZ) - -/** - * struct rmc_entry - entry in the Recent Multicast Cache - * - * @seqnum: mesh sequence number of the frame - * @exp_time: expiration time of the entry, in jiffies - * @sa: source address of the frame - * - * The Recent Multicast Cache keeps track of the latest multicast frames that - * have been received by a mesh interface and discards received multicast frames - * that are found in the cache. - */ -struct rmc_entry { - struct list_head list; - u32 seqnum; - unsigned long exp_time; - u8 sa[ETH_ALEN]; -}; - -struct mesh_rmc { - struct rmc_entry bucket[RMC_BUCKETS]; - u32 idx_mask; -}; - -#define IEEE80211_MESH_PEER_INACTIVITY_LIMIT (1800 * HZ) -#define IEEE80211_MESH_HOUSEKEEPING_INTERVAL (60 * HZ) - -#define MESH_DEFAULT_BEACON_INTERVAL 1000 /* in 1024 us units */ - -#define MESH_PATH_EXPIRE (600 * HZ) - -/* Default maximum number of plinks per interface */ -#define MESH_MAX_PLINKS 256 - -/* Maximum number of paths per interface */ -#define MESH_MAX_MPATHS 1024 - -/* Public interfaces */ -/* Various */ -int ieee80211_fill_mesh_addresses(struct ieee80211_hdr *hdr, __le16 *fc, - const u8 *da, const u8 *sa); -int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr, - struct ieee80211_sub_if_data *sdata, char *addr4or5, - char *addr6); -int mesh_rmc_check(u8 *addr, struct ieee80211s_hdr *mesh_hdr, - struct ieee80211_sub_if_data *sdata); -bool mesh_matches_local(struct ieee802_11_elems *ie, - struct ieee80211_sub_if_data *sdata); -void mesh_ids_set_default(struct ieee80211_if_mesh *mesh); -void mesh_mgmt_ies_add(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata); -int mesh_add_meshconf_ie(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata); -int mesh_add_meshid_ie(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata); -int mesh_add_rsn_ie(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata); -int mesh_add_vendor_ies(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata); -int mesh_add_ds_params_ie(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata); -int mesh_add_ht_cap_ie(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata); -int mesh_add_ht_info_ie(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata); -void mesh_rmc_free(struct ieee80211_sub_if_data *sdata); -int mesh_rmc_init(struct ieee80211_sub_if_data *sdata); -void ieee80211s_init(void); -void ieee80211s_update_metric(struct ieee80211_local *local, - struct sta_info *stainfo, struct sk_buff *skb); -void ieee80211s_stop(void); -void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata); -void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata); -void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata); -void ieee80211_mesh_root_setup(struct ieee80211_if_mesh *ifmsh); - -/* Mesh paths */ -int mesh_nexthop_lookup(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata); -int mesh_nexthop_resolve(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata); -void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata); -struct mesh_path *mesh_path_lookup(u8 *dst, - struct ieee80211_sub_if_data *sdata); -struct mesh_path *mpp_path_lookup(u8 *dst, - struct ieee80211_sub_if_data *sdata); -int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata); -struct mesh_path *mesh_path_lookup_by_idx(int idx, - struct ieee80211_sub_if_data *sdata); -void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop); -void mesh_path_expire(struct ieee80211_sub_if_data *sdata); -void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, size_t len); -int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata); - -int mesh_path_add_gate(struct mesh_path *mpath); -int mesh_path_send_to_gates(struct mesh_path *mpath); -int mesh_gate_num(struct ieee80211_sub_if_data *sdata); -/* Mesh plinks */ -void mesh_neighbour_update(u8 *hw_addr, u32 rates, - struct ieee80211_sub_if_data *sdata, - struct ieee802_11_elems *ie); -bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie); -void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata); -void mesh_plink_broken(struct sta_info *sta); -void mesh_plink_deactivate(struct sta_info *sta); -int mesh_plink_open(struct sta_info *sta); -void mesh_plink_block(struct sta_info *sta); -void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, size_t len, - struct ieee80211_rx_status *rx_status); - -/* Private interfaces */ -/* Mesh tables */ -void mesh_mpath_table_grow(void); -void mesh_mpp_table_grow(void); -/* Mesh paths */ -int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn, __le16 target_rcode, - const u8 *ra, struct ieee80211_sub_if_data *sdata); -void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta); -void mesh_path_flush_pending(struct mesh_path *mpath); -void mesh_path_tx_pending(struct mesh_path *mpath); -int mesh_pathtbl_init(void); -void mesh_pathtbl_unregister(void); -int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata); -void mesh_path_timer(unsigned long data); -void mesh_path_flush_by_nexthop(struct sta_info *sta); -void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata); -void mesh_path_discard_frame(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata); -void mesh_path_quiesce(struct ieee80211_sub_if_data *sdata); -void mesh_path_restart(struct ieee80211_sub_if_data *sdata); -void mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata); - -bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt); -extern int mesh_paths_generation; - -#ifdef CONFIG_MAC80211_MESH -extern int mesh_allocated; - -static inline int mesh_plink_free_count(struct ieee80211_sub_if_data *sdata) -{ - return sdata->u.mesh.mshcfg.dot11MeshMaxPeerLinks - - atomic_read(&sdata->u.mesh.mshstats.estab_plinks); -} - -static inline bool mesh_plink_availables(struct ieee80211_sub_if_data *sdata) -{ - return (min_t(long, mesh_plink_free_count(sdata), - MESH_MAX_PLINKS - sdata->local->num_sta)) > 0; -} - -static inline void mesh_path_activate(struct mesh_path *mpath) -{ - mpath->flags |= MESH_PATH_ACTIVE | MESH_PATH_RESOLVED; -} - -static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata) -{ - return sdata->u.mesh.mesh_pp_id == IEEE80211_PATH_PROTOCOL_HWMP; -} - -void ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local); - -void ieee80211_mesh_quiesce(struct ieee80211_sub_if_data *sdata); -void ieee80211_mesh_restart(struct ieee80211_sub_if_data *sdata); -void mesh_plink_quiesce(struct sta_info *sta); -void mesh_plink_restart(struct sta_info *sta); -#else -#define mesh_allocated 0 -static inline void -ieee80211_mesh_notify_scan_completed(struct ieee80211_local *local) {} -static inline void ieee80211_mesh_quiesce(struct ieee80211_sub_if_data *sdata) -{} -static inline void ieee80211_mesh_restart(struct ieee80211_sub_if_data *sdata) -{} -static inline void mesh_plink_quiesce(struct sta_info *sta) {} -static inline void mesh_plink_restart(struct sta_info *sta) {} -static inline bool mesh_path_sel_is_hwmp(struct ieee80211_sub_if_data *sdata) -{ return false; } -#endif - -#endif /* IEEE80211S_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/mesh_hwmp.c b/openairITS/mac/DOT11/net/mac80211/mesh_hwmp.c deleted file mode 100644 index 1c6f3d02aeb..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/mesh_hwmp.c +++ /dev/null @@ -1,1153 +0,0 @@ -/* - * Copyright (c) 2008, 2009 open80211s Ltd. - * Author: Luis Carlos Cobo <luisca@cozybit.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/slab.h> -#include <linux/etherdevice.h> -#include <asm/unaligned.h> -#include "wme.h" -#include "mesh.h" - -#ifdef CONFIG_MAC80211_VERBOSE_MHWMP_DEBUG -#define mhwmp_dbg(fmt, args...) \ - printk(KERN_DEBUG "Mesh HWMP (%s): " fmt "\n", sdata->name, ##args) -#else -#define mhwmp_dbg(fmt, args...) do { (void)(0); } while (0) -#endif - -#define TEST_FRAME_LEN 8192 -#define MAX_METRIC 0xffffffff -#define ARITH_SHIFT 8 - -/* Number of frames buffered per destination for unresolved destinations */ -#define MESH_FRAME_QUEUE_LEN 10 -#define MAX_PREQ_QUEUE_LEN 64 - -/* Destination only */ -#define MP_F_DO 0x1 -/* Reply and forward */ -#define MP_F_RF 0x2 -/* Unknown Sequence Number */ -#define MP_F_USN 0x01 -/* Reason code Present */ -#define MP_F_RCODE 0x02 - -static void mesh_queue_preq(struct mesh_path *, u8); - -static inline u32 u32_field_get(u8 *preq_elem, int offset, bool ae) -{ - if (ae) - offset += 6; - return get_unaligned_le32(preq_elem + offset); -} - -static inline u32 u16_field_get(u8 *preq_elem, int offset, bool ae) -{ - if (ae) - offset += 6; - return get_unaligned_le16(preq_elem + offset); -} - -/* HWMP IE processing macros */ -#define AE_F (1<<6) -#define AE_F_SET(x) (*x & AE_F) -#define PREQ_IE_FLAGS(x) (*(x)) -#define PREQ_IE_HOPCOUNT(x) (*(x + 1)) -#define PREQ_IE_TTL(x) (*(x + 2)) -#define PREQ_IE_PREQ_ID(x) u32_field_get(x, 3, 0) -#define PREQ_IE_ORIG_ADDR(x) (x + 7) -#define PREQ_IE_ORIG_SN(x) u32_field_get(x, 13, 0) -#define PREQ_IE_LIFETIME(x) u32_field_get(x, 17, AE_F_SET(x)) -#define PREQ_IE_METRIC(x) u32_field_get(x, 21, AE_F_SET(x)) -#define PREQ_IE_TARGET_F(x) (*(AE_F_SET(x) ? x + 32 : x + 26)) -#define PREQ_IE_TARGET_ADDR(x) (AE_F_SET(x) ? x + 33 : x + 27) -#define PREQ_IE_TARGET_SN(x) u32_field_get(x, 33, AE_F_SET(x)) - - -#define PREP_IE_FLAGS(x) PREQ_IE_FLAGS(x) -#define PREP_IE_HOPCOUNT(x) PREQ_IE_HOPCOUNT(x) -#define PREP_IE_TTL(x) PREQ_IE_TTL(x) -#define PREP_IE_ORIG_ADDR(x) (AE_F_SET(x) ? x + 27 : x + 21) -#define PREP_IE_ORIG_SN(x) u32_field_get(x, 27, AE_F_SET(x)) -#define PREP_IE_LIFETIME(x) u32_field_get(x, 13, AE_F_SET(x)) -#define PREP_IE_METRIC(x) u32_field_get(x, 17, AE_F_SET(x)) -#define PREP_IE_TARGET_ADDR(x) (x + 3) -#define PREP_IE_TARGET_SN(x) u32_field_get(x, 9, 0) - -#define PERR_IE_TTL(x) (*(x)) -#define PERR_IE_TARGET_FLAGS(x) (*(x + 2)) -#define PERR_IE_TARGET_ADDR(x) (x + 3) -#define PERR_IE_TARGET_SN(x) u32_field_get(x, 9, 0) -#define PERR_IE_TARGET_RCODE(x) u16_field_get(x, 13, 0) - -#define MSEC_TO_TU(x) (x*1000/1024) -#define SN_GT(x, y) ((long) (y) - (long) (x) < 0) -#define SN_LT(x, y) ((long) (x) - (long) (y) < 0) - -#define net_traversal_jiffies(s) \ - msecs_to_jiffies(s->u.mesh.mshcfg.dot11MeshHWMPnetDiameterTraversalTime) -#define default_lifetime(s) \ - MSEC_TO_TU(s->u.mesh.mshcfg.dot11MeshHWMPactivePathTimeout) -#define min_preq_int_jiff(s) \ - (msecs_to_jiffies(s->u.mesh.mshcfg.dot11MeshHWMPpreqMinInterval)) -#define max_preq_retries(s) (s->u.mesh.mshcfg.dot11MeshHWMPmaxPREQretries) -#define disc_timeout_jiff(s) \ - msecs_to_jiffies(sdata->u.mesh.mshcfg.min_discovery_timeout) - -enum mpath_frame_type { - MPATH_PREQ = 0, - MPATH_PREP, - MPATH_PERR, - MPATH_RANN -}; - -static const u8 broadcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - -static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags, - u8 *orig_addr, __le32 orig_sn, u8 target_flags, u8 *target, - __le32 target_sn, const u8 *da, u8 hop_count, u8 ttl, - __le32 lifetime, __le32 metric, __le32 preq_id, - struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - u8 *pos, ie_len; - int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.mesh_action) + - sizeof(mgmt->u.action.u.mesh_action); - - skb = dev_alloc_skb(local->tx_headroom + - hdr_len + - 2 + 37); /* max HWMP IE */ - if (!skb) - return -1; - skb_reserve(skb, local->tx_headroom); - mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); - memset(mgmt, 0, hdr_len); - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - - memcpy(mgmt->da, da, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - /* BSSID == SA */ - memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); - mgmt->u.action.category = WLAN_CATEGORY_MESH_ACTION; - mgmt->u.action.u.mesh_action.action_code = - WLAN_MESH_ACTION_HWMP_PATH_SELECTION; - - switch (action) { - case MPATH_PREQ: - mhwmp_dbg("sending PREQ to %pM", target); - ie_len = 37; - pos = skb_put(skb, 2 + ie_len); - *pos++ = WLAN_EID_PREQ; - break; - case MPATH_PREP: - mhwmp_dbg("sending PREP to %pM", target); - ie_len = 31; - pos = skb_put(skb, 2 + ie_len); - *pos++ = WLAN_EID_PREP; - break; - case MPATH_RANN: - mhwmp_dbg("sending RANN from %pM", orig_addr); - ie_len = sizeof(struct ieee80211_rann_ie); - pos = skb_put(skb, 2 + ie_len); - *pos++ = WLAN_EID_RANN; - break; - default: - kfree_skb(skb); - return -ENOTSUPP; - break; - } - *pos++ = ie_len; - *pos++ = flags; - *pos++ = hop_count; - *pos++ = ttl; - if (action == MPATH_PREP) { - memcpy(pos, target, ETH_ALEN); - pos += ETH_ALEN; - memcpy(pos, &target_sn, 4); - pos += 4; - } else { - if (action == MPATH_PREQ) { - memcpy(pos, &preq_id, 4); - pos += 4; - } - memcpy(pos, orig_addr, ETH_ALEN); - pos += ETH_ALEN; - memcpy(pos, &orig_sn, 4); - pos += 4; - } - memcpy(pos, &lifetime, 4); /* interval for RANN */ - pos += 4; - memcpy(pos, &metric, 4); - pos += 4; - if (action == MPATH_PREQ) { - *pos++ = 1; /* destination count */ - *pos++ = target_flags; - memcpy(pos, target, ETH_ALEN); - pos += ETH_ALEN; - memcpy(pos, &target_sn, 4); - pos += 4; - } else if (action == MPATH_PREP) { - memcpy(pos, orig_addr, ETH_ALEN); - pos += ETH_ALEN; - memcpy(pos, &orig_sn, 4); - pos += 4; - } - - ieee80211_tx_skb(sdata, skb); - return 0; -} - - -/* Headroom is not adjusted. Caller should ensure that skb has sufficient - * headroom in case the frame is encrypted. */ -static void prepare_frame_for_deferred_tx(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - skb_set_mac_header(skb, 0); - skb_set_network_header(skb, 0); - skb_set_transport_header(skb, 0); - - /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */ - skb_set_queue_mapping(skb, IEEE80211_AC_VO); - skb->priority = 7; - - info->control.vif = &sdata->vif; - ieee80211_set_qos_hdr(sdata, skb); -} - -/** - * mesh_send_path error - Sends a PERR mesh management frame - * - * @target: broken destination - * @target_sn: SN of the broken destination - * @target_rcode: reason code for this PERR - * @ra: node this frame is addressed to - * - * Note: This function may be called with driver locks taken that the driver - * also acquires in the TX path. To avoid a deadlock we don't transmit the - * frame directly but add it to the pending queue instead. - */ -int mesh_path_error_tx(u8 ttl, u8 *target, __le32 target_sn, - __le16 target_rcode, const u8 *ra, - struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct ieee80211_mgmt *mgmt; - u8 *pos, ie_len; - int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.mesh_action) + - sizeof(mgmt->u.action.u.mesh_action); - - if (time_before(jiffies, ifmsh->next_perr)) - return -EAGAIN; - - skb = dev_alloc_skb(local->tx_headroom + - hdr_len + - 2 + 15 /* PERR IE */); - if (!skb) - return -1; - skb_reserve(skb, local->tx_headroom); - mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); - memset(mgmt, 0, hdr_len); - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - - memcpy(mgmt->da, ra, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - /* BSSID == SA */ - memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); - mgmt->u.action.category = WLAN_CATEGORY_MESH_ACTION; - mgmt->u.action.u.mesh_action.action_code = - WLAN_MESH_ACTION_HWMP_PATH_SELECTION; - ie_len = 15; - pos = skb_put(skb, 2 + ie_len); - *pos++ = WLAN_EID_PERR; - *pos++ = ie_len; - /* ttl */ - *pos++ = ttl; - /* number of destinations */ - *pos++ = 1; - /* - * flags bit, bit 1 is unset if we know the sequence number and - * bit 2 is set if we have a reason code - */ - *pos = 0; - if (!target_sn) - *pos |= MP_F_USN; - if (target_rcode) - *pos |= MP_F_RCODE; - pos++; - memcpy(pos, target, ETH_ALEN); - pos += ETH_ALEN; - memcpy(pos, &target_sn, 4); - pos += 4; - memcpy(pos, &target_rcode, 2); - - /* see note in function header */ - prepare_frame_for_deferred_tx(sdata, skb); - ifmsh->next_perr = TU_TO_EXP_TIME( - ifmsh->mshcfg.dot11MeshHWMPperrMinInterval); - ieee80211_add_pending_skb(local, skb); - return 0; -} - -void ieee80211s_update_metric(struct ieee80211_local *local, - struct sta_info *stainfo, struct sk_buff *skb) -{ - struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - int failed; - - if (!ieee80211_is_data(hdr->frame_control)) - return; - - failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK); - - /* moving average, scaled to 100 */ - stainfo->fail_avg = ((80 * stainfo->fail_avg + 5) / 100 + 20 * failed); - if (stainfo->fail_avg > 95) - mesh_plink_broken(stainfo); -} - -static u32 airtime_link_metric_get(struct ieee80211_local *local, - struct sta_info *sta) -{ - struct ieee80211_supported_band *sband; - struct rate_info rinfo; - /* This should be adjusted for each device */ - int device_constant = 1 << ARITH_SHIFT; - int test_frame_len = TEST_FRAME_LEN << ARITH_SHIFT; - int s_unit = 1 << ARITH_SHIFT; - int rate, err; - u32 tx_time, estimated_retx; - u64 result; - - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - - if (sta->fail_avg >= 100) - return MAX_METRIC; - - sta_set_rate_info_tx(sta, &sta->last_tx_rate, &rinfo); - rate = cfg80211_calculate_bitrate(&rinfo); - if (WARN_ON(!rate)) - return MAX_METRIC; - - err = (sta->fail_avg << ARITH_SHIFT) / 100; - - /* bitrate is in units of 100 Kbps, while we need rate in units of - * 1Mbps. This will be corrected on tx_time computation. - */ - tx_time = (device_constant + 10 * test_frame_len / rate); - estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err)); - result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT) ; - return (u32)result; -} - -/** - * hwmp_route_info_get - Update routing info to originator and transmitter - * - * @sdata: local mesh subif - * @mgmt: mesh management frame - * @hwmp_ie: hwmp information element (PREP or PREQ) - * - * This function updates the path routing information to the originator and the - * transmitter of a HWMP PREQ or PREP frame. - * - * Returns: metric to frame originator or 0 if the frame should not be further - * processed - * - * Notes: this function is the only place (besides user-provided info) where - * path routing information is updated. - */ -static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - u8 *hwmp_ie, enum mpath_frame_type action) -{ - struct ieee80211_local *local = sdata->local; - struct mesh_path *mpath; - struct sta_info *sta; - bool fresh_info; - u8 *orig_addr, *ta; - u32 orig_sn, orig_metric; - unsigned long orig_lifetime, exp_time; - u32 last_hop_metric, new_metric; - bool process = true; - - rcu_read_lock(); - sta = sta_info_get(sdata, mgmt->sa); - if (!sta) { - rcu_read_unlock(); - return 0; - } - - last_hop_metric = airtime_link_metric_get(local, sta); - /* Update and check originator routing info */ - fresh_info = true; - - switch (action) { - case MPATH_PREQ: - orig_addr = PREQ_IE_ORIG_ADDR(hwmp_ie); - orig_sn = PREQ_IE_ORIG_SN(hwmp_ie); - orig_lifetime = PREQ_IE_LIFETIME(hwmp_ie); - orig_metric = PREQ_IE_METRIC(hwmp_ie); - break; - case MPATH_PREP: - /* Originator here refers to the MP that was the target in the - * Path Request. We divert from the nomenclature in the draft - * so that we can easily use a single function to gather path - * information from both PREQ and PREP frames. - */ - orig_addr = PREP_IE_TARGET_ADDR(hwmp_ie); - orig_sn = PREP_IE_TARGET_SN(hwmp_ie); - orig_lifetime = PREP_IE_LIFETIME(hwmp_ie); - orig_metric = PREP_IE_METRIC(hwmp_ie); - break; - default: - rcu_read_unlock(); - return 0; - } - new_metric = orig_metric + last_hop_metric; - if (new_metric < orig_metric) - new_metric = MAX_METRIC; - exp_time = TU_TO_EXP_TIME(orig_lifetime); - - if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0) { - /* This MP is the originator, we are not interested in this - * frame, except for updating transmitter's path info. - */ - process = false; - fresh_info = false; - } else { - mpath = mesh_path_lookup(orig_addr, sdata); - if (mpath) { - spin_lock_bh(&mpath->state_lock); - if (mpath->flags & MESH_PATH_FIXED) - fresh_info = false; - else if ((mpath->flags & MESH_PATH_ACTIVE) && - (mpath->flags & MESH_PATH_SN_VALID)) { - if (SN_GT(mpath->sn, orig_sn) || - (mpath->sn == orig_sn && - new_metric >= mpath->metric)) { - process = false; - fresh_info = false; - } - } - } else { - mesh_path_add(orig_addr, sdata); - mpath = mesh_path_lookup(orig_addr, sdata); - if (!mpath) { - rcu_read_unlock(); - return 0; - } - spin_lock_bh(&mpath->state_lock); - } - - if (fresh_info) { - mesh_path_assign_nexthop(mpath, sta); - mpath->flags |= MESH_PATH_SN_VALID; - mpath->metric = new_metric; - mpath->sn = orig_sn; - mpath->exp_time = time_after(mpath->exp_time, exp_time) - ? mpath->exp_time : exp_time; - mesh_path_activate(mpath); - spin_unlock_bh(&mpath->state_lock); - mesh_path_tx_pending(mpath); - /* draft says preq_id should be saved to, but there does - * not seem to be any use for it, skipping by now - */ - } else - spin_unlock_bh(&mpath->state_lock); - } - - /* Update and check transmitter routing info */ - ta = mgmt->sa; - if (compare_ether_addr(orig_addr, ta) == 0) - fresh_info = false; - else { - fresh_info = true; - - mpath = mesh_path_lookup(ta, sdata); - if (mpath) { - spin_lock_bh(&mpath->state_lock); - if ((mpath->flags & MESH_PATH_FIXED) || - ((mpath->flags & MESH_PATH_ACTIVE) && - (last_hop_metric > mpath->metric))) - fresh_info = false; - } else { - mesh_path_add(ta, sdata); - mpath = mesh_path_lookup(ta, sdata); - if (!mpath) { - rcu_read_unlock(); - return 0; - } - spin_lock_bh(&mpath->state_lock); - } - - if (fresh_info) { - mesh_path_assign_nexthop(mpath, sta); - mpath->metric = last_hop_metric; - mpath->exp_time = time_after(mpath->exp_time, exp_time) - ? mpath->exp_time : exp_time; - mesh_path_activate(mpath); - spin_unlock_bh(&mpath->state_lock); - mesh_path_tx_pending(mpath); - } else - spin_unlock_bh(&mpath->state_lock); - } - - rcu_read_unlock(); - - return process ? new_metric : 0; -} - -static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - u8 *preq_elem, u32 metric) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct mesh_path *mpath = NULL; - u8 *target_addr, *orig_addr; - const u8 *da; - u8 target_flags, ttl; - u32 orig_sn, target_sn, lifetime; - bool reply = false; - bool forward = true; - - /* Update target SN, if present */ - target_addr = PREQ_IE_TARGET_ADDR(preq_elem); - orig_addr = PREQ_IE_ORIG_ADDR(preq_elem); - target_sn = PREQ_IE_TARGET_SN(preq_elem); - orig_sn = PREQ_IE_ORIG_SN(preq_elem); - target_flags = PREQ_IE_TARGET_F(preq_elem); - - mhwmp_dbg("received PREQ from %pM", orig_addr); - - if (compare_ether_addr(target_addr, sdata->vif.addr) == 0) { - mhwmp_dbg("PREQ is for us"); - forward = false; - reply = true; - metric = 0; - if (time_after(jiffies, ifmsh->last_sn_update + - net_traversal_jiffies(sdata)) || - time_before(jiffies, ifmsh->last_sn_update)) { - target_sn = ++ifmsh->sn; - ifmsh->last_sn_update = jiffies; - } - } else { - rcu_read_lock(); - mpath = mesh_path_lookup(target_addr, sdata); - if (mpath) { - if ((!(mpath->flags & MESH_PATH_SN_VALID)) || - SN_LT(mpath->sn, target_sn)) { - mpath->sn = target_sn; - mpath->flags |= MESH_PATH_SN_VALID; - } else if ((!(target_flags & MP_F_DO)) && - (mpath->flags & MESH_PATH_ACTIVE)) { - reply = true; - metric = mpath->metric; - target_sn = mpath->sn; - if (target_flags & MP_F_RF) - target_flags |= MP_F_DO; - else - forward = false; - } - } - rcu_read_unlock(); - } - - if (reply) { - lifetime = PREQ_IE_LIFETIME(preq_elem); - ttl = ifmsh->mshcfg.element_ttl; - if (ttl != 0) { - mhwmp_dbg("replying to the PREQ"); - mesh_path_sel_frame_tx(MPATH_PREP, 0, orig_addr, - cpu_to_le32(orig_sn), 0, target_addr, - cpu_to_le32(target_sn), mgmt->sa, 0, ttl, - cpu_to_le32(lifetime), cpu_to_le32(metric), - 0, sdata); - } else - ifmsh->mshstats.dropped_frames_ttl++; - } - - if (forward && ifmsh->mshcfg.dot11MeshForwarding) { - u32 preq_id; - u8 hopcount, flags; - - ttl = PREQ_IE_TTL(preq_elem); - lifetime = PREQ_IE_LIFETIME(preq_elem); - if (ttl <= 1) { - ifmsh->mshstats.dropped_frames_ttl++; - return; - } - mhwmp_dbg("forwarding the PREQ from %pM", orig_addr); - --ttl; - flags = PREQ_IE_FLAGS(preq_elem); - preq_id = PREQ_IE_PREQ_ID(preq_elem); - hopcount = PREQ_IE_HOPCOUNT(preq_elem) + 1; - da = (mpath && mpath->is_root) ? - mpath->rann_snd_addr : broadcast_addr; - mesh_path_sel_frame_tx(MPATH_PREQ, flags, orig_addr, - cpu_to_le32(orig_sn), target_flags, target_addr, - cpu_to_le32(target_sn), da, - hopcount, ttl, cpu_to_le32(lifetime), - cpu_to_le32(metric), cpu_to_le32(preq_id), - sdata); - ifmsh->mshstats.fwded_mcast++; - ifmsh->mshstats.fwded_frames++; - } -} - - -static inline struct sta_info * -next_hop_deref_protected(struct mesh_path *mpath) -{ - return rcu_dereference_protected(mpath->next_hop, - lockdep_is_held(&mpath->state_lock)); -} - - -static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - u8 *prep_elem, u32 metric) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct mesh_path *mpath; - u8 *target_addr, *orig_addr; - u8 ttl, hopcount, flags; - u8 next_hop[ETH_ALEN]; - u32 target_sn, orig_sn, lifetime; - - mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem)); - - orig_addr = PREP_IE_ORIG_ADDR(prep_elem); - if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0) - /* destination, no forwarding required */ - return; - - if (!ifmsh->mshcfg.dot11MeshForwarding) - return; - - ttl = PREP_IE_TTL(prep_elem); - if (ttl <= 1) { - sdata->u.mesh.mshstats.dropped_frames_ttl++; - return; - } - - rcu_read_lock(); - mpath = mesh_path_lookup(orig_addr, sdata); - if (mpath) - spin_lock_bh(&mpath->state_lock); - else - goto fail; - if (!(mpath->flags & MESH_PATH_ACTIVE)) { - spin_unlock_bh(&mpath->state_lock); - goto fail; - } - memcpy(next_hop, next_hop_deref_protected(mpath)->sta.addr, ETH_ALEN); - spin_unlock_bh(&mpath->state_lock); - --ttl; - flags = PREP_IE_FLAGS(prep_elem); - lifetime = PREP_IE_LIFETIME(prep_elem); - hopcount = PREP_IE_HOPCOUNT(prep_elem) + 1; - target_addr = PREP_IE_TARGET_ADDR(prep_elem); - target_sn = PREP_IE_TARGET_SN(prep_elem); - orig_sn = PREP_IE_ORIG_SN(prep_elem); - - mesh_path_sel_frame_tx(MPATH_PREP, flags, orig_addr, - cpu_to_le32(orig_sn), 0, target_addr, - cpu_to_le32(target_sn), next_hop, hopcount, - ttl, cpu_to_le32(lifetime), cpu_to_le32(metric), - 0, sdata); - rcu_read_unlock(); - - sdata->u.mesh.mshstats.fwded_unicast++; - sdata->u.mesh.mshstats.fwded_frames++; - return; - -fail: - rcu_read_unlock(); - sdata->u.mesh.mshstats.dropped_frames_no_route++; -} - -static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, u8 *perr_elem) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct mesh_path *mpath; - u8 ttl; - u8 *ta, *target_addr; - u32 target_sn; - u16 target_rcode; - - ta = mgmt->sa; - ttl = PERR_IE_TTL(perr_elem); - if (ttl <= 1) { - ifmsh->mshstats.dropped_frames_ttl++; - return; - } - ttl--; - target_addr = PERR_IE_TARGET_ADDR(perr_elem); - target_sn = PERR_IE_TARGET_SN(perr_elem); - target_rcode = PERR_IE_TARGET_RCODE(perr_elem); - - rcu_read_lock(); - mpath = mesh_path_lookup(target_addr, sdata); - if (mpath) { - struct sta_info *sta; - - spin_lock_bh(&mpath->state_lock); - sta = next_hop_deref_protected(mpath); - if (mpath->flags & MESH_PATH_ACTIVE && - compare_ether_addr(ta, sta->sta.addr) == 0 && - (!(mpath->flags & MESH_PATH_SN_VALID) || - SN_GT(target_sn, mpath->sn))) { - mpath->flags &= ~MESH_PATH_ACTIVE; - mpath->sn = target_sn; - spin_unlock_bh(&mpath->state_lock); - if (!ifmsh->mshcfg.dot11MeshForwarding) - goto endperr; - mesh_path_error_tx(ttl, target_addr, cpu_to_le32(target_sn), - cpu_to_le16(target_rcode), - broadcast_addr, sdata); - } else - spin_unlock_bh(&mpath->state_lock); - } -endperr: - rcu_read_unlock(); -} - -static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - struct ieee80211_rann_ie *rann) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct mesh_path *mpath; - u8 ttl, flags, hopcount; - u8 *orig_addr; - u32 orig_sn, metric; - u32 interval = ifmsh->mshcfg.dot11MeshHWMPRannInterval; - bool root_is_gate; - - ttl = rann->rann_ttl; - if (ttl <= 1) { - ifmsh->mshstats.dropped_frames_ttl++; - return; - } - ttl--; - flags = rann->rann_flags; - root_is_gate = !!(flags & RANN_FLAG_IS_GATE); - orig_addr = rann->rann_addr; - orig_sn = rann->rann_seq; - hopcount = rann->rann_hopcount; - hopcount++; - metric = rann->rann_metric; - - /* Ignore our own RANNs */ - if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0) - return; - - mhwmp_dbg("received RANN from %pM via neighbour %pM (is_gate=%d)", - orig_addr, mgmt->sa, root_is_gate); - - rcu_read_lock(); - mpath = mesh_path_lookup(orig_addr, sdata); - if (!mpath) { - mesh_path_add(orig_addr, sdata); - mpath = mesh_path_lookup(orig_addr, sdata); - if (!mpath) { - rcu_read_unlock(); - sdata->u.mesh.mshstats.dropped_frames_no_route++; - return; - } - } - - if ((!(mpath->flags & (MESH_PATH_ACTIVE | MESH_PATH_RESOLVING)) || - time_after(jiffies, mpath->exp_time - 1*HZ)) && - !(mpath->flags & MESH_PATH_FIXED)) { - mhwmp_dbg("%s time to refresh root mpath %pM", sdata->name, - orig_addr); - mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); - } - - if (mpath->sn < orig_sn && ifmsh->mshcfg.dot11MeshForwarding) { - mesh_path_sel_frame_tx(MPATH_RANN, flags, orig_addr, - cpu_to_le32(orig_sn), - 0, NULL, 0, broadcast_addr, - hopcount, ttl, cpu_to_le32(interval), - cpu_to_le32(metric + mpath->metric), - 0, sdata); - mpath->sn = orig_sn; - } - - /* Using individually addressed PREQ for root node */ - memcpy(mpath->rann_snd_addr, mgmt->sa, ETH_ALEN); - mpath->is_root = true; - - if (root_is_gate) - mesh_path_add_gate(mpath); - - rcu_read_unlock(); -} - - -void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - size_t len) -{ - struct ieee802_11_elems elems; - size_t baselen; - u32 last_hop_metric; - struct sta_info *sta; - - /* need action_code */ - if (len < IEEE80211_MIN_ACTION_SIZE + 1) - return; - - rcu_read_lock(); - sta = sta_info_get(sdata, mgmt->sa); - if (!sta || sta->plink_state != NL80211_PLINK_ESTAB) { - rcu_read_unlock(); - return; - } - rcu_read_unlock(); - - baselen = (u8 *) mgmt->u.action.u.mesh_action.variable - (u8 *) mgmt; - ieee802_11_parse_elems(mgmt->u.action.u.mesh_action.variable, - len - baselen, &elems); - - if (elems.preq) { - if (elems.preq_len != 37) - /* Right now we support just 1 destination and no AE */ - return; - last_hop_metric = hwmp_route_info_get(sdata, mgmt, elems.preq, - MPATH_PREQ); - if (last_hop_metric) - hwmp_preq_frame_process(sdata, mgmt, elems.preq, - last_hop_metric); - } - if (elems.prep) { - if (elems.prep_len != 31) - /* Right now we support no AE */ - return; - last_hop_metric = hwmp_route_info_get(sdata, mgmt, elems.prep, - MPATH_PREP); - if (last_hop_metric) - hwmp_prep_frame_process(sdata, mgmt, elems.prep, - last_hop_metric); - } - if (elems.perr) { - if (elems.perr_len != 15) - /* Right now we support only one destination per PERR */ - return; - hwmp_perr_frame_process(sdata, mgmt, elems.perr); - } - if (elems.rann) - hwmp_rann_frame_process(sdata, mgmt, elems.rann); -} - -/** - * mesh_queue_preq - queue a PREQ to a given destination - * - * @mpath: mesh path to discover - * @flags: special attributes of the PREQ to be sent - * - * Locking: the function must be called from within a rcu read lock block. - * - */ -static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) -{ - struct ieee80211_sub_if_data *sdata = mpath->sdata; - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct mesh_preq_queue *preq_node; - - preq_node = kmalloc(sizeof(struct mesh_preq_queue), GFP_ATOMIC); - if (!preq_node) { - mhwmp_dbg("could not allocate PREQ node"); - return; - } - - spin_lock_bh(&ifmsh->mesh_preq_queue_lock); - if (ifmsh->preq_queue_len == MAX_PREQ_QUEUE_LEN) { - spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); - kfree(preq_node); - if (printk_ratelimit()) - mhwmp_dbg("PREQ node queue full"); - return; - } - - spin_lock(&mpath->state_lock); - if (mpath->flags & MESH_PATH_REQ_QUEUED) { - spin_unlock(&mpath->state_lock); - spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); - kfree(preq_node); - return; - } - - memcpy(preq_node->dst, mpath->dst, ETH_ALEN); - preq_node->flags = flags; - - mpath->flags |= MESH_PATH_REQ_QUEUED; - spin_unlock(&mpath->state_lock); - - list_add_tail(&preq_node->list, &ifmsh->preq_queue.list); - ++ifmsh->preq_queue_len; - spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); - - if (time_after(jiffies, ifmsh->last_preq + min_preq_int_jiff(sdata))) - ieee80211_queue_work(&sdata->local->hw, &sdata->work); - - else if (time_before(jiffies, ifmsh->last_preq)) { - /* avoid long wait if did not send preqs for a long time - * and jiffies wrapped around - */ - ifmsh->last_preq = jiffies - min_preq_int_jiff(sdata) - 1; - ieee80211_queue_work(&sdata->local->hw, &sdata->work); - } else - mod_timer(&ifmsh->mesh_path_timer, ifmsh->last_preq + - min_preq_int_jiff(sdata)); -} - -/** - * mesh_path_start_discovery - launch a path discovery from the PREQ queue - * - * @sdata: local mesh subif - */ -void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct mesh_preq_queue *preq_node; - struct mesh_path *mpath; - u8 ttl, target_flags; - const u8 *da; - u32 lifetime; - - spin_lock_bh(&ifmsh->mesh_preq_queue_lock); - if (!ifmsh->preq_queue_len || - time_before(jiffies, ifmsh->last_preq + - min_preq_int_jiff(sdata))) { - spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); - return; - } - - preq_node = list_first_entry(&ifmsh->preq_queue.list, - struct mesh_preq_queue, list); - list_del(&preq_node->list); - --ifmsh->preq_queue_len; - spin_unlock_bh(&ifmsh->mesh_preq_queue_lock); - - rcu_read_lock(); - mpath = mesh_path_lookup(preq_node->dst, sdata); - if (!mpath) - goto enddiscovery; - - spin_lock_bh(&mpath->state_lock); - mpath->flags &= ~MESH_PATH_REQ_QUEUED; - if (preq_node->flags & PREQ_Q_F_START) { - if (mpath->flags & MESH_PATH_RESOLVING) { - spin_unlock_bh(&mpath->state_lock); - goto enddiscovery; - } else { - mpath->flags &= ~MESH_PATH_RESOLVED; - mpath->flags |= MESH_PATH_RESOLVING; - mpath->discovery_retries = 0; - mpath->discovery_timeout = disc_timeout_jiff(sdata); - } - } else if (!(mpath->flags & MESH_PATH_RESOLVING) || - mpath->flags & MESH_PATH_RESOLVED) { - mpath->flags &= ~MESH_PATH_RESOLVING; - spin_unlock_bh(&mpath->state_lock); - goto enddiscovery; - } - - ifmsh->last_preq = jiffies; - - if (time_after(jiffies, ifmsh->last_sn_update + - net_traversal_jiffies(sdata)) || - time_before(jiffies, ifmsh->last_sn_update)) { - ++ifmsh->sn; - sdata->u.mesh.last_sn_update = jiffies; - } - lifetime = default_lifetime(sdata); - ttl = sdata->u.mesh.mshcfg.element_ttl; - if (ttl == 0) { - sdata->u.mesh.mshstats.dropped_frames_ttl++; - spin_unlock_bh(&mpath->state_lock); - goto enddiscovery; - } - - if (preq_node->flags & PREQ_Q_F_REFRESH) - target_flags = MP_F_DO; - else - target_flags = MP_F_RF; - - spin_unlock_bh(&mpath->state_lock); - da = (mpath->is_root) ? mpath->rann_snd_addr : broadcast_addr; - mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->vif.addr, - cpu_to_le32(ifmsh->sn), target_flags, mpath->dst, - cpu_to_le32(mpath->sn), da, 0, - ttl, cpu_to_le32(lifetime), 0, - cpu_to_le32(ifmsh->preq_id++), sdata); - mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout); - -enddiscovery: - rcu_read_unlock(); - kfree(preq_node); -} - -/* mesh_nexthop_resolve - lookup next hop for given skb and start path - * discovery if no forwarding information is found. - * - * @skb: 802.11 frame to be sent - * @sdata: network subif the frame will be sent through - * - * Returns: 0 if the next hop was found and -ENOENT if the frame was queued. - * skb is freeed here if no mpath could be allocated. - */ -int mesh_nexthop_resolve(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct mesh_path *mpath; - struct sk_buff *skb_to_free = NULL; - u8 *target_addr = hdr->addr3; - int err = 0; - - rcu_read_lock(); - err = mesh_nexthop_lookup(skb, sdata); - if (!err) - goto endlookup; - - /* no nexthop found, start resolving */ - mpath = mesh_path_lookup(target_addr, sdata); - if (!mpath) { - mesh_path_add(target_addr, sdata); - mpath = mesh_path_lookup(target_addr, sdata); - if (!mpath) { - mesh_path_discard_frame(skb, sdata); - err = -ENOSPC; - goto endlookup; - } - } - - if (!(mpath->flags & MESH_PATH_RESOLVING)) - mesh_queue_preq(mpath, PREQ_Q_F_START); - - if (skb_queue_len(&mpath->frame_queue) >= MESH_FRAME_QUEUE_LEN) - skb_to_free = skb_dequeue(&mpath->frame_queue); - - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; - ieee80211_set_qos_hdr(sdata, skb); - skb_queue_tail(&mpath->frame_queue, skb); - err = -ENOENT; - if (skb_to_free) - mesh_path_discard_frame(skb_to_free, sdata); - -endlookup: - rcu_read_unlock(); - return err; -} -/** - * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame. Calling - * this function is considered "using" the associated mpath, so preempt a path - * refresh if this mpath expires soon. - * - * @skb: 802.11 frame to be sent - * @sdata: network subif the frame will be sent through - * - * Returns: 0 if the next hop was found. Nonzero otherwise. - */ -int mesh_nexthop_lookup(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata) -{ - struct mesh_path *mpath; - struct sta_info *next_hop; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - u8 *target_addr = hdr->addr3; - int err = -ENOENT; - - rcu_read_lock(); - mpath = mesh_path_lookup(target_addr, sdata); - - if (!mpath || !(mpath->flags & MESH_PATH_ACTIVE)) - goto endlookup; - - if (time_after(jiffies, - mpath->exp_time - - msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) && - !compare_ether_addr(sdata->vif.addr, hdr->addr4) && - !(mpath->flags & MESH_PATH_RESOLVING) && - !(mpath->flags & MESH_PATH_FIXED)) - mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); - - next_hop = rcu_dereference(mpath->next_hop); - if (next_hop) { - memcpy(hdr->addr1, next_hop->sta.addr, ETH_ALEN); - memcpy(hdr->addr2, sdata->vif.addr, ETH_ALEN); - err = 0; - } - -endlookup: - rcu_read_unlock(); - return err; -} - -void mesh_path_timer(unsigned long data) -{ - struct mesh_path *mpath = (void *) data; - struct ieee80211_sub_if_data *sdata = mpath->sdata; - int ret; - - if (sdata->local->quiescing) - return; - - spin_lock_bh(&mpath->state_lock); - if (mpath->flags & MESH_PATH_RESOLVED || - (!(mpath->flags & MESH_PATH_RESOLVING))) { - mpath->flags &= ~(MESH_PATH_RESOLVING | MESH_PATH_RESOLVED); - spin_unlock_bh(&mpath->state_lock); - } else if (mpath->discovery_retries < max_preq_retries(sdata)) { - ++mpath->discovery_retries; - mpath->discovery_timeout *= 2; - mpath->flags &= ~MESH_PATH_REQ_QUEUED; - spin_unlock_bh(&mpath->state_lock); - mesh_queue_preq(mpath, 0); - } else { - mpath->flags = 0; - mpath->exp_time = jiffies; - spin_unlock_bh(&mpath->state_lock); - if (!mpath->is_gate && mesh_gate_num(sdata) > 0) { - ret = mesh_path_send_to_gates(mpath); - if (ret) - mhwmp_dbg("no gate was reachable"); - } else - mesh_path_flush_pending(mpath); - } -} - -void -mesh_path_tx_root_frame(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - u32 interval = ifmsh->mshcfg.dot11MeshHWMPRannInterval; - u8 flags; - - flags = (ifmsh->mshcfg.dot11MeshGateAnnouncementProtocol) - ? RANN_FLAG_IS_GATE : 0; - mesh_path_sel_frame_tx(MPATH_RANN, flags, sdata->vif.addr, - cpu_to_le32(++ifmsh->sn), - 0, NULL, 0, broadcast_addr, - 0, sdata->u.mesh.mshcfg.element_ttl, - cpu_to_le32(interval), 0, 0, sdata); -} diff --git a/openairITS/mac/DOT11/net/mac80211/mesh_pathtbl.c b/openairITS/mac/DOT11/net/mac80211/mesh_pathtbl.c deleted file mode 100644 index a58c0485274..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/mesh_pathtbl.c +++ /dev/null @@ -1,1126 +0,0 @@ -/* - * Copyright (c) 2008, 2009 open80211s Ltd. - * Author: Luis Carlos Cobo <luisca@cozybit.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/etherdevice.h> -#include <linux/list.h> -#include <linux/random.h> -#include <linux/slab.h> -#include <linux/spinlock.h> -#include <linux/string.h> -#include <net/mac80211.h> -#include "wme.h" -#include "ieee80211_i.h" -#include "mesh.h" - -#define path_lookup general_path_lookup - -#ifdef CONFIG_MAC80211_VERBOSE_MPATH_DEBUG -#define mpath_dbg(fmt, args...) printk(KERN_DEBUG fmt, ##args) -#else -#define mpath_dbg(fmt, args...) do { (void)(0); } while (0) -#endif - -/* There will be initially 2^INIT_PATHS_SIZE_ORDER buckets */ -#define INIT_PATHS_SIZE_ORDER 2 - -/* Keep the mean chain length below this constant */ -#define MEAN_CHAIN_LEN 2 - -#define MPATH_EXPIRED(mpath) ((mpath->flags & MESH_PATH_ACTIVE) && \ - time_after(jiffies, mpath->exp_time) && \ - !(mpath->flags & MESH_PATH_FIXED)) - -struct mpath_node { - struct hlist_node list; - struct rcu_head rcu; - /* This indirection allows two different tables to point to the same - * mesh_path structure, useful when resizing - */ - struct mesh_path *mpath; -}; - -static struct mesh_table __rcu *mesh_paths; -static struct mesh_table __rcu *mpp_paths; /* Store paths for MPP&MAP */ - -int mesh_paths_generation; - -/* This lock will have the grow table function as writer and add / delete nodes - * as readers. RCU provides sufficient protection only when reading the table - * (i.e. doing lookups). Adding or adding or removing nodes requires we take - * the read lock or we risk operating on an old table. The write lock is only - * needed when modifying the number of buckets a table. - */ -static DEFINE_RWLOCK(pathtbl_resize_lock); - - -static inline struct mesh_table *resize_dereference_mesh_paths(void) -{ - return rcu_dereference_protected(mesh_paths, - lockdep_is_held(&pathtbl_resize_lock)); -} - -static inline struct mesh_table *resize_dereference_mpp_paths(void) -{ - return rcu_dereference_protected(mpp_paths, - lockdep_is_held(&pathtbl_resize_lock)); -} - -/* - * CAREFUL -- "tbl" must not be an expression, - * in particular not an rcu_dereference(), since - * it's used twice. So it is illegal to do - * for_each_mesh_entry(rcu_dereference(...), ...) - */ -#define for_each_mesh_entry(tbl, p, node, i) \ - for (i = 0; i <= tbl->hash_mask; i++) \ - hlist_for_each_entry_rcu(node, p, &tbl->hash_buckets[i], list) - - -static struct mesh_table *mesh_table_alloc(int size_order) -{ - int i; - struct mesh_table *newtbl; - - newtbl = kmalloc(sizeof(struct mesh_table), GFP_ATOMIC); - if (!newtbl) - return NULL; - - newtbl->hash_buckets = kzalloc(sizeof(struct hlist_head) * - (1 << size_order), GFP_ATOMIC); - - if (!newtbl->hash_buckets) { - kfree(newtbl); - return NULL; - } - - newtbl->hashwlock = kmalloc(sizeof(spinlock_t) * - (1 << size_order), GFP_ATOMIC); - if (!newtbl->hashwlock) { - kfree(newtbl->hash_buckets); - kfree(newtbl); - return NULL; - } - - newtbl->size_order = size_order; - newtbl->hash_mask = (1 << size_order) - 1; - atomic_set(&newtbl->entries, 0); - get_random_bytes(&newtbl->hash_rnd, - sizeof(newtbl->hash_rnd)); - for (i = 0; i <= newtbl->hash_mask; i++) - spin_lock_init(&newtbl->hashwlock[i]); - spin_lock_init(&newtbl->gates_lock); - - return newtbl; -} - -static void __mesh_table_free(struct mesh_table *tbl) -{ - kfree(tbl->hash_buckets); - kfree(tbl->hashwlock); - kfree(tbl); -} - -static void mesh_table_free(struct mesh_table *tbl, bool free_leafs) -{ - struct hlist_head *mesh_hash; - struct hlist_node *p, *q; - struct mpath_node *gate; - int i; - - mesh_hash = tbl->hash_buckets; - for (i = 0; i <= tbl->hash_mask; i++) { - spin_lock_bh(&tbl->hashwlock[i]); - hlist_for_each_safe(p, q, &mesh_hash[i]) { - tbl->free_node(p, free_leafs); - atomic_dec(&tbl->entries); - } - spin_unlock_bh(&tbl->hashwlock[i]); - } - if (free_leafs) { - spin_lock_bh(&tbl->gates_lock); - hlist_for_each_entry_safe(gate, p, q, - tbl->known_gates, list) { - hlist_del(&gate->list); - kfree(gate); - } - kfree(tbl->known_gates); - spin_unlock_bh(&tbl->gates_lock); - } - - __mesh_table_free(tbl); -} - -static int mesh_table_grow(struct mesh_table *oldtbl, - struct mesh_table *newtbl) -{ - struct hlist_head *oldhash; - struct hlist_node *p, *q; - int i; - - if (atomic_read(&oldtbl->entries) - < oldtbl->mean_chain_len * (oldtbl->hash_mask + 1)) - return -EAGAIN; - - newtbl->free_node = oldtbl->free_node; - newtbl->mean_chain_len = oldtbl->mean_chain_len; - newtbl->copy_node = oldtbl->copy_node; - newtbl->known_gates = oldtbl->known_gates; - atomic_set(&newtbl->entries, atomic_read(&oldtbl->entries)); - - oldhash = oldtbl->hash_buckets; - for (i = 0; i <= oldtbl->hash_mask; i++) - hlist_for_each(p, &oldhash[i]) - if (oldtbl->copy_node(p, newtbl) < 0) - goto errcopy; - - return 0; - -errcopy: - for (i = 0; i <= newtbl->hash_mask; i++) { - hlist_for_each_safe(p, q, &newtbl->hash_buckets[i]) - oldtbl->free_node(p, 0); - } - return -ENOMEM; -} - -static u32 mesh_table_hash(u8 *addr, struct ieee80211_sub_if_data *sdata, - struct mesh_table *tbl) -{ - /* Use last four bytes of hw addr and interface index as hash index */ - return jhash_2words(*(u32 *)(addr+2), sdata->dev->ifindex, tbl->hash_rnd) - & tbl->hash_mask; -} - - -/** - * - * mesh_path_assign_nexthop - update mesh path next hop - * - * @mpath: mesh path to update - * @sta: next hop to assign - * - * Locking: mpath->state_lock must be held when calling this function - */ -void mesh_path_assign_nexthop(struct mesh_path *mpath, struct sta_info *sta) -{ - struct sk_buff *skb; - struct ieee80211_hdr *hdr; - struct sk_buff_head tmpq; - unsigned long flags; - - rcu_assign_pointer(mpath->next_hop, sta); - - __skb_queue_head_init(&tmpq); - - spin_lock_irqsave(&mpath->frame_queue.lock, flags); - - while ((skb = __skb_dequeue(&mpath->frame_queue)) != NULL) { - hdr = (struct ieee80211_hdr *) skb->data; - memcpy(hdr->addr1, sta->sta.addr, ETH_ALEN); - memcpy(hdr->addr2, mpath->sdata->vif.addr, ETH_ALEN); - __skb_queue_tail(&tmpq, skb); - } - - skb_queue_splice(&tmpq, &mpath->frame_queue); - spin_unlock_irqrestore(&mpath->frame_queue.lock, flags); -} - -static void prepare_for_gate(struct sk_buff *skb, char *dst_addr, - struct mesh_path *gate_mpath) -{ - struct ieee80211_hdr *hdr; - struct ieee80211s_hdr *mshdr; - int mesh_hdrlen, hdrlen; - char *next_hop; - - hdr = (struct ieee80211_hdr *) skb->data; - hdrlen = ieee80211_hdrlen(hdr->frame_control); - mshdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); - - if (!(mshdr->flags & MESH_FLAGS_AE)) { - /* size of the fixed part of the mesh header */ - mesh_hdrlen = 6; - - /* make room for the two extended addresses */ - skb_push(skb, 2 * ETH_ALEN); - memmove(skb->data, hdr, hdrlen + mesh_hdrlen); - - hdr = (struct ieee80211_hdr *) skb->data; - - /* we preserve the previous mesh header and only add - * the new addreses */ - mshdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); - mshdr->flags = MESH_FLAGS_AE_A5_A6; - memcpy(mshdr->eaddr1, hdr->addr3, ETH_ALEN); - memcpy(mshdr->eaddr2, hdr->addr4, ETH_ALEN); - } - - /* update next hop */ - hdr = (struct ieee80211_hdr *) skb->data; - rcu_read_lock(); - next_hop = rcu_dereference(gate_mpath->next_hop)->sta.addr; - memcpy(hdr->addr1, next_hop, ETH_ALEN); - rcu_read_unlock(); - memcpy(hdr->addr2, gate_mpath->sdata->vif.addr, ETH_ALEN); - memcpy(hdr->addr3, dst_addr, ETH_ALEN); -} - -/** - * - * mesh_path_move_to_queue - Move or copy frames from one mpath queue to another - * - * This function is used to transfer or copy frames from an unresolved mpath to - * a gate mpath. The function also adds the Address Extension field and - * updates the next hop. - * - * If a frame already has an Address Extension field, only the next hop and - * destination addresses are updated. - * - * The gate mpath must be an active mpath with a valid mpath->next_hop. - * - * @mpath: An active mpath the frames will be sent to (i.e. the gate) - * @from_mpath: The failed mpath - * @copy: When true, copy all the frames to the new mpath queue. When false, - * move them. - */ -static void mesh_path_move_to_queue(struct mesh_path *gate_mpath, - struct mesh_path *from_mpath, - bool copy) -{ - struct sk_buff *skb, *cp_skb = NULL; - struct sk_buff_head gateq, failq; - unsigned long flags; - int num_skbs; - - BUG_ON(gate_mpath == from_mpath); - BUG_ON(!gate_mpath->next_hop); - - __skb_queue_head_init(&gateq); - __skb_queue_head_init(&failq); - - spin_lock_irqsave(&from_mpath->frame_queue.lock, flags); - skb_queue_splice_init(&from_mpath->frame_queue, &failq); - spin_unlock_irqrestore(&from_mpath->frame_queue.lock, flags); - - num_skbs = skb_queue_len(&failq); - - while (num_skbs--) { - skb = __skb_dequeue(&failq); - if (copy) { - cp_skb = skb_copy(skb, GFP_ATOMIC); - if (cp_skb) - __skb_queue_tail(&failq, cp_skb); - } - - prepare_for_gate(skb, gate_mpath->dst, gate_mpath); - __skb_queue_tail(&gateq, skb); - } - - spin_lock_irqsave(&gate_mpath->frame_queue.lock, flags); - skb_queue_splice(&gateq, &gate_mpath->frame_queue); - mpath_dbg("Mpath queue for gate %pM has %d frames\n", - gate_mpath->dst, - skb_queue_len(&gate_mpath->frame_queue)); - spin_unlock_irqrestore(&gate_mpath->frame_queue.lock, flags); - - if (!copy) - return; - - spin_lock_irqsave(&from_mpath->frame_queue.lock, flags); - skb_queue_splice(&failq, &from_mpath->frame_queue); - spin_unlock_irqrestore(&from_mpath->frame_queue.lock, flags); -} - - -static struct mesh_path *mpath_lookup(struct mesh_table *tbl, u8 *dst, - struct ieee80211_sub_if_data *sdata) -{ - struct mesh_path *mpath; - struct hlist_node *n; - struct hlist_head *bucket; - struct mpath_node *node; - - bucket = &tbl->hash_buckets[mesh_table_hash(dst, sdata, tbl)]; - hlist_for_each_entry_rcu(node, n, bucket, list) { - mpath = node->mpath; - if (mpath->sdata == sdata && - compare_ether_addr(dst, mpath->dst) == 0) { - if (MPATH_EXPIRED(mpath)) { - spin_lock_bh(&mpath->state_lock); - mpath->flags &= ~MESH_PATH_ACTIVE; - spin_unlock_bh(&mpath->state_lock); - } - return mpath; - } - } - return NULL; -} - -/** - * mesh_path_lookup - look up a path in the mesh path table - * @dst: hardware address (ETH_ALEN length) of destination - * @sdata: local subif - * - * Returns: pointer to the mesh path structure, or NULL if not found - * - * Locking: must be called within a read rcu section. - */ -struct mesh_path *mesh_path_lookup(u8 *dst, struct ieee80211_sub_if_data *sdata) -{ - return mpath_lookup(rcu_dereference(mesh_paths), dst, sdata); -} - -struct mesh_path *mpp_path_lookup(u8 *dst, struct ieee80211_sub_if_data *sdata) -{ - return mpath_lookup(rcu_dereference(mpp_paths), dst, sdata); -} - - -/** - * mesh_path_lookup_by_idx - look up a path in the mesh path table by its index - * @idx: index - * @sdata: local subif, or NULL for all entries - * - * Returns: pointer to the mesh path structure, or NULL if not found. - * - * Locking: must be called within a read rcu section. - */ -struct mesh_path *mesh_path_lookup_by_idx(int idx, struct ieee80211_sub_if_data *sdata) -{ - struct mesh_table *tbl = rcu_dereference(mesh_paths); - struct mpath_node *node; - struct hlist_node *p; - int i; - int j = 0; - - for_each_mesh_entry(tbl, p, node, i) { - if (sdata && node->mpath->sdata != sdata) - continue; - if (j++ == idx) { - if (MPATH_EXPIRED(node->mpath)) { - spin_lock_bh(&node->mpath->state_lock); - node->mpath->flags &= ~MESH_PATH_ACTIVE; - spin_unlock_bh(&node->mpath->state_lock); - } - return node->mpath; - } - } - - return NULL; -} - -/** - * mesh_path_add_gate - add the given mpath to a mesh gate to our path table - * @mpath: gate path to add to table - */ -int mesh_path_add_gate(struct mesh_path *mpath) -{ - struct mesh_table *tbl; - struct mpath_node *gate, *new_gate; - struct hlist_node *n; - int err; - - rcu_read_lock(); - tbl = rcu_dereference(mesh_paths); - - hlist_for_each_entry_rcu(gate, n, tbl->known_gates, list) - if (gate->mpath == mpath) { - err = -EEXIST; - goto err_rcu; - } - - new_gate = kzalloc(sizeof(struct mpath_node), GFP_ATOMIC); - if (!new_gate) { - err = -ENOMEM; - goto err_rcu; - } - - mpath->is_gate = true; - mpath->sdata->u.mesh.num_gates++; - new_gate->mpath = mpath; - spin_lock_bh(&tbl->gates_lock); - hlist_add_head_rcu(&new_gate->list, tbl->known_gates); - spin_unlock_bh(&tbl->gates_lock); - rcu_read_unlock(); - mpath_dbg("Mesh path (%s): Recorded new gate: %pM. %d known gates\n", - mpath->sdata->name, mpath->dst, - mpath->sdata->u.mesh.num_gates); - return 0; -err_rcu: - rcu_read_unlock(); - return err; -} - -/** - * mesh_gate_del - remove a mesh gate from the list of known gates - * @tbl: table which holds our list of known gates - * @mpath: gate mpath - * - * Returns: 0 on success - * - * Locking: must be called inside rcu_read_lock() section - */ -static int mesh_gate_del(struct mesh_table *tbl, struct mesh_path *mpath) -{ - struct mpath_node *gate; - struct hlist_node *p, *q; - - hlist_for_each_entry_safe(gate, p, q, tbl->known_gates, list) - if (gate->mpath == mpath) { - spin_lock_bh(&tbl->gates_lock); - hlist_del_rcu(&gate->list); - kfree_rcu(gate, rcu); - spin_unlock_bh(&tbl->gates_lock); - mpath->sdata->u.mesh.num_gates--; - mpath->is_gate = false; - mpath_dbg("Mesh path (%s): Deleted gate: %pM. " - "%d known gates\n", mpath->sdata->name, - mpath->dst, mpath->sdata->u.mesh.num_gates); - break; - } - - return 0; -} - -/** - * mesh_gate_num - number of gates known to this interface - * @sdata: subif data - */ -int mesh_gate_num(struct ieee80211_sub_if_data *sdata) -{ - return sdata->u.mesh.num_gates; -} - -/** - * mesh_path_add - allocate and add a new path to the mesh path table - * @addr: destination address of the path (ETH_ALEN length) - * @sdata: local subif - * - * Returns: 0 on success - * - * State: the initial state of the new path is set to 0 - */ -int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct ieee80211_local *local = sdata->local; - struct mesh_table *tbl; - struct mesh_path *mpath, *new_mpath; - struct mpath_node *node, *new_node; - struct hlist_head *bucket; - struct hlist_node *n; - int grow = 0; - int err = 0; - u32 hash_idx; - - if (compare_ether_addr(dst, sdata->vif.addr) == 0) - /* never add ourselves as neighbours */ - return -ENOTSUPP; - - if (is_multicast_ether_addr(dst)) - return -ENOTSUPP; - - if (atomic_add_unless(&sdata->u.mesh.mpaths, 1, MESH_MAX_MPATHS) == 0) - return -ENOSPC; - - err = -ENOMEM; - new_mpath = kzalloc(sizeof(struct mesh_path), GFP_ATOMIC); - if (!new_mpath) - goto err_path_alloc; - - new_node = kmalloc(sizeof(struct mpath_node), GFP_ATOMIC); - if (!new_node) - goto err_node_alloc; - - read_lock_bh(&pathtbl_resize_lock); - memcpy(new_mpath->dst, dst, ETH_ALEN); - new_mpath->sdata = sdata; - new_mpath->flags = 0; - skb_queue_head_init(&new_mpath->frame_queue); - new_node->mpath = new_mpath; - new_mpath->timer.data = (unsigned long) new_mpath; - new_mpath->timer.function = mesh_path_timer; - new_mpath->exp_time = jiffies; - spin_lock_init(&new_mpath->state_lock); - init_timer(&new_mpath->timer); - - tbl = resize_dereference_mesh_paths(); - - hash_idx = mesh_table_hash(dst, sdata, tbl); - bucket = &tbl->hash_buckets[hash_idx]; - - spin_lock(&tbl->hashwlock[hash_idx]); - - err = -EEXIST; - hlist_for_each_entry(node, n, bucket, list) { - mpath = node->mpath; - if (mpath->sdata == sdata && - compare_ether_addr(dst, mpath->dst) == 0) - goto err_exists; - } - - hlist_add_head_rcu(&new_node->list, bucket); - if (atomic_inc_return(&tbl->entries) >= - tbl->mean_chain_len * (tbl->hash_mask + 1)) - grow = 1; - - mesh_paths_generation++; - - spin_unlock(&tbl->hashwlock[hash_idx]); - read_unlock_bh(&pathtbl_resize_lock); - if (grow) { - set_bit(MESH_WORK_GROW_MPATH_TABLE, &ifmsh->wrkq_flags); - ieee80211_queue_work(&local->hw, &sdata->work); - } - return 0; - -err_exists: - spin_unlock(&tbl->hashwlock[hash_idx]); - read_unlock_bh(&pathtbl_resize_lock); - kfree(new_node); -err_node_alloc: - kfree(new_mpath); -err_path_alloc: - atomic_dec(&sdata->u.mesh.mpaths); - return err; -} - -static void mesh_table_free_rcu(struct rcu_head *rcu) -{ - struct mesh_table *tbl = container_of(rcu, struct mesh_table, rcu_head); - - mesh_table_free(tbl, false); -} - -void mesh_mpath_table_grow(void) -{ - struct mesh_table *oldtbl, *newtbl; - - write_lock_bh(&pathtbl_resize_lock); - oldtbl = resize_dereference_mesh_paths(); - newtbl = mesh_table_alloc(oldtbl->size_order + 1); - if (!newtbl) - goto out; - if (mesh_table_grow(oldtbl, newtbl) < 0) { - __mesh_table_free(newtbl); - goto out; - } - rcu_assign_pointer(mesh_paths, newtbl); - - call_rcu(&oldtbl->rcu_head, mesh_table_free_rcu); - - out: - write_unlock_bh(&pathtbl_resize_lock); -} - -void mesh_mpp_table_grow(void) -{ - struct mesh_table *oldtbl, *newtbl; - - write_lock_bh(&pathtbl_resize_lock); - oldtbl = resize_dereference_mpp_paths(); - newtbl = mesh_table_alloc(oldtbl->size_order + 1); - if (!newtbl) - goto out; - if (mesh_table_grow(oldtbl, newtbl) < 0) { - __mesh_table_free(newtbl); - goto out; - } - rcu_assign_pointer(mpp_paths, newtbl); - call_rcu(&oldtbl->rcu_head, mesh_table_free_rcu); - - out: - write_unlock_bh(&pathtbl_resize_lock); -} - -int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - struct ieee80211_local *local = sdata->local; - struct mesh_table *tbl; - struct mesh_path *mpath, *new_mpath; - struct mpath_node *node, *new_node; - struct hlist_head *bucket; - struct hlist_node *n; - int grow = 0; - int err = 0; - u32 hash_idx; - - if (compare_ether_addr(dst, sdata->vif.addr) == 0) - /* never add ourselves as neighbours */ - return -ENOTSUPP; - - if (is_multicast_ether_addr(dst)) - return -ENOTSUPP; - - err = -ENOMEM; - new_mpath = kzalloc(sizeof(struct mesh_path), GFP_ATOMIC); - if (!new_mpath) - goto err_path_alloc; - - new_node = kmalloc(sizeof(struct mpath_node), GFP_ATOMIC); - if (!new_node) - goto err_node_alloc; - - read_lock_bh(&pathtbl_resize_lock); - memcpy(new_mpath->dst, dst, ETH_ALEN); - memcpy(new_mpath->mpp, mpp, ETH_ALEN); - new_mpath->sdata = sdata; - new_mpath->flags = 0; - skb_queue_head_init(&new_mpath->frame_queue); - new_node->mpath = new_mpath; - init_timer(&new_mpath->timer); - new_mpath->exp_time = jiffies; - spin_lock_init(&new_mpath->state_lock); - - tbl = resize_dereference_mpp_paths(); - - hash_idx = mesh_table_hash(dst, sdata, tbl); - bucket = &tbl->hash_buckets[hash_idx]; - - spin_lock(&tbl->hashwlock[hash_idx]); - - err = -EEXIST; - hlist_for_each_entry(node, n, bucket, list) { - mpath = node->mpath; - if (mpath->sdata == sdata && - compare_ether_addr(dst, mpath->dst) == 0) - goto err_exists; - } - - hlist_add_head_rcu(&new_node->list, bucket); - if (atomic_inc_return(&tbl->entries) >= - tbl->mean_chain_len * (tbl->hash_mask + 1)) - grow = 1; - - spin_unlock(&tbl->hashwlock[hash_idx]); - read_unlock_bh(&pathtbl_resize_lock); - if (grow) { - set_bit(MESH_WORK_GROW_MPP_TABLE, &ifmsh->wrkq_flags); - ieee80211_queue_work(&local->hw, &sdata->work); - } - return 0; - -err_exists: - spin_unlock(&tbl->hashwlock[hash_idx]); - read_unlock_bh(&pathtbl_resize_lock); - kfree(new_node); -err_node_alloc: - kfree(new_mpath); -err_path_alloc: - return err; -} - - -/** - * mesh_plink_broken - deactivates paths and sends perr when a link breaks - * - * @sta: broken peer link - * - * This function must be called from the rate control algorithm if enough - * delivery errors suggest that a peer link is no longer usable. - */ -void mesh_plink_broken(struct sta_info *sta) -{ - struct mesh_table *tbl; - static const u8 bcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - struct mesh_path *mpath; - struct mpath_node *node; - struct hlist_node *p; - struct ieee80211_sub_if_data *sdata = sta->sdata; - int i; - __le16 reason = cpu_to_le16(WLAN_REASON_MESH_PATH_DEST_UNREACHABLE); - - rcu_read_lock(); - tbl = rcu_dereference(mesh_paths); - for_each_mesh_entry(tbl, p, node, i) { - mpath = node->mpath; - if (rcu_dereference(mpath->next_hop) == sta && - mpath->flags & MESH_PATH_ACTIVE && - !(mpath->flags & MESH_PATH_FIXED)) { - spin_lock_bh(&mpath->state_lock); - mpath->flags &= ~MESH_PATH_ACTIVE; - ++mpath->sn; - spin_unlock_bh(&mpath->state_lock); - mesh_path_error_tx(sdata->u.mesh.mshcfg.element_ttl, - mpath->dst, cpu_to_le32(mpath->sn), - reason, bcast, sdata); - } - } - rcu_read_unlock(); -} - -static void mesh_path_node_reclaim(struct rcu_head *rp) -{ - struct mpath_node *node = container_of(rp, struct mpath_node, rcu); - struct ieee80211_sub_if_data *sdata = node->mpath->sdata; - - del_timer_sync(&node->mpath->timer); - atomic_dec(&sdata->u.mesh.mpaths); - kfree(node->mpath); - kfree(node); -} - -/* needs to be called with the corresponding hashwlock taken */ -static void __mesh_path_del(struct mesh_table *tbl, struct mpath_node *node) -{ - struct mesh_path *mpath; - mpath = node->mpath; - spin_lock(&mpath->state_lock); - mpath->flags |= MESH_PATH_RESOLVING; - if (mpath->is_gate) - mesh_gate_del(tbl, mpath); - hlist_del_rcu(&node->list); - call_rcu(&node->rcu, mesh_path_node_reclaim); - spin_unlock(&mpath->state_lock); - atomic_dec(&tbl->entries); -} - -/** - * mesh_path_flush_by_nexthop - Deletes mesh paths if their next hop matches - * - * @sta - mesh peer to match - * - * RCU notes: this function is called when a mesh plink transitions from - * PLINK_ESTAB to any other state, since PLINK_ESTAB state is the only one that - * allows path creation. This will happen before the sta can be freed (because - * sta_info_destroy() calls this) so any reader in a rcu read block will be - * protected against the plink disappearing. - */ -void mesh_path_flush_by_nexthop(struct sta_info *sta) -{ - struct mesh_table *tbl; - struct mesh_path *mpath; - struct mpath_node *node; - struct hlist_node *p; - int i; - - rcu_read_lock(); - read_lock_bh(&pathtbl_resize_lock); - tbl = resize_dereference_mesh_paths(); - for_each_mesh_entry(tbl, p, node, i) { - mpath = node->mpath; - if (rcu_dereference(mpath->next_hop) == sta) { - spin_lock(&tbl->hashwlock[i]); - __mesh_path_del(tbl, node); - spin_unlock(&tbl->hashwlock[i]); - } - } - read_unlock_bh(&pathtbl_resize_lock); - rcu_read_unlock(); -} - -static void table_flush_by_iface(struct mesh_table *tbl, - struct ieee80211_sub_if_data *sdata) -{ - struct mesh_path *mpath; - struct mpath_node *node; - struct hlist_node *p; - int i; - - WARN_ON(!rcu_read_lock_held()); - for_each_mesh_entry(tbl, p, node, i) { - mpath = node->mpath; - if (mpath->sdata != sdata) - continue; - spin_lock_bh(&tbl->hashwlock[i]); - __mesh_path_del(tbl, node); - spin_unlock_bh(&tbl->hashwlock[i]); - } -} - -/** - * mesh_path_flush_by_iface - Deletes all mesh paths associated with a given iface - * - * This function deletes both mesh paths as well as mesh portal paths. - * - * @sdata - interface data to match - * - */ -void mesh_path_flush_by_iface(struct ieee80211_sub_if_data *sdata) -{ - struct mesh_table *tbl; - - rcu_read_lock(); - read_lock_bh(&pathtbl_resize_lock); - tbl = resize_dereference_mesh_paths(); - table_flush_by_iface(tbl, sdata); - tbl = resize_dereference_mpp_paths(); - table_flush_by_iface(tbl, sdata); - read_unlock_bh(&pathtbl_resize_lock); - rcu_read_unlock(); -} - -/** - * mesh_path_del - delete a mesh path from the table - * - * @addr: dst address (ETH_ALEN length) - * @sdata: local subif - * - * Returns: 0 if successful - */ -int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata) -{ - struct mesh_table *tbl; - struct mesh_path *mpath; - struct mpath_node *node; - struct hlist_head *bucket; - struct hlist_node *n; - int hash_idx; - int err = 0; - - read_lock_bh(&pathtbl_resize_lock); - tbl = resize_dereference_mesh_paths(); - hash_idx = mesh_table_hash(addr, sdata, tbl); - bucket = &tbl->hash_buckets[hash_idx]; - - spin_lock(&tbl->hashwlock[hash_idx]); - hlist_for_each_entry(node, n, bucket, list) { - mpath = node->mpath; - if (mpath->sdata == sdata && - compare_ether_addr(addr, mpath->dst) == 0) { - __mesh_path_del(tbl, node); - goto enddel; - } - } - - err = -ENXIO; -enddel: - mesh_paths_generation++; - spin_unlock(&tbl->hashwlock[hash_idx]); - read_unlock_bh(&pathtbl_resize_lock); - return err; -} - -/** - * mesh_path_tx_pending - sends pending frames in a mesh path queue - * - * @mpath: mesh path to activate - * - * Locking: the state_lock of the mpath structure must NOT be held when calling - * this function. - */ -void mesh_path_tx_pending(struct mesh_path *mpath) -{ - if (mpath->flags & MESH_PATH_ACTIVE) - ieee80211_add_pending_skbs(mpath->sdata->local, - &mpath->frame_queue); -} - -/** - * mesh_path_send_to_gates - sends pending frames to all known mesh gates - * - * @mpath: mesh path whose queue will be emptied - * - * If there is only one gate, the frames are transferred from the failed mpath - * queue to that gate's queue. If there are more than one gates, the frames - * are copied from each gate to the next. After frames are copied, the - * mpath queues are emptied onto the transmission queue. - */ -int mesh_path_send_to_gates(struct mesh_path *mpath) -{ - struct ieee80211_sub_if_data *sdata = mpath->sdata; - struct hlist_node *n; - struct mesh_table *tbl; - struct mesh_path *from_mpath = mpath; - struct mpath_node *gate = NULL; - bool copy = false; - struct hlist_head *known_gates; - - rcu_read_lock(); - tbl = rcu_dereference(mesh_paths); - known_gates = tbl->known_gates; - rcu_read_unlock(); - - if (!known_gates) - return -EHOSTUNREACH; - - hlist_for_each_entry_rcu(gate, n, known_gates, list) { - if (gate->mpath->sdata != sdata) - continue; - - if (gate->mpath->flags & MESH_PATH_ACTIVE) { - mpath_dbg("Forwarding to %pM\n", gate->mpath->dst); - mesh_path_move_to_queue(gate->mpath, from_mpath, copy); - from_mpath = gate->mpath; - copy = true; - } else { - mpath_dbg("Not forwarding %p\n", gate->mpath); - mpath_dbg("flags %x\n", gate->mpath->flags); - } - } - - hlist_for_each_entry_rcu(gate, n, known_gates, list) - if (gate->mpath->sdata == sdata) { - mpath_dbg("Sending to %pM\n", gate->mpath->dst); - mesh_path_tx_pending(gate->mpath); - } - - return (from_mpath == mpath) ? -EHOSTUNREACH : 0; -} - -/** - * mesh_path_discard_frame - discard a frame whose path could not be resolved - * - * @skb: frame to discard - * @sdata: network subif the frame was to be sent through - * - * Locking: the function must me called within a rcu_read_lock region - */ -void mesh_path_discard_frame(struct sk_buff *skb, - struct ieee80211_sub_if_data *sdata) -{ - kfree_skb(skb); - sdata->u.mesh.mshstats.dropped_frames_no_route++; -} - -/** - * mesh_path_flush_pending - free the pending queue of a mesh path - * - * @mpath: mesh path whose queue has to be freed - * - * Locking: the function must me called within a rcu_read_lock region - */ -void mesh_path_flush_pending(struct mesh_path *mpath) -{ - struct sk_buff *skb; - - while ((skb = skb_dequeue(&mpath->frame_queue)) != NULL) - mesh_path_discard_frame(skb, mpath->sdata); -} - -/** - * mesh_path_fix_nexthop - force a specific next hop for a mesh path - * - * @mpath: the mesh path to modify - * @next_hop: the next hop to force - * - * Locking: this function must be called holding mpath->state_lock - */ -void mesh_path_fix_nexthop(struct mesh_path *mpath, struct sta_info *next_hop) -{ - spin_lock_bh(&mpath->state_lock); - mesh_path_assign_nexthop(mpath, next_hop); - mpath->sn = 0xffff; - mpath->metric = 0; - mpath->hop_count = 0; - mpath->exp_time = 0; - mpath->flags |= MESH_PATH_FIXED; - mesh_path_activate(mpath); - spin_unlock_bh(&mpath->state_lock); - mesh_path_tx_pending(mpath); -} - -static void mesh_path_node_free(struct hlist_node *p, bool free_leafs) -{ - struct mesh_path *mpath; - struct mpath_node *node = hlist_entry(p, struct mpath_node, list); - mpath = node->mpath; - hlist_del_rcu(p); - if (free_leafs) { - del_timer_sync(&mpath->timer); - kfree(mpath); - } - kfree(node); -} - -static int mesh_path_node_copy(struct hlist_node *p, struct mesh_table *newtbl) -{ - struct mesh_path *mpath; - struct mpath_node *node, *new_node; - u32 hash_idx; - - new_node = kmalloc(sizeof(struct mpath_node), GFP_ATOMIC); - if (new_node == NULL) - return -ENOMEM; - - node = hlist_entry(p, struct mpath_node, list); - mpath = node->mpath; - new_node->mpath = mpath; - hash_idx = mesh_table_hash(mpath->dst, mpath->sdata, newtbl); - hlist_add_head(&new_node->list, - &newtbl->hash_buckets[hash_idx]); - return 0; -} - -int mesh_pathtbl_init(void) -{ - struct mesh_table *tbl_path, *tbl_mpp; - int ret; - - tbl_path = mesh_table_alloc(INIT_PATHS_SIZE_ORDER); - if (!tbl_path) - return -ENOMEM; - tbl_path->free_node = &mesh_path_node_free; - tbl_path->copy_node = &mesh_path_node_copy; - tbl_path->mean_chain_len = MEAN_CHAIN_LEN; - tbl_path->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC); - if (!tbl_path->known_gates) { - ret = -ENOMEM; - goto free_path; - } - INIT_HLIST_HEAD(tbl_path->known_gates); - - - tbl_mpp = mesh_table_alloc(INIT_PATHS_SIZE_ORDER); - if (!tbl_mpp) { - ret = -ENOMEM; - goto free_path; - } - tbl_mpp->free_node = &mesh_path_node_free; - tbl_mpp->copy_node = &mesh_path_node_copy; - tbl_mpp->mean_chain_len = MEAN_CHAIN_LEN; - tbl_mpp->known_gates = kzalloc(sizeof(struct hlist_head), GFP_ATOMIC); - if (!tbl_mpp->known_gates) { - ret = -ENOMEM; - goto free_mpp; - } - INIT_HLIST_HEAD(tbl_mpp->known_gates); - - /* Need no locking since this is during init */ - RCU_INIT_POINTER(mesh_paths, tbl_path); - RCU_INIT_POINTER(mpp_paths, tbl_mpp); - - return 0; - -free_mpp: - mesh_table_free(tbl_mpp, true); -free_path: - mesh_table_free(tbl_path, true); - return ret; -} - -void mesh_path_expire(struct ieee80211_sub_if_data *sdata) -{ - struct mesh_table *tbl; - struct mesh_path *mpath; - struct mpath_node *node; - struct hlist_node *p; - int i; - - rcu_read_lock(); - tbl = rcu_dereference(mesh_paths); - for_each_mesh_entry(tbl, p, node, i) { - if (node->mpath->sdata != sdata) - continue; - mpath = node->mpath; - if ((!(mpath->flags & MESH_PATH_RESOLVING)) && - (!(mpath->flags & MESH_PATH_FIXED)) && - time_after(jiffies, mpath->exp_time + MESH_PATH_EXPIRE)) - mesh_path_del(mpath->dst, mpath->sdata); - } - rcu_read_unlock(); -} - -void mesh_pathtbl_unregister(void) -{ - /* no need for locking during exit path */ - mesh_table_free(rcu_dereference_protected(mesh_paths, 1), true); - mesh_table_free(rcu_dereference_protected(mpp_paths, 1), true); -} diff --git a/openairITS/mac/DOT11/net/mac80211/mesh_plink.c b/openairITS/mac/DOT11/net/mac80211/mesh_plink.c deleted file mode 100644 index 4e53c4cbca9..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/mesh_plink.c +++ /dev/null @@ -1,867 +0,0 @@ -/* - * Copyright (c) 2008, 2009 open80211s Ltd. - * Author: Luis Carlos Cobo <luisca@cozybit.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include <linux/gfp.h> -#include <linux/kernel.h> -#include <linux/random.h> -#include "ieee80211_i.h" -#include "rate.h" -#include "mesh.h" - -#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG -#define mpl_dbg(fmt, args...) printk(KERN_DEBUG fmt, ##args) -#else -#define mpl_dbg(fmt, args...) do { (void)(0); } while (0) -#endif - -#define PLINK_GET_LLID(p) (p + 2) -#define PLINK_GET_PLID(p) (p + 4) - -#define mod_plink_timer(s, t) (mod_timer(&s->plink_timer, \ - jiffies + HZ * t / 1000)) - -#define dot11MeshMaxRetries(s) (s->u.mesh.mshcfg.dot11MeshMaxRetries) -#define dot11MeshRetryTimeout(s) (s->u.mesh.mshcfg.dot11MeshRetryTimeout) -#define dot11MeshConfirmTimeout(s) (s->u.mesh.mshcfg.dot11MeshConfirmTimeout) -#define dot11MeshHoldingTimeout(s) (s->u.mesh.mshcfg.dot11MeshHoldingTimeout) -#define dot11MeshMaxPeerLinks(s) (s->u.mesh.mshcfg.dot11MeshMaxPeerLinks) - -/* We only need a valid sta if user configured a minimum rssi_threshold. */ -#define rssi_threshold_check(sta, sdata) \ - (sdata->u.mesh.mshcfg.rssi_threshold == 0 ||\ - (sta && (s8) -ewma_read(&sta->avg_signal) > \ - sdata->u.mesh.mshcfg.rssi_threshold)) - -enum plink_event { - PLINK_UNDEFINED, - OPN_ACPT, - OPN_RJCT, - OPN_IGNR, - CNF_ACPT, - CNF_RJCT, - CNF_IGNR, - CLS_ACPT, - CLS_IGNR -}; - -static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, - enum ieee80211_self_protected_actioncode action, - u8 *da, __le16 llid, __le16 plid, __le16 reason); - -static inline -void mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata) -{ - atomic_inc(&sdata->u.mesh.mshstats.estab_plinks); - mesh_accept_plinks_update(sdata); -} - -static inline -void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata) -{ - atomic_dec(&sdata->u.mesh.mshstats.estab_plinks); - mesh_accept_plinks_update(sdata); -} - -/** - * mesh_plink_fsm_restart - restart a mesh peer link finite state machine - * - * @sta: mesh peer link to restart - * - * Locking: this function must be called holding sta->lock - */ -static inline void mesh_plink_fsm_restart(struct sta_info *sta) -{ - sta->plink_state = NL80211_PLINK_LISTEN; - sta->llid = sta->plid = sta->reason = 0; - sta->plink_retries = 0; -} - -/* - * NOTE: This is just an alias for sta_info_alloc(), see notes - * on it in the lifecycle management section! - */ -static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata, - u8 *hw_addr, u32 rates, - struct ieee802_11_elems *elems) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_supported_band *sband; - struct sta_info *sta; - - sband = local->hw.wiphy->bands[local->oper_channel->band]; - - if (local->num_sta >= MESH_MAX_PLINKS) - return NULL; - - sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL); - if (!sta) - return NULL; - - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); - - set_sta_flag(sta, WLAN_STA_WME); - - sta->sta.supp_rates[local->hw.conf.channel->band] = rates; - if (elems->ht_cap_elem) - ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, - elems->ht_cap_elem, - &sta->sta.ht_cap); - rate_control_rate_init(sta); - - return sta; -} - -/** - * __mesh_plink_deactivate - deactivate mesh peer link - * - * @sta: mesh peer link to deactivate - * - * All mesh paths with this peer as next hop will be flushed - * - * Locking: the caller must hold sta->lock - */ -static bool __mesh_plink_deactivate(struct sta_info *sta) -{ - struct ieee80211_sub_if_data *sdata = sta->sdata; - bool deactivated = false; - - if (sta->plink_state == NL80211_PLINK_ESTAB) { - mesh_plink_dec_estab_count(sdata); - deactivated = true; - } - sta->plink_state = NL80211_PLINK_BLOCKED; - mesh_path_flush_by_nexthop(sta); - - return deactivated; -} - -/** - * mesh_plink_deactivate - deactivate mesh peer link - * - * @sta: mesh peer link to deactivate - * - * All mesh paths with this peer as next hop will be flushed - */ -void mesh_plink_deactivate(struct sta_info *sta) -{ - struct ieee80211_sub_if_data *sdata = sta->sdata; - bool deactivated; - - spin_lock_bh(&sta->lock); - deactivated = __mesh_plink_deactivate(sta); - sta->reason = cpu_to_le16(WLAN_REASON_MESH_PEER_CANCELED); - mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE, - sta->sta.addr, sta->llid, sta->plid, - sta->reason); - spin_unlock_bh(&sta->lock); - - if (deactivated) - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON); -} - -static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, - enum ieee80211_self_protected_actioncode action, - u8 *da, __le16 llid, __le16 plid, __le16 reason) { - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - bool include_plid = false; - u16 peering_proto = 0; - u8 *pos, ie_len = 4; - int hdr_len = offsetof(struct ieee80211_mgmt, u.action.u.self_prot) + - sizeof(mgmt->u.action.u.self_prot); - - skb = dev_alloc_skb(local->tx_headroom + - hdr_len + - 2 + /* capability info */ - 2 + /* AID */ - 2 + 8 + /* supported rates */ - 2 + (IEEE80211_MAX_SUPP_RATES - 8) + - 2 + sdata->u.mesh.mesh_id_len + - 2 + sizeof(struct ieee80211_meshconf_ie) + - 2 + sizeof(struct ieee80211_ht_cap) + - 2 + sizeof(struct ieee80211_ht_info) + - 2 + 8 + /* peering IE */ - sdata->u.mesh.ie_len); - if (!skb) - return -1; - skb_reserve(skb, local->tx_headroom); - mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); - memset(mgmt, 0, hdr_len); - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - memcpy(mgmt->da, da, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); - mgmt->u.action.category = WLAN_CATEGORY_SELF_PROTECTED; - mgmt->u.action.u.self_prot.action_code = action; - - if (action != WLAN_SP_MESH_PEERING_CLOSE) { - /* capability info */ - pos = skb_put(skb, 2); - memset(pos, 0, 2); - if (action == WLAN_SP_MESH_PEERING_CONFIRM) { - /* AID */ - pos = skb_put(skb, 2); - memcpy(pos + 2, &plid, 2); - } - if (ieee80211_add_srates_ie(&sdata->vif, skb) || - ieee80211_add_ext_srates_ie(&sdata->vif, skb) || - mesh_add_rsn_ie(skb, sdata) || - mesh_add_meshid_ie(skb, sdata) || - mesh_add_meshconf_ie(skb, sdata)) - return -1; - } else { /* WLAN_SP_MESH_PEERING_CLOSE */ - if (mesh_add_meshid_ie(skb, sdata)) - return -1; - } - - /* Add Mesh Peering Management element */ - switch (action) { - case WLAN_SP_MESH_PEERING_OPEN: - break; - case WLAN_SP_MESH_PEERING_CONFIRM: - ie_len += 2; - include_plid = true; - break; - case WLAN_SP_MESH_PEERING_CLOSE: - if (plid) { - ie_len += 2; - include_plid = true; - } - ie_len += 2; /* reason code */ - break; - default: - return -EINVAL; - } - - if (WARN_ON(skb_tailroom(skb) < 2 + ie_len)) - return -ENOMEM; - - pos = skb_put(skb, 2 + ie_len); - *pos++ = WLAN_EID_PEER_MGMT; - *pos++ = ie_len; - memcpy(pos, &peering_proto, 2); - pos += 2; - memcpy(pos, &llid, 2); - pos += 2; - if (include_plid) { - memcpy(pos, &plid, 2); - pos += 2; - } - if (action == WLAN_SP_MESH_PEERING_CLOSE) { - memcpy(pos, &reason, 2); - pos += 2; - } - - if (action != WLAN_SP_MESH_PEERING_CLOSE) { - if (mesh_add_ht_cap_ie(skb, sdata) || - mesh_add_ht_info_ie(skb, sdata)) - return -1; - } - - if (mesh_add_vendor_ies(skb, sdata)) - return -1; - - ieee80211_tx_skb(sdata, skb); - return 0; -} - -void mesh_neighbour_update(u8 *hw_addr, u32 rates, - struct ieee80211_sub_if_data *sdata, - struct ieee802_11_elems *elems) -{ - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - - rcu_read_lock(); - - sta = sta_info_get(sdata, hw_addr); - if (!sta) { - rcu_read_unlock(); - /* Userspace handles peer allocation when security is enabled - * */ - if (sdata->u.mesh.security & IEEE80211_MESH_SEC_AUTHED) - cfg80211_notify_new_peer_candidate(sdata->dev, hw_addr, - elems->ie_start, elems->total_len, - GFP_KERNEL); - else - sta = mesh_plink_alloc(sdata, hw_addr, rates, elems); - if (!sta) - return; - if (sta_info_insert_rcu(sta)) { - rcu_read_unlock(); - return; - } - } - - sta->last_rx = jiffies; - sta->sta.supp_rates[local->hw.conf.channel->band] = rates; - if (mesh_peer_accepts_plinks(elems) && - sta->plink_state == NL80211_PLINK_LISTEN && - sdata->u.mesh.accepting_plinks && - sdata->u.mesh.mshcfg.auto_open_plinks && - rssi_threshold_check(sta, sdata)) - mesh_plink_open(sta); - - rcu_read_unlock(); -} - -static void mesh_plink_timer(unsigned long data) -{ - struct sta_info *sta; - __le16 llid, plid, reason; - struct ieee80211_sub_if_data *sdata; - - /* - * This STA is valid because sta_info_destroy() will - * del_timer_sync() this timer after having made sure - * it cannot be readded (by deleting the plink.) - */ - sta = (struct sta_info *) data; - - if (sta->sdata->local->quiescing) { - sta->plink_timer_was_running = true; - return; - } - - spin_lock_bh(&sta->lock); - if (sta->ignore_plink_timer) { - sta->ignore_plink_timer = false; - spin_unlock_bh(&sta->lock); - return; - } - mpl_dbg("Mesh plink timer for %pM fired on state %d\n", - sta->sta.addr, sta->plink_state); - reason = 0; - llid = sta->llid; - plid = sta->plid; - sdata = sta->sdata; - - switch (sta->plink_state) { - case NL80211_PLINK_OPN_RCVD: - case NL80211_PLINK_OPN_SNT: - /* retry timer */ - if (sta->plink_retries < dot11MeshMaxRetries(sdata)) { - u32 rand; - mpl_dbg("Mesh plink for %pM (retry, timeout): %d %d\n", - sta->sta.addr, sta->plink_retries, - sta->plink_timeout); - get_random_bytes(&rand, sizeof(u32)); - sta->plink_timeout = sta->plink_timeout + - rand % sta->plink_timeout; - ++sta->plink_retries; - mod_plink_timer(sta, sta->plink_timeout); - spin_unlock_bh(&sta->lock); - mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN, - sta->sta.addr, llid, 0, 0); - break; - } - reason = cpu_to_le16(WLAN_REASON_MESH_MAX_RETRIES); - /* fall through on else */ - case NL80211_PLINK_CNF_RCVD: - /* confirm timer */ - if (!reason) - reason = cpu_to_le16(WLAN_REASON_MESH_CONFIRM_TIMEOUT); - sta->plink_state = NL80211_PLINK_HOLDING; - mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); - spin_unlock_bh(&sta->lock); - mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE, - sta->sta.addr, llid, plid, reason); - break; - case NL80211_PLINK_HOLDING: - /* holding timer */ - del_timer(&sta->plink_timer); - mesh_plink_fsm_restart(sta); - spin_unlock_bh(&sta->lock); - break; - default: - spin_unlock_bh(&sta->lock); - break; - } -} - -#ifdef CONFIG_PM -void mesh_plink_quiesce(struct sta_info *sta) -{ - if (del_timer_sync(&sta->plink_timer)) - sta->plink_timer_was_running = true; -} - -void mesh_plink_restart(struct sta_info *sta) -{ - if (sta->plink_timer_was_running) { - add_timer(&sta->plink_timer); - sta->plink_timer_was_running = false; - } -} -#endif - -static inline void mesh_plink_timer_set(struct sta_info *sta, int timeout) -{ - sta->plink_timer.expires = jiffies + (HZ * timeout / 1000); - sta->plink_timer.data = (unsigned long) sta; - sta->plink_timer.function = mesh_plink_timer; - sta->plink_timeout = timeout; - add_timer(&sta->plink_timer); -} - -int mesh_plink_open(struct sta_info *sta) -{ - __le16 llid; - struct ieee80211_sub_if_data *sdata = sta->sdata; - - if (!test_sta_flag(sta, WLAN_STA_AUTH)) - return -EPERM; - - spin_lock_bh(&sta->lock); - get_random_bytes(&llid, 2); - sta->llid = llid; - if (sta->plink_state != NL80211_PLINK_LISTEN) { - spin_unlock_bh(&sta->lock); - return -EBUSY; - } - sta->plink_state = NL80211_PLINK_OPN_SNT; - mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); - spin_unlock_bh(&sta->lock); - mpl_dbg("Mesh plink: starting establishment with %pM\n", - sta->sta.addr); - - return mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN, - sta->sta.addr, llid, 0, 0); -} - -void mesh_plink_block(struct sta_info *sta) -{ - struct ieee80211_sub_if_data *sdata = sta->sdata; - bool deactivated; - - spin_lock_bh(&sta->lock); - deactivated = __mesh_plink_deactivate(sta); - sta->plink_state = NL80211_PLINK_BLOCKED; - spin_unlock_bh(&sta->lock); - - if (deactivated) - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON); -} - - -void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt, - size_t len, struct ieee80211_rx_status *rx_status) -{ - struct ieee80211_local *local = sdata->local; - struct ieee802_11_elems elems; - struct sta_info *sta; - enum plink_event event; - enum ieee80211_self_protected_actioncode ftype; - size_t baselen; - bool deactivated, matches_local = true; - u8 ie_len; - u8 *baseaddr; - __le16 plid, llid, reason; -#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG - static const char *mplstates[] = { - [NL80211_PLINK_LISTEN] = "LISTEN", - [NL80211_PLINK_OPN_SNT] = "OPN-SNT", - [NL80211_PLINK_OPN_RCVD] = "OPN-RCVD", - [NL80211_PLINK_CNF_RCVD] = "CNF_RCVD", - [NL80211_PLINK_ESTAB] = "ESTAB", - [NL80211_PLINK_HOLDING] = "HOLDING", - [NL80211_PLINK_BLOCKED] = "BLOCKED" - }; -#endif - - /* need action_code, aux */ - if (len < IEEE80211_MIN_ACTION_SIZE + 3) - return; - - if (is_multicast_ether_addr(mgmt->da)) { - mpl_dbg("Mesh plink: ignore frame from multicast address"); - return; - } - - baseaddr = mgmt->u.action.u.self_prot.variable; - baselen = (u8 *) mgmt->u.action.u.self_prot.variable - (u8 *) mgmt; - if (mgmt->u.action.u.self_prot.action_code == - WLAN_SP_MESH_PEERING_CONFIRM) { - baseaddr += 4; - baselen += 4; - } - ieee802_11_parse_elems(baseaddr, len - baselen, &elems); - if (!elems.peering) { - mpl_dbg("Mesh plink: missing necessary peer link ie\n"); - return; - } - if (elems.rsn_len && - sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) { - mpl_dbg("Mesh plink: can't establish link with secure peer\n"); - return; - } - - ftype = mgmt->u.action.u.self_prot.action_code; - ie_len = elems.peering_len; - if ((ftype == WLAN_SP_MESH_PEERING_OPEN && ie_len != 4) || - (ftype == WLAN_SP_MESH_PEERING_CONFIRM && ie_len != 6) || - (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len != 6 - && ie_len != 8)) { - mpl_dbg("Mesh plink: incorrect plink ie length %d %d\n", - ftype, ie_len); - return; - } - - if (ftype != WLAN_SP_MESH_PEERING_CLOSE && - (!elems.mesh_id || !elems.mesh_config)) { - mpl_dbg("Mesh plink: missing necessary ie\n"); - return; - } - /* Note the lines below are correct, the llid in the frame is the plid - * from the point of view of this host. - */ - memcpy(&plid, PLINK_GET_LLID(elems.peering), 2); - if (ftype == WLAN_SP_MESH_PEERING_CONFIRM || - (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len == 8)) - memcpy(&llid, PLINK_GET_PLID(elems.peering), 2); - - rcu_read_lock(); - - sta = sta_info_get(sdata, mgmt->sa); - if (!sta && ftype != WLAN_SP_MESH_PEERING_OPEN) { - mpl_dbg("Mesh plink: cls or cnf from unknown peer\n"); - rcu_read_unlock(); - return; - } - - if (ftype == WLAN_SP_MESH_PEERING_OPEN && - !rssi_threshold_check(sta, sdata)) { - mpl_dbg("Mesh plink: %pM does not meet rssi threshold\n", - mgmt->sa); - rcu_read_unlock(); - return; - } - - if (sta && !test_sta_flag(sta, WLAN_STA_AUTH)) { - mpl_dbg("Mesh plink: Action frame from non-authed peer\n"); - rcu_read_unlock(); - return; - } - - if (sta && sta->plink_state == NL80211_PLINK_BLOCKED) { - rcu_read_unlock(); - return; - } - - /* Now we will figure out the appropriate event... */ - event = PLINK_UNDEFINED; - if (ftype != WLAN_SP_MESH_PEERING_CLOSE && - (!mesh_matches_local(&elems, sdata))) { - matches_local = false; - switch (ftype) { - case WLAN_SP_MESH_PEERING_OPEN: - event = OPN_RJCT; - break; - case WLAN_SP_MESH_PEERING_CONFIRM: - event = CNF_RJCT; - break; - default: - break; - } - } - - if (!sta && !matches_local) { - rcu_read_unlock(); - reason = cpu_to_le16(WLAN_REASON_MESH_CONFIG); - llid = 0; - mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE, - mgmt->sa, llid, plid, reason); - return; - } else if (!sta) { - /* ftype == WLAN_SP_MESH_PEERING_OPEN */ - u32 rates; - - rcu_read_unlock(); - - if (!mesh_plink_free_count(sdata)) { - mpl_dbg("Mesh plink error: no more free plinks\n"); - return; - } - - rates = ieee80211_sta_get_rates(local, &elems, rx_status->band); - sta = mesh_plink_alloc(sdata, mgmt->sa, rates, &elems); - if (!sta) { - mpl_dbg("Mesh plink error: plink table full\n"); - return; - } - if (sta_info_insert_rcu(sta)) { - rcu_read_unlock(); - return; - } - event = OPN_ACPT; - spin_lock_bh(&sta->lock); - } else if (matches_local) { - spin_lock_bh(&sta->lock); - switch (ftype) { - case WLAN_SP_MESH_PEERING_OPEN: - if (!mesh_plink_free_count(sdata) || - (sta->plid && sta->plid != plid)) - event = OPN_IGNR; - else - event = OPN_ACPT; - break; - case WLAN_SP_MESH_PEERING_CONFIRM: - if (!mesh_plink_free_count(sdata) || - (sta->llid != llid || sta->plid != plid)) - event = CNF_IGNR; - else - event = CNF_ACPT; - break; - case WLAN_SP_MESH_PEERING_CLOSE: - if (sta->plink_state == NL80211_PLINK_ESTAB) - /* Do not check for llid or plid. This does not - * follow the standard but since multiple plinks - * per sta are not supported, it is necessary in - * order to avoid a livelock when MP A sees an - * establish peer link to MP B but MP B does not - * see it. This can be caused by a timeout in - * B's peer link establishment or B beign - * restarted. - */ - event = CLS_ACPT; - else if (sta->plid != plid) - event = CLS_IGNR; - else if (ie_len == 7 && sta->llid != llid) - event = CLS_IGNR; - else - event = CLS_ACPT; - break; - default: - mpl_dbg("Mesh plink: unknown frame subtype\n"); - spin_unlock_bh(&sta->lock); - rcu_read_unlock(); - return; - } - } else { - spin_lock_bh(&sta->lock); - } - - mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n", - mgmt->sa, mplstates[sta->plink_state], - le16_to_cpu(sta->llid), le16_to_cpu(sta->plid), - event); - reason = 0; - switch (sta->plink_state) { - /* spin_unlock as soon as state is updated at each case */ - case NL80211_PLINK_LISTEN: - switch (event) { - case CLS_ACPT: - mesh_plink_fsm_restart(sta); - spin_unlock_bh(&sta->lock); - break; - case OPN_ACPT: - sta->plink_state = NL80211_PLINK_OPN_RCVD; - sta->plid = plid; - get_random_bytes(&llid, 2); - sta->llid = llid; - mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata)); - spin_unlock_bh(&sta->lock); - mesh_plink_frame_tx(sdata, - WLAN_SP_MESH_PEERING_OPEN, - sta->sta.addr, llid, 0, 0); - mesh_plink_frame_tx(sdata, - WLAN_SP_MESH_PEERING_CONFIRM, - sta->sta.addr, llid, plid, 0); - break; - default: - spin_unlock_bh(&sta->lock); - break; - } - break; - - case NL80211_PLINK_OPN_SNT: - switch (event) { - case OPN_RJCT: - case CNF_RJCT: - reason = cpu_to_le16(WLAN_REASON_MESH_CONFIG); - case CLS_ACPT: - if (!reason) - reason = cpu_to_le16(WLAN_REASON_MESH_CLOSE); - sta->reason = reason; - sta->plink_state = NL80211_PLINK_HOLDING; - if (!mod_plink_timer(sta, - dot11MeshHoldingTimeout(sdata))) - sta->ignore_plink_timer = true; - - llid = sta->llid; - spin_unlock_bh(&sta->lock); - mesh_plink_frame_tx(sdata, - WLAN_SP_MESH_PEERING_CLOSE, - sta->sta.addr, llid, plid, reason); - break; - case OPN_ACPT: - /* retry timer is left untouched */ - sta->plink_state = NL80211_PLINK_OPN_RCVD; - sta->plid = plid; - llid = sta->llid; - spin_unlock_bh(&sta->lock); - mesh_plink_frame_tx(sdata, - WLAN_SP_MESH_PEERING_CONFIRM, - sta->sta.addr, llid, plid, 0); - break; - case CNF_ACPT: - sta->plink_state = NL80211_PLINK_CNF_RCVD; - if (!mod_plink_timer(sta, - dot11MeshConfirmTimeout(sdata))) - sta->ignore_plink_timer = true; - - spin_unlock_bh(&sta->lock); - break; - default: - spin_unlock_bh(&sta->lock); - break; - } - break; - - case NL80211_PLINK_OPN_RCVD: - switch (event) { - case OPN_RJCT: - case CNF_RJCT: - reason = cpu_to_le16(WLAN_REASON_MESH_CONFIG); - case CLS_ACPT: - if (!reason) - reason = cpu_to_le16(WLAN_REASON_MESH_CLOSE); - sta->reason = reason; - sta->plink_state = NL80211_PLINK_HOLDING; - if (!mod_plink_timer(sta, - dot11MeshHoldingTimeout(sdata))) - sta->ignore_plink_timer = true; - - llid = sta->llid; - spin_unlock_bh(&sta->lock); - mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE, - sta->sta.addr, llid, plid, reason); - break; - case OPN_ACPT: - llid = sta->llid; - spin_unlock_bh(&sta->lock); - mesh_plink_frame_tx(sdata, - WLAN_SP_MESH_PEERING_CONFIRM, - sta->sta.addr, llid, plid, 0); - break; - case CNF_ACPT: - del_timer(&sta->plink_timer); - sta->plink_state = NL80211_PLINK_ESTAB; - spin_unlock_bh(&sta->lock); - mesh_plink_inc_estab_count(sdata); - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON); - mpl_dbg("Mesh plink with %pM ESTABLISHED\n", - sta->sta.addr); - break; - default: - spin_unlock_bh(&sta->lock); - break; - } - break; - - case NL80211_PLINK_CNF_RCVD: - switch (event) { - case OPN_RJCT: - case CNF_RJCT: - reason = cpu_to_le16(WLAN_REASON_MESH_CONFIG); - case CLS_ACPT: - if (!reason) - reason = cpu_to_le16(WLAN_REASON_MESH_CLOSE); - sta->reason = reason; - sta->plink_state = NL80211_PLINK_HOLDING; - if (!mod_plink_timer(sta, - dot11MeshHoldingTimeout(sdata))) - sta->ignore_plink_timer = true; - - llid = sta->llid; - spin_unlock_bh(&sta->lock); - mesh_plink_frame_tx(sdata, - WLAN_SP_MESH_PEERING_CLOSE, - sta->sta.addr, llid, plid, reason); - break; - case OPN_ACPT: - del_timer(&sta->plink_timer); - sta->plink_state = NL80211_PLINK_ESTAB; - spin_unlock_bh(&sta->lock); - mesh_plink_inc_estab_count(sdata); - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON); - mpl_dbg("Mesh plink with %pM ESTABLISHED\n", - sta->sta.addr); - mesh_plink_frame_tx(sdata, - WLAN_SP_MESH_PEERING_CONFIRM, - sta->sta.addr, llid, plid, 0); - break; - default: - spin_unlock_bh(&sta->lock); - break; - } - break; - - case NL80211_PLINK_ESTAB: - switch (event) { - case CLS_ACPT: - reason = cpu_to_le16(WLAN_REASON_MESH_CLOSE); - sta->reason = reason; - deactivated = __mesh_plink_deactivate(sta); - sta->plink_state = NL80211_PLINK_HOLDING; - llid = sta->llid; - mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)); - spin_unlock_bh(&sta->lock); - if (deactivated) - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON); - mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE, - sta->sta.addr, llid, plid, reason); - break; - case OPN_ACPT: - llid = sta->llid; - spin_unlock_bh(&sta->lock); - mesh_plink_frame_tx(sdata, - WLAN_SP_MESH_PEERING_CONFIRM, - sta->sta.addr, llid, plid, 0); - break; - default: - spin_unlock_bh(&sta->lock); - break; - } - break; - case NL80211_PLINK_HOLDING: - switch (event) { - case CLS_ACPT: - if (del_timer(&sta->plink_timer)) - sta->ignore_plink_timer = 1; - mesh_plink_fsm_restart(sta); - spin_unlock_bh(&sta->lock); - break; - case OPN_ACPT: - case CNF_ACPT: - case OPN_RJCT: - case CNF_RJCT: - llid = sta->llid; - reason = sta->reason; - spin_unlock_bh(&sta->lock); - mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE, - sta->sta.addr, llid, plid, reason); - break; - default: - spin_unlock_bh(&sta->lock); - } - break; - default: - /* should not get here, PLINK_BLOCKED is dealt with at the - * beginning of the function - */ - spin_unlock_bh(&sta->lock); - break; - } - - rcu_read_unlock(); -} diff --git a/openairITS/mac/DOT11/net/mac80211/michael.c b/openairITS/mac/DOT11/net/mac80211/michael.c deleted file mode 100644 index 408649bd470..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/michael.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Michael MIC implementation - optimized for TKIP MIC operations - * Copyright 2002-2003, Instant802 Networks, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include <linux/types.h> -#include <linux/bitops.h> -#include <linux/ieee80211.h> -#include <asm/unaligned.h> - -#include "michael.h" - -static void michael_block(struct michael_mic_ctx *mctx, u32 val) -{ - mctx->l ^= val; - mctx->r ^= rol32(mctx->l, 17); - mctx->l += mctx->r; - mctx->r ^= ((mctx->l & 0xff00ff00) >> 8) | - ((mctx->l & 0x00ff00ff) << 8); - mctx->l += mctx->r; - mctx->r ^= rol32(mctx->l, 3); - mctx->l += mctx->r; - mctx->r ^= ror32(mctx->l, 2); - mctx->l += mctx->r; -} - -static void michael_mic_hdr(struct michael_mic_ctx *mctx, const u8 *key, - struct ieee80211_hdr *hdr) -{ - u8 *da, *sa, tid; - - da = ieee80211_get_DA(hdr); - sa = ieee80211_get_SA(hdr); - if (ieee80211_is_data_qos(hdr->frame_control)) - tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; - else - tid = 0; - - mctx->l = get_unaligned_le32(key); - mctx->r = get_unaligned_le32(key + 4); - - /* - * A pseudo header (DA, SA, Priority, 0, 0, 0) is used in Michael MIC - * calculation, but it is _not_ transmitted - */ - michael_block(mctx, get_unaligned_le32(da)); - michael_block(mctx, get_unaligned_le16(&da[4]) | - (get_unaligned_le16(sa) << 16)); - michael_block(mctx, get_unaligned_le32(&sa[2])); - michael_block(mctx, tid); -} - -void michael_mic(const u8 *key, struct ieee80211_hdr *hdr, - const u8 *data, size_t data_len, u8 *mic) -{ - u32 val; - size_t block, blocks, left; - struct michael_mic_ctx mctx; - - michael_mic_hdr(&mctx, key, hdr); - - /* Real data */ - blocks = data_len / 4; - left = data_len % 4; - - for (block = 0; block < blocks; block++) - michael_block(&mctx, get_unaligned_le32(&data[block * 4])); - - /* Partial block of 0..3 bytes and padding: 0x5a + 4..7 zeros to make - * total length a multiple of 4. */ - val = 0x5a; - while (left > 0) { - val <<= 8; - left--; - val |= data[blocks * 4 + left]; - } - - michael_block(&mctx, val); - michael_block(&mctx, 0); - - put_unaligned_le32(mctx.l, mic); - put_unaligned_le32(mctx.r, mic + 4); -} diff --git a/openairITS/mac/DOT11/net/mac80211/michael.h b/openairITS/mac/DOT11/net/mac80211/michael.h deleted file mode 100644 index 3b848dad958..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/michael.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Michael MIC implementation - optimized for TKIP MIC operations - * Copyright 2002-2003, Instant802 Networks, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef MICHAEL_H -#define MICHAEL_H - -#include <linux/types.h> - -#define MICHAEL_MIC_LEN 8 - -struct michael_mic_ctx { - u32 l, r; -}; - -void michael_mic(const u8 *key, struct ieee80211_hdr *hdr, - const u8 *data, size_t data_len, u8 *mic); - -#endif /* MICHAEL_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/mlme.c b/openairITS/mac/DOT11/net/mac80211/mlme.c deleted file mode 100644 index f823aa39ee3..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/mlme.c +++ /dev/null @@ -1,3534 +0,0 @@ -/* - * BSS client mode implementation - * Copyright 2003-2008, Jouni Malinen <j@w1.fi> - * Copyright 2004, Instant802 Networks, Inc. - * Copyright 2005, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007, Michael Wu <flamingice@sourmilk.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/delay.h> -#include <linux/if_ether.h> -#include <linux/skbuff.h> -#include <linux/if_arp.h> -#include <linux/etherdevice.h> -#include <linux/moduleparam.h> -#include <linux/rtnetlink.h> -#include <linux/pm_qos.h> -#include <linux/crc32.h> -#include <linux/slab.h> -#include <linux/export.h> -#include <net/mac80211.h> -#include <asm/unaligned.h> - -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "rate.h" -#include "led.h" - -#define IEEE80211_AUTH_TIMEOUT (HZ / 5) -#define IEEE80211_AUTH_MAX_TRIES 3 -#define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5) -#define IEEE80211_ASSOC_TIMEOUT (HZ / 5) -#define IEEE80211_ASSOC_MAX_TRIES 3 - -static int max_nullfunc_tries = 2; -module_param(max_nullfunc_tries, int, 0644); -MODULE_PARM_DESC(max_nullfunc_tries, - "Maximum nullfunc tx tries before disconnecting (reason 4)."); - -static int max_probe_tries = 5; -module_param(max_probe_tries, int, 0644); -MODULE_PARM_DESC(max_probe_tries, - "Maximum probe tries before disconnecting (reason 4)."); - -/* - * Beacon loss timeout is calculated as N frames times the - * advertised beacon interval. This may need to be somewhat - * higher than what hardware might detect to account for - * delays in the host processing frames. But since we also - * probe on beacon miss before declaring the connection lost - * default to what we want. - */ -#define IEEE80211_BEACON_LOSS_COUNT 7 - -/* - * Time the connection can be idle before we probe - * it to see if we can still talk to the AP. - */ -#define IEEE80211_CONNECTION_IDLE_TIME (30 * HZ) -/* - * Time we wait for a probe response after sending - * a probe request because of beacon loss or for - * checking the connection still works. - */ -static int probe_wait_ms = 500; -module_param(probe_wait_ms, int, 0644); -MODULE_PARM_DESC(probe_wait_ms, - "Maximum time(ms) to wait for probe response" - " before disconnecting (reason 4)."); - -/* - * Weight given to the latest Beacon frame when calculating average signal - * strength for Beacon frames received in the current BSS. This must be - * between 1 and 15. - */ -#define IEEE80211_SIGNAL_AVE_WEIGHT 3 - -/* - * How many Beacon frames need to have been used in average signal strength - * before starting to indicate signal change events. - */ -#define IEEE80211_SIGNAL_AVE_MIN_COUNT 4 - -#define TMR_RUNNING_TIMER 0 -#define TMR_RUNNING_CHANSW 1 - -#define DEAUTH_DISASSOC_LEN (24 /* hdr */ + 2 /* reason */) - -/* - * All cfg80211 functions have to be called outside a locked - * section so that they can acquire a lock themselves... This - * is much simpler than queuing up things in cfg80211, but we - * do need some indirection for that here. - */ -enum rx_mgmt_action { - /* no action required */ - RX_MGMT_NONE, - - /* caller must call cfg80211_send_deauth() */ - RX_MGMT_CFG80211_DEAUTH, - - /* caller must call cfg80211_send_disassoc() */ - RX_MGMT_CFG80211_DISASSOC, - - /* caller must call cfg80211_send_rx_auth() */ - RX_MGMT_CFG80211_RX_AUTH, - - /* caller must call cfg80211_send_rx_assoc() */ - RX_MGMT_CFG80211_RX_ASSOC, - - /* caller must call cfg80211_send_assoc_timeout() */ - RX_MGMT_CFG80211_ASSOC_TIMEOUT, -}; - -/* utils */ -static inline void ASSERT_MGD_MTX(struct ieee80211_if_managed *ifmgd) -{ - lockdep_assert_held(&ifmgd->mtx); -} - -/* - * We can have multiple work items (and connection probing) - * scheduling this timer, but we need to take care to only - * reschedule it when it should fire _earlier_ than it was - * asked for before, or if it's not pending right now. This - * function ensures that. Note that it then is required to - * run this function for all timeouts after the first one - * has happened -- the work that runs from this timer will - * do that. - */ -static void run_again(struct ieee80211_if_managed *ifmgd, unsigned long timeout) -{ - ASSERT_MGD_MTX(ifmgd); - - if (!timer_pending(&ifmgd->timer) || - time_before(timeout, ifmgd->timer.expires)) - mod_timer(&ifmgd->timer, timeout); -} - -void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata) -{ - if (sdata->vif.driver_flags & IEEE80211_VIF_BEACON_FILTER) - return; - - mod_timer(&sdata->u.mgd.bcn_mon_timer, - round_jiffies_up(jiffies + sdata->u.mgd.beacon_timeout)); -} - -void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - if (unlikely(!sdata->u.mgd.associated)) - return; - - if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) - return; - - mod_timer(&sdata->u.mgd.conn_mon_timer, - round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME)); - - ifmgd->probe_send_count = 0; -} - -static int ecw2cw(int ecw) -{ - return (1 << ecw) - 1; -} - -/* - * ieee80211_enable_ht should be called only after the operating band - * has been determined as ht configuration depends on the hw's - * HT abilities for a specific band. - */ -static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, - struct ieee80211_ht_info *hti, - const u8 *bssid, u16 ap_ht_cap_flags, - bool beacon_htcap_ie) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_supported_band *sband; - struct sta_info *sta; - u32 changed = 0; - int hti_cfreq; - u16 ht_opmode; - bool enable_ht = true; - enum nl80211_channel_type prev_chantype; - enum nl80211_channel_type rx_channel_type = NL80211_CHAN_NO_HT; - enum nl80211_channel_type tx_channel_type; - - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - prev_chantype = sdata->vif.bss_conf.channel_type; - - - hti_cfreq = ieee80211_channel_to_frequency(hti->control_chan, - sband->band); - /* check that channel matches the right operating channel */ - if (local->hw.conf.channel->center_freq != hti_cfreq) { - /* Some APs mess this up, evidently. - * Netgear WNDR3700 sometimes reports 4 higher than - * the actual channel, for instance. - */ - printk(KERN_DEBUG - "%s: Wrong control channel in association" - " response: configured center-freq: %d" - " hti-cfreq: %d hti->control_chan: %d" - " band: %d. Disabling HT.\n", - sdata->name, - local->hw.conf.channel->center_freq, - hti_cfreq, hti->control_chan, - sband->band); - enable_ht = false; - } - - if (enable_ht) { - rx_channel_type = NL80211_CHAN_HT20; - - if (!(ap_ht_cap_flags & IEEE80211_HT_CAP_40MHZ_INTOLERANT) && - !ieee80111_cfg_override_disables_ht40(sdata) && - (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) && - (hti->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) { - switch(hti->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { - case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: - rx_channel_type = NL80211_CHAN_HT40PLUS; - break; - case IEEE80211_HT_PARAM_CHA_SEC_BELOW: - rx_channel_type = NL80211_CHAN_HT40MINUS; - break; - } - } - } - - tx_channel_type = ieee80211_get_tx_channel_type(local, rx_channel_type); - - if (local->tmp_channel) - local->tmp_channel_type = rx_channel_type; - - if (!ieee80211_set_channel_type(local, sdata, rx_channel_type)) { - /* can only fail due to HT40+/- mismatch */ - rx_channel_type = NL80211_CHAN_HT20; - WARN_ON(!ieee80211_set_channel_type(local, sdata, - rx_channel_type)); - } - - if (beacon_htcap_ie && (prev_chantype != rx_channel_type)) { - /* - * Whenever the AP announces the HT mode change that can be - * 40MHz intolerant or etc., it would be safer to stop tx - * queues before doing hw config to avoid buffer overflow. - */ - ieee80211_stop_queues_by_reason(&sdata->local->hw, - IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE); - - /* flush out all packets */ - synchronize_net(); - - drv_flush(local, false); - } - - /* channel_type change automatically detected */ - ieee80211_hw_config(local, 0); - - if (prev_chantype != tx_channel_type) { - rcu_read_lock(); - sta = sta_info_get(sdata, bssid); - if (sta) - rate_control_rate_update(local, sband, sta, - IEEE80211_RC_HT_CHANGED, - tx_channel_type); - rcu_read_unlock(); - - if (beacon_htcap_ie) - ieee80211_wake_queues_by_reason(&sdata->local->hw, - IEEE80211_QUEUE_STOP_REASON_CHTYPE_CHANGE); - } - - ht_opmode = le16_to_cpu(hti->operation_mode); - - /* if bss configuration changed store the new one */ - if (sdata->ht_opmode_valid != enable_ht || - sdata->vif.bss_conf.ht_operation_mode != ht_opmode || - prev_chantype != rx_channel_type) { - changed |= BSS_CHANGED_HT; - sdata->vif.bss_conf.ht_operation_mode = ht_opmode; - sdata->ht_opmode_valid = enable_ht; - } - - return changed; -} - -/* frame sending functions */ - -static int ieee80211_compatible_rates(const u8 *supp_rates, int supp_rates_len, - struct ieee80211_supported_band *sband, - u32 *rates) -{ - int i, j, count; - *rates = 0; - count = 0; - for (i = 0; i < supp_rates_len; i++) { - int rate = (supp_rates[i] & 0x7F) * 5; - - for (j = 0; j < sband->n_bitrates; j++) - if (sband->bitrates[j].bitrate == rate) { - *rates |= BIT(j); - count++; - break; - } - } - - return count; -} - -static void ieee80211_add_ht_ie(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb, const u8 *ht_info_ie, - struct ieee80211_supported_band *sband, - struct ieee80211_channel *channel, - enum ieee80211_smps_mode smps) -{ - struct ieee80211_ht_info *ht_info; - u8 *pos; - u32 flags = channel->flags; - u16 cap; - struct ieee80211_sta_ht_cap ht_cap; - - BUILD_BUG_ON(sizeof(ht_cap) != sizeof(sband->ht_cap)); - - if (!ht_info_ie) - return; - - if (ht_info_ie[1] < sizeof(struct ieee80211_ht_info)) - return; - - memcpy(&ht_cap, &sband->ht_cap, sizeof(ht_cap)); - ieee80211_apply_htcap_overrides(sdata, &ht_cap); - - ht_info = (struct ieee80211_ht_info *)(ht_info_ie + 2); - - /* determine capability flags */ - cap = ht_cap.cap; - - switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { - case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: - if (flags & IEEE80211_CHAN_NO_HT40PLUS) { - cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; - cap &= ~IEEE80211_HT_CAP_SGI_40; - } - break; - case IEEE80211_HT_PARAM_CHA_SEC_BELOW: - if (flags & IEEE80211_CHAN_NO_HT40MINUS) { - cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; - cap &= ~IEEE80211_HT_CAP_SGI_40; - } - break; - } - - /* set SM PS mode properly */ - cap &= ~IEEE80211_HT_CAP_SM_PS; - switch (smps) { - case IEEE80211_SMPS_AUTOMATIC: - case IEEE80211_SMPS_NUM_MODES: - WARN_ON(1); - case IEEE80211_SMPS_OFF: - cap |= WLAN_HT_CAP_SM_PS_DISABLED << - IEEE80211_HT_CAP_SM_PS_SHIFT; - break; - case IEEE80211_SMPS_STATIC: - cap |= WLAN_HT_CAP_SM_PS_STATIC << - IEEE80211_HT_CAP_SM_PS_SHIFT; - break; - case IEEE80211_SMPS_DYNAMIC: - cap |= WLAN_HT_CAP_SM_PS_DYNAMIC << - IEEE80211_HT_CAP_SM_PS_SHIFT; - break; - } - - /* reserve and fill IE */ - pos = skb_put(skb, sizeof(struct ieee80211_ht_cap) + 2); - ieee80211_ie_build_ht_cap(pos, &ht_cap, cap); -} - -static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - u8 *pos, qos_info; - size_t offset = 0, noffset; - int i, count, rates_len, supp_rates_len; - u16 capab; - struct ieee80211_supported_band *sband; - u32 rates = 0; - - lockdep_assert_held(&ifmgd->mtx); - - sband = local->hw.wiphy->bands[local->oper_channel->band]; - - if (assoc_data->supp_rates_len) { - /* - * Get all rates supported by the device and the AP as - * some APs don't like getting a superset of their rates - * in the association request (e.g. D-Link DAP 1353 in - * b-only mode)... - */ - rates_len = ieee80211_compatible_rates(assoc_data->supp_rates, - assoc_data->supp_rates_len, - sband, &rates); - } else { - /* - * In case AP not provide any supported rates information - * before association, we send information element(s) with - * all rates that we support. - */ - rates = ~0; - rates_len = sband->n_bitrates; - } - - skb = alloc_skb(local->hw.extra_tx_headroom + - sizeof(*mgmt) + /* bit too much but doesn't matter */ - 2 + assoc_data->ssid_len + /* SSID */ - 4 + rates_len + /* (extended) rates */ - 4 + /* power capability */ - 2 + 2 * sband->n_channels + /* supported channels */ - 2 + sizeof(struct ieee80211_ht_cap) + /* HT */ - assoc_data->ie_len + /* extra IEs */ - 9, /* WMM */ - GFP_KERNEL); - if (!skb) - return; - - skb_reserve(skb, local->hw.extra_tx_headroom); - - capab = WLAN_CAPABILITY_ESS; - - if (sband->band == IEEE80211_BAND_2GHZ) { - if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE)) - capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME; - if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE)) - capab |= WLAN_CAPABILITY_SHORT_PREAMBLE; - } - - if (assoc_data->capability & WLAN_CAPABILITY_PRIVACY) - capab |= WLAN_CAPABILITY_PRIVACY; - - if ((assoc_data->capability & WLAN_CAPABILITY_SPECTRUM_MGMT) && - (local->hw.flags & IEEE80211_HW_SPECTRUM_MGMT)) - capab |= WLAN_CAPABILITY_SPECTRUM_MGMT; - - mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24); - memset(mgmt, 0, 24); - memcpy(mgmt->da, assoc_data->bss->bssid, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - memcpy(mgmt->bssid, assoc_data->bss->bssid, ETH_ALEN); - - if (!is_zero_ether_addr(assoc_data->prev_bssid)) { - skb_put(skb, 10); - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_REASSOC_REQ); - mgmt->u.reassoc_req.capab_info = cpu_to_le16(capab); - mgmt->u.reassoc_req.listen_interval = - cpu_to_le16(local->hw.conf.listen_interval); - memcpy(mgmt->u.reassoc_req.current_ap, assoc_data->prev_bssid, - ETH_ALEN); - } else { - skb_put(skb, 4); - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ASSOC_REQ); - mgmt->u.assoc_req.capab_info = cpu_to_le16(capab); - mgmt->u.assoc_req.listen_interval = - cpu_to_le16(local->hw.conf.listen_interval); - } - - /* SSID */ - pos = skb_put(skb, 2 + assoc_data->ssid_len); - *pos++ = WLAN_EID_SSID; - *pos++ = assoc_data->ssid_len; - memcpy(pos, assoc_data->ssid, assoc_data->ssid_len); - - /* add all rates which were marked to be used above */ - supp_rates_len = rates_len; - if (supp_rates_len > 8) - supp_rates_len = 8; - - pos = skb_put(skb, supp_rates_len + 2); - *pos++ = WLAN_EID_SUPP_RATES; - *pos++ = supp_rates_len; - - count = 0; - for (i = 0; i < sband->n_bitrates; i++) { - if (BIT(i) & rates) { - int rate = sband->bitrates[i].bitrate; - *pos++ = (u8) (rate / 5); - if (++count == 8) - break; - } - } - - if (rates_len > count) { - pos = skb_put(skb, rates_len - count + 2); - *pos++ = WLAN_EID_EXT_SUPP_RATES; - *pos++ = rates_len - count; - - for (i++; i < sband->n_bitrates; i++) { - if (BIT(i) & rates) { - int rate = sband->bitrates[i].bitrate; - *pos++ = (u8) (rate / 5); - } - } - } - - if (capab & WLAN_CAPABILITY_SPECTRUM_MGMT) { - /* 1. power capabilities */ - pos = skb_put(skb, 4); - *pos++ = WLAN_EID_PWR_CAPABILITY; - *pos++ = 2; - *pos++ = 0; /* min tx power */ - *pos++ = local->oper_channel->max_power; /* max tx power */ - - /* 2. supported channels */ - /* TODO: get this in reg domain format */ - pos = skb_put(skb, 2 * sband->n_channels + 2); - *pos++ = WLAN_EID_SUPPORTED_CHANNELS; - *pos++ = 2 * sband->n_channels; - for (i = 0; i < sband->n_channels; i++) { - *pos++ = ieee80211_frequency_to_channel( - sband->channels[i].center_freq); - *pos++ = 1; /* one channel in the subband*/ - } - } - - /* if present, add any custom IEs that go before HT */ - if (assoc_data->ie_len && assoc_data->ie) { - static const u8 before_ht[] = { - WLAN_EID_SSID, - WLAN_EID_SUPP_RATES, - WLAN_EID_EXT_SUPP_RATES, - WLAN_EID_PWR_CAPABILITY, - WLAN_EID_SUPPORTED_CHANNELS, - WLAN_EID_RSN, - WLAN_EID_QOS_CAPA, - WLAN_EID_RRM_ENABLED_CAPABILITIES, - WLAN_EID_MOBILITY_DOMAIN, - WLAN_EID_SUPPORTED_REGULATORY_CLASSES, - }; - noffset = ieee80211_ie_split(assoc_data->ie, assoc_data->ie_len, - before_ht, ARRAY_SIZE(before_ht), - offset); - pos = skb_put(skb, noffset - offset); - memcpy(pos, assoc_data->ie + offset, noffset - offset); - offset = noffset; - } - - if (!(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) - ieee80211_add_ht_ie(sdata, skb, assoc_data->ht_information_ie, - sband, local->oper_channel, ifmgd->ap_smps); - - /* if present, add any custom non-vendor IEs that go after HT */ - if (assoc_data->ie_len && assoc_data->ie) { - noffset = ieee80211_ie_split_vendor(assoc_data->ie, - assoc_data->ie_len, - offset); - pos = skb_put(skb, noffset - offset); - memcpy(pos, assoc_data->ie + offset, noffset - offset); - offset = noffset; - } - - if (assoc_data->wmm) { - if (assoc_data->uapsd) { - qos_info = ifmgd->uapsd_queues; - qos_info |= (ifmgd->uapsd_max_sp_len << - IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT); - } else { - qos_info = 0; - } - - pos = skb_put(skb, 9); - *pos++ = WLAN_EID_VENDOR_SPECIFIC; - *pos++ = 7; /* len */ - *pos++ = 0x00; /* Microsoft OUI 00:50:F2 */ - *pos++ = 0x50; - *pos++ = 0xf2; - *pos++ = 2; /* WME */ - *pos++ = 0; /* WME info */ - *pos++ = 1; /* WME ver */ - *pos++ = qos_info; - } - - /* add any remaining custom (i.e. vendor specific here) IEs */ - if (assoc_data->ie_len && assoc_data->ie) { - noffset = assoc_data->ie_len; - pos = skb_put(skb, noffset - offset); - memcpy(pos, assoc_data->ie + offset, noffset - offset); - } - - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - ieee80211_tx_skb(sdata, skb); -} - -static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, - const u8 *bssid, u16 stype, - u16 reason, bool send_frame, - u8 *frame_buf) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt = (void *)frame_buf; - - /* build frame */ - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | stype); - mgmt->duration = 0; /* initialize only */ - mgmt->seq_ctrl = 0; /* initialize only */ - memcpy(mgmt->da, bssid, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - memcpy(mgmt->bssid, bssid, ETH_ALEN); - /* u.deauth.reason_code == u.disassoc.reason_code */ - mgmt->u.deauth.reason_code = cpu_to_le16(reason); - - if (send_frame) { - skb = dev_alloc_skb(local->hw.extra_tx_headroom + - DEAUTH_DISASSOC_LEN); - if (!skb) - return; - - skb_reserve(skb, local->hw.extra_tx_headroom); - - /* copy in frame */ - memcpy(skb_put(skb, DEAUTH_DISASSOC_LEN), - mgmt, DEAUTH_DISASSOC_LEN); - - if (!(ifmgd->flags & IEEE80211_STA_MFP_ENABLED)) - IEEE80211_SKB_CB(skb)->flags |= - IEEE80211_TX_INTFL_DONT_ENCRYPT; - ieee80211_tx_skb(sdata, skb); - } -} - -void ieee80211_send_pspoll(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_pspoll *pspoll; - struct sk_buff *skb; - - skb = ieee80211_pspoll_get(&local->hw, &sdata->vif); - if (!skb) - return; - - pspoll = (struct ieee80211_pspoll *) skb->data; - pspoll->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); - - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - ieee80211_tx_skb(sdata, skb); -} - -void ieee80211_send_nullfunc(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - int powersave) -{ - struct sk_buff *skb; - struct ieee80211_hdr_3addr *nullfunc; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - skb = ieee80211_nullfunc_get(&local->hw, &sdata->vif); - if (!skb) - return; - - nullfunc = (struct ieee80211_hdr_3addr *) skb->data; - if (powersave) - nullfunc->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); - - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - if (ifmgd->flags & (IEEE80211_STA_BEACON_POLL | - IEEE80211_STA_CONNECTION_POLL)) - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_USE_MINRATE; - - ieee80211_tx_skb(sdata, skb); -} - -static void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata) -{ - struct sk_buff *skb; - struct ieee80211_hdr *nullfunc; - __le16 fc; - - if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) - return; - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + 30); - if (!skb) - return; - - skb_reserve(skb, local->hw.extra_tx_headroom); - - nullfunc = (struct ieee80211_hdr *) skb_put(skb, 30); - memset(nullfunc, 0, 30); - fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC | - IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); - nullfunc->frame_control = fc; - memcpy(nullfunc->addr1, sdata->u.mgd.bssid, ETH_ALEN); - memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); - memcpy(nullfunc->addr3, sdata->u.mgd.bssid, ETH_ALEN); - memcpy(nullfunc->addr4, sdata->vif.addr, ETH_ALEN); - - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - ieee80211_tx_skb(sdata, skb); -} - -/* spectrum management related things */ -static void ieee80211_chswitch_work(struct work_struct *work) -{ - struct ieee80211_sub_if_data *sdata = - container_of(work, struct ieee80211_sub_if_data, u.mgd.chswitch_work); - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - if (!ieee80211_sdata_running(sdata)) - return; - - mutex_lock(&ifmgd->mtx); - if (!ifmgd->associated) - goto out; - - sdata->local->oper_channel = sdata->local->csa_channel; - if (!sdata->local->ops->channel_switch) { - /* call "hw_config" only if doing sw channel switch */ - ieee80211_hw_config(sdata->local, - IEEE80211_CONF_CHANGE_CHANNEL); - } else { - /* update the device channel directly */ - sdata->local->hw.conf.channel = sdata->local->oper_channel; - } - - /* XXX: shouldn't really modify cfg80211-owned data! */ - ifmgd->associated->channel = sdata->local->oper_channel; - - ieee80211_wake_queues_by_reason(&sdata->local->hw, - IEEE80211_QUEUE_STOP_REASON_CSA); - out: - ifmgd->flags &= ~IEEE80211_STA_CSA_RECEIVED; - mutex_unlock(&ifmgd->mtx); -} - -void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success) -{ - struct ieee80211_sub_if_data *sdata; - struct ieee80211_if_managed *ifmgd; - - sdata = vif_to_sdata(vif); - ifmgd = &sdata->u.mgd; - - trace_api_chswitch_done(sdata, success); - if (!success) { - /* - * If the channel switch was not successful, stay - * around on the old channel. We currently lack - * good handling of this situation, possibly we - * should just drop the association. - */ - sdata->local->csa_channel = sdata->local->oper_channel; - } - - ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); -} -EXPORT_SYMBOL(ieee80211_chswitch_done); - -static void ieee80211_chswitch_timer(unsigned long data) -{ - struct ieee80211_sub_if_data *sdata = - (struct ieee80211_sub_if_data *) data; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - if (sdata->local->quiescing) { - set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running); - return; - } - - ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); -} - -void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, - struct ieee80211_channel_sw_ie *sw_elem, - struct ieee80211_bss *bss, - u64 timestamp) -{ - struct cfg80211_bss *cbss = - container_of((void *)bss, struct cfg80211_bss, priv); - struct ieee80211_channel *new_ch; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - int new_freq = ieee80211_channel_to_frequency(sw_elem->new_ch_num, - cbss->channel->band); - - ASSERT_MGD_MTX(ifmgd); - - if (!ifmgd->associated) - return; - - if (sdata->local->scanning) - return; - - /* Disregard subsequent beacons if we are already running a timer - processing a CSA */ - - if (ifmgd->flags & IEEE80211_STA_CSA_RECEIVED) - return; - - new_ch = ieee80211_get_channel(sdata->local->hw.wiphy, new_freq); - if (!new_ch || new_ch->flags & IEEE80211_CHAN_DISABLED) - return; - - sdata->local->csa_channel = new_ch; - - if (sdata->local->ops->channel_switch) { - /* use driver's channel switch callback */ - struct ieee80211_channel_switch ch_switch; - memset(&ch_switch, 0, sizeof(ch_switch)); - ch_switch.timestamp = timestamp; - if (sw_elem->mode) { - ch_switch.block_tx = true; - ieee80211_stop_queues_by_reason(&sdata->local->hw, - IEEE80211_QUEUE_STOP_REASON_CSA); - } - ch_switch.channel = new_ch; - ch_switch.count = sw_elem->count; - ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; - drv_channel_switch(sdata->local, &ch_switch); - return; - } - - /* channel switch handled in software */ - if (sw_elem->count <= 1) { - ieee80211_queue_work(&sdata->local->hw, &ifmgd->chswitch_work); - } else { - if (sw_elem->mode) - ieee80211_stop_queues_by_reason(&sdata->local->hw, - IEEE80211_QUEUE_STOP_REASON_CSA); - ifmgd->flags |= IEEE80211_STA_CSA_RECEIVED; - mod_timer(&ifmgd->chswitch_timer, - jiffies + - msecs_to_jiffies(sw_elem->count * - cbss->beacon_interval)); - } -} - -static void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata, - u16 capab_info, u8 *pwr_constr_elem, - u8 pwr_constr_elem_len) -{ - struct ieee80211_conf *conf = &sdata->local->hw.conf; - - if (!(capab_info & WLAN_CAPABILITY_SPECTRUM_MGMT)) - return; - - /* Power constraint IE length should be 1 octet */ - if (pwr_constr_elem_len != 1) - return; - - if ((*pwr_constr_elem <= conf->channel->max_reg_power) && - (*pwr_constr_elem != sdata->local->power_constr_level)) { - sdata->local->power_constr_level = *pwr_constr_elem; - ieee80211_hw_config(sdata->local, 0); - } -} - -void ieee80211_enable_dyn_ps(struct ieee80211_vif *vif) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_local *local = sdata->local; - struct ieee80211_conf *conf = &local->hw.conf; - - WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION || - !(local->hw.flags & IEEE80211_HW_SUPPORTS_PS) || - (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)); - - local->disable_dynamic_ps = false; - conf->dynamic_ps_timeout = local->dynamic_ps_user_timeout; -} -EXPORT_SYMBOL(ieee80211_enable_dyn_ps); - -void ieee80211_disable_dyn_ps(struct ieee80211_vif *vif) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_local *local = sdata->local; - struct ieee80211_conf *conf = &local->hw.conf; - - WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION || - !(local->hw.flags & IEEE80211_HW_SUPPORTS_PS) || - (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)); - - local->disable_dynamic_ps = true; - conf->dynamic_ps_timeout = 0; - del_timer_sync(&local->dynamic_ps_timer); - ieee80211_queue_work(&local->hw, - &local->dynamic_ps_enable_work); -} -EXPORT_SYMBOL(ieee80211_disable_dyn_ps); - -/* powersave */ -static void ieee80211_enable_ps(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_conf *conf = &local->hw.conf; - - /* - * If we are scanning right now then the parameters will - * take effect when scan finishes. - */ - if (local->scanning) - return; - - if (conf->dynamic_ps_timeout > 0 && - !(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)) { - mod_timer(&local->dynamic_ps_timer, jiffies + - msecs_to_jiffies(conf->dynamic_ps_timeout)); - } else { - if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) - ieee80211_send_nullfunc(local, sdata, 1); - - if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) && - (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) - return; - - conf->flags |= IEEE80211_CONF_PS; - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); - } -} - -static void ieee80211_change_ps(struct ieee80211_local *local) -{ - struct ieee80211_conf *conf = &local->hw.conf; - - if (local->ps_sdata) { - ieee80211_enable_ps(local, local->ps_sdata); - } else if (conf->flags & IEEE80211_CONF_PS) { - conf->flags &= ~IEEE80211_CONF_PS; - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); - del_timer_sync(&local->dynamic_ps_timer); - cancel_work_sync(&local->dynamic_ps_enable_work); - } -} - -static bool ieee80211_powersave_allowed(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_managed *mgd = &sdata->u.mgd; - struct sta_info *sta = NULL; - bool authorized = false; - - if (!mgd->powersave) - return false; - - if (mgd->broken_ap) - return false; - - if (!mgd->associated) - return false; - - if (!mgd->associated->beacon_ies) - return false; - - if (mgd->flags & (IEEE80211_STA_BEACON_POLL | - IEEE80211_STA_CONNECTION_POLL)) - return false; - - rcu_read_lock(); - sta = sta_info_get(sdata, mgd->bssid); - if (sta) - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED); - rcu_read_unlock(); - - return authorized; -} - -/* need to hold RTNL or interface lock */ -void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency) -{ - struct ieee80211_sub_if_data *sdata, *found = NULL; - int count = 0; - int timeout; - - if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) { - local->ps_sdata = NULL; - return; - } - - if (!list_empty(&local->work_list)) { - local->ps_sdata = NULL; - goto change; - } - - list_for_each_entry(sdata, &local->interfaces, list) { - if (!ieee80211_sdata_running(sdata)) - continue; - if (sdata->vif.type == NL80211_IFTYPE_AP) { - /* If an AP vif is found, then disable PS - * by setting the count to zero thereby setting - * ps_sdata to NULL. - */ - count = 0; - break; - } - if (sdata->vif.type != NL80211_IFTYPE_STATION) - continue; - found = sdata; - count++; - } - - if (count == 1 && ieee80211_powersave_allowed(found)) { - struct ieee80211_conf *conf = &local->hw.conf; - s32 beaconint_us; - - if (latency < 0) - latency = pm_qos_request(PM_QOS_NETWORK_LATENCY); - - beaconint_us = ieee80211_tu_to_usec( - found->vif.bss_conf.beacon_int); - - timeout = local->dynamic_ps_forced_timeout; - if (timeout < 0) { - /* - * Go to full PSM if the user configures a very low - * latency requirement. - * The 2000 second value is there for compatibility - * until the PM_QOS_NETWORK_LATENCY is configured - * with real values. - */ - if (latency > (1900 * USEC_PER_MSEC) && - latency != (2000 * USEC_PER_SEC)) - timeout = 0; - else - timeout = 100; - } - local->dynamic_ps_user_timeout = timeout; - if (!local->disable_dynamic_ps) - conf->dynamic_ps_timeout = - local->dynamic_ps_user_timeout; - - if (beaconint_us > latency) { - local->ps_sdata = NULL; - } else { - struct ieee80211_bss *bss; - int maxslp = 1; - u8 dtimper; - - bss = (void *)found->u.mgd.associated->priv; - dtimper = bss->dtim_period; - - /* If the TIM IE is invalid, pretend the value is 1 */ - if (!dtimper) - dtimper = 1; - else if (dtimper > 1) - maxslp = min_t(int, dtimper, - latency / beaconint_us); - - local->hw.conf.max_sleep_period = maxslp; - local->hw.conf.ps_dtim_period = dtimper; - local->ps_sdata = found; - } - } else { - local->ps_sdata = NULL; - } - - change: - ieee80211_change_ps(local); -} - -void ieee80211_dynamic_ps_disable_work(struct work_struct *work) -{ - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, - dynamic_ps_disable_work); - - if (local->hw.conf.flags & IEEE80211_CONF_PS) { - local->hw.conf.flags &= ~IEEE80211_CONF_PS; - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); - } - - ieee80211_wake_queues_by_reason(&local->hw, - IEEE80211_QUEUE_STOP_REASON_PS); -} - -void ieee80211_dynamic_ps_enable_work(struct work_struct *work) -{ - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, - dynamic_ps_enable_work); - struct ieee80211_sub_if_data *sdata = local->ps_sdata; - struct ieee80211_if_managed *ifmgd; - unsigned long flags; - int q; - - /* can only happen when PS was just disabled anyway */ - if (!sdata) - return; - - ifmgd = &sdata->u.mgd; - - if (local->hw.conf.flags & IEEE80211_CONF_PS) - return; - - if (!local->disable_dynamic_ps && - local->hw.conf.dynamic_ps_timeout > 0) { - /* don't enter PS if TX frames are pending */ - if (drv_tx_frames_pending(local)) { - mod_timer(&local->dynamic_ps_timer, jiffies + - msecs_to_jiffies( - local->hw.conf.dynamic_ps_timeout)); - return; - } - - /* - * transmission can be stopped by others which leads to - * dynamic_ps_timer expiry. Postpone the ps timer if it - * is not the actual idle state. - */ - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - for (q = 0; q < local->hw.queues; q++) { - if (local->queue_stop_reasons[q]) { - spin_unlock_irqrestore(&local->queue_stop_reason_lock, - flags); - mod_timer(&local->dynamic_ps_timer, jiffies + - msecs_to_jiffies( - local->hw.conf.dynamic_ps_timeout)); - return; - } - } - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); - } - - if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) && - !(ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { - netif_tx_stop_all_queues(sdata->dev); - - if (drv_tx_frames_pending(local)) - mod_timer(&local->dynamic_ps_timer, jiffies + - msecs_to_jiffies( - local->hw.conf.dynamic_ps_timeout)); - else { - ieee80211_send_nullfunc(local, sdata, 1); - /* Flush to get the tx status of nullfunc frame */ - drv_flush(local, false); - } - } - - if (!((local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) && - (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)) || - (ifmgd->flags & IEEE80211_STA_NULLFUNC_ACKED)) { - ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; - local->hw.conf.flags |= IEEE80211_CONF_PS; - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); - } - - if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) - netif_tx_wake_all_queues(sdata->dev); -} - -void ieee80211_dynamic_ps_timer(unsigned long data) -{ - struct ieee80211_local *local = (void *) data; - - if (local->quiescing || local->suspended) - return; - - ieee80211_queue_work(&local->hw, &local->dynamic_ps_enable_work); -} - -/* MLME */ -static void ieee80211_sta_wmm_params(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - u8 *wmm_param, size_t wmm_param_len) -{ - struct ieee80211_tx_queue_params params; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - size_t left; - int count; - u8 *pos, uapsd_queues = 0; - - if (!local->ops->conf_tx) - return; - - if (local->hw.queues < 4) - return; - - if (!wmm_param) - return; - - if (wmm_param_len < 8 || wmm_param[5] /* version */ != 1) - return; - - if (ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) - uapsd_queues = ifmgd->uapsd_queues; - - count = wmm_param[6] & 0x0f; - if (count == ifmgd->wmm_last_param_set) - return; - ifmgd->wmm_last_param_set = count; - - pos = wmm_param + 8; - left = wmm_param_len - 8; - - memset(¶ms, 0, sizeof(params)); - - local->wmm_acm = 0; - for (; left >= 4; left -= 4, pos += 4) { - int aci = (pos[0] >> 5) & 0x03; - int acm = (pos[0] >> 4) & 0x01; - bool uapsd = false; - int queue; - - switch (aci) { - case 1: /* AC_BK */ - queue = 3; - if (acm) - local->wmm_acm |= BIT(1) | BIT(2); /* BK/- */ - if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) - uapsd = true; - break; - case 2: /* AC_VI */ - queue = 1; - if (acm) - local->wmm_acm |= BIT(4) | BIT(5); /* CL/VI */ - if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VI) - uapsd = true; - break; - case 3: /* AC_VO */ - queue = 0; - if (acm) - local->wmm_acm |= BIT(6) | BIT(7); /* VO/NC */ - if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) - uapsd = true; - break; - case 0: /* AC_BE */ - default: - queue = 2; - if (acm) - local->wmm_acm |= BIT(0) | BIT(3); /* BE/EE */ - if (uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_BE) - uapsd = true; - break; - } - - params.aifs = pos[0] & 0x0f; - params.cw_max = ecw2cw((pos[1] & 0xf0) >> 4); - params.cw_min = ecw2cw(pos[1] & 0x0f); - params.txop = get_unaligned_le16(pos + 2); - params.uapsd = uapsd; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(local->hw.wiphy, - "WMM queue=%d aci=%d acm=%d aifs=%d " - "cWmin=%d cWmax=%d txop=%d uapsd=%d\n", - queue, aci, acm, - params.aifs, params.cw_min, params.cw_max, - params.txop, params.uapsd); -#endif - sdata->tx_conf[queue] = params; - if (drv_conf_tx(local, sdata, queue, ¶ms)) - wiphy_debug(local->hw.wiphy, - "failed to set TX queue parameters for queue %d\n", - queue); - } - - /* enable WMM or activate new settings */ - sdata->vif.bss_conf.qos = true; -} - -static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, - u16 capab, bool erp_valid, u8 erp) -{ - struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; - u32 changed = 0; - bool use_protection; - bool use_short_preamble; - bool use_short_slot; - - if (erp_valid) { - use_protection = (erp & WLAN_ERP_USE_PROTECTION) != 0; - use_short_preamble = (erp & WLAN_ERP_BARKER_PREAMBLE) == 0; - } else { - use_protection = false; - use_short_preamble = !!(capab & WLAN_CAPABILITY_SHORT_PREAMBLE); - } - - use_short_slot = !!(capab & WLAN_CAPABILITY_SHORT_SLOT_TIME); - if (sdata->local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) - use_short_slot = true; - - if (use_protection != bss_conf->use_cts_prot) { - bss_conf->use_cts_prot = use_protection; - changed |= BSS_CHANGED_ERP_CTS_PROT; - } - - if (use_short_preamble != bss_conf->use_short_preamble) { - bss_conf->use_short_preamble = use_short_preamble; - changed |= BSS_CHANGED_ERP_PREAMBLE; - } - - if (use_short_slot != bss_conf->use_short_slot) { - bss_conf->use_short_slot = use_short_slot; - changed |= BSS_CHANGED_ERP_SLOT; - } - - return changed; -} - -static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, - struct cfg80211_bss *cbss, - u32 bss_info_changed) -{ - struct ieee80211_bss *bss = (void *)cbss->priv; - struct ieee80211_local *local = sdata->local; - struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; - - bss_info_changed |= BSS_CHANGED_ASSOC; - /* set timing information */ - bss_conf->beacon_int = cbss->beacon_interval; - bss_conf->last_tsf = cbss->tsf; - - bss_info_changed |= BSS_CHANGED_BEACON_INT; - bss_info_changed |= ieee80211_handle_bss_capability(sdata, - cbss->capability, bss->has_erp_value, bss->erp_value); - - sdata->u.mgd.beacon_timeout = usecs_to_jiffies(ieee80211_tu_to_usec( - IEEE80211_BEACON_LOSS_COUNT * bss_conf->beacon_int)); - - sdata->u.mgd.associated = cbss; - memcpy(sdata->u.mgd.bssid, cbss->bssid, ETH_ALEN); - - sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE; - - /* just to be sure */ - sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL | - IEEE80211_STA_BEACON_POLL); - - ieee80211_led_assoc(local, 1); - - if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) - bss_conf->dtim_period = bss->dtim_period; - else - bss_conf->dtim_period = 0; - - bss_conf->assoc = 1; - - /* Tell the driver to monitor connection quality (if supported) */ - if (sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI && - bss_conf->cqm_rssi_thold) - bss_info_changed |= BSS_CHANGED_CQM; - - /* Enable ARP filtering */ - if (bss_conf->arp_filter_enabled != sdata->arp_filter_state) { - bss_conf->arp_filter_enabled = sdata->arp_filter_state; - bss_info_changed |= BSS_CHANGED_ARP_FILTER; - } - - ieee80211_bss_info_change_notify(sdata, bss_info_changed); - - mutex_lock(&local->iflist_mtx); - ieee80211_recalc_ps(local, -1); - ieee80211_recalc_smps(local); - mutex_unlock(&local->iflist_mtx); - - netif_tx_start_all_queues(sdata->dev); - netif_carrier_on(sdata->dev); -} - -static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, - u16 stype, u16 reason, bool tx, - u8 *frame_buf) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - u32 changed = 0; - u8 bssid[ETH_ALEN]; - - ASSERT_MGD_MTX(ifmgd); - - if (WARN_ON_ONCE(tx && !frame_buf)) - return; - - if (WARN_ON(!ifmgd->associated)) - return; - - memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); - - ifmgd->associated = NULL; - memset(ifmgd->bssid, 0, ETH_ALEN); - - /* - * we need to commit the associated = NULL change because the - * scan code uses that to determine whether this iface should - * go to/wake up from powersave or not -- and could otherwise - * wake the queues erroneously. - */ - smp_mb(); - - /* - * Thus, we can only afterwards stop the queues -- to account - * for the case where another CPU is finishing a scan at this - * time -- we don't want the scan code to enable queues. - */ - - netif_tx_stop_all_queues(sdata->dev); - netif_carrier_off(sdata->dev); - - mutex_lock(&local->sta_mtx); - sta = sta_info_get(sdata, bssid); - if (sta) { - set_sta_flag(sta, WLAN_STA_BLOCK_BA); - ieee80211_sta_tear_down_BA_sessions(sta, tx); - } - mutex_unlock(&local->sta_mtx); - - /* deauthenticate/disassociate now */ - if (tx || frame_buf) - ieee80211_send_deauth_disassoc(sdata, bssid, stype, reason, - tx, frame_buf); - - /* flush out frame */ - if (tx) - drv_flush(local, false); - - /* remove AP and TDLS peers */ - sta_info_flush(local, sdata); - - /* finally reset all BSS / config parameters */ - changed |= ieee80211_reset_erp_info(sdata); - - ieee80211_led_assoc(local, 0); - changed |= BSS_CHANGED_ASSOC; - sdata->vif.bss_conf.assoc = false; - - /* on the next assoc, re-program HT parameters */ - sdata->ht_opmode_valid = false; - memset(&ifmgd->ht_capa, 0, sizeof(ifmgd->ht_capa)); - memset(&ifmgd->ht_capa_mask, 0, sizeof(ifmgd->ht_capa_mask)); - - local->power_constr_level = 0; - - del_timer_sync(&local->dynamic_ps_timer); - cancel_work_sync(&local->dynamic_ps_enable_work); - - if (local->hw.conf.flags & IEEE80211_CONF_PS) { - local->hw.conf.flags &= ~IEEE80211_CONF_PS; - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); - } - local->ps_sdata = NULL; - - /* Disable ARP filtering */ - if (sdata->vif.bss_conf.arp_filter_enabled) { - sdata->vif.bss_conf.arp_filter_enabled = false; - changed |= BSS_CHANGED_ARP_FILTER; - } - - sdata->vif.bss_conf.qos = false; - changed |= BSS_CHANGED_QOS; - - /* The BSSID (not really interesting) and HT changed */ - changed |= BSS_CHANGED_BSSID | BSS_CHANGED_HT; - ieee80211_bss_info_change_notify(sdata, changed); - - /* channel(_type) changes are handled by ieee80211_hw_config */ - WARN_ON(!ieee80211_set_channel_type(local, sdata, NL80211_CHAN_NO_HT)); - ieee80211_hw_config(local, 0); - - /* disassociated - set to defaults now */ - ieee80211_set_wmm_default(sdata, false); - - del_timer_sync(&sdata->u.mgd.conn_mon_timer); - del_timer_sync(&sdata->u.mgd.bcn_mon_timer); - del_timer_sync(&sdata->u.mgd.timer); - del_timer_sync(&sdata->u.mgd.chswitch_timer); -} - -void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, - struct ieee80211_hdr *hdr) -{ - /* - * We can postpone the mgd.timer whenever receiving unicast frames - * from AP because we know that the connection is working both ways - * at that time. But multicast frames (and hence also beacons) must - * be ignored here, because we need to trigger the timer during - * data idle periods for sending the periodic probe request to the - * AP we're connected to. - */ - if (is_multicast_ether_addr(hdr->addr1)) - return; - - ieee80211_sta_reset_conn_monitor(sdata); -} - -static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - if (!(ifmgd->flags & (IEEE80211_STA_BEACON_POLL | - IEEE80211_STA_CONNECTION_POLL))) - return; - - ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL | - IEEE80211_STA_BEACON_POLL); - mutex_lock(&sdata->local->iflist_mtx); - ieee80211_recalc_ps(sdata->local, -1); - mutex_unlock(&sdata->local->iflist_mtx); - - if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) - return; - - /* - * We've received a probe response, but are not sure whether - * we have or will be receiving any beacons or data, so let's - * schedule the timers again, just in case. - */ - ieee80211_sta_reset_beacon_monitor(sdata); - - mod_timer(&ifmgd->conn_mon_timer, - round_jiffies_up(jiffies + - IEEE80211_CONNECTION_IDLE_TIME)); -} - -void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, - struct ieee80211_hdr *hdr, bool ack) -{ - if (!ieee80211_is_data(hdr->frame_control)) - return; - - if (ack) - ieee80211_sta_reset_conn_monitor(sdata); - - if (ieee80211_is_nullfunc(hdr->frame_control) && - sdata->u.mgd.probe_send_count > 0) { - if (ack) - sdata->u.mgd.probe_send_count = 0; - else - sdata->u.mgd.nullfunc_failed = true; - ieee80211_queue_work(&sdata->local->hw, &sdata->work); - } -} - -static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - const u8 *ssid; - u8 *dst = ifmgd->associated->bssid; - u8 unicast_limit = max(1, max_probe_tries - 3); - - /* - * Try sending broadcast probe requests for the last three - * probe requests after the first ones failed since some - * buggy APs only support broadcast probe requests. - */ - if (ifmgd->probe_send_count >= unicast_limit) - dst = NULL; - - /* - * When the hardware reports an accurate Tx ACK status, it's - * better to send a nullfunc frame instead of a probe request, - * as it will kick us off the AP quickly if we aren't associated - * anymore. The timeout will be reset if the frame is ACKed by - * the AP. - */ - if (sdata->local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { - ifmgd->nullfunc_failed = false; - ieee80211_send_nullfunc(sdata->local, sdata, 0); - } else { - ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); - ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid[1], NULL, 0, - (u32) -1, true, false); - } - - ifmgd->probe_send_count++; - ifmgd->probe_timeout = jiffies + msecs_to_jiffies(probe_wait_ms); - run_again(ifmgd, ifmgd->probe_timeout); -} - -static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, - bool beacon) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - bool already = false; - - if (!ieee80211_sdata_running(sdata)) - return; - - if (sdata->local->scanning) - return; - - if (sdata->local->tmp_channel) - return; - - mutex_lock(&ifmgd->mtx); - - if (!ifmgd->associated) - goto out; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - if (beacon && net_ratelimit()) - printk(KERN_DEBUG "%s: detected beacon loss from AP " - "- sending probe request\n", sdata->name); -#endif - - /* - * The driver/our work has already reported this event or the - * connection monitoring has kicked in and we have already sent - * a probe request. Or maybe the AP died and the driver keeps - * reporting until we disassociate... - * - * In either case we have to ignore the current call to this - * function (except for setting the correct probe reason bit) - * because otherwise we would reset the timer every time and - * never check whether we received a probe response! - */ - if (ifmgd->flags & (IEEE80211_STA_BEACON_POLL | - IEEE80211_STA_CONNECTION_POLL)) - already = true; - - if (beacon) - ifmgd->flags |= IEEE80211_STA_BEACON_POLL; - else - ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL; - - if (already) - goto out; - - mutex_lock(&sdata->local->iflist_mtx); - ieee80211_recalc_ps(sdata->local, -1); - mutex_unlock(&sdata->local->iflist_mtx); - - ifmgd->probe_send_count = 0; - ieee80211_mgd_probe_ap_send(sdata); - out: - mutex_unlock(&ifmgd->mtx); -} - -struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct sk_buff *skb; - const u8 *ssid; - - if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) - return NULL; - - ASSERT_MGD_MTX(ifmgd); - - if (!ifmgd->associated) - return NULL; - - ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); - skb = ieee80211_build_probe_req(sdata, ifmgd->associated->bssid, - (u32) -1, ssid + 2, ssid[1], - NULL, 0, true); - - return skb; -} -EXPORT_SYMBOL(ieee80211_ap_probereq_get); - -static void __ieee80211_connection_loss(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_local *local = sdata->local; - u8 bssid[ETH_ALEN]; - u8 frame_buf[DEAUTH_DISASSOC_LEN]; - - mutex_lock(&ifmgd->mtx); - if (!ifmgd->associated) { - mutex_unlock(&ifmgd->mtx); - return; - } - - memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); - - printk(KERN_DEBUG "%s: Connection to AP %pM lost.\n", - sdata->name, bssid); - - ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, - false, frame_buf); - mutex_unlock(&ifmgd->mtx); - - /* - * must be outside lock due to cfg80211, - * but that's not a problem. - */ - cfg80211_send_deauth(sdata->dev, frame_buf, DEAUTH_DISASSOC_LEN); - - mutex_lock(&local->mtx); - ieee80211_recalc_idle(local); - mutex_unlock(&local->mtx); -} - -void ieee80211_beacon_connection_loss_work(struct work_struct *work) -{ - struct ieee80211_sub_if_data *sdata = - container_of(work, struct ieee80211_sub_if_data, - u.mgd.beacon_connection_loss_work); - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct sta_info *sta; - - if (ifmgd->associated) { - rcu_read_lock(); - sta = sta_info_get(sdata, ifmgd->bssid); - if (sta) - sta->beacon_loss_count++; - rcu_read_unlock(); - } - - if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) - __ieee80211_connection_loss(sdata); - else - ieee80211_mgd_probe_ap(sdata, true); -} - -void ieee80211_beacon_loss(struct ieee80211_vif *vif) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_hw *hw = &sdata->local->hw; - - trace_api_beacon_loss(sdata); - - WARN_ON(hw->flags & IEEE80211_HW_CONNECTION_MONITOR); - ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work); -} -EXPORT_SYMBOL(ieee80211_beacon_loss); - -void ieee80211_connection_loss(struct ieee80211_vif *vif) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_hw *hw = &sdata->local->hw; - - trace_api_connection_loss(sdata); - - WARN_ON(!(hw->flags & IEEE80211_HW_CONNECTION_MONITOR)); - ieee80211_queue_work(hw, &sdata->u.mgd.beacon_connection_loss_work); -} -EXPORT_SYMBOL(ieee80211_connection_loss); - - -static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata, - bool assoc) -{ - struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; - - lockdep_assert_held(&sdata->u.mgd.mtx); - - if (!assoc) { - sta_info_destroy_addr(sdata, auth_data->bss->bssid); - - memset(sdata->u.mgd.bssid, 0, ETH_ALEN); - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID); - } - - cfg80211_put_bss(auth_data->bss); - kfree(auth_data); - sdata->u.mgd.auth_data = NULL; -} - -static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, size_t len) -{ - struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; - u8 *pos; - struct ieee802_11_elems elems; - - pos = mgmt->u.auth.variable; - ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); - if (!elems.challenge) - return; - auth_data->expected_transaction = 4; - ieee80211_send_auth(sdata, 3, auth_data->algorithm, - elems.challenge - 2, elems.challenge_len + 2, - auth_data->bss->bssid, auth_data->bss->bssid, - auth_data->key, auth_data->key_len, - auth_data->key_idx); -} - -static enum rx_mgmt_action __must_check -ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, size_t len) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - u8 bssid[ETH_ALEN]; - u16 auth_alg, auth_transaction, status_code; - struct sta_info *sta; - - lockdep_assert_held(&ifmgd->mtx); - - if (len < 24 + 6) - return RX_MGMT_NONE; - - if (!ifmgd->auth_data || ifmgd->auth_data->done) - return RX_MGMT_NONE; - - memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN); - - if (compare_ether_addr(bssid, mgmt->bssid)) - return RX_MGMT_NONE; - - auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); - auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction); - status_code = le16_to_cpu(mgmt->u.auth.status_code); - - if (auth_alg != ifmgd->auth_data->algorithm || - auth_transaction != ifmgd->auth_data->expected_transaction) - return RX_MGMT_NONE; - - if (status_code != WLAN_STATUS_SUCCESS) { - printk(KERN_DEBUG "%s: %pM denied authentication (status %d)\n", - sdata->name, mgmt->sa, status_code); - goto out; - } - - switch (ifmgd->auth_data->algorithm) { - case WLAN_AUTH_OPEN: - case WLAN_AUTH_LEAP: - case WLAN_AUTH_FT: - break; - case WLAN_AUTH_SHARED_KEY: - if (ifmgd->auth_data->expected_transaction != 4) { - ieee80211_auth_challenge(sdata, mgmt, len); - /* need another frame */ - return RX_MGMT_NONE; - } - break; - default: - WARN_ONCE(1, "invalid auth alg %d", - ifmgd->auth_data->algorithm); - return RX_MGMT_NONE; - } - - printk(KERN_DEBUG "%s: authenticated\n", sdata->name); - out: - ifmgd->auth_data->done = true; - ifmgd->auth_data->timeout = jiffies + IEEE80211_AUTH_WAIT_ASSOC; - run_again(ifmgd, ifmgd->auth_data->timeout); - - /* move station state to auth */ - mutex_lock(&sdata->local->sta_mtx); - sta = sta_info_get(sdata, bssid); - if (!sta) { - WARN_ONCE(1, "%s: STA %pM not found", sdata->name, bssid); - goto out_err; - } - if (sta_info_move_state(sta, IEEE80211_STA_AUTH)) { - printk(KERN_DEBUG "%s: failed moving %pM to auth\n", - sdata->name, bssid); - goto out_err; - } - mutex_unlock(&sdata->local->sta_mtx); - - return RX_MGMT_CFG80211_RX_AUTH; - out_err: - mutex_unlock(&sdata->local->sta_mtx); - /* ignore frame -- wait for timeout */ - return RX_MGMT_NONE; -} - - -static enum rx_mgmt_action __must_check -ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, size_t len) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - const u8 *bssid = NULL; - u16 reason_code; - - lockdep_assert_held(&ifmgd->mtx); - - if (len < 24 + 2) - return RX_MGMT_NONE; - - if (!ifmgd->associated || - compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid)) - return RX_MGMT_NONE; - - bssid = ifmgd->associated->bssid; - - reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); - - printk(KERN_DEBUG "%s: deauthenticated from %pM (Reason: %u)\n", - sdata->name, bssid, reason_code); - - ieee80211_set_disassoc(sdata, 0, 0, false, NULL); - - mutex_lock(&sdata->local->mtx); - ieee80211_recalc_idle(sdata->local); - mutex_unlock(&sdata->local->mtx); - - return RX_MGMT_CFG80211_DEAUTH; -} - - -static enum rx_mgmt_action __must_check -ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, size_t len) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - u16 reason_code; - - lockdep_assert_held(&ifmgd->mtx); - - if (len < 24 + 2) - return RX_MGMT_NONE; - - if (!ifmgd->associated || - compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid)) - return RX_MGMT_NONE; - - reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); - - printk(KERN_DEBUG "%s: disassociated from %pM (Reason: %u)\n", - sdata->name, mgmt->sa, reason_code); - - ieee80211_set_disassoc(sdata, 0, 0, false, NULL); - - mutex_lock(&sdata->local->mtx); - ieee80211_recalc_idle(sdata->local); - mutex_unlock(&sdata->local->mtx); - - return RX_MGMT_CFG80211_DISASSOC; -} - -static void ieee80211_get_rates(struct ieee80211_supported_band *sband, - u8 *supp_rates, unsigned int supp_rates_len, - u32 *rates, u32 *basic_rates, - bool *have_higher_than_11mbit, - int *min_rate, int *min_rate_index) -{ - int i, j; - - for (i = 0; i < supp_rates_len; i++) { - int rate = (supp_rates[i] & 0x7f) * 5; - bool is_basic = !!(supp_rates[i] & 0x80); - - if (rate > 110) - *have_higher_than_11mbit = true; - - /* - * BSS_MEMBERSHIP_SELECTOR_HT_PHY is defined in 802.11n-2009 - * 7.3.2.2 as a magic value instead of a rate. Hence, skip it. - * - * Note: Even through the membership selector and the basic - * rate flag share the same bit, they are not exactly - * the same. - */ - if (!!(supp_rates[i] & 0x80) && - (supp_rates[i] & 0x7f) == BSS_MEMBERSHIP_SELECTOR_HT_PHY) - continue; - - for (j = 0; j < sband->n_bitrates; j++) { - if (sband->bitrates[j].bitrate == rate) { - *rates |= BIT(j); - if (is_basic) - *basic_rates |= BIT(j); - if (rate < *min_rate) { - *min_rate = rate; - *min_rate_index = j; - } - break; - } - } - } -} - -static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata, - bool assoc) -{ - struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; - - lockdep_assert_held(&sdata->u.mgd.mtx); - - if (!assoc) { - sta_info_destroy_addr(sdata, assoc_data->bss->bssid); - - memset(sdata->u.mgd.bssid, 0, ETH_ALEN); - ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BSSID); - } - - kfree(assoc_data); - sdata->u.mgd.assoc_data = NULL; -} - -/* - * [PLATA] after a association success - the state machine is changed...how to do this for the OCB mode? - * probably the station should directly be in mode 'authorized' - */ -static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, - struct cfg80211_bss *cbss, - struct ieee80211_mgmt *mgmt, size_t len) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_local *local = sdata->local; - struct ieee80211_supported_band *sband; - struct sta_info *sta; - u8 *pos; - u16 capab_info, aid; - struct ieee802_11_elems elems; - struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; - u32 changed = 0; - int err; - u16 ap_ht_cap_flags; - - /* AssocResp and ReassocResp have identical structure */ - - aid = le16_to_cpu(mgmt->u.assoc_resp.aid); - capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); - - if ((aid & (BIT(15) | BIT(14))) != (BIT(15) | BIT(14))) - printk(KERN_DEBUG - "%s: invalid AID value 0x%x; bits 15:14 not set\n", - sdata->name, aid); - aid &= ~(BIT(15) | BIT(14)); - - ifmgd->broken_ap = false; - - if (aid == 0 || aid > IEEE80211_MAX_AID) { - printk(KERN_DEBUG - "%s: invalid AID value %d (out of range), turn off PS\n", - sdata->name, aid); - aid = 0; - ifmgd->broken_ap = true; - } - - pos = mgmt->u.assoc_resp.variable; - ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); - - if (!elems.supp_rates) { - printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n", - sdata->name); - return false; - } - - ifmgd->aid = aid; - - mutex_lock(&sdata->local->sta_mtx); - /* - * station info was already allocated and inserted before - * the association and should be available to us - */ - sta = sta_info_get(sdata, cbss->bssid); - if (WARN_ON(!sta)) { - mutex_unlock(&sdata->local->sta_mtx); - return false; - } - - sband = local->hw.wiphy->bands[local->oper_channel->band]; - - if (elems.ht_cap_elem && !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) - ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, - elems.ht_cap_elem, &sta->sta.ht_cap); - - ap_ht_cap_flags = sta->sta.ht_cap.cap; - - rate_control_rate_init(sta); - - if (ifmgd->flags & IEEE80211_STA_MFP_ENABLED) - set_sta_flag(sta, WLAN_STA_MFP); - - if (elems.wmm_param) - set_sta_flag(sta, WLAN_STA_WME); - - err = sta_info_move_state(sta, IEEE80211_STA_AUTH); - if (!err) - err = sta_info_move_state(sta, IEEE80211_STA_ASSOC); - if (!err && !(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) - err = sta_info_move_state(sta, IEEE80211_STA_AUTHORIZED); - if (err) { - printk(KERN_DEBUG - "%s: failed to move station %pM to desired state\n", - sdata->name, sta->sta.addr); - WARN_ON(__sta_info_destroy(sta)); - mutex_unlock(&sdata->local->sta_mtx); - return false; - } - - mutex_unlock(&sdata->local->sta_mtx); - - /* - * Always handle WMM once after association regardless - * of the first value the AP uses. Setting -1 here has - * that effect because the AP values is an unsigned - * 4-bit value. - */ - ifmgd->wmm_last_param_set = -1; - - if (elems.wmm_param) - ieee80211_sta_wmm_params(local, sdata, elems.wmm_param, - elems.wmm_param_len); - else - ieee80211_set_wmm_default(sdata, false); - changed |= BSS_CHANGED_QOS; - - if (elems.ht_info_elem && elems.wmm_param && - !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) - changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem, - cbss->bssid, ap_ht_cap_flags, - false); - - /* set AID and assoc capability, - * ieee80211_set_associated() will tell the driver */ - bss_conf->aid = aid; - bss_conf->assoc_capability = capab_info; - ieee80211_set_associated(sdata, cbss, changed); - - /* - * If we're using 4-addr mode, let the AP know that we're - * doing so, so that it can create the STA VLAN on its side - */ - if (ifmgd->use_4addr) - ieee80211_send_4addr_nullfunc(local, sdata); - - /* - * Start timer to probe the connection to the AP now. - * Also start the timer that will detect beacon loss. - */ - ieee80211_sta_rx_notify(sdata, (struct ieee80211_hdr *)mgmt); - ieee80211_sta_reset_beacon_monitor(sdata); - - return true; -} - -static enum rx_mgmt_action __must_check -ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, size_t len, - struct cfg80211_bss **bss) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_mgd_assoc_data *assoc_data = ifmgd->assoc_data; - u16 capab_info, status_code, aid; - struct ieee802_11_elems elems; - u8 *pos; - bool reassoc; - - lockdep_assert_held(&ifmgd->mtx); - - if (!assoc_data) - return RX_MGMT_NONE; - if (compare_ether_addr(assoc_data->bss->bssid, mgmt->bssid)) - return RX_MGMT_NONE; - - /* - * AssocResp and ReassocResp have identical structure, so process both - * of them in this function. - */ - - if (len < 24 + 6) - return RX_MGMT_NONE; - - reassoc = ieee80211_is_reassoc_req(mgmt->frame_control); - capab_info = le16_to_cpu(mgmt->u.assoc_resp.capab_info); - status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); - aid = le16_to_cpu(mgmt->u.assoc_resp.aid); - - printk(KERN_DEBUG "%s: RX %sssocResp from %pM (capab=0x%x " - "status=%d aid=%d)\n", - sdata->name, reassoc ? "Rea" : "A", mgmt->sa, - capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14)))); - - pos = mgmt->u.assoc_resp.variable; - ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems); - - if (status_code == WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY && - elems.timeout_int && elems.timeout_int_len == 5 && - elems.timeout_int[0] == WLAN_TIMEOUT_ASSOC_COMEBACK) { - u32 tu, ms; - tu = get_unaligned_le32(elems.timeout_int + 1); - ms = tu * 1024 / 1000; - printk(KERN_DEBUG "%s: %pM rejected association temporarily; " - "comeback duration %u TU (%u ms)\n", - sdata->name, mgmt->sa, tu, ms); - assoc_data->timeout = jiffies + msecs_to_jiffies(ms); - if (ms > IEEE80211_ASSOC_TIMEOUT) - run_again(ifmgd, assoc_data->timeout); - return RX_MGMT_NONE; - } - - *bss = assoc_data->bss; - - if (status_code != WLAN_STATUS_SUCCESS) { - printk(KERN_DEBUG "%s: %pM denied association (code=%d)\n", - sdata->name, mgmt->sa, status_code); - ieee80211_destroy_assoc_data(sdata, false); - } else { - printk(KERN_DEBUG "%s: associated\n", sdata->name); - - if (!ieee80211_assoc_success(sdata, *bss, mgmt, len)) { - /* oops -- internal error -- send timeout for now */ - ieee80211_destroy_assoc_data(sdata, true); - sta_info_destroy_addr(sdata, mgmt->bssid); - cfg80211_put_bss(*bss); - return RX_MGMT_CFG80211_ASSOC_TIMEOUT; - } - - /* - * destroy assoc_data afterwards, as otherwise an idle - * recalc after assoc_data is NULL but before associated - * is set can cause the interface to go idle - */ - ieee80211_destroy_assoc_data(sdata, true); - } - - return RX_MGMT_CFG80211_RX_ASSOC; -} -static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - size_t len, - struct ieee80211_rx_status *rx_status, - struct ieee802_11_elems *elems, - bool beacon) -{ - struct ieee80211_local *local = sdata->local; - int freq; - struct ieee80211_bss *bss; - struct ieee80211_channel *channel; - bool need_ps = false; - - if (sdata->u.mgd.associated && - compare_ether_addr(mgmt->bssid, sdata->u.mgd.associated->bssid) - == 0) { - bss = (void *)sdata->u.mgd.associated->priv; - /* not previously set so we may need to recalc */ - need_ps = !bss->dtim_period; - } - - if (elems->ds_params && elems->ds_params_len == 1) - freq = ieee80211_channel_to_frequency(elems->ds_params[0], - rx_status->band); - else - freq = rx_status->freq; - - channel = ieee80211_get_channel(local->hw.wiphy, freq); - - if (!channel || channel->flags & IEEE80211_CHAN_DISABLED) - return; - - bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems, - channel, beacon); - if (bss) - ieee80211_rx_bss_put(local, bss); - - if (!sdata->u.mgd.associated) - return; - - if (need_ps) { - mutex_lock(&local->iflist_mtx); - ieee80211_recalc_ps(local, -1); - mutex_unlock(&local->iflist_mtx); - } - - if (elems->ch_switch_elem && (elems->ch_switch_elem_len == 3) && - (memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid, - ETH_ALEN) == 0)) { - struct ieee80211_channel_sw_ie *sw_elem = - (struct ieee80211_channel_sw_ie *)elems->ch_switch_elem; - ieee80211_sta_process_chanswitch(sdata, sw_elem, - bss, rx_status->mactime); - } -} - - -static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb) -{ - struct ieee80211_mgmt *mgmt = (void *)skb->data; - struct ieee80211_if_managed *ifmgd; - struct ieee80211_rx_status *rx_status = (void *) skb->cb; - size_t baselen, len = skb->len; - struct ieee802_11_elems elems; - - ifmgd = &sdata->u.mgd; - - ASSERT_MGD_MTX(ifmgd); - - if (compare_ether_addr(mgmt->da, sdata->vif.addr)) - return; /* ignore ProbeResp to foreign address */ - - baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; - if (baselen > len) - return; - - ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen, - &elems); - - ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false); - - if (ifmgd->associated && - compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid) == 0) - ieee80211_reset_ap_probe(sdata); - - if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies && - compare_ether_addr(mgmt->bssid, ifmgd->auth_data->bss->bssid) - == 0) { - /* got probe response, continue with auth */ - printk(KERN_DEBUG "%s: direct probe responded\n", sdata->name); - ifmgd->auth_data->tries = 0; - ifmgd->auth_data->timeout = jiffies; - run_again(ifmgd, ifmgd->auth_data->timeout); - } -} - -/* - * This is the canonical list of information elements we care about, - * the filter code also gives us all changes to the Microsoft OUI - * (00:50:F2) vendor IE which is used for WMM which we need to track. - * - * We implement beacon filtering in software since that means we can - * avoid processing the frame here and in cfg80211, and userspace - * will not be able to tell whether the hardware supports it or not. - * - * XXX: This list needs to be dynamic -- userspace needs to be able to - * add items it requires. It also needs to be able to tell us to - * look out for other vendor IEs. - */ -static const u64 care_about_ies = - (1ULL << WLAN_EID_COUNTRY) | - (1ULL << WLAN_EID_ERP_INFO) | - (1ULL << WLAN_EID_CHANNEL_SWITCH) | - (1ULL << WLAN_EID_PWR_CONSTRAINT) | - (1ULL << WLAN_EID_HT_CAPABILITY) | - (1ULL << WLAN_EID_HT_INFORMATION); - -static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - size_t len, - struct ieee80211_rx_status *rx_status) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; - size_t baselen; - struct ieee802_11_elems elems; - struct ieee80211_local *local = sdata->local; - u32 changed = 0; - bool erp_valid, directed_tim = false; - u8 erp_value = 0; - u32 ncrc; - u8 *bssid; - - lockdep_assert_held(&ifmgd->mtx); - - /* Process beacon from the current BSS */ - baselen = (u8 *) mgmt->u.beacon.variable - (u8 *) mgmt; - if (baselen > len) - return; - - if (rx_status->freq != local->hw.conf.channel->center_freq) - return; - - if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon && - compare_ether_addr(mgmt->bssid, ifmgd->assoc_data->bss->bssid) - == 0) { - ieee802_11_parse_elems(mgmt->u.beacon.variable, - len - baselen, &elems); - - ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, - false); - ifmgd->assoc_data->have_beacon = true; - ifmgd->assoc_data->sent_assoc = false; - /* continue assoc process */ - ifmgd->assoc_data->timeout = jiffies; - run_again(ifmgd, ifmgd->assoc_data->timeout); - return; - } - - if (!ifmgd->associated || - compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid)) - return; - bssid = ifmgd->associated->bssid; - - /* Track average RSSI from the Beacon frames of the current AP */ - ifmgd->last_beacon_signal = rx_status->signal; - if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { - ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; - ifmgd->ave_beacon_signal = rx_status->signal * 16; - ifmgd->last_cqm_event_signal = 0; - ifmgd->count_beacon_signal = 1; - ifmgd->last_ave_beacon_signal = 0; - } else { - ifmgd->ave_beacon_signal = - (IEEE80211_SIGNAL_AVE_WEIGHT * rx_status->signal * 16 + - (16 - IEEE80211_SIGNAL_AVE_WEIGHT) * - ifmgd->ave_beacon_signal) / 16; - ifmgd->count_beacon_signal++; - } - - if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold && - ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { - int sig = ifmgd->ave_beacon_signal; - int last_sig = ifmgd->last_ave_beacon_signal; - - /* - * if signal crosses either of the boundaries, invoke callback - * with appropriate parameters - */ - if (sig > ifmgd->rssi_max_thold && - (last_sig <= ifmgd->rssi_min_thold || last_sig == 0)) { - ifmgd->last_ave_beacon_signal = sig; - drv_rssi_callback(local, RSSI_EVENT_HIGH); - } else if (sig < ifmgd->rssi_min_thold && - (last_sig >= ifmgd->rssi_max_thold || - last_sig == 0)) { - ifmgd->last_ave_beacon_signal = sig; - drv_rssi_callback(local, RSSI_EVENT_LOW); - } - } - - if (bss_conf->cqm_rssi_thold && - ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT && - !(sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) { - int sig = ifmgd->ave_beacon_signal / 16; - int last_event = ifmgd->last_cqm_event_signal; - int thold = bss_conf->cqm_rssi_thold; - int hyst = bss_conf->cqm_rssi_hyst; - if (sig < thold && - (last_event == 0 || sig < last_event - hyst)) { - ifmgd->last_cqm_event_signal = sig; - ieee80211_cqm_rssi_notify( - &sdata->vif, - NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, - GFP_KERNEL); - } else if (sig > thold && - (last_event == 0 || sig > last_event + hyst)) { - ifmgd->last_cqm_event_signal = sig; - ieee80211_cqm_rssi_notify( - &sdata->vif, - NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, - GFP_KERNEL); - } - } - - if (ifmgd->flags & IEEE80211_STA_BEACON_POLL) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - if (net_ratelimit()) { - printk(KERN_DEBUG "%s: cancelling probereq poll due " - "to a received beacon\n", sdata->name); - } -#endif - ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL; - mutex_lock(&local->iflist_mtx); - ieee80211_recalc_ps(local, -1); - mutex_unlock(&local->iflist_mtx); - } - - /* - * Push the beacon loss detection into the future since - * we are processing a beacon from the AP just now. - */ - ieee80211_sta_reset_beacon_monitor(sdata); - - ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); - ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable, - len - baselen, &elems, - care_about_ies, ncrc); - - if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) - directed_tim = ieee80211_check_tim(elems.tim, elems.tim_len, - ifmgd->aid); - - if (ncrc != ifmgd->beacon_crc || !ifmgd->beacon_crc_valid) { - ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, - true); - - ieee80211_sta_wmm_params(local, sdata, elems.wmm_param, - elems.wmm_param_len); - } - - if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) { - if (directed_tim) { - if (local->hw.conf.dynamic_ps_timeout > 0) { - local->hw.conf.flags &= ~IEEE80211_CONF_PS; - ieee80211_hw_config(local, - IEEE80211_CONF_CHANGE_PS); - ieee80211_send_nullfunc(local, sdata, 0); - } else { - local->pspolling = true; - - /* - * Here is assumed that the driver will be - * able to send ps-poll frame and receive a - * response even though power save mode is - * enabled, but some drivers might require - * to disable power save here. This needs - * to be investigated. - */ - ieee80211_send_pspoll(local, sdata); - } - } - } - - if (ncrc == ifmgd->beacon_crc && ifmgd->beacon_crc_valid) - return; - ifmgd->beacon_crc = ncrc; - ifmgd->beacon_crc_valid = true; - - if (elems.erp_info && elems.erp_info_len >= 1) { - erp_valid = true; - erp_value = elems.erp_info[0]; - } else { - erp_valid = false; - } - changed |= ieee80211_handle_bss_capability(sdata, - le16_to_cpu(mgmt->u.beacon.capab_info), - erp_valid, erp_value); - - - if (elems.ht_cap_elem && elems.ht_info_elem && elems.wmm_param && - !(ifmgd->flags & IEEE80211_STA_DISABLE_11N)) { - struct sta_info *sta; - struct ieee80211_supported_band *sband; - u16 ap_ht_cap_flags; - - rcu_read_lock(); - - sta = sta_info_get(sdata, bssid); - if (WARN_ON(!sta)) { - rcu_read_unlock(); - return; - } - - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - - ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, - elems.ht_cap_elem, &sta->sta.ht_cap); - - ap_ht_cap_flags = sta->sta.ht_cap.cap; - - rcu_read_unlock(); - - changed |= ieee80211_enable_ht(sdata, elems.ht_info_elem, - bssid, ap_ht_cap_flags, true); - } - - /* Note: country IE parsing is done for us by cfg80211 */ - if (elems.country_elem) { - /* TODO: IBSS also needs this */ - if (elems.pwr_constr_elem) - ieee80211_handle_pwr_constr(sdata, - le16_to_cpu(mgmt->u.probe_resp.capab_info), - elems.pwr_constr_elem, - elems.pwr_constr_elem_len); - } - - ieee80211_bss_info_change_notify(sdata, changed); -} - -void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_rx_status *rx_status; - struct ieee80211_mgmt *mgmt; - struct cfg80211_bss *bss = NULL; - enum rx_mgmt_action rma = RX_MGMT_NONE; - u16 fc; - - rx_status = (struct ieee80211_rx_status *) skb->cb; - mgmt = (struct ieee80211_mgmt *) skb->data; - fc = le16_to_cpu(mgmt->frame_control); - - mutex_lock(&ifmgd->mtx); - - switch (fc & IEEE80211_FCTL_STYPE) { - case IEEE80211_STYPE_BEACON: - ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len, rx_status); - break; - case IEEE80211_STYPE_PROBE_RESP: - ieee80211_rx_mgmt_probe_resp(sdata, skb); - break; - case IEEE80211_STYPE_AUTH: - rma = ieee80211_rx_mgmt_auth(sdata, mgmt, skb->len); - break; - case IEEE80211_STYPE_DEAUTH: - rma = ieee80211_rx_mgmt_deauth(sdata, mgmt, skb->len); - break; - case IEEE80211_STYPE_DISASSOC: - rma = ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->len); - break; - case IEEE80211_STYPE_ASSOC_RESP: - case IEEE80211_STYPE_REASSOC_RESP: - rma = ieee80211_rx_mgmt_assoc_resp(sdata, mgmt, skb->len, &bss); - break; - case IEEE80211_STYPE_ACTION: - switch (mgmt->u.action.category) { - case WLAN_CATEGORY_SPECTRUM_MGMT: - ieee80211_sta_process_chanswitch(sdata, - &mgmt->u.action.u.chan_switch.sw_elem, - (void *)ifmgd->associated->priv, - rx_status->mactime); - break; - } - } - mutex_unlock(&ifmgd->mtx); - - switch (rma) { - case RX_MGMT_NONE: - /* no action */ - break; - case RX_MGMT_CFG80211_DEAUTH: - cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len); - break; - case RX_MGMT_CFG80211_DISASSOC: - cfg80211_send_disassoc(sdata->dev, (u8 *)mgmt, skb->len); - break; - case RX_MGMT_CFG80211_RX_AUTH: - cfg80211_send_rx_auth(sdata->dev, (u8 *)mgmt, skb->len); - break; - case RX_MGMT_CFG80211_RX_ASSOC: - cfg80211_send_rx_assoc(sdata->dev, bss, (u8 *)mgmt, skb->len); - break; - case RX_MGMT_CFG80211_ASSOC_TIMEOUT: - cfg80211_send_assoc_timeout(sdata->dev, mgmt->bssid); - break; - default: - WARN(1, "unexpected: %d", rma); - } -} - -static void ieee80211_sta_timer(unsigned long data) -{ - struct ieee80211_sub_if_data *sdata = - (struct ieee80211_sub_if_data *) data; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_local *local = sdata->local; - - if (local->quiescing) { - set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running); - return; - } - - ieee80211_queue_work(&local->hw, &sdata->work); -} - -static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata, - u8 *bssid, u8 reason) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - u8 frame_buf[DEAUTH_DISASSOC_LEN]; - - ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL | - IEEE80211_STA_BEACON_POLL); - - ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason, - false, frame_buf); - mutex_unlock(&ifmgd->mtx); - - /* - * must be outside lock due to cfg80211, - * but that's not a problem. - */ - cfg80211_send_deauth(sdata->dev, frame_buf, DEAUTH_DISASSOC_LEN); - - mutex_lock(&local->mtx); - ieee80211_recalc_idle(local); - mutex_unlock(&local->mtx); - - mutex_lock(&ifmgd->mtx); -} - -static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_mgd_auth_data *auth_data = ifmgd->auth_data; - - lockdep_assert_held(&ifmgd->mtx); - - if (WARN_ON_ONCE(!auth_data)) - return -EINVAL; - - auth_data->tries++; - - if (auth_data->tries > IEEE80211_AUTH_MAX_TRIES) { - printk(KERN_DEBUG "%s: authentication with %pM timed out\n", - sdata->name, auth_data->bss->bssid); - - /* - * Most likely AP is not in the range so remove the - * bss struct for that AP. - */ - cfg80211_unlink_bss(local->hw.wiphy, auth_data->bss); - - return -ETIMEDOUT; - } - - if (auth_data->bss->proberesp_ies) { - printk(KERN_DEBUG "%s: send auth to %pM (try %d/%d)\n", - sdata->name, auth_data->bss->bssid, auth_data->tries, - IEEE80211_AUTH_MAX_TRIES); - - auth_data->expected_transaction = 2; - ieee80211_send_auth(sdata, 1, auth_data->algorithm, - auth_data->ie, auth_data->ie_len, - auth_data->bss->bssid, - auth_data->bss->bssid, NULL, 0, 0); - } else { - const u8 *ssidie; - - printk(KERN_DEBUG "%s: direct probe to %pM (try %d/%i)\n", - sdata->name, auth_data->bss->bssid, auth_data->tries, - IEEE80211_AUTH_MAX_TRIES); - - ssidie = ieee80211_bss_get_ie(auth_data->bss, WLAN_EID_SSID); - if (!ssidie) - return -EINVAL; - /* - * Direct probe is sent to broadcast address as some APs - * will not answer to direct packet in unassociated state. - */ - ieee80211_send_probe_req(sdata, NULL, ssidie + 2, ssidie[1], - NULL, 0, (u32) -1, true, false); - } - - auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; - run_again(ifmgd, auth_data->timeout); - - return 0; -} - -static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; - struct ieee80211_local *local = sdata->local; - - lockdep_assert_held(&sdata->u.mgd.mtx); - - assoc_data->tries++; - if (assoc_data->tries > IEEE80211_ASSOC_MAX_TRIES) { - printk(KERN_DEBUG "%s: association with %pM timed out\n", - sdata->name, assoc_data->bss->bssid); - - /* - * Most likely AP is not in the range so remove the - * bss struct for that AP. - */ - cfg80211_unlink_bss(local->hw.wiphy, assoc_data->bss); - - return -ETIMEDOUT; - } - - printk(KERN_DEBUG "%s: associate with %pM (try %d/%d)\n", - sdata->name, assoc_data->bss->bssid, assoc_data->tries, - IEEE80211_ASSOC_MAX_TRIES); - ieee80211_send_assoc(sdata); - - assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT; - run_again(&sdata->u.mgd, assoc_data->timeout); - - return 0; -} - -void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - mutex_lock(&ifmgd->mtx); - - if (ifmgd->auth_data && - time_after(jiffies, ifmgd->auth_data->timeout)) { - if (ifmgd->auth_data->done) { - /* - * ok ... we waited for assoc but userspace didn't, - * so let's just kill the auth data - */ - ieee80211_destroy_auth_data(sdata, false); - } else if (ieee80211_probe_auth(sdata)) { - u8 bssid[ETH_ALEN]; - - memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN); - - ieee80211_destroy_auth_data(sdata, false); - - mutex_unlock(&ifmgd->mtx); - cfg80211_send_auth_timeout(sdata->dev, bssid); - mutex_lock(&ifmgd->mtx); - } - } else if (ifmgd->auth_data) - run_again(ifmgd, ifmgd->auth_data->timeout); - - if (ifmgd->assoc_data && - time_after(jiffies, ifmgd->assoc_data->timeout)) { - if (!ifmgd->assoc_data->have_beacon || - ieee80211_do_assoc(sdata)) { - u8 bssid[ETH_ALEN]; - - memcpy(bssid, ifmgd->assoc_data->bss->bssid, ETH_ALEN); - - ieee80211_destroy_assoc_data(sdata, false); - - mutex_unlock(&ifmgd->mtx); - cfg80211_send_assoc_timeout(sdata->dev, bssid); - mutex_lock(&ifmgd->mtx); - } - } else if (ifmgd->assoc_data) - run_again(ifmgd, ifmgd->assoc_data->timeout); - - if (ifmgd->flags & (IEEE80211_STA_BEACON_POLL | - IEEE80211_STA_CONNECTION_POLL) && - ifmgd->associated) { - u8 bssid[ETH_ALEN]; - int max_tries; - - memcpy(bssid, ifmgd->associated->bssid, ETH_ALEN); - - if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) - max_tries = max_nullfunc_tries; - else - max_tries = max_probe_tries; - - /* ACK received for nullfunc probing frame */ - if (!ifmgd->probe_send_count) - ieee80211_reset_ap_probe(sdata); - else if (ifmgd->nullfunc_failed) { - if (ifmgd->probe_send_count < max_tries) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(local->hw.wiphy, - "%s: No ack for nullfunc frame to" - " AP %pM, try %d/%i\n", - sdata->name, bssid, - ifmgd->probe_send_count, max_tries); -#endif - ieee80211_mgd_probe_ap_send(sdata); - } else { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(local->hw.wiphy, - "%s: No ack for nullfunc frame to" - " AP %pM, disconnecting.\n", - sdata->name, bssid); -#endif - ieee80211_sta_connection_lost(sdata, bssid, - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); - } - } else if (time_is_after_jiffies(ifmgd->probe_timeout)) - run_again(ifmgd, ifmgd->probe_timeout); - else if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(local->hw.wiphy, - "%s: Failed to send nullfunc to AP %pM" - " after %dms, disconnecting.\n", - sdata->name, - bssid, probe_wait_ms); -#endif - ieee80211_sta_connection_lost(sdata, bssid, - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); - } else if (ifmgd->probe_send_count < max_tries) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(local->hw.wiphy, - "%s: No probe response from AP %pM" - " after %dms, try %d/%i\n", - sdata->name, - bssid, probe_wait_ms, - ifmgd->probe_send_count, max_tries); -#endif - ieee80211_mgd_probe_ap_send(sdata); - } else { - /* - * We actually lost the connection ... or did we? - * Let's make sure! - */ - wiphy_debug(local->hw.wiphy, - "%s: No probe response from AP %pM" - " after %dms, disconnecting.\n", - sdata->name, - bssid, probe_wait_ms); - - ieee80211_sta_connection_lost(sdata, bssid, - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); - } - } - - mutex_unlock(&ifmgd->mtx); - - mutex_lock(&local->mtx); - ieee80211_recalc_idle(local); - mutex_unlock(&local->mtx); -} - -static void ieee80211_sta_bcn_mon_timer(unsigned long data) -{ - struct ieee80211_sub_if_data *sdata = - (struct ieee80211_sub_if_data *) data; - struct ieee80211_local *local = sdata->local; - - if (local->quiescing) - return; - - ieee80211_queue_work(&sdata->local->hw, - &sdata->u.mgd.beacon_connection_loss_work); -} - -static void ieee80211_sta_conn_mon_timer(unsigned long data) -{ - struct ieee80211_sub_if_data *sdata = - (struct ieee80211_sub_if_data *) data; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_local *local = sdata->local; - - if (local->quiescing) - return; - - ieee80211_queue_work(&local->hw, &ifmgd->monitor_work); -} - -static void ieee80211_sta_monitor_work(struct work_struct *work) -{ - struct ieee80211_sub_if_data *sdata = - container_of(work, struct ieee80211_sub_if_data, - u.mgd.monitor_work); - - ieee80211_mgd_probe_ap(sdata, false); -} - -static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata) -{ - u32 flags; - - if (sdata->vif.type == NL80211_IFTYPE_STATION) { - sdata->u.mgd.flags &= ~(IEEE80211_STA_BEACON_POLL | - IEEE80211_STA_CONNECTION_POLL); - - /* let's probe the connection once */ - flags = sdata->local->hw.flags; - if (!(flags & IEEE80211_HW_CONNECTION_MONITOR)) - ieee80211_queue_work(&sdata->local->hw, - &sdata->u.mgd.monitor_work); - /* and do all the other regular work too */ - ieee80211_queue_work(&sdata->local->hw, &sdata->work); - } -} - -#ifdef CONFIG_PM -void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - /* - * we need to use atomic bitops for the running bits - * only because both timers might fire at the same - * time -- the code here is properly synchronised. - */ - - cancel_work_sync(&ifmgd->request_smps_work); - - cancel_work_sync(&ifmgd->monitor_work); - cancel_work_sync(&ifmgd->beacon_connection_loss_work); - if (del_timer_sync(&ifmgd->timer)) - set_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running); - - cancel_work_sync(&ifmgd->chswitch_work); - if (del_timer_sync(&ifmgd->chswitch_timer)) - set_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running); - - /* these will just be re-established on connection */ - del_timer_sync(&ifmgd->conn_mon_timer); - del_timer_sync(&ifmgd->bcn_mon_timer); -} - -void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - if (!ifmgd->associated) - return; - - if (sdata->flags & IEEE80211_SDATA_DISCONNECT_RESUME) { - sdata->flags &= ~IEEE80211_SDATA_DISCONNECT_RESUME; - mutex_lock(&ifmgd->mtx); - if (ifmgd->associated) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(sdata->local->hw.wiphy, - "%s: driver requested disconnect after resume.\n", - sdata->name); -#endif - ieee80211_sta_connection_lost(sdata, - ifmgd->associated->bssid, - WLAN_REASON_UNSPECIFIED); - mutex_unlock(&ifmgd->mtx); - return; - } - mutex_unlock(&ifmgd->mtx); - } - - if (test_and_clear_bit(TMR_RUNNING_TIMER, &ifmgd->timers_running)) - add_timer(&ifmgd->timer); - if (test_and_clear_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running)) - add_timer(&ifmgd->chswitch_timer); - ieee80211_sta_reset_beacon_monitor(sdata); - ieee80211_restart_sta_timer(sdata); -} -#endif - -/* interface setup */ -void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_managed *ifmgd; - - ifmgd = &sdata->u.mgd; - INIT_WORK(&ifmgd->monitor_work, ieee80211_sta_monitor_work); - INIT_WORK(&ifmgd->chswitch_work, ieee80211_chswitch_work); - INIT_WORK(&ifmgd->beacon_connection_loss_work, - ieee80211_beacon_connection_loss_work); - INIT_WORK(&ifmgd->request_smps_work, ieee80211_request_smps_work); - setup_timer(&ifmgd->timer, ieee80211_sta_timer, - (unsigned long) sdata); - setup_timer(&ifmgd->bcn_mon_timer, ieee80211_sta_bcn_mon_timer, - (unsigned long) sdata); - setup_timer(&ifmgd->conn_mon_timer, ieee80211_sta_conn_mon_timer, - (unsigned long) sdata); - setup_timer(&ifmgd->chswitch_timer, ieee80211_chswitch_timer, - (unsigned long) sdata); - - ifmgd->flags = 0; - ifmgd->powersave = sdata->wdev.ps; - ifmgd->uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES; - ifmgd->uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN; - - mutex_init(&ifmgd->mtx); - - if (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_SMPS) - ifmgd->req_smps = IEEE80211_SMPS_AUTOMATIC; - else - ifmgd->req_smps = IEEE80211_SMPS_OFF; -} - -/* scan finished notification */ -void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local) -{ - struct ieee80211_sub_if_data *sdata = local->scan_sdata; - - /* Restart STA timers */ - rcu_read_lock(); - list_for_each_entry_rcu(sdata, &local->interfaces, list) - ieee80211_restart_sta_timer(sdata); - rcu_read_unlock(); -} - -int ieee80211_max_network_latency(struct notifier_block *nb, - unsigned long data, void *dummy) -{ - s32 latency_usec = (s32) data; - struct ieee80211_local *local = - container_of(nb, struct ieee80211_local, - network_latency_notifier); - - mutex_lock(&local->iflist_mtx); - ieee80211_recalc_ps(local, latency_usec); - mutex_unlock(&local->iflist_mtx); - - return 0; -} - -static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, - struct cfg80211_bss *cbss, bool assoc) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_bss *bss = (void *)cbss->priv; - struct sta_info *sta; - bool have_sta = false; - int err; - - if (WARN_ON(!ifmgd->auth_data && !ifmgd->assoc_data)) - return -EINVAL; - - if (assoc) { - rcu_read_lock(); - have_sta = sta_info_get(sdata, cbss->bssid); - rcu_read_unlock(); - } - - if (!have_sta) { - sta = sta_info_alloc(sdata, cbss->bssid, GFP_KERNEL); - if (!sta) - return -ENOMEM; - } - - mutex_lock(&local->mtx); - ieee80211_recalc_idle(sdata->local); - mutex_unlock(&local->mtx); - - /* switch to the right channel */ - local->oper_channel = cbss->channel; - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); - - if (!have_sta) { - struct ieee80211_supported_band *sband; - u32 rates = 0, basic_rates = 0; - bool have_higher_than_11mbit; - int min_rate = INT_MAX, min_rate_index = -1; - - sband = sdata->local->hw.wiphy->bands[cbss->channel->band]; - - ieee80211_get_rates(sband, bss->supp_rates, - bss->supp_rates_len, - &rates, &basic_rates, - &have_higher_than_11mbit, - &min_rate, &min_rate_index); - - /* - * This used to be a workaround for basic rates missing - * in the association response frame. Now that we no - * longer use the basic rates from there, it probably - * doesn't happen any more, but keep the workaround so - * in case some *other* APs are buggy in different ways - * we can connect -- with a warning. - */ - if (!basic_rates && min_rate_index >= 0) { - printk(KERN_DEBUG - "%s: No basic rates, using min rate instead.\n", - sdata->name); - basic_rates = BIT(min_rate_index); - } - - sta->sta.supp_rates[cbss->channel->band] = rates; - sdata->vif.bss_conf.basic_rates = basic_rates; - - /* cf. IEEE 802.11 9.2.12 */ - if (local->oper_channel->band == IEEE80211_BAND_2GHZ && - have_higher_than_11mbit) - sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; - else - sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; - - memcpy(ifmgd->bssid, cbss->bssid, ETH_ALEN); - - /* tell driver about BSSID and basic rates */ - ieee80211_bss_info_change_notify(sdata, - BSS_CHANGED_BSSID | BSS_CHANGED_BASIC_RATES); - - if (assoc) - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); - - err = sta_info_insert(sta); - sta = NULL; - if (err) { - printk(KERN_DEBUG - "%s: failed to insert STA entry for the AP (error %d)\n", - sdata->name, err); - return err; - } - } else - WARN_ON_ONCE(compare_ether_addr(ifmgd->bssid, cbss->bssid)); - - return 0; -} - -/* config hooks */ -int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, - struct cfg80211_auth_request *req) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_mgd_auth_data *auth_data; - u16 auth_alg; - int err; - - /* prepare auth data structure */ - - switch (req->auth_type) { - case NL80211_AUTHTYPE_OPEN_SYSTEM: - auth_alg = WLAN_AUTH_OPEN; - break; - case NL80211_AUTHTYPE_SHARED_KEY: - if (IS_ERR(local->wep_tx_tfm)) - return -EOPNOTSUPP; - auth_alg = WLAN_AUTH_SHARED_KEY; - break; - case NL80211_AUTHTYPE_FT: - auth_alg = WLAN_AUTH_FT; - break; - case NL80211_AUTHTYPE_NETWORK_EAP: - auth_alg = WLAN_AUTH_LEAP; - break; - default: - return -EOPNOTSUPP; - } - - auth_data = kzalloc(sizeof(*auth_data) + req->ie_len, GFP_KERNEL); - if (!auth_data) - return -ENOMEM; - - auth_data->bss = req->bss; - - if (req->ie && req->ie_len) { - memcpy(auth_data->ie, req->ie, req->ie_len); - auth_data->ie_len = req->ie_len; - } - - if (req->key && req->key_len) { - auth_data->key_len = req->key_len; - auth_data->key_idx = req->key_idx; - memcpy(auth_data->key, req->key, req->key_len); - } - - auth_data->algorithm = auth_alg; - - /* try to authenticate/probe */ - - mutex_lock(&ifmgd->mtx); - - if ((ifmgd->auth_data && !ifmgd->auth_data->done) || - ifmgd->assoc_data) { - err = -EBUSY; - goto err_free; - } - - if (ifmgd->auth_data) - ieee80211_destroy_auth_data(sdata, false); - - /* prep auth_data so we don't go into idle on disassoc */ - ifmgd->auth_data = auth_data; - - if (ifmgd->associated) - ieee80211_set_disassoc(sdata, 0, 0, false, NULL); - - printk(KERN_DEBUG "%s: authenticate with %pM\n", - sdata->name, req->bss->bssid); - - err = ieee80211_prep_connection(sdata, req->bss, false); - if (err) - goto err_clear; - - err = ieee80211_probe_auth(sdata); - if (err) { - sta_info_destroy_addr(sdata, req->bss->bssid); - goto err_clear; - } - - /* hold our own reference */ - cfg80211_ref_bss(auth_data->bss); - err = 0; - goto out_unlock; - - err_clear: - ifmgd->auth_data = NULL; - err_free: - kfree(auth_data); - out_unlock: - mutex_unlock(&ifmgd->mtx); - - return err; -} - -int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, - struct cfg80211_assoc_request *req) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - struct ieee80211_bss *bss = (void *)req->bss->priv; - struct ieee80211_mgd_assoc_data *assoc_data; - struct ieee80211_supported_band *sband; - const u8 *ssidie; - int i, err; - - ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID); - if (!ssidie) - return -EINVAL; - - assoc_data = kzalloc(sizeof(*assoc_data) + req->ie_len, GFP_KERNEL); - if (!assoc_data) - return -ENOMEM; - - mutex_lock(&ifmgd->mtx); - - if (ifmgd->associated) - ieee80211_set_disassoc(sdata, 0, 0, false, NULL); - - if (ifmgd->auth_data && !ifmgd->auth_data->done) { - err = -EBUSY; - goto err_free; - } - - if (ifmgd->assoc_data) { - err = -EBUSY; - goto err_free; - } - - if (ifmgd->auth_data) { - bool match; - - /* keep sta info, bssid if matching */ - match = compare_ether_addr(ifmgd->bssid, req->bss->bssid) == 0; - ieee80211_destroy_auth_data(sdata, match); - } - - /* prepare assoc data */ - - ifmgd->flags &= ~IEEE80211_STA_DISABLE_11N; - ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; - - ifmgd->beacon_crc_valid = false; - - /* - * IEEE802.11n does not allow TKIP/WEP as pairwise ciphers in HT mode. - * We still associate in non-HT mode (11a/b/g) if any one of these - * ciphers is configured as pairwise. - * We can set this to true for non-11n hardware, that'll be checked - * separately along with the peer capabilities. - */ - for (i = 0; i < req->crypto.n_ciphers_pairwise; i++) - if (req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP40 || - req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_TKIP || - req->crypto.ciphers_pairwise[i] == WLAN_CIPHER_SUITE_WEP104) - ifmgd->flags |= IEEE80211_STA_DISABLE_11N; - - if (req->flags & ASSOC_REQ_DISABLE_HT) - ifmgd->flags |= IEEE80211_STA_DISABLE_11N; - - /* Also disable HT if we don't support it or the AP doesn't use WMM */ - sband = local->hw.wiphy->bands[req->bss->channel->band]; - if (!sband->ht_cap.ht_supported || - local->hw.queues < 4 || !bss->wmm_used) - ifmgd->flags |= IEEE80211_STA_DISABLE_11N; - - memcpy(&ifmgd->ht_capa, &req->ht_capa, sizeof(ifmgd->ht_capa)); - memcpy(&ifmgd->ht_capa_mask, &req->ht_capa_mask, - sizeof(ifmgd->ht_capa_mask)); - - if (req->ie && req->ie_len) { - memcpy(assoc_data->ie, req->ie, req->ie_len); - assoc_data->ie_len = req->ie_len; - } - - assoc_data->bss = req->bss; - - if (ifmgd->req_smps == IEEE80211_SMPS_AUTOMATIC) { - if (ifmgd->powersave) - ifmgd->ap_smps = IEEE80211_SMPS_DYNAMIC; - else - ifmgd->ap_smps = IEEE80211_SMPS_OFF; - } else - ifmgd->ap_smps = ifmgd->req_smps; - - assoc_data->capability = req->bss->capability; - assoc_data->wmm = bss->wmm_used && (local->hw.queues >= 4); - assoc_data->supp_rates = bss->supp_rates; - assoc_data->supp_rates_len = bss->supp_rates_len; - assoc_data->ht_information_ie = - ieee80211_bss_get_ie(req->bss, WLAN_EID_HT_INFORMATION); - - if (bss->wmm_used && bss->uapsd_supported && - (sdata->local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD)) { - assoc_data->uapsd = true; - ifmgd->flags |= IEEE80211_STA_UAPSD_ENABLED; - } else { - assoc_data->uapsd = false; - ifmgd->flags &= ~IEEE80211_STA_UAPSD_ENABLED; - } - - memcpy(assoc_data->ssid, ssidie + 2, ssidie[1]); - assoc_data->ssid_len = ssidie[1]; - - if (req->prev_bssid) - memcpy(assoc_data->prev_bssid, req->prev_bssid, ETH_ALEN); - - if (req->use_mfp) { - ifmgd->mfp = IEEE80211_MFP_REQUIRED; - ifmgd->flags |= IEEE80211_STA_MFP_ENABLED; - } else { - ifmgd->mfp = IEEE80211_MFP_DISABLED; - ifmgd->flags &= ~IEEE80211_STA_MFP_ENABLED; - } - - if (req->crypto.control_port) - ifmgd->flags |= IEEE80211_STA_CONTROL_PORT; - else - ifmgd->flags &= ~IEEE80211_STA_CONTROL_PORT; - - sdata->control_port_protocol = req->crypto.control_port_ethertype; - sdata->control_port_no_encrypt = req->crypto.control_port_no_encrypt; - - /* kick off associate process */ - - ifmgd->assoc_data = assoc_data; - - err = ieee80211_prep_connection(sdata, req->bss, true); - if (err) - goto err_clear; - - if (!bss->dtim_period && - sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) { - /* - * Wait up to one beacon interval ... - * should this be more if we miss one? - */ - printk(KERN_DEBUG "%s: waiting for beacon from %pM\n", - sdata->name, ifmgd->bssid); - assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval); - } else { - assoc_data->have_beacon = true; - assoc_data->sent_assoc = false; - assoc_data->timeout = jiffies; - } - run_again(ifmgd, assoc_data->timeout); - - if (bss->corrupt_data) { - char *corrupt_type = "data"; - if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_BEACON) { - if (bss->corrupt_data & - IEEE80211_BSS_CORRUPT_PROBE_RESP) - corrupt_type = "beacon and probe response"; - else - corrupt_type = "beacon"; - } else if (bss->corrupt_data & IEEE80211_BSS_CORRUPT_PROBE_RESP) - corrupt_type = "probe response"; - printk(KERN_DEBUG "%s: associating with AP with corrupt %s\n", - sdata->name, corrupt_type); - } - - err = 0; - goto out; - err_clear: - ifmgd->assoc_data = NULL; - err_free: - kfree(assoc_data); - out: - mutex_unlock(&ifmgd->mtx); - - return err; -} - -int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, - struct cfg80211_deauth_request *req) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - u8 frame_buf[DEAUTH_DISASSOC_LEN]; - - mutex_lock(&ifmgd->mtx); - - if (ifmgd->auth_data) { - ieee80211_destroy_auth_data(sdata, false); - mutex_unlock(&ifmgd->mtx); - return 0; - } - - printk(KERN_DEBUG - "%s: deauthenticating from %pM by local choice (reason=%d)\n", - sdata->name, req->bssid, req->reason_code); - - if (ifmgd->associated && - compare_ether_addr(ifmgd->associated->bssid, req->bssid) == 0) - ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, - req->reason_code, true, frame_buf); - else - ieee80211_send_deauth_disassoc(sdata, req->bssid, - IEEE80211_STYPE_DEAUTH, - req->reason_code, true, - frame_buf); - mutex_unlock(&ifmgd->mtx); - - __cfg80211_send_deauth(sdata->dev, frame_buf, DEAUTH_DISASSOC_LEN); - - mutex_lock(&sdata->local->mtx); - ieee80211_recalc_idle(sdata->local); - mutex_unlock(&sdata->local->mtx); - - return 0; -} - -int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, - struct cfg80211_disassoc_request *req) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - u8 bssid[ETH_ALEN]; - u8 frame_buf[DEAUTH_DISASSOC_LEN]; - - mutex_lock(&ifmgd->mtx); - - /* - * cfg80211 should catch this ... but it's racy since - * we can receive a disassoc frame, process it, hand it - * to cfg80211 while that's in a locked section already - * trying to tell us that the user wants to disconnect. - */ - if (ifmgd->associated != req->bss) { - mutex_unlock(&ifmgd->mtx); - return -ENOLINK; - } - - printk(KERN_DEBUG "%s: disassociating from %pM by local choice (reason=%d)\n", - sdata->name, req->bss->bssid, req->reason_code); - - memcpy(bssid, req->bss->bssid, ETH_ALEN); - ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DISASSOC, - req->reason_code, !req->local_state_change, - frame_buf); - mutex_unlock(&ifmgd->mtx); - - __cfg80211_send_disassoc(sdata->dev, frame_buf, DEAUTH_DISASSOC_LEN); - - mutex_lock(&sdata->local->mtx); - ieee80211_recalc_idle(sdata->local); - mutex_unlock(&sdata->local->mtx); - - return 0; -} - -void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - mutex_lock(&ifmgd->mtx); - if (ifmgd->assoc_data) - ieee80211_destroy_assoc_data(sdata, false); - if (ifmgd->auth_data) - ieee80211_destroy_auth_data(sdata, false); - del_timer_sync(&ifmgd->timer); - mutex_unlock(&ifmgd->mtx); -} - -void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, - enum nl80211_cqm_rssi_threshold_event rssi_event, - gfp_t gfp) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - - trace_api_cqm_rssi_notify(sdata, rssi_event); - - cfg80211_cqm_rssi_notify(sdata->dev, rssi_event, gfp); -} -EXPORT_SYMBOL(ieee80211_cqm_rssi_notify); - -unsigned char ieee80211_get_operstate(struct ieee80211_vif *vif) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - return sdata->dev->operstate; -} -EXPORT_SYMBOL(ieee80211_get_operstate); diff --git a/openairITS/mac/DOT11/net/mac80211/modules.order b/openairITS/mac/DOT11/net/mac80211/modules.order deleted file mode 100644 index c3b62d6bdb0..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/modules.order +++ /dev/null @@ -1 +0,0 @@ -kernel//home/thales/openair4G/openairITS/mac/DOT11/net/mac80211/mac80211_eurecom.ko diff --git a/openairITS/mac/DOT11/net/mac80211/offchannel.c b/openairITS/mac/DOT11/net/mac80211/offchannel.c deleted file mode 100644 index f054e94901a..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/offchannel.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Off-channel operation helpers - * - * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi> - * Copyright 2004, Instant802 Networks, Inc. - * Copyright 2005, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007, Michael Wu <flamingice@sourmilk.net> - * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include <linux/export.h> -#include <net/mac80211.h> -#include "ieee80211_i.h" -#include "driver-trace.h" - -/* - * Tell our hardware to disable PS. - * Optionally inform AP that we will go to sleep so that it will buffer - * the frames while we are doing off-channel work. This is optional - * because we *may* be doing work on-operating channel, and want our - * hardware unconditionally awake, but still let the AP send us normal frames. - */ -static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata, - bool tell_ap) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; - - local->offchannel_ps_enabled = false; - - /* FIXME: what to do when local->pspolling is true? */ - - del_timer_sync(&local->dynamic_ps_timer); - del_timer_sync(&ifmgd->bcn_mon_timer); - del_timer_sync(&ifmgd->conn_mon_timer); - - cancel_work_sync(&local->dynamic_ps_enable_work); - - if (local->hw.conf.flags & IEEE80211_CONF_PS) { - local->offchannel_ps_enabled = true; - local->hw.conf.flags &= ~IEEE80211_CONF_PS; - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); - } - - if (tell_ap && (!local->offchannel_ps_enabled || - !(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))) - /* - * If power save was enabled, no need to send a nullfunc - * frame because AP knows that we are sleeping. But if the - * hardware is creating the nullfunc frame for power save - * status (ie. IEEE80211_HW_PS_NULLFUNC_STACK is not - * enabled) and power save was enabled, the firmware just - * sent a null frame with power save disabled. So we need - * to send a new nullfunc frame to inform the AP that we - * are again sleeping. - */ - ieee80211_send_nullfunc(local, sdata, 1); -} - -/* inform AP that we are awake again, unless power save is enabled */ -static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - - if (!local->ps_sdata) - ieee80211_send_nullfunc(local, sdata, 0); - else if (local->offchannel_ps_enabled) { - /* - * In !IEEE80211_HW_PS_NULLFUNC_STACK case the hardware - * will send a nullfunc frame with the powersave bit set - * even though the AP already knows that we are sleeping. - * This could be avoided by sending a null frame with power - * save bit disabled before enabling the power save, but - * this doesn't gain anything. - * - * When IEEE80211_HW_PS_NULLFUNC_STACK is enabled, no need - * to send a nullfunc frame because AP already knows that - * we are sleeping, let's just enable power save mode in - * hardware. - */ - /* TODO: Only set hardware if CONF_PS changed? - * TODO: Should we set offchannel_ps_enabled to false? - */ - local->hw.conf.flags |= IEEE80211_CONF_PS; - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); - } else if (local->hw.conf.dynamic_ps_timeout > 0) { - /* - * If IEEE80211_CONF_PS was not set and the dynamic_ps_timer - * had been running before leaving the operating channel, - * restart the timer now and send a nullfunc frame to inform - * the AP that we are awake. - */ - ieee80211_send_nullfunc(local, sdata, 0); - mod_timer(&local->dynamic_ps_timer, jiffies + - msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); - } - - ieee80211_sta_reset_beacon_monitor(sdata); - ieee80211_sta_reset_conn_monitor(sdata); -} - -void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local, - bool offchannel_ps_enable) -{ - struct ieee80211_sub_if_data *sdata; - - /* - * notify the AP about us leaving the channel and stop all - * STA interfaces. - */ - mutex_lock(&local->iflist_mtx); - list_for_each_entry(sdata, &local->interfaces, list) { - if (!ieee80211_sdata_running(sdata)) - continue; - - if (sdata->vif.type != NL80211_IFTYPE_MONITOR) - set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); - - /* Check to see if we should disable beaconing. */ - if (sdata->vif.type == NL80211_IFTYPE_AP || - sdata->vif.type == NL80211_IFTYPE_ADHOC || - sdata->vif.type == NL80211_IFTYPE_MESH_POINT) - ieee80211_bss_info_change_notify( - sdata, BSS_CHANGED_BEACON_ENABLED); - - if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { - netif_tx_stop_all_queues(sdata->dev); - if (offchannel_ps_enable && - (sdata->vif.type == NL80211_IFTYPE_STATION) && - sdata->u.mgd.associated) - ieee80211_offchannel_ps_enable(sdata, true); - } - } - mutex_unlock(&local->iflist_mtx); -} - -void ieee80211_offchannel_return(struct ieee80211_local *local, - bool offchannel_ps_disable) -{ - struct ieee80211_sub_if_data *sdata; - - mutex_lock(&local->iflist_mtx); - list_for_each_entry(sdata, &local->interfaces, list) { - if (sdata->vif.type != NL80211_IFTYPE_MONITOR) - clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); - - if (!ieee80211_sdata_running(sdata)) - continue; - - /* Tell AP we're back */ - if (offchannel_ps_disable && - sdata->vif.type == NL80211_IFTYPE_STATION) { - if (sdata->u.mgd.associated) - ieee80211_offchannel_ps_disable(sdata); - } - - if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { - /* - * This may wake up queues even though the driver - * currently has them stopped. This is not very - * likely, since the driver won't have gotten any - * (or hardly any) new packets while we weren't - * on the right channel, and even if it happens - * it will at most lead to queueing up one more - * packet per queue in mac80211 rather than on - * the interface qdisc. - */ - netif_tx_wake_all_queues(sdata->dev); - } - - if (sdata->vif.type == NL80211_IFTYPE_AP || - sdata->vif.type == NL80211_IFTYPE_ADHOC || - sdata->vif.type == NL80211_IFTYPE_MESH_POINT) - ieee80211_bss_info_change_notify( - sdata, BSS_CHANGED_BEACON_ENABLED); - } - mutex_unlock(&local->iflist_mtx); -} - -static void ieee80211_hw_roc_start(struct work_struct *work) -{ - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, hw_roc_start); - struct ieee80211_sub_if_data *sdata; - - mutex_lock(&local->mtx); - - if (!local->hw_roc_channel) { - mutex_unlock(&local->mtx); - return; - } - - if (local->hw_roc_skb) { - sdata = IEEE80211_DEV_TO_SUB_IF(local->hw_roc_dev); - ieee80211_tx_skb(sdata, local->hw_roc_skb); - local->hw_roc_skb = NULL; - } else { - cfg80211_ready_on_channel(local->hw_roc_dev, - local->hw_roc_cookie, - local->hw_roc_channel, - local->hw_roc_channel_type, - local->hw_roc_duration, - GFP_KERNEL); - } - - ieee80211_recalc_idle(local); - - mutex_unlock(&local->mtx); -} - -void ieee80211_ready_on_channel(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - trace_api_ready_on_channel(local); - - ieee80211_queue_work(hw, &local->hw_roc_start); -} -EXPORT_SYMBOL_GPL(ieee80211_ready_on_channel); - -static void ieee80211_hw_roc_done(struct work_struct *work) -{ - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, hw_roc_done); - - mutex_lock(&local->mtx); - - if (!local->hw_roc_channel) { - mutex_unlock(&local->mtx); - return; - } - - if (!local->hw_roc_for_tx) - cfg80211_remain_on_channel_expired(local->hw_roc_dev, - local->hw_roc_cookie, - local->hw_roc_channel, - local->hw_roc_channel_type, - GFP_KERNEL); - - local->hw_roc_channel = NULL; - local->hw_roc_cookie = 0; - - ieee80211_recalc_idle(local); - - mutex_unlock(&local->mtx); -} - -void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - trace_api_remain_on_channel_expired(local); - - ieee80211_queue_work(hw, &local->hw_roc_done); -} -EXPORT_SYMBOL_GPL(ieee80211_remain_on_channel_expired); - -void ieee80211_hw_roc_setup(struct ieee80211_local *local) -{ - INIT_WORK(&local->hw_roc_start, ieee80211_hw_roc_start); - INIT_WORK(&local->hw_roc_done, ieee80211_hw_roc_done); -} diff --git a/openairITS/mac/DOT11/net/mac80211/pm.c b/openairITS/mac/DOT11/net/mac80211/pm.c deleted file mode 100644 index ef8eba1d736..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/pm.c +++ /dev/null @@ -1,147 +0,0 @@ -#include <net/mac80211.h> -#include <net/rtnetlink.h> - -#include "ieee80211_i.h" -#include "mesh.h" -#include "driver-ops.h" -#include "led.h" - -/* return value indicates whether the driver should be further notified */ -static bool ieee80211_quiesce(struct ieee80211_sub_if_data *sdata) -{ - switch (sdata->vif.type) { - case NL80211_IFTYPE_STATION: - ieee80211_sta_quiesce(sdata); - return true; - case NL80211_IFTYPE_ADHOC: - ieee80211_ibss_quiesce(sdata); - return true; - case NL80211_IFTYPE_MESH_POINT: - ieee80211_mesh_quiesce(sdata); - return true; - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_MONITOR: - /* don't tell driver about this */ - return false; - default: - return true; - } -} - -int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_sub_if_data *sdata; - struct sta_info *sta; - - if (!local->open_count) - goto suspend; - - ieee80211_scan_cancel(local); - - if (hw->flags & IEEE80211_HW_AMPDU_AGGREGATION) { - mutex_lock(&local->sta_mtx); - list_for_each_entry(sta, &local->sta_list, list) { - set_sta_flag(sta, WLAN_STA_BLOCK_BA); - ieee80211_sta_tear_down_BA_sessions(sta, true); - } - mutex_unlock(&local->sta_mtx); - } - - ieee80211_stop_queues_by_reason(hw, - IEEE80211_QUEUE_STOP_REASON_SUSPEND); - - /* flush out all packets */ - synchronize_net(); - - drv_flush(local, false); - - local->quiescing = true; - /* make quiescing visible to timers everywhere */ - mb(); - - flush_workqueue(local->workqueue); - - /* Don't try to run timers while suspended. */ - del_timer_sync(&local->sta_cleanup); - - /* - * Note that this particular timer doesn't need to be - * restarted at resume. - */ - cancel_work_sync(&local->dynamic_ps_enable_work); - del_timer_sync(&local->dynamic_ps_timer); - - local->wowlan = wowlan && local->open_count; - if (local->wowlan) { - int err = drv_suspend(local, wowlan); - if (err < 0) { - local->quiescing = false; - return err; - } else if (err > 0) { - WARN_ON(err != 1); - local->wowlan = false; - } else { - list_for_each_entry(sdata, &local->interfaces, list) { - cancel_work_sync(&sdata->work); - ieee80211_quiesce(sdata); - } - goto suspend; - } - } - - /* disable keys */ - list_for_each_entry(sdata, &local->interfaces, list) - ieee80211_disable_keys(sdata); - - /* tear down aggregation sessions and remove STAs */ - mutex_lock(&local->sta_mtx); - list_for_each_entry(sta, &local->sta_list, list) { - if (sta->uploaded) { - enum ieee80211_sta_state state; - - state = sta->sta_state; - for (; state > IEEE80211_STA_NOTEXIST; state--) - WARN_ON(drv_sta_state(local, sta->sdata, sta, - state, state - 1)); - } - - mesh_plink_quiesce(sta); - } - mutex_unlock(&local->sta_mtx); - - /* remove all interfaces */ - list_for_each_entry(sdata, &local->interfaces, list) { - cancel_work_sync(&sdata->work); - - if (!ieee80211_quiesce(sdata)) - continue; - - if (!ieee80211_sdata_running(sdata)) - continue; - - /* disable beaconing */ - ieee80211_bss_info_change_notify(sdata, - BSS_CHANGED_BEACON_ENABLED); - - drv_remove_interface(local, sdata); - } - - /* stop hardware - this must stop RX */ - if (local->open_count) - ieee80211_stop_device(local); - - suspend: - local->suspended = true; - /* need suspended to be visible before quiescing is false */ - barrier(); - local->quiescing = false; - - return 0; -} - -/* - * __ieee80211_resume() is a static inline which just calls - * ieee80211_reconfig(), which is also needed for hardware - * hang/firmware failure/etc. recovery. - */ diff --git a/openairITS/mac/DOT11/net/mac80211/rate.c b/openairITS/mac/DOT11/net/mac80211/rate.c deleted file mode 100644 index da85baff8f9..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rate.c +++ /dev/null @@ -1,534 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/kernel.h> -#include <linux/rtnetlink.h> -#include <linux/slab.h> -#include <linux/module.h> -#include "rate.h" -#include "ieee80211_i.h" -#include "debugfs.h" - -struct rate_control_alg { - struct list_head list; - struct rate_control_ops *ops; -}; - -static LIST_HEAD(rate_ctrl_algs); -static DEFINE_MUTEX(rate_ctrl_mutex); - -static char *ieee80211_default_rc_algo = CONFIG_COMPAT_MAC80211_RC_DEFAULT; -module_param(ieee80211_default_rc_algo, charp, 0644); -MODULE_PARM_DESC(ieee80211_default_rc_algo, - "Default rate control algorithm for mac80211 to use"); - -int ieee80211_rate_control_register(struct rate_control_ops *ops) -{ - struct rate_control_alg *alg; - - if (!ops->name) - return -EINVAL; - - mutex_lock(&rate_ctrl_mutex); - list_for_each_entry(alg, &rate_ctrl_algs, list) { - if (!strcmp(alg->ops->name, ops->name)) { - /* don't register an algorithm twice */ - WARN_ON(1); - mutex_unlock(&rate_ctrl_mutex); - return -EALREADY; - } - } - - alg = kzalloc(sizeof(*alg), GFP_KERNEL); - if (alg == NULL) { - mutex_unlock(&rate_ctrl_mutex); - return -ENOMEM; - } - alg->ops = ops; - - list_add_tail(&alg->list, &rate_ctrl_algs); - mutex_unlock(&rate_ctrl_mutex); - - return 0; -} -EXPORT_SYMBOL(ieee80211_rate_control_register); - -void ieee80211_rate_control_unregister(struct rate_control_ops *ops) -{ - struct rate_control_alg *alg; - - mutex_lock(&rate_ctrl_mutex); - list_for_each_entry(alg, &rate_ctrl_algs, list) { - if (alg->ops == ops) { - list_del(&alg->list); - kfree(alg); - break; - } - } - mutex_unlock(&rate_ctrl_mutex); -} -EXPORT_SYMBOL(ieee80211_rate_control_unregister); - -static struct rate_control_ops * -ieee80211_try_rate_control_ops_get(const char *name) -{ - struct rate_control_alg *alg; - struct rate_control_ops *ops = NULL; - - if (!name) - return NULL; - - mutex_lock(&rate_ctrl_mutex); - list_for_each_entry(alg, &rate_ctrl_algs, list) { - if (!strcmp(alg->ops->name, name)) - if (try_module_get(alg->ops->module)) { - ops = alg->ops; - break; - } - } - mutex_unlock(&rate_ctrl_mutex); - return ops; -} - -/* Get the rate control algorithm. */ -static struct rate_control_ops * -ieee80211_rate_control_ops_get(const char *name) -{ - struct rate_control_ops *ops; - const char *alg_name; - - kparam_block_sysfs_write(ieee80211_default_rc_algo); - if (!name) - alg_name = ieee80211_default_rc_algo; - else - alg_name = name; - - ops = ieee80211_try_rate_control_ops_get(alg_name); - if (!ops) { - request_module("rc80211_%s", alg_name); - ops = ieee80211_try_rate_control_ops_get(alg_name); - } - if (!ops && name) - /* try default if specific alg requested but not found */ - ops = ieee80211_try_rate_control_ops_get(ieee80211_default_rc_algo); - - /* try built-in one if specific alg requested but not found */ - if (!ops && strlen(CONFIG_COMPAT_MAC80211_RC_DEFAULT)) - ops = ieee80211_try_rate_control_ops_get(CONFIG_COMPAT_MAC80211_RC_DEFAULT); - kparam_unblock_sysfs_write(ieee80211_default_rc_algo); - - return ops; -} - -static void ieee80211_rate_control_ops_put(struct rate_control_ops *ops) -{ - module_put(ops->module); -} - -#ifdef CONFIG_MAC80211_DEBUGFS -static ssize_t rcname_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) -{ - struct rate_control_ref *ref = file->private_data; - int len = strlen(ref->ops->name); - - return simple_read_from_buffer(userbuf, count, ppos, - ref->ops->name, len); -} - -static const struct file_operations rcname_ops = { - .read = rcname_read, - .open = simple_open, - .llseek = default_llseek, -}; -#endif - -static struct rate_control_ref *rate_control_alloc(const char *name, - struct ieee80211_local *local) -{ - struct dentry *debugfsdir = NULL; - struct rate_control_ref *ref; - - ref = kmalloc(sizeof(struct rate_control_ref), GFP_KERNEL); - if (!ref) - goto fail_ref; - ref->local = local; - ref->ops = ieee80211_rate_control_ops_get(name); - if (!ref->ops) - goto fail_ops; - -#ifdef CONFIG_MAC80211_DEBUGFS - debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir); - local->debugfs.rcdir = debugfsdir; - debugfs_create_file("name", 0400, debugfsdir, ref, &rcname_ops); -#endif - - ref->priv = ref->ops->alloc(&local->hw, debugfsdir); - if (!ref->priv) - goto fail_priv; - return ref; - -fail_priv: - ieee80211_rate_control_ops_put(ref->ops); -fail_ops: - kfree(ref); -fail_ref: - return NULL; -} - -static void rate_control_free(struct rate_control_ref *ctrl_ref) -{ - ctrl_ref->ops->free(ctrl_ref->priv); - -#ifdef CONFIG_MAC80211_DEBUGFS - debugfs_remove_recursive(ctrl_ref->local->debugfs.rcdir); - ctrl_ref->local->debugfs.rcdir = NULL; -#endif - - ieee80211_rate_control_ops_put(ctrl_ref->ops); - kfree(ctrl_ref); -} - -static bool rc_no_data_or_no_ack_use_min(struct ieee80211_tx_rate_control *txrc) -{ - struct sk_buff *skb = txrc->skb; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - __le16 fc; - - fc = hdr->frame_control; - - return (info->flags & (IEEE80211_TX_CTL_NO_ACK | - IEEE80211_TX_CTL_USE_MINRATE)) || - !ieee80211_is_data(fc); -} - -static void rc_send_low_broadcast(s8 *idx, u32 basic_rates, - struct ieee80211_supported_band *sband) -{ - u8 i; - - if (basic_rates == 0) - return; /* assume basic rates unknown and accept rate */ - if (*idx < 0) - return; - if (basic_rates & (1 << *idx)) - return; /* selected rate is a basic rate */ - - for (i = *idx + 1; i <= sband->n_bitrates; i++) { - if (basic_rates & (1 << i)) { - *idx = i; - return; - } - } - - /* could not find a basic rate; use original selection */ -} - -static inline s8 -rate_lowest_non_cck_index(struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta) -{ - int i; - - for (i = 0; i < sband->n_bitrates; i++) { - struct ieee80211_rate *srate = &sband->bitrates[i]; - if ((srate->bitrate == 10) || (srate->bitrate == 20) || - (srate->bitrate == 55) || (srate->bitrate == 110)) - continue; - - if (rate_supported(sta, sband->band, i)) - return i; - } - - /* No matching rate found */ - return 0; -} - - -bool rate_control_send_low(struct ieee80211_sta *sta, - void *priv_sta, - struct ieee80211_tx_rate_control *txrc) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb); - struct ieee80211_supported_band *sband = txrc->sband; - int mcast_rate; - - if (!sta || !priv_sta || rc_no_data_or_no_ack_use_min(txrc)) { - if ((sband->band != IEEE80211_BAND_2GHZ) || - !(info->flags & IEEE80211_TX_CTL_NO_CCK_RATE)) - info->control.rates[0].idx = - rate_lowest_index(txrc->sband, sta); - else - info->control.rates[0].idx = - rate_lowest_non_cck_index(txrc->sband, sta); - info->control.rates[0].count = - (info->flags & IEEE80211_TX_CTL_NO_ACK) ? - 1 : txrc->hw->max_rate_tries; - if (!sta && txrc->bss) { - mcast_rate = txrc->bss_conf->mcast_rate[sband->band]; - if (mcast_rate > 0) { - info->control.rates[0].idx = mcast_rate - 1; - return true; - } - - rc_send_low_broadcast(&info->control.rates[0].idx, - txrc->bss_conf->basic_rates, - sband); - } - return true; - } - return false; -} -EXPORT_SYMBOL(rate_control_send_low); - -static bool rate_idx_match_legacy_mask(struct ieee80211_tx_rate *rate, - int n_bitrates, u32 mask) -{ - int j; - - /* See whether the selected rate or anything below it is allowed. */ - for (j = rate->idx; j >= 0; j--) { - if (mask & (1 << j)) { - /* Okay, found a suitable rate. Use it. */ - rate->idx = j; - return true; - } - } - - /* Try to find a higher rate that would be allowed */ - for (j = rate->idx + 1; j < n_bitrates; j++) { - if (mask & (1 << j)) { - /* Okay, found a suitable rate. Use it. */ - rate->idx = j; - return true; - } - } - return false; -} - -static bool rate_idx_match_mcs_mask(struct ieee80211_tx_rate *rate, - u8 mcs_mask[IEEE80211_HT_MCS_MASK_LEN]) -{ - int i, j; - int ridx, rbit; - - ridx = rate->idx / 8; - rbit = rate->idx % 8; - - /* sanity check */ - if (ridx < 0 || ridx >= IEEE80211_HT_MCS_MASK_LEN) - return false; - - /* See whether the selected rate or anything below it is allowed. */ - for (i = ridx; i >= 0; i--) { - for (j = rbit; j >= 0; j--) - if (mcs_mask[i] & BIT(j)) { - rate->idx = i * 8 + j; - return true; - } - rbit = 7; - } - - /* Try to find a higher rate that would be allowed */ - ridx = (rate->idx + 1) / 8; - rbit = (rate->idx + 1) % 8; - - for (i = ridx; i < IEEE80211_HT_MCS_MASK_LEN; i++) { - for (j = rbit; j < 8; j++) - if (mcs_mask[i] & BIT(j)) { - rate->idx = i * 8 + j; - return true; - } - rbit = 0; - } - return false; -} - - - -static void rate_idx_match_mask(struct ieee80211_tx_rate *rate, - struct ieee80211_tx_rate_control *txrc, - u32 mask, - u8 mcs_mask[IEEE80211_HT_MCS_MASK_LEN]) -{ - struct ieee80211_tx_rate alt_rate; - - /* handle HT rates */ - if (rate->flags & IEEE80211_TX_RC_MCS) { - if (rate_idx_match_mcs_mask(rate, mcs_mask)) - return; - - /* also try the legacy rates. */ - alt_rate.idx = 0; - /* keep protection flags */ - alt_rate.flags = rate->flags & - (IEEE80211_TX_RC_USE_RTS_CTS | - IEEE80211_TX_RC_USE_CTS_PROTECT | - IEEE80211_TX_RC_USE_SHORT_PREAMBLE); - alt_rate.count = rate->count; - if (rate_idx_match_legacy_mask(&alt_rate, - txrc->sband->n_bitrates, - mask)) { - *rate = alt_rate; - return; - } - } else { - struct sk_buff *skb = txrc->skb; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - __le16 fc; - - /* handle legacy rates */ - if (rate_idx_match_legacy_mask(rate, txrc->sband->n_bitrates, - mask)) - return; - - /* if HT BSS, and we handle a data frame, also try HT rates */ - if (txrc->bss_conf->channel_type == NL80211_CHAN_NO_HT) - return; - - fc = hdr->frame_control; - if (!ieee80211_is_data(fc)) - return; - - alt_rate.idx = 0; - /* keep protection flags */ - alt_rate.flags = rate->flags & - (IEEE80211_TX_RC_USE_RTS_CTS | - IEEE80211_TX_RC_USE_CTS_PROTECT | - IEEE80211_TX_RC_USE_SHORT_PREAMBLE); - alt_rate.count = rate->count; - - alt_rate.flags |= IEEE80211_TX_RC_MCS; - - if ((txrc->bss_conf->channel_type == NL80211_CHAN_HT40MINUS) || - (txrc->bss_conf->channel_type == NL80211_CHAN_HT40PLUS)) - alt_rate.flags |= IEEE80211_TX_RC_40_MHZ_WIDTH; - - if (rate_idx_match_mcs_mask(&alt_rate, mcs_mask)) { - *rate = alt_rate; - return; - } - } - - /* - * Uh.. No suitable rate exists. This should not really happen with - * sane TX rate mask configurations. However, should someone manage to - * configure supported rates and TX rate mask in incompatible way, - * allow the frame to be transmitted with whatever the rate control - * selected. - */ -} - -void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, - struct sta_info *sta, - struct ieee80211_tx_rate_control *txrc) -{ - struct rate_control_ref *ref = sdata->local->rate_ctrl; - void *priv_sta = NULL; - struct ieee80211_sta *ista = NULL; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb); - int i; - u32 mask; - u8 mcs_mask[IEEE80211_HT_MCS_MASK_LEN]; - - if (sta && test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) { - ista = &sta->sta; - priv_sta = sta->rate_ctrl_priv; - } - - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { - info->control.rates[i].idx = -1; - info->control.rates[i].flags = 0; - info->control.rates[i].count = 0; - } - - if (sdata->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) - return; - - ref->ops->get_rate(ref->priv, ista, priv_sta, txrc); - - /* - * Try to enforce the rateidx mask the user wanted. skip this if the - * default mask (allow all rates) is used to save some processing for - * the common case. - */ - mask = sdata->rc_rateidx_mask[info->band]; - memcpy(mcs_mask, sdata->rc_rateidx_mcs_mask[info->band], - sizeof(mcs_mask)); - if (mask != (1 << txrc->sband->n_bitrates) - 1) { - if (sta) { - /* Filter out rates that the STA does not support */ - mask &= sta->sta.supp_rates[info->band]; - for (i = 0; i < sizeof(mcs_mask); i++) - mcs_mask[i] &= sta->sta.ht_cap.mcs.rx_mask[i]; - } - /* - * Make sure the rate index selected for each TX rate is - * included in the configured mask and change the rate indexes - * if needed. - */ - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { - /* Skip invalid rates */ - if (info->control.rates[i].idx < 0) - break; - rate_idx_match_mask(&info->control.rates[i], txrc, - mask, mcs_mask); - } - } - - BUG_ON(info->control.rates[0].idx < 0); -} - -int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, - const char *name) -{ - struct rate_control_ref *ref; - - ASSERT_RTNL(); - - if (local->open_count) - return -EBUSY; - - if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) { - if (WARN_ON(!local->ops->set_rts_threshold)) - return -EINVAL; - return 0; - } - - ref = rate_control_alloc(name, local); - if (!ref) { - wiphy_warn(local->hw.wiphy, - "Failed to select rate control algorithm\n"); - return -ENOENT; - } - - WARN_ON(local->rate_ctrl); - local->rate_ctrl = ref; - - wiphy_debug(local->hw.wiphy, "Selected rate control algorithm '%s'\n", - ref->ops->name); - - return 0; -} - -void rate_control_deinitialize(struct ieee80211_local *local) -{ - struct rate_control_ref *ref; - - ref = local->rate_ctrl; - - if (!ref) - return; - - local->rate_ctrl = NULL; - rate_control_free(ref); -} - diff --git a/openairITS/mac/DOT11/net/mac80211/rate.h b/openairITS/mac/DOT11/net/mac80211/rate.h deleted file mode 100644 index fbb1efdc4d0..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rate.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005, Devicescape Software, Inc. - * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef IEEE80211_RATE_H -#define IEEE80211_RATE_H - -#include <linux/netdevice.h> -#include <linux/skbuff.h> -#include <linux/types.h> -#include <net/mac80211.h> -#include "ieee80211_i.h" -#include "sta_info.h" - -struct rate_control_ref { - struct ieee80211_local *local; - struct rate_control_ops *ops; - void *priv; -}; - -void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, - struct sta_info *sta, - struct ieee80211_tx_rate_control *txrc); - -static inline void rate_control_tx_status(struct ieee80211_local *local, - struct ieee80211_supported_band *sband, - struct sta_info *sta, - struct sk_buff *skb) -{ - struct rate_control_ref *ref = local->rate_ctrl; - struct ieee80211_sta *ista = &sta->sta; - void *priv_sta = sta->rate_ctrl_priv; - - if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) - return; - - ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb); -} - - -static inline void rate_control_rate_init(struct sta_info *sta) -{ - struct ieee80211_local *local = sta->sdata->local; - struct rate_control_ref *ref = sta->rate_ctrl; - struct ieee80211_sta *ista = &sta->sta; - void *priv_sta = sta->rate_ctrl_priv; - struct ieee80211_supported_band *sband; - - if (!ref) - return; - - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - - ref->ops->rate_init(ref->priv, sband, ista, priv_sta); - set_sta_flag(sta, WLAN_STA_RATE_CONTROL); -} - -static inline void rate_control_rate_update(struct ieee80211_local *local, - struct ieee80211_supported_band *sband, - struct sta_info *sta, u32 changed, - enum nl80211_channel_type oper_chan_type) -{ - struct rate_control_ref *ref = local->rate_ctrl; - struct ieee80211_sta *ista = &sta->sta; - void *priv_sta = sta->rate_ctrl_priv; - - if (ref && ref->ops->rate_update) - ref->ops->rate_update(ref->priv, sband, ista, - priv_sta, changed, oper_chan_type); -} - -static inline void *rate_control_alloc_sta(struct rate_control_ref *ref, - struct ieee80211_sta *sta, - gfp_t gfp) -{ - return ref->ops->alloc_sta(ref->priv, sta, gfp); -} - -static inline void rate_control_free_sta(struct sta_info *sta) -{ - struct rate_control_ref *ref = sta->rate_ctrl; - struct ieee80211_sta *ista = &sta->sta; - void *priv_sta = sta->rate_ctrl_priv; - - ref->ops->free_sta(ref->priv, ista, priv_sta); -} - -static inline void rate_control_add_sta_debugfs(struct sta_info *sta) -{ -#ifdef CONFIG_MAC80211_DEBUGFS - struct rate_control_ref *ref = sta->rate_ctrl; - if (ref && sta->debugfs.dir && ref->ops->add_sta_debugfs) - ref->ops->add_sta_debugfs(ref->priv, sta->rate_ctrl_priv, - sta->debugfs.dir); -#endif -} - -static inline void rate_control_remove_sta_debugfs(struct sta_info *sta) -{ -#ifdef CONFIG_MAC80211_DEBUGFS - struct rate_control_ref *ref = sta->rate_ctrl; - if (ref && ref->ops->remove_sta_debugfs) - ref->ops->remove_sta_debugfs(ref->priv, sta->rate_ctrl_priv); -#endif -} - -/* Get a reference to the rate control algorithm. If `name' is NULL, get the - * first available algorithm. */ -int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local, - const char *name); -void rate_control_deinitialize(struct ieee80211_local *local); - - -/* Rate control algorithms */ -#ifdef CONFIG_MAC80211_RC_PID -extern int rc80211_pid_init(void); -extern void rc80211_pid_exit(void); -#else -static inline int rc80211_pid_init(void) -{ - return 0; -} -static inline void rc80211_pid_exit(void) -{ -} -#endif - -#ifdef CONFIG_MAC80211_RC_MINSTREL -extern int rc80211_minstrel_init(void); -extern void rc80211_minstrel_exit(void); -#else -static inline int rc80211_minstrel_init(void) -{ - return 0; -} -static inline void rc80211_minstrel_exit(void) -{ -} -#endif - -#ifdef CONFIG_MAC80211_RC_MINSTREL_HT -extern int rc80211_minstrel_ht_init(void); -extern void rc80211_minstrel_ht_exit(void); -#else -static inline int rc80211_minstrel_ht_init(void) -{ - return 0; -} -static inline void rc80211_minstrel_ht_exit(void) -{ -} -#endif - - -#endif /* IEEE80211_RATE_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel.c b/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel.c deleted file mode 100644 index b39dda523f3..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel.c +++ /dev/null @@ -1,578 +0,0 @@ -/* - * Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Based on minstrel.c: - * Copyright (C) 2005-2007 Derek Smithies <derek@indranet.co.nz> - * Sponsored by Indranet Technologies Ltd - * - * Based on sample.c: - * Copyright (c) 2005 John Bicket - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any - * redistribution must be conditioned upon including a substantially - * similar Disclaimer requirement for further binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGES. - */ -#include <linux/netdevice.h> -#include <linux/types.h> -#include <linux/skbuff.h> -#include <linux/debugfs.h> -#include <linux/random.h> -#include <linux/ieee80211.h> -#include <linux/slab.h> -#include <net/mac80211.h> -#include "rate.h" -#include "rc80211_minstrel.h" - -#define SAMPLE_COLUMNS 10 -#define SAMPLE_TBL(_mi, _idx, _col) \ - _mi->sample_table[(_idx * SAMPLE_COLUMNS) + _col] - -/* convert mac80211 rate index to local array index */ -static inline int -rix_to_ndx(struct minstrel_sta_info *mi, int rix) -{ - int i = rix; - for (i = rix; i >= 0; i--) - if (mi->r[i].rix == rix) - break; - return i; -} - -static void -minstrel_update_stats(struct minstrel_priv *mp, struct minstrel_sta_info *mi) -{ - u32 max_tp = 0, index_max_tp = 0, index_max_tp2 = 0; - u32 max_prob = 0, index_max_prob = 0; - u32 usecs; - u32 p; - int i; - - mi->stats_update = jiffies; - for (i = 0; i < mi->n_rates; i++) { - struct minstrel_rate *mr = &mi->r[i]; - - usecs = mr->perfect_tx_time; - if (!usecs) - usecs = 1000000; - - /* To avoid rounding issues, probabilities scale from 0 (0%) - * to 18000 (100%) */ - if (mr->attempts) { - p = (mr->success * 18000) / mr->attempts; - mr->succ_hist += mr->success; - mr->att_hist += mr->attempts; - mr->cur_prob = p; - p = ((p * (100 - mp->ewma_level)) + (mr->probability * - mp->ewma_level)) / 100; - mr->probability = p; - mr->cur_tp = p * (1000000 / usecs); - } - - mr->last_success = mr->success; - mr->last_attempts = mr->attempts; - mr->success = 0; - mr->attempts = 0; - - /* Sample less often below the 10% chance of success. - * Sample less often above the 95% chance of success. */ - if ((mr->probability > 17100) || (mr->probability < 1800)) { - mr->adjusted_retry_count = mr->retry_count >> 1; - if (mr->adjusted_retry_count > 2) - mr->adjusted_retry_count = 2; - mr->sample_limit = 4; - } else { - mr->sample_limit = -1; - mr->adjusted_retry_count = mr->retry_count; - } - if (!mr->adjusted_retry_count) - mr->adjusted_retry_count = 2; - } - - for (i = 0; i < mi->n_rates; i++) { - struct minstrel_rate *mr = &mi->r[i]; - if (max_tp < mr->cur_tp) { - index_max_tp = i; - max_tp = mr->cur_tp; - } - if (max_prob < mr->probability) { - index_max_prob = i; - max_prob = mr->probability; - } - } - - max_tp = 0; - for (i = 0; i < mi->n_rates; i++) { - struct minstrel_rate *mr = &mi->r[i]; - - if (i == index_max_tp) - continue; - - if (max_tp < mr->cur_tp) { - index_max_tp2 = i; - max_tp = mr->cur_tp; - } - } - mi->max_tp_rate = index_max_tp; - mi->max_tp_rate2 = index_max_tp2; - mi->max_prob_rate = index_max_prob; -} - -static void -minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - struct sk_buff *skb) -{ - struct minstrel_sta_info *mi = priv_sta; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_tx_rate *ar = info->status.rates; - int i, ndx; - int success; - - success = !!(info->flags & IEEE80211_TX_STAT_ACK); - - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { - if (ar[i].idx < 0) - break; - - ndx = rix_to_ndx(mi, ar[i].idx); - if (ndx < 0) - continue; - - mi->r[ndx].attempts += ar[i].count; - - if ((i != IEEE80211_TX_MAX_RATES - 1) && (ar[i + 1].idx < 0)) - mi->r[ndx].success += success; - } - - if ((info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) && (i >= 0)) - mi->sample_count++; - - if (mi->sample_deferred > 0) - mi->sample_deferred--; -} - - -static inline unsigned int -minstrel_get_retry_count(struct minstrel_rate *mr, - struct ieee80211_tx_info *info) -{ - unsigned int retry = mr->adjusted_retry_count; - - if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) - retry = max(2U, min(mr->retry_count_rtscts, retry)); - else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) - retry = max(2U, min(mr->retry_count_cts, retry)); - return retry; -} - - -static int -minstrel_get_next_sample(struct minstrel_sta_info *mi) -{ - unsigned int sample_ndx; - sample_ndx = SAMPLE_TBL(mi, mi->sample_idx, mi->sample_column); - mi->sample_idx++; - if ((int) mi->sample_idx > (mi->n_rates - 2)) { - mi->sample_idx = 0; - mi->sample_column++; - if (mi->sample_column >= SAMPLE_COLUMNS) - mi->sample_column = 0; - } - return sample_ndx; -} - -static void -minstrel_get_rate(void *priv, struct ieee80211_sta *sta, - void *priv_sta, struct ieee80211_tx_rate_control *txrc) -{ - struct sk_buff *skb = txrc->skb; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct minstrel_sta_info *mi = priv_sta; - struct minstrel_priv *mp = priv; - struct ieee80211_tx_rate *ar = info->control.rates; - unsigned int ndx, sample_ndx = 0; - bool mrr; - bool sample_slower = false; - bool sample = false; - int i, delta; - int mrr_ndx[3]; - int sample_rate; - - if (rate_control_send_low(sta, priv_sta, txrc)) - return; - - mrr = mp->has_mrr && !txrc->rts && !txrc->bss_conf->use_cts_prot; - - if (time_after(jiffies, mi->stats_update + (mp->update_interval * - HZ) / 1000)) - minstrel_update_stats(mp, mi); - - ndx = mi->max_tp_rate; - - if (mrr) - sample_rate = mp->lookaround_rate_mrr; - else - sample_rate = mp->lookaround_rate; - - mi->packet_count++; - delta = (mi->packet_count * sample_rate / 100) - - (mi->sample_count + mi->sample_deferred / 2); - - /* delta > 0: sampling required */ - if ((delta > 0) && (mrr || !mi->prev_sample)) { - struct minstrel_rate *msr; - if (mi->packet_count >= 10000) { - mi->sample_deferred = 0; - mi->sample_count = 0; - mi->packet_count = 0; - } else if (delta > mi->n_rates * 2) { - /* With multi-rate retry, not every planned sample - * attempt actually gets used, due to the way the retry - * chain is set up - [max_tp,sample,prob,lowest] for - * sample_rate < max_tp. - * - * If there's too much sampling backlog and the link - * starts getting worse, minstrel would start bursting - * out lots of sampling frames, which would result - * in a large throughput loss. */ - mi->sample_count += (delta - mi->n_rates * 2); - } - - sample_ndx = minstrel_get_next_sample(mi); - msr = &mi->r[sample_ndx]; - sample = true; - sample_slower = mrr && (msr->perfect_tx_time > - mi->r[ndx].perfect_tx_time); - - if (!sample_slower) { - if (msr->sample_limit != 0) { - ndx = sample_ndx; - mi->sample_count++; - if (msr->sample_limit > 0) - msr->sample_limit--; - } else { - sample = false; - } - } else { - /* Only use IEEE80211_TX_CTL_RATE_CTRL_PROBE to mark - * packets that have the sampling rate deferred to the - * second MRR stage. Increase the sample counter only - * if the deferred sample rate was actually used. - * Use the sample_deferred counter to make sure that - * the sampling is not done in large bursts */ - info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; - mi->sample_deferred++; - } - } - mi->prev_sample = sample; - - /* If we're not using MRR and the sampling rate already - * has a probability of >95%, we shouldn't be attempting - * to use it, as this only wastes precious airtime */ - if (!mrr && sample && (mi->r[ndx].probability > 17100)) - ndx = mi->max_tp_rate; - - ar[0].idx = mi->r[ndx].rix; - ar[0].count = minstrel_get_retry_count(&mi->r[ndx], info); - - if (!mrr) { - if (!sample) - ar[0].count = mp->max_retry; - ar[1].idx = mi->lowest_rix; - ar[1].count = mp->max_retry; - return; - } - - /* MRR setup */ - if (sample) { - if (sample_slower) - mrr_ndx[0] = sample_ndx; - else - mrr_ndx[0] = mi->max_tp_rate; - } else { - mrr_ndx[0] = mi->max_tp_rate2; - } - mrr_ndx[1] = mi->max_prob_rate; - mrr_ndx[2] = 0; - for (i = 1; i < 4; i++) { - ar[i].idx = mi->r[mrr_ndx[i - 1]].rix; - ar[i].count = mi->r[mrr_ndx[i - 1]].adjusted_retry_count; - } -} - - -static void -calc_rate_durations(struct ieee80211_local *local, struct minstrel_rate *d, - struct ieee80211_rate *rate) -{ - int erp = !!(rate->flags & IEEE80211_RATE_ERP_G); - - d->perfect_tx_time = ieee80211_frame_duration(local, 1200, - rate->bitrate, erp, 1); - d->ack_time = ieee80211_frame_duration(local, 10, - rate->bitrate, erp, 1); -} - -static void -init_sample_table(struct minstrel_sta_info *mi) -{ - unsigned int i, col, new_idx; - unsigned int n_srates = mi->n_rates - 1; - u8 rnd[8]; - - mi->sample_column = 0; - mi->sample_idx = 0; - memset(mi->sample_table, 0, SAMPLE_COLUMNS * mi->n_rates); - - for (col = 0; col < SAMPLE_COLUMNS; col++) { - for (i = 0; i < n_srates; i++) { - get_random_bytes(rnd, sizeof(rnd)); - new_idx = (i + rnd[i & 7]) % n_srates; - - while (SAMPLE_TBL(mi, new_idx, col) != 0) - new_idx = (new_idx + 1) % n_srates; - - /* Don't sample the slowest rate (i.e. slowest base - * rate). We must presume that the slowest rate works - * fine, or else other management frames will also be - * failing and the link will break */ - SAMPLE_TBL(mi, new_idx, col) = i + 1; - } - } -} - -static void -minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta) -{ - struct minstrel_sta_info *mi = priv_sta; - struct minstrel_priv *mp = priv; - struct ieee80211_local *local = hw_to_local(mp->hw); - struct ieee80211_rate *ctl_rate; - unsigned int i, n = 0; - unsigned int t_slot = 9; /* FIXME: get real slot time */ - - mi->lowest_rix = rate_lowest_index(sband, sta); - ctl_rate = &sband->bitrates[mi->lowest_rix]; - mi->sp_ack_dur = ieee80211_frame_duration(local, 10, ctl_rate->bitrate, - !!(ctl_rate->flags & IEEE80211_RATE_ERP_G), 1); - - for (i = 0; i < sband->n_bitrates; i++) { - struct minstrel_rate *mr = &mi->r[n]; - unsigned int tx_time = 0, tx_time_cts = 0, tx_time_rtscts = 0; - unsigned int tx_time_single; - unsigned int cw = mp->cw_min; - - if (!rate_supported(sta, sband->band, i)) - continue; - n++; - memset(mr, 0, sizeof(*mr)); - - mr->rix = i; - mr->bitrate = sband->bitrates[i].bitrate / 5; - calc_rate_durations(local, mr, &sband->bitrates[i]); - - /* calculate maximum number of retransmissions before - * fallback (based on maximum segment size) */ - mr->sample_limit = -1; - mr->retry_count = 1; - mr->retry_count_cts = 1; - mr->retry_count_rtscts = 1; - tx_time = mr->perfect_tx_time + mi->sp_ack_dur; - do { - /* add one retransmission */ - tx_time_single = mr->ack_time + mr->perfect_tx_time; - - /* contention window */ - tx_time_single += (t_slot * cw) >> 1; - cw = min((cw << 1) | 1, mp->cw_max); - - tx_time += tx_time_single; - tx_time_cts += tx_time_single + mi->sp_ack_dur; - tx_time_rtscts += tx_time_single + 2 * mi->sp_ack_dur; - if ((tx_time_cts < mp->segment_size) && - (mr->retry_count_cts < mp->max_retry)) - mr->retry_count_cts++; - if ((tx_time_rtscts < mp->segment_size) && - (mr->retry_count_rtscts < mp->max_retry)) - mr->retry_count_rtscts++; - } while ((tx_time < mp->segment_size) && - (++mr->retry_count < mp->max_retry)); - mr->adjusted_retry_count = mr->retry_count; - } - - for (i = n; i < sband->n_bitrates; i++) { - struct minstrel_rate *mr = &mi->r[i]; - mr->rix = -1; - } - - mi->n_rates = n; - mi->stats_update = jiffies; - - init_sample_table(mi); -} - -static void * -minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) -{ - struct ieee80211_supported_band *sband; - struct minstrel_sta_info *mi; - struct minstrel_priv *mp = priv; - struct ieee80211_hw *hw = mp->hw; - int max_rates = 0; - int i; - - mi = kzalloc(sizeof(struct minstrel_sta_info), gfp); - if (!mi) - return NULL; - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) { - sband = hw->wiphy->bands[i]; - if (sband && sband->n_bitrates > max_rates) - max_rates = sband->n_bitrates; - } - - mi->r = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp); - if (!mi->r) - goto error; - - mi->sample_table = kmalloc(SAMPLE_COLUMNS * max_rates, gfp); - if (!mi->sample_table) - goto error1; - - mi->stats_update = jiffies; - return mi; - -error1: - kfree(mi->r); -error: - kfree(mi); - return NULL; -} - -static void -minstrel_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta) -{ - struct minstrel_sta_info *mi = priv_sta; - - kfree(mi->sample_table); - kfree(mi->r); - kfree(mi); -} - -static void * -minstrel_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -{ - struct minstrel_priv *mp; - - mp = kzalloc(sizeof(struct minstrel_priv), GFP_ATOMIC); - if (!mp) - return NULL; - - /* contention window settings - * Just an approximation. Using the per-queue values would complicate - * the calculations and is probably unnecessary */ - mp->cw_min = 15; - mp->cw_max = 1023; - - /* number of packets (in %) to use for sampling other rates - * sample less often for non-mrr packets, because the overhead - * is much higher than with mrr */ - mp->lookaround_rate = 5; - mp->lookaround_rate_mrr = 10; - - /* moving average weight for EWMA */ - mp->ewma_level = 75; - - /* maximum time that the hw is allowed to stay in one MRR segment */ - mp->segment_size = 6000; - - if (hw->max_rate_tries > 0) - mp->max_retry = hw->max_rate_tries; - else - /* safe default, does not necessarily have to match hw properties */ - mp->max_retry = 7; - - if (hw->max_rates >= 4) - mp->has_mrr = true; - - mp->hw = hw; - mp->update_interval = 100; - -#ifdef CONFIG_MAC80211_DEBUGFS - mp->fixed_rate_idx = (u32) -1; - mp->dbg_fixed_rate = debugfs_create_u32("fixed_rate_idx", - S_IRUGO | S_IWUGO, debugfsdir, &mp->fixed_rate_idx); -#endif - - return mp; -} - -static void -minstrel_free(void *priv) -{ -#ifdef CONFIG_MAC80211_DEBUGFS - debugfs_remove(((struct minstrel_priv *)priv)->dbg_fixed_rate); -#endif - kfree(priv); -} - -struct rate_control_ops mac80211_minstrel = { - .name = "minstrel", - .tx_status = minstrel_tx_status, - .get_rate = minstrel_get_rate, - .rate_init = minstrel_rate_init, - .alloc = minstrel_alloc, - .free = minstrel_free, - .alloc_sta = minstrel_alloc_sta, - .free_sta = minstrel_free_sta, -#ifdef CONFIG_MAC80211_DEBUGFS - .add_sta_debugfs = minstrel_add_sta_debugfs, - .remove_sta_debugfs = minstrel_remove_sta_debugfs, -#endif -}; - -int __init -rc80211_minstrel_init(void) -{ - return ieee80211_rate_control_register(&mac80211_minstrel); -} - -void -rc80211_minstrel_exit(void) -{ - ieee80211_rate_control_unregister(&mac80211_minstrel); -} - diff --git a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel.h b/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel.h deleted file mode 100644 index 5d278eccaef..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef __RC_MINSTREL_H -#define __RC_MINSTREL_H - -struct minstrel_rate { - int bitrate; - int rix; - - unsigned int perfect_tx_time; - unsigned int ack_time; - - int sample_limit; - unsigned int retry_count; - unsigned int retry_count_cts; - unsigned int retry_count_rtscts; - unsigned int adjusted_retry_count; - - u32 success; - u32 attempts; - u32 last_attempts; - u32 last_success; - - /* parts per thousand */ - u32 cur_prob; - u32 probability; - - /* per-rate throughput */ - u32 cur_tp; - - u64 succ_hist; - u64 att_hist; -}; - -struct minstrel_sta_info { - unsigned long stats_update; - unsigned int sp_ack_dur; - unsigned int rate_avg; - - unsigned int lowest_rix; - - unsigned int max_tp_rate; - unsigned int max_tp_rate2; - unsigned int max_prob_rate; - unsigned int packet_count; - unsigned int sample_count; - int sample_deferred; - - unsigned int sample_idx; - unsigned int sample_column; - - int n_rates; - struct minstrel_rate *r; - bool prev_sample; - - /* sampling table */ - u8 *sample_table; - -#ifdef CONFIG_MAC80211_DEBUGFS - struct dentry *dbg_stats; -#endif -}; - -struct minstrel_priv { - struct ieee80211_hw *hw; - bool has_mrr; - unsigned int cw_min; - unsigned int cw_max; - unsigned int max_retry; - unsigned int ewma_level; - unsigned int segment_size; - unsigned int update_interval; - unsigned int lookaround_rate; - unsigned int lookaround_rate_mrr; - -#ifdef CONFIG_MAC80211_DEBUGFS - /* - * enable fixed rate processing per RC - * - write static index to debugfs:ieee80211/phyX/rc/fixed_rate_idx - * - write -1 to enable RC processing again - * - setting will be applied on next update - */ - u32 fixed_rate_idx; - struct dentry *dbg_fixed_rate; -#endif - -}; - -struct minstrel_debugfs_info { - size_t len; - char buf[]; -}; - -extern struct rate_control_ops mac80211_minstrel; -void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); -void minstrel_remove_sta_debugfs(void *priv, void *priv_sta); - -/* debugfs */ -int minstrel_stats_open(struct inode *inode, struct file *file); -ssize_t minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos); -int minstrel_stats_release(struct inode *inode, struct file *file); - -#endif diff --git a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_debugfs.c b/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_debugfs.c deleted file mode 100644 index d5a56226e67..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_debugfs.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Based on minstrel.c: - * Copyright (C) 2005-2007 Derek Smithies <derek@indranet.co.nz> - * Sponsored by Indranet Technologies Ltd - * - * Based on sample.c: - * Copyright (c) 2005 John Bicket - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any - * redistribution must be conditioned upon including a substantially - * similar Disclaimer requirement for further binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGES. - */ -#include <linux/netdevice.h> -#include <linux/types.h> -#include <linux/skbuff.h> -#include <linux/debugfs.h> -#include <linux/ieee80211.h> -#include <linux/slab.h> -#include <linux/export.h> -#include <net/mac80211.h> -#include "rc80211_minstrel.h" - -int -minstrel_stats_open(struct inode *inode, struct file *file) -{ - struct minstrel_sta_info *mi = inode->i_private; - struct minstrel_debugfs_info *ms; - unsigned int i, tp, prob, eprob; - char *p; - - ms = kmalloc(sizeof(*ms) + 4096, GFP_KERNEL); - if (!ms) - return -ENOMEM; - - file->private_data = ms; - p = ms->buf; - p += sprintf(p, "rate throughput ewma prob this prob " - "this succ/attempt success attempts\n"); - for (i = 0; i < mi->n_rates; i++) { - struct minstrel_rate *mr = &mi->r[i]; - - *(p++) = (i == mi->max_tp_rate) ? 'T' : ' '; - *(p++) = (i == mi->max_tp_rate2) ? 't' : ' '; - *(p++) = (i == mi->max_prob_rate) ? 'P' : ' '; - p += sprintf(p, "%3u%s", mr->bitrate / 2, - (mr->bitrate & 1 ? ".5" : " ")); - - tp = mr->cur_tp / ((18000 << 10) / 96); - prob = mr->cur_prob / 18; - eprob = mr->probability / 18; - - p += sprintf(p, " %6u.%1u %6u.%1u %6u.%1u " - "%3u(%3u) %8llu %8llu\n", - tp / 10, tp % 10, - eprob / 10, eprob % 10, - prob / 10, prob % 10, - mr->last_success, - mr->last_attempts, - (unsigned long long)mr->succ_hist, - (unsigned long long)mr->att_hist); - } - p += sprintf(p, "\nTotal packet count:: ideal %d " - "lookaround %d\n\n", - mi->packet_count - mi->sample_count, - mi->sample_count); - ms->len = p - ms->buf; - - return 0; -} - -ssize_t -minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) -{ - struct minstrel_debugfs_info *ms; - - ms = file->private_data; - return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len); -} - -int -minstrel_stats_release(struct inode *inode, struct file *file) -{ - kfree(file->private_data); - return 0; -} - -static const struct file_operations minstrel_stat_fops = { - .owner = THIS_MODULE, - .open = minstrel_stats_open, - .read = minstrel_stats_read, - .release = minstrel_stats_release, - .llseek = default_llseek, -}; - -void -minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir) -{ - struct minstrel_sta_info *mi = priv_sta; - - mi->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, mi, - &minstrel_stat_fops); -} - -void -minstrel_remove_sta_debugfs(void *priv, void *priv_sta) -{ - struct minstrel_sta_info *mi = priv_sta; - - debugfs_remove(mi->dbg_stats); -} diff --git a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht.c b/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht.c deleted file mode 100644 index 16e0b277b9a..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht.c +++ /dev/null @@ -1,911 +0,0 @@ -/* - * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include <linux/netdevice.h> -#include <linux/types.h> -#include <linux/skbuff.h> -#include <linux/debugfs.h> -#include <linux/random.h> -#include <linux/ieee80211.h> -#include <net/mac80211.h> -#include "rate.h" -#include "rc80211_minstrel.h" -#include "rc80211_minstrel_ht.h" - -#define AVG_PKT_SIZE 1200 -#define SAMPLE_COLUMNS 10 -#define EWMA_LEVEL 75 - -/* Number of bits for an average sized packet */ -#define MCS_NBITS (AVG_PKT_SIZE << 3) - -/* Number of symbols for a packet with (bps) bits per symbol */ -#define MCS_NSYMS(bps) ((MCS_NBITS + (bps) - 1) / (bps)) - -/* Transmission time for a packet containing (syms) symbols */ -#define MCS_SYMBOL_TIME(sgi, syms) \ - (sgi ? \ - ((syms) * 18 + 4) / 5 : /* syms * 3.6 us */ \ - (syms) << 2 /* syms * 4 us */ \ - ) - -/* Transmit duration for the raw data part of an average sized packet */ -#define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) - -/* - * Define group sort order: HT40 -> SGI -> #streams - */ -#define GROUP_IDX(_streams, _sgi, _ht40) \ - MINSTREL_MAX_STREAMS * 2 * _ht40 + \ - MINSTREL_MAX_STREAMS * _sgi + \ - _streams - 1 - -/* MCS rate information for an MCS group */ -#define MCS_GROUP(_streams, _sgi, _ht40) \ - [GROUP_IDX(_streams, _sgi, _ht40)] = { \ - .streams = _streams, \ - .flags = \ - (_sgi ? IEEE80211_TX_RC_SHORT_GI : 0) | \ - (_ht40 ? IEEE80211_TX_RC_40_MHZ_WIDTH : 0), \ - .duration = { \ - MCS_DURATION(_streams, _sgi, _ht40 ? 54 : 26), \ - MCS_DURATION(_streams, _sgi, _ht40 ? 108 : 52), \ - MCS_DURATION(_streams, _sgi, _ht40 ? 162 : 78), \ - MCS_DURATION(_streams, _sgi, _ht40 ? 216 : 104), \ - MCS_DURATION(_streams, _sgi, _ht40 ? 324 : 156), \ - MCS_DURATION(_streams, _sgi, _ht40 ? 432 : 208), \ - MCS_DURATION(_streams, _sgi, _ht40 ? 486 : 234), \ - MCS_DURATION(_streams, _sgi, _ht40 ? 540 : 260) \ - } \ -} - -/* - * To enable sufficiently targeted rate sampling, MCS rates are divided into - * groups, based on the number of streams and flags (HT40, SGI) that they - * use. - * - * Sortorder has to be fixed for GROUP_IDX macro to be applicable: - * HT40 -> SGI -> #streams - */ -const struct mcs_group minstrel_mcs_groups[] = { - MCS_GROUP(1, 0, 0), - MCS_GROUP(2, 0, 0), -#if MINSTREL_MAX_STREAMS >= 3 - MCS_GROUP(3, 0, 0), -#endif - - MCS_GROUP(1, 1, 0), - MCS_GROUP(2, 1, 0), -#if MINSTREL_MAX_STREAMS >= 3 - MCS_GROUP(3, 1, 0), -#endif - - MCS_GROUP(1, 0, 1), - MCS_GROUP(2, 0, 1), -#if MINSTREL_MAX_STREAMS >= 3 - MCS_GROUP(3, 0, 1), -#endif - - MCS_GROUP(1, 1, 1), - MCS_GROUP(2, 1, 1), -#if MINSTREL_MAX_STREAMS >= 3 - MCS_GROUP(3, 1, 1), -#endif -}; - -static u8 sample_table[SAMPLE_COLUMNS][MCS_GROUP_RATES]; - -/* - * Perform EWMA (Exponentially Weighted Moving Average) calculation - */ -static int -minstrel_ewma(int old, int new, int weight) -{ - return (new * (100 - weight) + old * weight) / 100; -} - -/* - * Look up an MCS group index based on mac80211 rate information - */ -static int -minstrel_ht_get_group_idx(struct ieee80211_tx_rate *rate) -{ - return GROUP_IDX((rate->idx / MCS_GROUP_RATES) + 1, - !!(rate->flags & IEEE80211_TX_RC_SHORT_GI), - !!(rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)); -} - -static inline struct minstrel_rate_stats * -minstrel_get_ratestats(struct minstrel_ht_sta *mi, int index) -{ - return &mi->groups[index / MCS_GROUP_RATES].rates[index % MCS_GROUP_RATES]; -} - - -/* - * Recalculate success probabilities and counters for a rate using EWMA - */ -static void -minstrel_calc_rate_ewma(struct minstrel_rate_stats *mr) -{ - if (unlikely(mr->attempts > 0)) { - mr->sample_skipped = 0; - mr->cur_prob = MINSTREL_FRAC(mr->success, mr->attempts); - if (!mr->att_hist) - mr->probability = mr->cur_prob; - else - mr->probability = minstrel_ewma(mr->probability, - mr->cur_prob, EWMA_LEVEL); - mr->att_hist += mr->attempts; - mr->succ_hist += mr->success; - } else { - mr->sample_skipped++; - } - mr->last_success = mr->success; - mr->last_attempts = mr->attempts; - mr->success = 0; - mr->attempts = 0; -} - -/* - * Calculate throughput based on the average A-MPDU length, taking into account - * the expected number of retransmissions and their expected length - */ -static void -minstrel_ht_calc_tp(struct minstrel_ht_sta *mi, int group, int rate) -{ - struct minstrel_rate_stats *mr; - unsigned int usecs; - - mr = &mi->groups[group].rates[rate]; - - if (mr->probability < MINSTREL_FRAC(1, 10)) { - mr->cur_tp = 0; - return; - } - - usecs = mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len); - usecs += minstrel_mcs_groups[group].duration[rate]; - mr->cur_tp = MINSTREL_TRUNC((1000000 / usecs) * mr->probability); -} - -/* - * Update rate statistics and select new primary rates - * - * Rules for rate selection: - * - max_prob_rate must use only one stream, as a tradeoff between delivery - * probability and throughput during strong fluctuations - * - as long as the max prob rate has a probability of more than 3/4, pick - * higher throughput rates, even if the probablity is a bit lower - */ -static void -minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) -{ - struct minstrel_mcs_group_data *mg; - struct minstrel_rate_stats *mr; - int cur_prob, cur_prob_tp, cur_tp, cur_tp2; - int group, i, index; - - if (mi->ampdu_packets > 0) { - mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len, - MINSTREL_FRAC(mi->ampdu_len, mi->ampdu_packets), EWMA_LEVEL); - mi->ampdu_len = 0; - mi->ampdu_packets = 0; - } - - mi->sample_slow = 0; - mi->sample_count = 0; - mi->max_tp_rate = 0; - mi->max_tp_rate2 = 0; - mi->max_prob_rate = 0; - - for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { - cur_prob = 0; - cur_prob_tp = 0; - cur_tp = 0; - cur_tp2 = 0; - - mg = &mi->groups[group]; - if (!mg->supported) - continue; - - mg->max_tp_rate = 0; - mg->max_tp_rate2 = 0; - mg->max_prob_rate = 0; - mi->sample_count++; - - for (i = 0; i < MCS_GROUP_RATES; i++) { - if (!(mg->supported & BIT(i))) - continue; - - mr = &mg->rates[i]; - mr->retry_updated = false; - index = MCS_GROUP_RATES * group + i; - minstrel_calc_rate_ewma(mr); - minstrel_ht_calc_tp(mi, group, i); - - if (!mr->cur_tp) - continue; - - /* ignore the lowest rate of each single-stream group */ - if (!i && minstrel_mcs_groups[group].streams == 1) - continue; - - if ((mr->cur_tp > cur_prob_tp && mr->probability > - MINSTREL_FRAC(3, 4)) || mr->probability > cur_prob) { - mg->max_prob_rate = index; - cur_prob = mr->probability; - cur_prob_tp = mr->cur_tp; - } - - if (mr->cur_tp > cur_tp) { - swap(index, mg->max_tp_rate); - cur_tp = mr->cur_tp; - mr = minstrel_get_ratestats(mi, index); - } - - if (index >= mg->max_tp_rate) - continue; - - if (mr->cur_tp > cur_tp2) { - mg->max_tp_rate2 = index; - cur_tp2 = mr->cur_tp; - } - } - } - - /* try to sample up to half of the available rates during each interval */ - mi->sample_count *= 4; - - cur_prob = 0; - cur_prob_tp = 0; - cur_tp = 0; - cur_tp2 = 0; - for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) { - mg = &mi->groups[group]; - if (!mg->supported) - continue; - - mr = minstrel_get_ratestats(mi, mg->max_prob_rate); - if (cur_prob_tp < mr->cur_tp && - minstrel_mcs_groups[group].streams == 1) { - mi->max_prob_rate = mg->max_prob_rate; - cur_prob = mr->cur_prob; - cur_prob_tp = mr->cur_tp; - } - - mr = minstrel_get_ratestats(mi, mg->max_tp_rate); - if (cur_tp < mr->cur_tp) { - mi->max_tp_rate2 = mi->max_tp_rate; - cur_tp2 = cur_tp; - mi->max_tp_rate = mg->max_tp_rate; - cur_tp = mr->cur_tp; - } - - mr = minstrel_get_ratestats(mi, mg->max_tp_rate2); - if (cur_tp2 < mr->cur_tp) { - mi->max_tp_rate2 = mg->max_tp_rate2; - cur_tp2 = mr->cur_tp; - } - } - - mi->stats_update = jiffies; -} - -static bool -minstrel_ht_txstat_valid(struct ieee80211_tx_rate *rate) -{ - if (rate->idx < 0) - return false; - - if (!rate->count) - return false; - - return !!(rate->flags & IEEE80211_TX_RC_MCS); -} - -static void -minstrel_next_sample_idx(struct minstrel_ht_sta *mi) -{ - struct minstrel_mcs_group_data *mg; - - for (;;) { - mi->sample_group++; - mi->sample_group %= ARRAY_SIZE(minstrel_mcs_groups); - mg = &mi->groups[mi->sample_group]; - - if (!mg->supported) - continue; - - if (++mg->index >= MCS_GROUP_RATES) { - mg->index = 0; - if (++mg->column >= ARRAY_SIZE(sample_table)) - mg->column = 0; - } - break; - } -} - -static void -minstrel_downgrade_rate(struct minstrel_ht_sta *mi, unsigned int *idx, - bool primary) -{ - int group, orig_group; - - orig_group = group = *idx / MCS_GROUP_RATES; - while (group > 0) { - group--; - - if (!mi->groups[group].supported) - continue; - - if (minstrel_mcs_groups[group].streams > - minstrel_mcs_groups[orig_group].streams) - continue; - - if (primary) - *idx = mi->groups[group].max_tp_rate; - else - *idx = mi->groups[group].max_tp_rate2; - break; - } -} - -static void -minstrel_aggr_check(struct ieee80211_sta *pubsta, struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct sta_info *sta = container_of(pubsta, struct sta_info, sta); - u16 tid; - - if (unlikely(!ieee80211_is_data_qos(hdr->frame_control))) - return; - - if (unlikely(skb->protocol == cpu_to_be16(ETH_P_PAE))) - return; - - tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; - if (likely(sta->ampdu_mlme.tid_tx[tid])) - return; - - if (skb_get_queue_mapping(skb) == IEEE80211_AC_VO) - return; - - ieee80211_start_tx_ba_session(pubsta, tid, 5000); -} - -static void -minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - struct sk_buff *skb) -{ - struct minstrel_ht_sta_priv *msp = priv_sta; - struct minstrel_ht_sta *mi = &msp->ht; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_tx_rate *ar = info->status.rates; - struct minstrel_rate_stats *rate, *rate2; - struct minstrel_priv *mp = priv; - bool last = false; - int group; - int i = 0; - - if (!msp->is_ht) - return mac80211_minstrel.tx_status(priv, sband, sta, &msp->legacy, skb); - - /* This packet was aggregated but doesn't carry status info */ - if ((info->flags & IEEE80211_TX_CTL_AMPDU) && - !(info->flags & IEEE80211_TX_STAT_AMPDU)) - return; - - if (!(info->flags & IEEE80211_TX_STAT_AMPDU)) { - info->status.ampdu_ack_len = - (info->flags & IEEE80211_TX_STAT_ACK ? 1 : 0); - info->status.ampdu_len = 1; - } - - mi->ampdu_packets++; - mi->ampdu_len += info->status.ampdu_len; - - if (!mi->sample_wait && !mi->sample_tries && mi->sample_count > 0) { - mi->sample_wait = 16 + 2 * MINSTREL_TRUNC(mi->avg_ampdu_len); - mi->sample_tries = 2; - mi->sample_count--; - } - - if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) - mi->sample_packets += info->status.ampdu_len; - - for (i = 0; !last; i++) { - last = (i == IEEE80211_TX_MAX_RATES - 1) || - !minstrel_ht_txstat_valid(&ar[i + 1]); - - if (!minstrel_ht_txstat_valid(&ar[i])) - break; - - group = minstrel_ht_get_group_idx(&ar[i]); - rate = &mi->groups[group].rates[ar[i].idx % 8]; - - if (last) - rate->success += info->status.ampdu_ack_len; - - rate->attempts += ar[i].count * info->status.ampdu_len; - } - - /* - * check for sudden death of spatial multiplexing, - * downgrade to a lower number of streams if necessary. - */ - rate = minstrel_get_ratestats(mi, mi->max_tp_rate); - if (rate->attempts > 30 && - MINSTREL_FRAC(rate->success, rate->attempts) < - MINSTREL_FRAC(20, 100)) - minstrel_downgrade_rate(mi, &mi->max_tp_rate, true); - - rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate2); - if (rate2->attempts > 30 && - MINSTREL_FRAC(rate2->success, rate2->attempts) < - MINSTREL_FRAC(20, 100)) - minstrel_downgrade_rate(mi, &mi->max_tp_rate2, false); - - if (time_after(jiffies, mi->stats_update + (mp->update_interval / 2 * HZ) / 1000)) { - minstrel_ht_update_stats(mp, mi); - if (!(info->flags & IEEE80211_TX_CTL_AMPDU)) - minstrel_aggr_check(sta, skb); - } -} - -static void -minstrel_calc_retransmit(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, - int index) -{ - struct minstrel_rate_stats *mr; - const struct mcs_group *group; - unsigned int tx_time, tx_time_rtscts, tx_time_data; - unsigned int cw = mp->cw_min; - unsigned int ctime = 0; - unsigned int t_slot = 9; /* FIXME */ - unsigned int ampdu_len = MINSTREL_TRUNC(mi->avg_ampdu_len); - - mr = minstrel_get_ratestats(mi, index); - if (mr->probability < MINSTREL_FRAC(1, 10)) { - mr->retry_count = 1; - mr->retry_count_rtscts = 1; - return; - } - - mr->retry_count = 2; - mr->retry_count_rtscts = 2; - mr->retry_updated = true; - - group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; - tx_time_data = group->duration[index % MCS_GROUP_RATES] * ampdu_len; - - /* Contention time for first 2 tries */ - ctime = (t_slot * cw) >> 1; - cw = min((cw << 1) | 1, mp->cw_max); - ctime += (t_slot * cw) >> 1; - cw = min((cw << 1) | 1, mp->cw_max); - - /* Total TX time for data and Contention after first 2 tries */ - tx_time = ctime + 2 * (mi->overhead + tx_time_data); - tx_time_rtscts = ctime + 2 * (mi->overhead_rtscts + tx_time_data); - - /* See how many more tries we can fit inside segment size */ - do { - /* Contention time for this try */ - ctime = (t_slot * cw) >> 1; - cw = min((cw << 1) | 1, mp->cw_max); - - /* Total TX time after this try */ - tx_time += ctime + mi->overhead + tx_time_data; - tx_time_rtscts += ctime + mi->overhead_rtscts + tx_time_data; - - if (tx_time_rtscts < mp->segment_size) - mr->retry_count_rtscts++; - } while ((tx_time < mp->segment_size) && - (++mr->retry_count < mp->max_retry)); -} - - -static void -minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi, - struct ieee80211_tx_rate *rate, int index, - bool sample, bool rtscts) -{ - const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; - struct minstrel_rate_stats *mr; - - mr = minstrel_get_ratestats(mi, index); - if (!mr->retry_updated) - minstrel_calc_retransmit(mp, mi, index); - - if (sample) - rate->count = 1; - else if (mr->probability < MINSTREL_FRAC(20, 100)) - rate->count = 2; - else if (rtscts) - rate->count = mr->retry_count_rtscts; - else - rate->count = mr->retry_count; - - rate->flags = IEEE80211_TX_RC_MCS | group->flags; - if (rtscts) - rate->flags |= IEEE80211_TX_RC_USE_RTS_CTS; - rate->idx = index % MCS_GROUP_RATES + (group->streams - 1) * MCS_GROUP_RATES; -} - -static inline int -minstrel_get_duration(int index) -{ - const struct mcs_group *group = &minstrel_mcs_groups[index / MCS_GROUP_RATES]; - return group->duration[index % MCS_GROUP_RATES]; -} - -static int -minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) -{ - struct minstrel_rate_stats *mr; - struct minstrel_mcs_group_data *mg; - int sample_idx = 0; - - if (mi->sample_wait > 0) { - mi->sample_wait--; - return -1; - } - - if (!mi->sample_tries) - return -1; - - mi->sample_tries--; - mg = &mi->groups[mi->sample_group]; - sample_idx = sample_table[mg->column][mg->index]; - mr = &mg->rates[sample_idx]; - sample_idx += mi->sample_group * MCS_GROUP_RATES; - minstrel_next_sample_idx(mi); - - /* - * Sampling might add some overhead (RTS, no aggregation) - * to the frame. Hence, don't use sampling for the currently - * used max TP rate. - */ - if (sample_idx == mi->max_tp_rate) - return -1; - /* - * When not using MRR, do not sample if the probability is already - * higher than 95% to avoid wasting airtime - */ - if (!mp->has_mrr && (mr->probability > MINSTREL_FRAC(95, 100))) - return -1; - - /* - * Make sure that lower rates get sampled only occasionally, - * if the link is working perfectly. - */ - if (minstrel_get_duration(sample_idx) > - minstrel_get_duration(mi->max_tp_rate)) { - if (mr->sample_skipped < 20) - return -1; - - if (mi->sample_slow++ > 2) - return -1; - } - - return sample_idx; -} - -static void -minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, - struct ieee80211_tx_rate_control *txrc) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb); - struct ieee80211_tx_rate *ar = info->status.rates; - struct minstrel_ht_sta_priv *msp = priv_sta; - struct minstrel_ht_sta *mi = &msp->ht; - struct minstrel_priv *mp = priv; - int sample_idx; - bool sample = false; - - if (rate_control_send_low(sta, priv_sta, txrc)) - return; - - if (!msp->is_ht) - return mac80211_minstrel.get_rate(priv, sta, &msp->legacy, txrc); - - info->flags |= mi->tx_flags; - - /* Don't use EAPOL frames for sampling on non-mrr hw */ - if (mp->hw->max_rates == 1 && - txrc->skb->protocol == cpu_to_be16(ETH_P_PAE)) - sample_idx = -1; - else - sample_idx = minstrel_get_sample_rate(mp, mi); - -#ifdef CONFIG_MAC80211_DEBUGFS - /* use fixed index if set */ - if (mp->fixed_rate_idx != -1) - sample_idx = mp->fixed_rate_idx; -#endif - - if (sample_idx >= 0) { - sample = true; - minstrel_ht_set_rate(mp, mi, &ar[0], sample_idx, - true, false); - info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; - } else { - minstrel_ht_set_rate(mp, mi, &ar[0], mi->max_tp_rate, - false, false); - } - - if (mp->hw->max_rates >= 3) { - /* - * At least 3 tx rates supported, use - * sample_rate -> max_tp_rate -> max_prob_rate for sampling and - * max_tp_rate -> max_tp_rate2 -> max_prob_rate by default. - */ - if (sample_idx >= 0) - minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate, - false, false); - else - minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_tp_rate2, - false, true); - - minstrel_ht_set_rate(mp, mi, &ar[2], mi->max_prob_rate, - false, !sample); - - ar[3].count = 0; - ar[3].idx = -1; - } else if (mp->hw->max_rates == 2) { - /* - * Only 2 tx rates supported, use - * sample_rate -> max_prob_rate for sampling and - * max_tp_rate -> max_prob_rate by default. - */ - minstrel_ht_set_rate(mp, mi, &ar[1], mi->max_prob_rate, - false, !sample); - - ar[2].count = 0; - ar[2].idx = -1; - } else { - /* Not using MRR, only use the first rate */ - ar[1].count = 0; - ar[1].idx = -1; - } - - mi->total_packets++; - - /* wraparound */ - if (mi->total_packets == ~0) { - mi->total_packets = 0; - mi->sample_packets = 0; - } -} - -static void -minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - enum nl80211_channel_type oper_chan_type) -{ - struct minstrel_priv *mp = priv; - struct minstrel_ht_sta_priv *msp = priv_sta; - struct minstrel_ht_sta *mi = &msp->ht; - struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs; - struct ieee80211_local *local = hw_to_local(mp->hw); - u16 sta_cap = sta->ht_cap.cap; - int n_supported = 0; - int ack_dur; - int stbc; - int i; - unsigned int smps; - - /* fall back to the old minstrel for legacy stations */ - if (!sta->ht_cap.ht_supported) - goto use_legacy; - - BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) != - MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS); - - msp->is_ht = true; - memset(mi, 0, sizeof(*mi)); - mi->stats_update = jiffies; - - ack_dur = ieee80211_frame_duration(local, 10, 60, 1, 1); - mi->overhead = ieee80211_frame_duration(local, 0, 60, 1, 1) + ack_dur; - mi->overhead_rtscts = mi->overhead + 2 * ack_dur; - - mi->avg_ampdu_len = MINSTREL_FRAC(1, 1); - - /* When using MRR, sample more on the first attempt, without delay */ - if (mp->has_mrr) { - mi->sample_count = 16; - mi->sample_wait = 0; - } else { - mi->sample_count = 8; - mi->sample_wait = 8; - } - mi->sample_tries = 4; - - stbc = (sta_cap & IEEE80211_HT_CAP_RX_STBC) >> - IEEE80211_HT_CAP_RX_STBC_SHIFT; - mi->tx_flags |= stbc << IEEE80211_TX_CTL_STBC_SHIFT; - - if (sta_cap & IEEE80211_HT_CAP_LDPC_CODING) - mi->tx_flags |= IEEE80211_TX_CTL_LDPC; - - if (oper_chan_type != NL80211_CHAN_HT40MINUS && - oper_chan_type != NL80211_CHAN_HT40PLUS) - sta_cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; - - smps = (sta_cap & IEEE80211_HT_CAP_SM_PS) >> - IEEE80211_HT_CAP_SM_PS_SHIFT; - - for (i = 0; i < ARRAY_SIZE(mi->groups); i++) { - u16 req = 0; - - mi->groups[i].supported = 0; - if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_SHORT_GI) { - if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) - req |= IEEE80211_HT_CAP_SGI_40; - else - req |= IEEE80211_HT_CAP_SGI_20; - } - - if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) - req |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; - - if ((sta_cap & req) != req) - continue; - - /* Mark MCS > 7 as unsupported if STA is in static SMPS mode */ - if (smps == WLAN_HT_CAP_SM_PS_STATIC && - minstrel_mcs_groups[i].streams > 1) - continue; - - mi->groups[i].supported = - mcs->rx_mask[minstrel_mcs_groups[i].streams - 1]; - - if (mi->groups[i].supported) - n_supported++; - } - - if (!n_supported) - goto use_legacy; - - return; - -use_legacy: - msp->is_ht = false; - memset(&msp->legacy, 0, sizeof(msp->legacy)); - msp->legacy.r = msp->ratelist; - msp->legacy.sample_table = msp->sample_table; - return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy); -} - -static void -minstrel_ht_rate_init(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta) -{ - struct minstrel_priv *mp = priv; - - minstrel_ht_update_caps(priv, sband, sta, priv_sta, mp->hw->conf.channel_type); -} - -static void -minstrel_ht_rate_update(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - u32 changed, enum nl80211_channel_type oper_chan_type) -{ - minstrel_ht_update_caps(priv, sband, sta, priv_sta, oper_chan_type); -} - -static void * -minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) -{ - struct ieee80211_supported_band *sband; - struct minstrel_ht_sta_priv *msp; - struct minstrel_priv *mp = priv; - struct ieee80211_hw *hw = mp->hw; - int max_rates = 0; - int i; - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) { - sband = hw->wiphy->bands[i]; - if (sband && sband->n_bitrates > max_rates) - max_rates = sband->n_bitrates; - } - - msp = kzalloc(sizeof(struct minstrel_ht_sta), gfp); - if (!msp) - return NULL; - - msp->ratelist = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp); - if (!msp->ratelist) - goto error; - - msp->sample_table = kmalloc(SAMPLE_COLUMNS * max_rates, gfp); - if (!msp->sample_table) - goto error1; - - return msp; - -error1: - kfree(msp->ratelist); -error: - kfree(msp); - return NULL; -} - -static void -minstrel_ht_free_sta(void *priv, struct ieee80211_sta *sta, void *priv_sta) -{ - struct minstrel_ht_sta_priv *msp = priv_sta; - - kfree(msp->sample_table); - kfree(msp->ratelist); - kfree(msp); -} - -static void * -minstrel_ht_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir) -{ - return mac80211_minstrel.alloc(hw, debugfsdir); -} - -static void -minstrel_ht_free(void *priv) -{ - mac80211_minstrel.free(priv); -} - -static struct rate_control_ops mac80211_minstrel_ht = { - .name = "minstrel_ht", - .tx_status = minstrel_ht_tx_status, - .get_rate = minstrel_ht_get_rate, - .rate_init = minstrel_ht_rate_init, - .rate_update = minstrel_ht_rate_update, - .alloc_sta = minstrel_ht_alloc_sta, - .free_sta = minstrel_ht_free_sta, - .alloc = minstrel_ht_alloc, - .free = minstrel_ht_free, -#ifdef CONFIG_MAC80211_DEBUGFS - .add_sta_debugfs = minstrel_ht_add_sta_debugfs, - .remove_sta_debugfs = minstrel_ht_remove_sta_debugfs, -#endif -}; - - -static void -init_sample_table(void) -{ - int col, i, new_idx; - u8 rnd[MCS_GROUP_RATES]; - - memset(sample_table, 0xff, sizeof(sample_table)); - for (col = 0; col < SAMPLE_COLUMNS; col++) { - for (i = 0; i < MCS_GROUP_RATES; i++) { - get_random_bytes(rnd, sizeof(rnd)); - new_idx = (i + rnd[i]) % MCS_GROUP_RATES; - - while (sample_table[col][new_idx] != 0xff) - new_idx = (new_idx + 1) % MCS_GROUP_RATES; - - sample_table[col][new_idx] = i; - } - } -} - -int __init -rc80211_minstrel_ht_init(void) -{ - init_sample_table(); - return ieee80211_rate_control_register(&mac80211_minstrel_ht); -} - -void -rc80211_minstrel_ht_exit(void) -{ - ieee80211_rate_control_unregister(&mac80211_minstrel_ht); -} diff --git a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht.h b/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht.h deleted file mode 100644 index 462d2b227ed..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef __RC_MINSTREL_HT_H -#define __RC_MINSTREL_HT_H - -/* - * The number of streams can be changed to 2 to reduce code - * size and memory footprint. - */ -#define MINSTREL_MAX_STREAMS 3 -#define MINSTREL_STREAM_GROUPS 4 - -/* scaled fraction values */ -#define MINSTREL_SCALE 16 -#define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div) -#define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE) - -#define MCS_GROUP_RATES 8 - -struct mcs_group { - u32 flags; - unsigned int streams; - unsigned int duration[MCS_GROUP_RATES]; -}; - -extern const struct mcs_group minstrel_mcs_groups[]; - -struct minstrel_rate_stats { - /* current / last sampling period attempts/success counters */ - unsigned int attempts, last_attempts; - unsigned int success, last_success; - - /* total attempts/success counters */ - u64 att_hist, succ_hist; - - /* current throughput */ - unsigned int cur_tp; - - /* packet delivery probabilities */ - unsigned int cur_prob, probability; - - /* maximum retry counts */ - unsigned int retry_count; - unsigned int retry_count_rtscts; - - bool retry_updated; - u8 sample_skipped; -}; - -struct minstrel_mcs_group_data { - u8 index; - u8 column; - - /* bitfield of supported MCS rates of this group */ - u8 supported; - - /* selected primary rates */ - unsigned int max_tp_rate; - unsigned int max_tp_rate2; - unsigned int max_prob_rate; - - /* MCS rate statistics */ - struct minstrel_rate_stats rates[MCS_GROUP_RATES]; -}; - -struct minstrel_ht_sta { - /* ampdu length (average, per sampling interval) */ - unsigned int ampdu_len; - unsigned int ampdu_packets; - - /* ampdu length (EWMA) */ - unsigned int avg_ampdu_len; - - /* best throughput rate */ - unsigned int max_tp_rate; - - /* second best throughput rate */ - unsigned int max_tp_rate2; - - /* best probability rate */ - unsigned int max_prob_rate; - - /* time of last status update */ - unsigned long stats_update; - - /* overhead time in usec for each frame */ - unsigned int overhead; - unsigned int overhead_rtscts; - - unsigned int total_packets; - unsigned int sample_packets; - - /* tx flags to add for frames for this sta */ - u32 tx_flags; - - u8 sample_wait; - u8 sample_tries; - u8 sample_count; - u8 sample_slow; - - /* current MCS group to be sampled */ - u8 sample_group; - - /* MCS rate group info and statistics */ - struct minstrel_mcs_group_data groups[MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS]; -}; - -struct minstrel_ht_sta_priv { - union { - struct minstrel_ht_sta ht; - struct minstrel_sta_info legacy; - }; -#ifdef CONFIG_MAC80211_DEBUGFS - struct dentry *dbg_stats; -#endif - void *ratelist; - void *sample_table; - bool is_ht; -}; - -void minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir); -void minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta); - -#endif diff --git a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht_debugfs.c b/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht_debugfs.c deleted file mode 100644 index e788f76a1df..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rc80211_minstrel_ht_debugfs.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include <linux/netdevice.h> -#include <linux/types.h> -#include <linux/skbuff.h> -#include <linux/debugfs.h> -#include <linux/ieee80211.h> -#include <linux/export.h> -#include <net/mac80211.h> -#include "rc80211_minstrel.h" -#include "rc80211_minstrel_ht.h" - -static int -minstrel_ht_stats_open(struct inode *inode, struct file *file) -{ - struct minstrel_ht_sta_priv *msp = inode->i_private; - struct minstrel_ht_sta *mi = &msp->ht; - struct minstrel_debugfs_info *ms; - unsigned int i, j, tp, prob, eprob; - char *p; - int ret; - - if (!msp->is_ht) { - inode->i_private = &msp->legacy; - ret = minstrel_stats_open(inode, file); - inode->i_private = msp; - return ret; - } - - ms = kmalloc(sizeof(*ms) + 8192, GFP_KERNEL); - if (!ms) - return -ENOMEM; - - file->private_data = ms; - p = ms->buf; - p += sprintf(p, "type rate throughput ewma prob this prob " - "this succ/attempt success attempts\n"); - for (i = 0; i < MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS; i++) { - char htmode = '2'; - char gimode = 'L'; - - if (!mi->groups[i].supported) - continue; - - if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) - htmode = '4'; - if (minstrel_mcs_groups[i].flags & IEEE80211_TX_RC_SHORT_GI) - gimode = 'S'; - - for (j = 0; j < MCS_GROUP_RATES; j++) { - struct minstrel_rate_stats *mr = &mi->groups[i].rates[j]; - int idx = i * MCS_GROUP_RATES + j; - - if (!(mi->groups[i].supported & BIT(j))) - continue; - - p += sprintf(p, "HT%c0/%cGI ", htmode, gimode); - - *(p++) = (idx == mi->max_tp_rate) ? 'T' : ' '; - *(p++) = (idx == mi->max_tp_rate2) ? 't' : ' '; - *(p++) = (idx == mi->max_prob_rate) ? 'P' : ' '; - p += sprintf(p, "MCS%-2u", (minstrel_mcs_groups[i].streams - 1) * - MCS_GROUP_RATES + j); - - tp = mr->cur_tp / 10; - prob = MINSTREL_TRUNC(mr->cur_prob * 1000); - eprob = MINSTREL_TRUNC(mr->probability * 1000); - - p += sprintf(p, " %6u.%1u %6u.%1u %6u.%1u " - "%3u(%3u) %8llu %8llu\n", - tp / 10, tp % 10, - eprob / 10, eprob % 10, - prob / 10, prob % 10, - mr->last_success, - mr->last_attempts, - (unsigned long long)mr->succ_hist, - (unsigned long long)mr->att_hist); - } - } - p += sprintf(p, "\nTotal packet count:: ideal %d " - "lookaround %d\n", - max(0, (int) mi->total_packets - (int) mi->sample_packets), - mi->sample_packets); - p += sprintf(p, "Average A-MPDU length: %d.%d\n", - MINSTREL_TRUNC(mi->avg_ampdu_len), - MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); - ms->len = p - ms->buf; - - return nonseekable_open(inode, file); -} - -static const struct file_operations minstrel_ht_stat_fops = { - .owner = THIS_MODULE, - .open = minstrel_ht_stats_open, - .read = minstrel_stats_read, - .release = minstrel_stats_release, - .llseek = no_llseek, -}; - -void -minstrel_ht_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir) -{ - struct minstrel_ht_sta_priv *msp = priv_sta; - - msp->dbg_stats = debugfs_create_file("rc_stats", S_IRUGO, dir, msp, - &minstrel_ht_stat_fops); -} - -void -minstrel_ht_remove_sta_debugfs(void *priv, void *priv_sta) -{ - struct minstrel_ht_sta_priv *msp = priv_sta; - - debugfs_remove(msp->dbg_stats); -} diff --git a/openairITS/mac/DOT11/net/mac80211/rc80211_pid.h b/openairITS/mac/DOT11/net/mac80211/rc80211_pid.h deleted file mode 100644 index 19111c7bf45..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rc80211_pid.h +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright 2007, Mattias Nissler <mattias.nissler@gmx.de> - * Copyright 2007, Stefano Brivio <stefano.brivio@polimi.it> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef RC80211_PID_H -#define RC80211_PID_H - -/* Sampling period for measuring percentage of failed frames in ms. */ -#define RC_PID_INTERVAL 125 - -/* Exponential averaging smoothness (used for I part of PID controller) */ -#define RC_PID_SMOOTHING_SHIFT 3 -#define RC_PID_SMOOTHING (1 << RC_PID_SMOOTHING_SHIFT) - -/* Sharpening factor (used for D part of PID controller) */ -#define RC_PID_SHARPENING_FACTOR 0 -#define RC_PID_SHARPENING_DURATION 0 - -/* Fixed point arithmetic shifting amount. */ -#define RC_PID_ARITH_SHIFT 8 - -/* Proportional PID component coefficient. */ -#define RC_PID_COEFF_P 15 -/* Integral PID component coefficient. */ -#define RC_PID_COEFF_I 9 -/* Derivative PID component coefficient. */ -#define RC_PID_COEFF_D 15 - -/* Target failed frames rate for the PID controller. NB: This effectively gives - * maximum failed frames percentage we're willing to accept. If the wireless - * link quality is good, the controller will fail to adjust failed frames - * percentage to the target. This is intentional. - */ -#define RC_PID_TARGET_PF 14 - -/* Rate behaviour normalization quantity over time. */ -#define RC_PID_NORM_OFFSET 3 - -/* Push high rates right after loading. */ -#define RC_PID_FAST_START 0 - -/* Arithmetic right shift for positive and negative values for ISO C. */ -#define RC_PID_DO_ARITH_RIGHT_SHIFT(x, y) \ - ((x) < 0 ? -((-(x)) >> (y)) : (x) >> (y)) - -enum rc_pid_event_type { - RC_PID_EVENT_TYPE_TX_STATUS, - RC_PID_EVENT_TYPE_RATE_CHANGE, - RC_PID_EVENT_TYPE_TX_RATE, - RC_PID_EVENT_TYPE_PF_SAMPLE, -}; - -union rc_pid_event_data { - /* RC_PID_EVENT_TX_STATUS */ - struct { - u32 flags; - struct ieee80211_tx_info tx_status; - }; - /* RC_PID_EVENT_TYPE_RATE_CHANGE */ - /* RC_PID_EVENT_TYPE_TX_RATE */ - struct { - int index; - int rate; - }; - /* RC_PID_EVENT_TYPE_PF_SAMPLE */ - struct { - s32 pf_sample; - s32 prop_err; - s32 int_err; - s32 der_err; - }; -}; - -struct rc_pid_event { - /* The time when the event occurred */ - unsigned long timestamp; - - /* Event ID number */ - unsigned int id; - - /* Type of event */ - enum rc_pid_event_type type; - - /* type specific data */ - union rc_pid_event_data data; -}; - -/* Size of the event ring buffer. */ -#define RC_PID_EVENT_RING_SIZE 32 - -struct rc_pid_event_buffer { - /* Counter that generates event IDs */ - unsigned int ev_count; - - /* Ring buffer of events */ - struct rc_pid_event ring[RC_PID_EVENT_RING_SIZE]; - - /* Index to the entry in events_buf to be reused */ - unsigned int next_entry; - - /* Lock that guards against concurrent access to this buffer struct */ - spinlock_t lock; - - /* Wait queue for poll/select and blocking I/O */ - wait_queue_head_t waitqueue; -}; - -struct rc_pid_events_file_info { - /* The event buffer we read */ - struct rc_pid_event_buffer *events; - - /* The entry we have should read next */ - unsigned int next_entry; -}; - -/** - * struct rc_pid_debugfs_entries - tunable parameters - * - * Algorithm parameters, tunable via debugfs. - * @target: target percentage for failed frames - * @sampling_period: error sampling interval in milliseconds - * @coeff_p: absolute value of the proportional coefficient - * @coeff_i: absolute value of the integral coefficient - * @coeff_d: absolute value of the derivative coefficient - * @smoothing_shift: absolute value of the integral smoothing factor (i.e. - * amount of smoothing introduced by the exponential moving average) - * @sharpen_factor: absolute value of the derivative sharpening factor (i.e. - * amount of emphasis given to the derivative term after low activity - * events) - * @sharpen_duration: duration of the sharpening effect after the detected low - * activity event, relative to sampling_period - * @norm_offset: amount of normalization periodically performed on the learnt - * rate behaviour values (lower means we should trust more what we learnt - * about behaviour of rates, higher means we should trust more the natural - * ordering of rates) - */ -struct rc_pid_debugfs_entries { - struct dentry *target; - struct dentry *sampling_period; - struct dentry *coeff_p; - struct dentry *coeff_i; - struct dentry *coeff_d; - struct dentry *smoothing_shift; - struct dentry *sharpen_factor; - struct dentry *sharpen_duration; - struct dentry *norm_offset; -}; - -void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf, - struct ieee80211_tx_info *stat); - -void rate_control_pid_event_rate_change(struct rc_pid_event_buffer *buf, - int index, int rate); - -void rate_control_pid_event_tx_rate(struct rc_pid_event_buffer *buf, - int index, int rate); - -void rate_control_pid_event_pf_sample(struct rc_pid_event_buffer *buf, - s32 pf_sample, s32 prop_err, - s32 int_err, s32 der_err); - -void rate_control_pid_add_sta_debugfs(void *priv, void *priv_sta, - struct dentry *dir); - -void rate_control_pid_remove_sta_debugfs(void *priv, void *priv_sta); - -struct rc_pid_sta_info { - unsigned long last_change; - unsigned long last_sample; - - u32 tx_num_failed; - u32 tx_num_xmit; - - int txrate_idx; - - /* Average failed frames percentage error (i.e. actual vs. target - * percentage), scaled by RC_PID_SMOOTHING. This value is computed - * using using an exponential weighted average technique: - * - * (RC_PID_SMOOTHING - 1) * err_avg_old + err - * err_avg = ------------------------------------------ - * RC_PID_SMOOTHING - * - * where err_avg is the new approximation, err_avg_old the previous one - * and err is the error w.r.t. to the current failed frames percentage - * sample. Note that the bigger RC_PID_SMOOTHING the more weight is - * given to the previous estimate, resulting in smoother behavior (i.e. - * corresponding to a longer integration window). - * - * For computation, we actually don't use the above formula, but this - * one: - * - * err_avg_scaled = err_avg_old_scaled - err_avg_old + err - * - * where: - * err_avg_scaled = err * RC_PID_SMOOTHING - * err_avg_old_scaled = err_avg_old * RC_PID_SMOOTHING - * - * This avoids floating point numbers and the per_failed_old value can - * easily be obtained by shifting per_failed_old_scaled right by - * RC_PID_SMOOTHING_SHIFT. - */ - s32 err_avg_sc; - - /* Last framed failes percentage sample. */ - u32 last_pf; - - /* Sharpening needed. */ - u8 sharp_cnt; - -#ifdef CONFIG_MAC80211_DEBUGFS - /* Event buffer */ - struct rc_pid_event_buffer events; - - /* Events debugfs file entry */ - struct dentry *events_entry; -#endif -}; - -/* Algorithm parameters. We keep them on a per-algorithm approach, so they can - * be tuned individually for each interface. - */ -struct rc_pid_rateinfo { - - /* Map sorted rates to rates in ieee80211_hw_mode. */ - int index; - - /* Map rates in ieee80211_hw_mode to sorted rates. */ - int rev_index; - - /* Did we do any measurement on this rate? */ - bool valid; - - /* Comparison with the lowest rate. */ - int diff; -}; - -struct rc_pid_info { - - /* The failed frames percentage target. */ - unsigned int target; - - /* Rate at which failed frames percentage is sampled in 0.001s. */ - unsigned int sampling_period; - - /* P, I and D coefficients. */ - int coeff_p; - int coeff_i; - int coeff_d; - - /* Exponential averaging shift. */ - unsigned int smoothing_shift; - - /* Sharpening factor and duration. */ - unsigned int sharpen_factor; - unsigned int sharpen_duration; - - /* Normalization offset. */ - unsigned int norm_offset; - - /* Rates information. */ - struct rc_pid_rateinfo *rinfo; - - /* Index of the last used rate. */ - int oldrate; - -#ifdef CONFIG_MAC80211_DEBUGFS - /* Debugfs entries created for the parameters above. */ - struct rc_pid_debugfs_entries dentries; -#endif -}; - -#endif /* RC80211_PID_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/rc80211_pid_algo.c b/openairITS/mac/DOT11/net/mac80211/rc80211_pid_algo.c deleted file mode 100644 index 502d3ecc4a7..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rc80211_pid_algo.c +++ /dev/null @@ -1,477 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005, Devicescape Software, Inc. - * Copyright 2007, Mattias Nissler <mattias.nissler@gmx.de> - * Copyright 2007-2008, Stefano Brivio <stefano.brivio@polimi.it> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/netdevice.h> -#include <linux/types.h> -#include <linux/skbuff.h> -#include <linux/debugfs.h> -#include <linux/slab.h> -#include <net/mac80211.h> -#include "rate.h" -#include "mesh.h" -#include "rc80211_pid.h" - - -/* This is an implementation of a TX rate control algorithm that uses a PID - * controller. Given a target failed frames rate, the controller decides about - * TX rate changes to meet the target failed frames rate. - * - * The controller basically computes the following: - * - * adj = CP * err + CI * err_avg + CD * (err - last_err) * (1 + sharpening) - * - * where - * adj adjustment value that is used to switch TX rate (see below) - * err current error: target vs. current failed frames percentage - * last_err last error - * err_avg average (i.e. poor man's integral) of recent errors - * sharpening non-zero when fast response is needed (i.e. right after - * association or no frames sent for a long time), heading - * to zero over time - * CP Proportional coefficient - * CI Integral coefficient - * CD Derivative coefficient - * - * CP, CI, CD are subject to careful tuning. - * - * The integral component uses a exponential moving average approach instead of - * an actual sliding window. The advantage is that we don't need to keep an - * array of the last N error values and computation is easier. - * - * Once we have the adj value, we map it to a rate by means of a learning - * algorithm. This algorithm keeps the state of the percentual failed frames - * difference between rates. The behaviour of the lowest available rate is kept - * as a reference value, and every time we switch between two rates, we compute - * the difference between the failed frames each rate exhibited. By doing so, - * we compare behaviours which different rates exhibited in adjacent timeslices, - * thus the comparison is minimally affected by external conditions. This - * difference gets propagated to the whole set of measurements, so that the - * reference is always the same. Periodically, we normalize this set so that - * recent events weigh the most. By comparing the adj value with this set, we - * avoid pejorative switches to lower rates and allow for switches to higher - * rates if they behaved well. - * - * Note that for the computations we use a fixed-point representation to avoid - * floating point arithmetic. Hence, all values are shifted left by - * RC_PID_ARITH_SHIFT. - */ - - -/* Adjust the rate while ensuring that we won't switch to a lower rate if it - * exhibited a worse failed frames behaviour and we'll choose the highest rate - * whose failed frames behaviour is not worse than the one of the original rate - * target. While at it, check that the new rate is valid. */ -static void rate_control_pid_adjust_rate(struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, - struct rc_pid_sta_info *spinfo, int adj, - struct rc_pid_rateinfo *rinfo) -{ - int cur_sorted, new_sorted, probe, tmp, n_bitrates, band; - int cur = spinfo->txrate_idx; - - band = sband->band; - n_bitrates = sband->n_bitrates; - - /* Map passed arguments to sorted values. */ - cur_sorted = rinfo[cur].rev_index; - new_sorted = cur_sorted + adj; - - /* Check limits. */ - if (new_sorted < 0) - new_sorted = rinfo[0].rev_index; - else if (new_sorted >= n_bitrates) - new_sorted = rinfo[n_bitrates - 1].rev_index; - - tmp = new_sorted; - - if (adj < 0) { - /* Ensure that the rate decrease isn't disadvantageous. */ - for (probe = cur_sorted; probe >= new_sorted; probe--) - if (rinfo[probe].diff <= rinfo[cur_sorted].diff && - rate_supported(sta, band, rinfo[probe].index)) - tmp = probe; - } else { - /* Look for rate increase with zero (or below) cost. */ - for (probe = new_sorted + 1; probe < n_bitrates; probe++) - if (rinfo[probe].diff <= rinfo[new_sorted].diff && - rate_supported(sta, band, rinfo[probe].index)) - tmp = probe; - } - - /* Fit the rate found to the nearest supported rate. */ - do { - if (rate_supported(sta, band, rinfo[tmp].index)) { - spinfo->txrate_idx = rinfo[tmp].index; - break; - } - if (adj < 0) - tmp--; - else - tmp++; - } while (tmp < n_bitrates && tmp >= 0); - -#ifdef CONFIG_MAC80211_DEBUGFS - rate_control_pid_event_rate_change(&spinfo->events, - spinfo->txrate_idx, - sband->bitrates[spinfo->txrate_idx].bitrate); -#endif -} - -/* Normalize the failed frames per-rate differences. */ -static void rate_control_pid_normalize(struct rc_pid_info *pinfo, int l) -{ - int i, norm_offset = pinfo->norm_offset; - struct rc_pid_rateinfo *r = pinfo->rinfo; - - if (r[0].diff > norm_offset) - r[0].diff -= norm_offset; - else if (r[0].diff < -norm_offset) - r[0].diff += norm_offset; - for (i = 0; i < l - 1; i++) - if (r[i + 1].diff > r[i].diff + norm_offset) - r[i + 1].diff -= norm_offset; - else if (r[i + 1].diff <= r[i].diff) - r[i + 1].diff += norm_offset; -} - -static void rate_control_pid_sample(struct rc_pid_info *pinfo, - struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, - struct rc_pid_sta_info *spinfo) -{ - struct rc_pid_rateinfo *rinfo = pinfo->rinfo; - u32 pf; - s32 err_avg; - u32 err_prop; - u32 err_int; - u32 err_der; - int adj, i, j, tmp; - unsigned long period; - - /* In case nothing happened during the previous control interval, turn - * the sharpening factor on. */ - period = msecs_to_jiffies(pinfo->sampling_period); - if (jiffies - spinfo->last_sample > 2 * period) - spinfo->sharp_cnt = pinfo->sharpen_duration; - - spinfo->last_sample = jiffies; - - /* This should never happen, but in case, we assume the old sample is - * still a good measurement and copy it. */ - if (unlikely(spinfo->tx_num_xmit == 0)) - pf = spinfo->last_pf; - else - pf = spinfo->tx_num_failed * 100 / spinfo->tx_num_xmit; - - spinfo->tx_num_xmit = 0; - spinfo->tx_num_failed = 0; - - /* If we just switched rate, update the rate behaviour info. */ - if (pinfo->oldrate != spinfo->txrate_idx) { - - i = rinfo[pinfo->oldrate].rev_index; - j = rinfo[spinfo->txrate_idx].rev_index; - - tmp = (pf - spinfo->last_pf); - tmp = RC_PID_DO_ARITH_RIGHT_SHIFT(tmp, RC_PID_ARITH_SHIFT); - - rinfo[j].diff = rinfo[i].diff + tmp; - pinfo->oldrate = spinfo->txrate_idx; - } - rate_control_pid_normalize(pinfo, sband->n_bitrates); - - /* Compute the proportional, integral and derivative errors. */ - err_prop = (pinfo->target - pf) << RC_PID_ARITH_SHIFT; - - err_avg = spinfo->err_avg_sc >> pinfo->smoothing_shift; - spinfo->err_avg_sc = spinfo->err_avg_sc - err_avg + err_prop; - err_int = spinfo->err_avg_sc >> pinfo->smoothing_shift; - - err_der = (pf - spinfo->last_pf) * - (1 + pinfo->sharpen_factor * spinfo->sharp_cnt); - spinfo->last_pf = pf; - if (spinfo->sharp_cnt) - spinfo->sharp_cnt--; - -#ifdef CONFIG_MAC80211_DEBUGFS - rate_control_pid_event_pf_sample(&spinfo->events, pf, err_prop, err_int, - err_der); -#endif - - /* Compute the controller output. */ - adj = (err_prop * pinfo->coeff_p + err_int * pinfo->coeff_i - + err_der * pinfo->coeff_d); - adj = RC_PID_DO_ARITH_RIGHT_SHIFT(adj, 2 * RC_PID_ARITH_SHIFT); - - /* Change rate. */ - if (adj) - rate_control_pid_adjust_rate(sband, sta, spinfo, adj, rinfo); -} - -static void rate_control_pid_tx_status(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta, - struct sk_buff *skb) -{ - struct rc_pid_info *pinfo = priv; - struct rc_pid_sta_info *spinfo = priv_sta; - unsigned long period; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - if (!spinfo) - return; - - /* Ignore all frames that were sent with a different rate than the rate - * we currently advise mac80211 to use. */ - if (info->status.rates[0].idx != spinfo->txrate_idx) - return; - - spinfo->tx_num_xmit++; - -#ifdef CONFIG_MAC80211_DEBUGFS - rate_control_pid_event_tx_status(&spinfo->events, info); -#endif - - /* We count frames that totally failed to be transmitted as two bad - * frames, those that made it out but had some retries as one good and - * one bad frame. */ - if (!(info->flags & IEEE80211_TX_STAT_ACK)) { - spinfo->tx_num_failed += 2; - spinfo->tx_num_xmit++; - } else if (info->status.rates[0].count > 1) { - spinfo->tx_num_failed++; - spinfo->tx_num_xmit++; - } - - /* Update PID controller state. */ - period = msecs_to_jiffies(pinfo->sampling_period); - if (time_after(jiffies, spinfo->last_sample + period)) - rate_control_pid_sample(pinfo, sband, sta, spinfo); -} - -static void -rate_control_pid_get_rate(void *priv, struct ieee80211_sta *sta, - void *priv_sta, - struct ieee80211_tx_rate_control *txrc) -{ - struct sk_buff *skb = txrc->skb; - struct ieee80211_supported_band *sband = txrc->sband; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct rc_pid_sta_info *spinfo = priv_sta; - int rateidx; - - if (txrc->rts) - info->control.rates[0].count = - txrc->hw->conf.long_frame_max_tx_count; - else - info->control.rates[0].count = - txrc->hw->conf.short_frame_max_tx_count; - - /* Send management frames and NO_ACK data using lowest rate. */ - if (rate_control_send_low(sta, priv_sta, txrc)) - return; - - rateidx = spinfo->txrate_idx; - - if (rateidx >= sband->n_bitrates) - rateidx = sband->n_bitrates - 1; - - info->control.rates[0].idx = rateidx; - -#ifdef CONFIG_MAC80211_DEBUGFS - rate_control_pid_event_tx_rate(&spinfo->events, - rateidx, sband->bitrates[rateidx].bitrate); -#endif -} - -static void -rate_control_pid_rate_init(void *priv, struct ieee80211_supported_band *sband, - struct ieee80211_sta *sta, void *priv_sta) -{ - struct rc_pid_sta_info *spinfo = priv_sta; - struct rc_pid_info *pinfo = priv; - struct rc_pid_rateinfo *rinfo = pinfo->rinfo; - int i, j, tmp; - bool s; - - /* TODO: This routine should consider using RSSI from previous packets - * as we need to have IEEE 802.1X auth succeed immediately after assoc.. - * Until that method is implemented, we will use the lowest supported - * rate as a workaround. */ - - /* Sort the rates. This is optimized for the most common case (i.e. - * almost-sorted CCK+OFDM rates). Kind of bubble-sort with reversed - * mapping too. */ - for (i = 0; i < sband->n_bitrates; i++) { - rinfo[i].index = i; - rinfo[i].rev_index = i; - if (RC_PID_FAST_START) - rinfo[i].diff = 0; - else - rinfo[i].diff = i * pinfo->norm_offset; - } - for (i = 1; i < sband->n_bitrates; i++) { - s = false; - for (j = 0; j < sband->n_bitrates - i; j++) - if (unlikely(sband->bitrates[rinfo[j].index].bitrate > - sband->bitrates[rinfo[j + 1].index].bitrate)) { - tmp = rinfo[j].index; - rinfo[j].index = rinfo[j + 1].index; - rinfo[j + 1].index = tmp; - rinfo[rinfo[j].index].rev_index = j; - rinfo[rinfo[j + 1].index].rev_index = j + 1; - s = true; - } - if (!s) - break; - } - - spinfo->txrate_idx = rate_lowest_index(sband, sta); -} - -static void *rate_control_pid_alloc(struct ieee80211_hw *hw, - struct dentry *debugfsdir) -{ - struct rc_pid_info *pinfo; - struct rc_pid_rateinfo *rinfo; - struct ieee80211_supported_band *sband; - int i, max_rates = 0; -#ifdef CONFIG_MAC80211_DEBUGFS - struct rc_pid_debugfs_entries *de; -#endif - - pinfo = kmalloc(sizeof(*pinfo), GFP_ATOMIC); - if (!pinfo) - return NULL; - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) { - sband = hw->wiphy->bands[i]; - if (sband && sband->n_bitrates > max_rates) - max_rates = sband->n_bitrates; - } - - rinfo = kmalloc(sizeof(*rinfo) * max_rates, GFP_ATOMIC); - if (!rinfo) { - kfree(pinfo); - return NULL; - } - - pinfo->target = RC_PID_TARGET_PF; - pinfo->sampling_period = RC_PID_INTERVAL; - pinfo->coeff_p = RC_PID_COEFF_P; - pinfo->coeff_i = RC_PID_COEFF_I; - pinfo->coeff_d = RC_PID_COEFF_D; - pinfo->smoothing_shift = RC_PID_SMOOTHING_SHIFT; - pinfo->sharpen_factor = RC_PID_SHARPENING_FACTOR; - pinfo->sharpen_duration = RC_PID_SHARPENING_DURATION; - pinfo->norm_offset = RC_PID_NORM_OFFSET; - pinfo->rinfo = rinfo; - pinfo->oldrate = 0; - -#ifdef CONFIG_MAC80211_DEBUGFS - de = &pinfo->dentries; - de->target = debugfs_create_u32("target_pf", S_IRUSR | S_IWUSR, - debugfsdir, &pinfo->target); - de->sampling_period = debugfs_create_u32("sampling_period", - S_IRUSR | S_IWUSR, debugfsdir, - &pinfo->sampling_period); - de->coeff_p = debugfs_create_u32("coeff_p", S_IRUSR | S_IWUSR, - debugfsdir, (u32 *)&pinfo->coeff_p); - de->coeff_i = debugfs_create_u32("coeff_i", S_IRUSR | S_IWUSR, - debugfsdir, (u32 *)&pinfo->coeff_i); - de->coeff_d = debugfs_create_u32("coeff_d", S_IRUSR | S_IWUSR, - debugfsdir, (u32 *)&pinfo->coeff_d); - de->smoothing_shift = debugfs_create_u32("smoothing_shift", - S_IRUSR | S_IWUSR, debugfsdir, - &pinfo->smoothing_shift); - de->sharpen_factor = debugfs_create_u32("sharpen_factor", - S_IRUSR | S_IWUSR, debugfsdir, - &pinfo->sharpen_factor); - de->sharpen_duration = debugfs_create_u32("sharpen_duration", - S_IRUSR | S_IWUSR, debugfsdir, - &pinfo->sharpen_duration); - de->norm_offset = debugfs_create_u32("norm_offset", - S_IRUSR | S_IWUSR, debugfsdir, - &pinfo->norm_offset); -#endif - - return pinfo; -} - -static void rate_control_pid_free(void *priv) -{ - struct rc_pid_info *pinfo = priv; -#ifdef CONFIG_MAC80211_DEBUGFS - struct rc_pid_debugfs_entries *de = &pinfo->dentries; - - debugfs_remove(de->norm_offset); - debugfs_remove(de->sharpen_duration); - debugfs_remove(de->sharpen_factor); - debugfs_remove(de->smoothing_shift); - debugfs_remove(de->coeff_d); - debugfs_remove(de->coeff_i); - debugfs_remove(de->coeff_p); - debugfs_remove(de->sampling_period); - debugfs_remove(de->target); -#endif - - kfree(pinfo->rinfo); - kfree(pinfo); -} - -static void *rate_control_pid_alloc_sta(void *priv, struct ieee80211_sta *sta, - gfp_t gfp) -{ - struct rc_pid_sta_info *spinfo; - - spinfo = kzalloc(sizeof(*spinfo), gfp); - if (spinfo == NULL) - return NULL; - - spinfo->last_sample = jiffies; - -#ifdef CONFIG_MAC80211_DEBUGFS - spin_lock_init(&spinfo->events.lock); - init_waitqueue_head(&spinfo->events.waitqueue); -#endif - - return spinfo; -} - -static void rate_control_pid_free_sta(void *priv, struct ieee80211_sta *sta, - void *priv_sta) -{ - kfree(priv_sta); -} - -static struct rate_control_ops mac80211_rcpid = { - .name = "pid", - .tx_status = rate_control_pid_tx_status, - .get_rate = rate_control_pid_get_rate, - .rate_init = rate_control_pid_rate_init, - .alloc = rate_control_pid_alloc, - .free = rate_control_pid_free, - .alloc_sta = rate_control_pid_alloc_sta, - .free_sta = rate_control_pid_free_sta, -#ifdef CONFIG_MAC80211_DEBUGFS - .add_sta_debugfs = rate_control_pid_add_sta_debugfs, - .remove_sta_debugfs = rate_control_pid_remove_sta_debugfs, -#endif -}; - -int __init rc80211_pid_init(void) -{ - return ieee80211_rate_control_register(&mac80211_rcpid); -} - -void rc80211_pid_exit(void) -{ - ieee80211_rate_control_unregister(&mac80211_rcpid); -} diff --git a/openairITS/mac/DOT11/net/mac80211/rc80211_pid_debugfs.c b/openairITS/mac/DOT11/net/mac80211/rc80211_pid_debugfs.c deleted file mode 100644 index c97a0657c04..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rc80211_pid_debugfs.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Copyright 2007, Mattias Nissler <mattias.nissler@gmx.de> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/sched.h> -#include <linux/spinlock.h> -#include <linux/poll.h> -#include <linux/netdevice.h> -#include <linux/types.h> -#include <linux/skbuff.h> -#include <linux/slab.h> -#include <linux/export.h> - -#include <net/mac80211.h> -#include "rate.h" - -#include "rc80211_pid.h" - -static void rate_control_pid_event(struct rc_pid_event_buffer *buf, - enum rc_pid_event_type type, - union rc_pid_event_data *data) -{ - struct rc_pid_event *ev; - unsigned long status; - - spin_lock_irqsave(&buf->lock, status); - ev = &(buf->ring[buf->next_entry]); - buf->next_entry = (buf->next_entry + 1) % RC_PID_EVENT_RING_SIZE; - - ev->timestamp = jiffies; - ev->id = buf->ev_count++; - ev->type = type; - ev->data = *data; - - spin_unlock_irqrestore(&buf->lock, status); - - wake_up_all(&buf->waitqueue); -} - -void rate_control_pid_event_tx_status(struct rc_pid_event_buffer *buf, - struct ieee80211_tx_info *stat) -{ - union rc_pid_event_data evd; - - evd.flags = stat->flags; - memcpy(&evd.tx_status, stat, sizeof(struct ieee80211_tx_info)); - rate_control_pid_event(buf, RC_PID_EVENT_TYPE_TX_STATUS, &evd); -} - -void rate_control_pid_event_rate_change(struct rc_pid_event_buffer *buf, - int index, int rate) -{ - union rc_pid_event_data evd; - - evd.index = index; - evd.rate = rate; - rate_control_pid_event(buf, RC_PID_EVENT_TYPE_RATE_CHANGE, &evd); -} - -void rate_control_pid_event_tx_rate(struct rc_pid_event_buffer *buf, - int index, int rate) -{ - union rc_pid_event_data evd; - - evd.index = index; - evd.rate = rate; - rate_control_pid_event(buf, RC_PID_EVENT_TYPE_TX_RATE, &evd); -} - -void rate_control_pid_event_pf_sample(struct rc_pid_event_buffer *buf, - s32 pf_sample, s32 prop_err, - s32 int_err, s32 der_err) -{ - union rc_pid_event_data evd; - - evd.pf_sample = pf_sample; - evd.prop_err = prop_err; - evd.int_err = int_err; - evd.der_err = der_err; - rate_control_pid_event(buf, RC_PID_EVENT_TYPE_PF_SAMPLE, &evd); -} - -static int rate_control_pid_events_open(struct inode *inode, struct file *file) -{ - struct rc_pid_sta_info *sinfo = inode->i_private; - struct rc_pid_event_buffer *events = &sinfo->events; - struct rc_pid_events_file_info *file_info; - unsigned long status; - - /* Allocate a state struct */ - file_info = kmalloc(sizeof(*file_info), GFP_KERNEL); - if (file_info == NULL) - return -ENOMEM; - - spin_lock_irqsave(&events->lock, status); - - file_info->next_entry = events->next_entry; - file_info->events = events; - - spin_unlock_irqrestore(&events->lock, status); - - file->private_data = file_info; - - return 0; -} - -static int rate_control_pid_events_release(struct inode *inode, - struct file *file) -{ - struct rc_pid_events_file_info *file_info = file->private_data; - - kfree(file_info); - - return 0; -} - -static unsigned int rate_control_pid_events_poll(struct file *file, - poll_table *wait) -{ - struct rc_pid_events_file_info *file_info = file->private_data; - - poll_wait(file, &file_info->events->waitqueue, wait); - - return POLLIN | POLLRDNORM; -} - -#define RC_PID_PRINT_BUF_SIZE 64 - -static ssize_t rate_control_pid_events_read(struct file *file, char __user *buf, - size_t length, loff_t *offset) -{ - struct rc_pid_events_file_info *file_info = file->private_data; - struct rc_pid_event_buffer *events = file_info->events; - struct rc_pid_event *ev; - char pb[RC_PID_PRINT_BUF_SIZE]; - int ret; - int p; - unsigned long status; - - /* Check if there is something to read. */ - if (events->next_entry == file_info->next_entry) { - if (file->f_flags & O_NONBLOCK) - return -EAGAIN; - - /* Wait */ - ret = wait_event_interruptible(events->waitqueue, - events->next_entry != file_info->next_entry); - - if (ret) - return ret; - } - - /* Write out one event per call. I don't care whether it's a little - * inefficient, this is debugging code anyway. */ - spin_lock_irqsave(&events->lock, status); - - /* Get an event */ - ev = &(events->ring[file_info->next_entry]); - file_info->next_entry = (file_info->next_entry + 1) % - RC_PID_EVENT_RING_SIZE; - - /* Print information about the event. Note that userspace needs to - * provide large enough buffers. */ - length = length < RC_PID_PRINT_BUF_SIZE ? - length : RC_PID_PRINT_BUF_SIZE; - p = snprintf(pb, length, "%u %lu ", ev->id, ev->timestamp); - switch (ev->type) { - case RC_PID_EVENT_TYPE_TX_STATUS: - p += snprintf(pb + p, length - p, "tx_status %u %u", - !(ev->data.flags & IEEE80211_TX_STAT_ACK), - ev->data.tx_status.status.rates[0].idx); - break; - case RC_PID_EVENT_TYPE_RATE_CHANGE: - p += snprintf(pb + p, length - p, "rate_change %d %d", - ev->data.index, ev->data.rate); - break; - case RC_PID_EVENT_TYPE_TX_RATE: - p += snprintf(pb + p, length - p, "tx_rate %d %d", - ev->data.index, ev->data.rate); - break; - case RC_PID_EVENT_TYPE_PF_SAMPLE: - p += snprintf(pb + p, length - p, - "pf_sample %d %d %d %d", - ev->data.pf_sample, ev->data.prop_err, - ev->data.int_err, ev->data.der_err); - break; - } - p += snprintf(pb + p, length - p, "\n"); - - spin_unlock_irqrestore(&events->lock, status); - - if (copy_to_user(buf, pb, p)) - return -EFAULT; - - return p; -} - -#undef RC_PID_PRINT_BUF_SIZE - -static const struct file_operations rc_pid_fop_events = { - .owner = THIS_MODULE, - .read = rate_control_pid_events_read, - .poll = rate_control_pid_events_poll, - .open = rate_control_pid_events_open, - .release = rate_control_pid_events_release, - .llseek = noop_llseek, -}; - -void rate_control_pid_add_sta_debugfs(void *priv, void *priv_sta, - struct dentry *dir) -{ - struct rc_pid_sta_info *spinfo = priv_sta; - - spinfo->events_entry = debugfs_create_file("rc_pid_events", S_IRUGO, - dir, spinfo, - &rc_pid_fop_events); -} - -void rate_control_pid_remove_sta_debugfs(void *priv, void *priv_sta) -{ - struct rc_pid_sta_info *spinfo = priv_sta; - - debugfs_remove(spinfo->events_entry); -} diff --git a/openairITS/mac/DOT11/net/mac80211/rx.c b/openairITS/mac/DOT11/net/mac80211/rx.c deleted file mode 100644 index 6d5c3d5c20b..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/rx.c +++ /dev/null @@ -1,3320 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/jiffies.h> -#include <linux/slab.h> -#include <linux/kernel.h> -#include <linux/skbuff.h> -#include <linux/netdevice.h> -#include <linux/etherdevice.h> -#include <linux/rcupdate.h> -#include <linux/export.h> -#include <net/mac80211.h> -#include <net/ieee80211_radiotap.h> -#include <asm/unaligned.h> - -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "led.h" -#include "mesh.h" -#include "wep.h" -#include "wpa.h" -#include "tkip.h" -#include "wme.h" -#include "rate.h" - -/* - * monitor mode reception - * - * This function cleans up the SKB, i.e. it removes all the stuff - * only useful for monitoring. - */ -static struct sk_buff *remove_monitor_info(struct ieee80211_local *local, - struct sk_buff *skb) -{ - if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) { - if (likely(skb->len > FCS_LEN)) - __pskb_trim(skb, skb->len - FCS_LEN); - else { - /* driver bug */ - WARN_ON(1); - dev_kfree_skb(skb); - skb = NULL; - } - } - - return skb; -} - -static inline int should_drop_frame(struct sk_buff *skb, - int present_fcs_len) -{ - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - - if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) - return 1; - if (unlikely(skb->len < 16 + present_fcs_len)) - return 1; - if (ieee80211_is_ctl(hdr->frame_control) && - !ieee80211_is_pspoll(hdr->frame_control) && - !ieee80211_is_back_req(hdr->frame_control)) - return 1; - return 0; -} - -static int -ieee80211_rx_radiotap_len(struct ieee80211_local *local, - struct ieee80211_rx_status *status) -{ - int len; - - /* always present fields */ - len = sizeof(struct ieee80211_radiotap_header) + 9; - - if (status->flag & RX_FLAG_MACTIME_MPDU) - len += 8; - if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) - len += 1; - - if (len & 1) /* padding for RX_FLAGS if necessary */ - len++; - - if (status->flag & RX_FLAG_HT) /* HT info */ - len += 3; - - return len; -} - -/* - * ieee80211_add_rx_radiotap_header - add radiotap header - * - * add a radiotap header containing all the fields which the hardware provided. - * - * [PLATA] - check the harmonization with the PHY header from the driver... - */ -static void -ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, - struct sk_buff *skb, - struct ieee80211_rate *rate, - int rtap_len) -{ - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_radiotap_header *rthdr; - unsigned char *pos; - u16 rx_flags = 0; - - rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len); - memset(rthdr, 0, rtap_len); - - /* radiotap header, set always present flags */ - rthdr->it_present = - cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) | - (1 << IEEE80211_RADIOTAP_CHANNEL) | - (1 << IEEE80211_RADIOTAP_ANTENNA) | - (1 << IEEE80211_RADIOTAP_RX_FLAGS)); - rthdr->it_len = cpu_to_le16(rtap_len); - - pos = (unsigned char *)(rthdr+1); - - /* the order of the following fields is important */ - - /* IEEE80211_RADIOTAP_TSFT */ - if (status->flag & RX_FLAG_MACTIME_MPDU) { - put_unaligned_le64(status->mactime, pos); - rthdr->it_present |= - cpu_to_le32(1 << IEEE80211_RADIOTAP_TSFT); - pos += 8; - } - - /* IEEE80211_RADIOTAP_FLAGS */ - if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) - *pos |= IEEE80211_RADIOTAP_F_FCS; - if (status->flag & (RX_FLAG_FAILED_FCS_CRC | RX_FLAG_FAILED_PLCP_CRC)) - *pos |= IEEE80211_RADIOTAP_F_BADFCS; - if (status->flag & RX_FLAG_SHORTPRE) - *pos |= IEEE80211_RADIOTAP_F_SHORTPRE; - pos++; - - /* IEEE80211_RADIOTAP_RATE */ - if (!rate || status->flag & RX_FLAG_HT) { - /* - * Without rate information don't add it. If we have, - * MCS information is a separate field in radiotap, - * added below. The byte here is needed as padding - * for the channel though, so initialise it to 0. - */ - *pos = 0; - } else { - rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_RATE); - *pos = rate->bitrate / 5; - } - pos++; - - /* IEEE80211_RADIOTAP_CHANNEL */ - put_unaligned_le16(status->freq, pos); - pos += 2; - if (status->band == IEEE80211_BAND_5GHZ) - put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ, - pos); - else if (status->band == IEEE80211_BAND_5_9GHZ) // [PLATA] - the PHY header mentions OFDM for the 802.11p PHY mode - put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5_9GHZ, - pos); - else if (status->band == IEEE80211_BAND_0_8GHZ) // [PLATA] - the PHY header mentions OFDM for the 802.11p PHY mode - put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_0_8GHZ, - pos); - else if (status->flag & RX_FLAG_HT) - put_unaligned_le16(IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ, - pos); - else if (rate && rate->flags & IEEE80211_RATE_ERP_G) - put_unaligned_le16(IEEE80211_CHAN_OFDM | IEEE80211_CHAN_2GHZ, - pos); - else if (rate) - put_unaligned_le16(IEEE80211_CHAN_CCK | IEEE80211_CHAN_2GHZ, - pos); - else - put_unaligned_le16(IEEE80211_CHAN_2GHZ, pos); - pos += 2; - - /* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */ - if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM && - !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { - *pos = status->signal; - rthdr->it_present |= - cpu_to_le32(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL); - pos++; - } - - /* IEEE80211_RADIOTAP_LOCK_QUALITY is missing */ - - /* IEEE80211_RADIOTAP_ANTENNA */ - *pos = status->antenna; - pos++; - - /* IEEE80211_RADIOTAP_DB_ANTNOISE is not used */ - - /* IEEE80211_RADIOTAP_RX_FLAGS */ - /* ensure 2 byte alignment for the 2 byte field as required */ - if ((pos - (u8 *)rthdr) & 1) - pos++; - if (status->flag & RX_FLAG_FAILED_PLCP_CRC) - rx_flags |= IEEE80211_RADIOTAP_F_RX_BADPLCP; - put_unaligned_le16(rx_flags, pos); - pos += 2; - - if (status->flag & RX_FLAG_HT) { - rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS); - *pos++ = IEEE80211_RADIOTAP_MCS_HAVE_MCS | - IEEE80211_RADIOTAP_MCS_HAVE_GI | - IEEE80211_RADIOTAP_MCS_HAVE_BW; - *pos = 0; - if (status->flag & RX_FLAG_SHORT_GI) - *pos |= IEEE80211_RADIOTAP_MCS_SGI; - if (status->flag & RX_FLAG_40MHZ) - *pos |= IEEE80211_RADIOTAP_MCS_BW_40; - pos++; - *pos++ = status->rate_idx; - } -} - -/* - * This function copies a received frame to all monitor interfaces and - * returns a cleaned-up SKB that no longer includes the FCS nor the - * radiotap header the driver might have added. - */ -static struct sk_buff * -ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, - struct ieee80211_rate *rate) -{ - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(origskb); - struct ieee80211_sub_if_data *sdata; - int needed_headroom; - struct sk_buff *skb, *skb2; - struct net_device *prev_dev = NULL; - int present_fcs_len = 0; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- ieee80211_rx_monitor \n"); -#endif - - /* - * First, we may need to make a copy of the skb because - * (1) we need to modify it for radiotap (if not present), and - * (2) the other RX handlers will modify the skb we got. - * - * We don't need to, of course, if we aren't going to return - * the SKB because it has a bad FCS/PLCP checksum. - */ - - /* room for the radiotap header based on driver features */ - needed_headroom = ieee80211_rx_radiotap_len(local, status); - - if (local->hw.flags & IEEE80211_HW_RX_INCLUDES_FCS) - present_fcs_len = FCS_LEN; - - /* make sure hdr->frame_control is on the linear part */ - if (!pskb_may_pull(origskb, 2)) { - dev_kfree_skb(origskb); - return NULL; - } - - /* - * [PLATA] - When OCBMode is activated, we do not monitor, so we should not enter here...(the SKB should NOT have monitoring info) - */ - if ((!local->monitors) || ((local->hw.wiphy->dot11OCBActivated == 1) && (local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED))) { - if (should_drop_frame(origskb, present_fcs_len)) { - dev_kfree_skb(origskb); - return NULL; - } - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- OCBActivated and Monitoring mode not supported - exiting here \n"); -#endif - return remove_monitor_info(local, origskb); - } - - if (should_drop_frame(origskb, present_fcs_len)) { - /* only need to expand headroom if necessary */ - skb = origskb; - origskb = NULL; - - /* - * This shouldn't trigger often because most devices have an - * RX header they pull before we get here, and that should - * be big enough for our radiotap information. We should - * probably export the length to drivers so that we can have - * them allocate enough headroom to start with. - */ - if (skb_headroom(skb) < needed_headroom && - pskb_expand_head(skb, needed_headroom, 0, GFP_ATOMIC)) { - dev_kfree_skb(skb); - return NULL; - } - } else { - /* - * Need to make a copy and possibly remove radiotap header - * and FCS from the original. - */ - skb = skb_copy_expand(origskb, needed_headroom, 0, GFP_ATOMIC); - - origskb = remove_monitor_info(local, origskb); - - if (!skb) - return origskb; - } - - /* prepend radiotap information */ - /* - * [PLATA] method is entered and used to build the PHY header - need to harmonize with the driver - */ - ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom); - - skb_reset_mac_header(skb); - skb->ip_summed = CHECKSUM_UNNECESSARY; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = htons(ETH_P_802_2); - - /* - * [PLATA] - check what it does... - */ - list_for_each_entry_rcu(sdata, &local->interfaces, list) { - if (sdata->vif.type != NL80211_IFTYPE_MONITOR) - continue; - - if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) - continue; - - if (!ieee80211_sdata_running(sdata)) - continue; - - if (prev_dev) { - skb2 = skb_clone(skb, GFP_ATOMIC); - if (skb2) { - skb2->dev = prev_dev; - netif_receive_skb(skb2); - } - } - - prev_dev = sdata->dev; - sdata->dev->stats.rx_packets++; - sdata->dev->stats.rx_bytes += skb->len; - } - - if (prev_dev) { - skb->dev = prev_dev; - netif_receive_skb(skb); - } else - dev_kfree_skb(skb); - - return origskb; -} - - -static void ieee80211_parse_qos(struct ieee80211_rx_data *rx) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - int tid, seqno_idx, security_idx; - - /* does the frame have a qos control field? */ - if (ieee80211_is_data_qos(hdr->frame_control)) { - u8 *qc = ieee80211_get_qos_ctl(hdr); - /* frame has qos control */ - tid = *qc & IEEE80211_QOS_CTL_TID_MASK; - if (*qc & IEEE80211_QOS_CTL_A_MSDU_PRESENT) - status->rx_flags |= IEEE80211_RX_AMSDU; - - seqno_idx = tid; - security_idx = tid; - } else { - /* - * IEEE 802.11-2007, 7.1.3.4.1 ("Sequence Number field"): - * - * Sequence numbers for management frames, QoS data - * frames with a broadcast/multicast address in the - * Address 1 field, and all non-QoS data frames sent - * by QoS STAs are assigned using an additional single - * modulo-4096 counter, [...] - * - * We also use that counter for non-QoS STAs. - */ - /* - * [PLATA] - NUM_RX_DATA_QUEUES is 1 for this version of PLATA. Must be harmonized with the driver. - */ - seqno_idx = NUM_RX_DATA_QUEUES; - security_idx = 0; - if (ieee80211_is_mgmt(hdr->frame_control)) - security_idx = NUM_RX_DATA_QUEUES; - tid = 0; - } - - rx->seqno_idx = seqno_idx; - rx->security_idx = security_idx; - /* Set skb->priority to 1d tag if highest order bit of TID is not set. - * For now, set skb->priority to 0 for other cases. */ - rx->skb->priority = (tid > 7) ? 0 : tid; -} - -/** - * DOC: Packet alignment - * - * Drivers always need to pass packets that are aligned to two-byte boundaries - * to the stack. - * - * Additionally, should, if possible, align the payload data in a way that - * guarantees that the contained IP header is aligned to a four-byte - * boundary. In the case of regular frames, this simply means aligning the - * payload to a four-byte boundary (because either the IP header is directly - * contained, or IV/RFC1042 headers that have a length divisible by four are - * in front of it). If the payload data is not properly aligned and the - * architecture doesn't support efficient unaligned operations, mac80211 - * will align the data. - * - * With A-MSDU frames, however, the payload data address must yield two modulo - * four because there are 14-byte 802.3 headers within the A-MSDU frames that - * push the IP header further back to a multiple of four again. Thankfully, the - * specs were sane enough this time around to require padding each A-MSDU - * subframe to a length that is a multiple of four. - * - * Padding like Atheros hardware adds which is between the 802.11 header and - * the payload is not supported, the driver is required to move the 802.11 - * header to be directly in front of the payload in that case. - */ -static void ieee80211_verify_alignment(struct ieee80211_rx_data *rx) -{ -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - WARN_ONCE((unsigned long)rx->skb->data & 1, - "unaligned packet at 0x%p\n", rx->skb->data); -#endif -} - - -/* rx handlers */ - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx) -{ - struct ieee80211_local *local = rx->local; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - struct sk_buff *skb = rx->skb; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ieee80211_rx_h_passive_scan \n"); -#endif - /* - * [PLATA] - we exit immediately if OCB is activated - */ - if ((likely(!(status->rx_flags & IEEE80211_RX_IN_SCAN) && - !local->sched_scanning)) || ((rx->local->hw.wiphy->dot11OCBActivated == 1) && (rx->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED))) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ieee80211_rx_h_passive_scan OCB Activated...exiting immediately\n"); -#endif - return RX_CONTINUE; - } - - if (test_bit(SCAN_HW_SCANNING, &local->scanning) || - test_bit(SCAN_SW_SCANNING, &local->scanning) || - local->sched_scanning) - return ieee80211_scan_rx(rx->sdata, skb); - - /* scanning finished during invoking of handlers */ - I802_DEBUG_INC(local->rx_handlers_drop_passive_scan); - return RX_DROP_UNUSABLE; -} - - -static int ieee80211_is_unicast_robust_mgmt_frame(struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - - if (skb->len < 24 || is_multicast_ether_addr(hdr->addr1)) - return 0; - - return ieee80211_is_robust_mgmt_frame(hdr); -} - - -static int ieee80211_is_multicast_robust_mgmt_frame(struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - - if (skb->len < 24 || !is_multicast_ether_addr(hdr->addr1)) - return 0; - - return ieee80211_is_robust_mgmt_frame(hdr); -} - - -/* Get the BIP key index from MMIE; return -1 if this is not a BIP frame */ -static int ieee80211_get_mmie_keyidx(struct sk_buff *skb) -{ - struct ieee80211_mgmt *hdr = (struct ieee80211_mgmt *) skb->data; - struct ieee80211_mmie *mmie; - - if (skb->len < 24 + sizeof(*mmie) || - !is_multicast_ether_addr(hdr->da)) - return -1; - - if (!ieee80211_is_robust_mgmt_frame((struct ieee80211_hdr *) hdr)) - return -1; /* not a robust management frame */ - - mmie = (struct ieee80211_mmie *) - (skb->data + skb->len - sizeof(*mmie)); - if (mmie->element_id != WLAN_EID_MMIE || - mmie->length != sizeof(*mmie) - 2) - return -1; - - return le16_to_cpu(mmie->key_id); -} - - -static ieee80211_rx_result -ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; - char *dev_addr = rx->sdata->vif.addr; - - if (ieee80211_is_data(hdr->frame_control)) { - if (is_multicast_ether_addr(hdr->addr1)) { - if (ieee80211_has_tods(hdr->frame_control) || - !ieee80211_has_fromds(hdr->frame_control)) - return RX_DROP_MONITOR; - if (compare_ether_addr(hdr->addr3, dev_addr) == 0) - return RX_DROP_MONITOR; - } else { - if (!ieee80211_has_a4(hdr->frame_control)) - return RX_DROP_MONITOR; - if (compare_ether_addr(hdr->addr4, dev_addr) == 0) - return RX_DROP_MONITOR; - } - } - - /* If there is not an established peer link and this is not a peer link - * establisment frame, beacon or probe, drop the frame. - */ - - if (!rx->sta || sta_plink_state(rx->sta) != NL80211_PLINK_ESTAB) { - struct ieee80211_mgmt *mgmt; - - if (!ieee80211_is_mgmt(hdr->frame_control)) - return RX_DROP_MONITOR; - - if (ieee80211_is_action(hdr->frame_control)) { - u8 category; - mgmt = (struct ieee80211_mgmt *)hdr; - category = mgmt->u.action.category; - if (category != WLAN_CATEGORY_MESH_ACTION && - category != WLAN_CATEGORY_SELF_PROTECTED) - return RX_DROP_MONITOR; - return RX_CONTINUE; - } - - if (ieee80211_is_probe_req(hdr->frame_control) || - ieee80211_is_probe_resp(hdr->frame_control) || - ieee80211_is_beacon(hdr->frame_control) || - ieee80211_is_auth(hdr->frame_control)) - return RX_CONTINUE; - - return RX_DROP_MONITOR; - - } - - return RX_CONTINUE; -} - -#define SEQ_MODULO 0x1000 -#define SEQ_MASK 0xfff - -static inline int seq_less(u16 sq1, u16 sq2) -{ - return ((sq1 - sq2) & SEQ_MASK) > (SEQ_MODULO >> 1); -} - -static inline u16 seq_inc(u16 sq) -{ - return (sq + 1) & SEQ_MASK; -} - -static inline u16 seq_sub(u16 sq1, u16 sq2) -{ - return (sq1 - sq2) & SEQ_MASK; -} - - -static void ieee80211_release_reorder_frame(struct ieee80211_hw *hw, - struct tid_ampdu_rx *tid_agg_rx, - int index) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct sk_buff *skb = tid_agg_rx->reorder_buf[index]; - struct ieee80211_rx_status *status; - - lockdep_assert_held(&tid_agg_rx->reorder_lock); - - if (!skb) - goto no_frame; - - /* release the frame from the reorder ring buffer */ - tid_agg_rx->stored_mpdu_num--; - tid_agg_rx->reorder_buf[index] = NULL; - status = IEEE80211_SKB_RXCB(skb); - status->rx_flags |= IEEE80211_RX_DEFERRED_RELEASE; - skb_queue_tail(&local->rx_skb_queue, skb); - -no_frame: - tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num); -} - -static void ieee80211_release_reorder_frames(struct ieee80211_hw *hw, - struct tid_ampdu_rx *tid_agg_rx, - u16 head_seq_num) -{ - int index; - - lockdep_assert_held(&tid_agg_rx->reorder_lock); - - while (seq_less(tid_agg_rx->head_seq_num, head_seq_num)) { - index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % - tid_agg_rx->buf_size; - ieee80211_release_reorder_frame(hw, tid_agg_rx, index); - } -} - -/* - * Timeout (in jiffies) for skb's that are waiting in the RX reorder buffer. If - * the skb was added to the buffer longer than this time ago, the earlier - * frames that have not yet been received are assumed to be lost and the skb - * can be released for processing. This may also release other skb's from the - * reorder buffer if there are no additional gaps between the frames. - * - * Callers must hold tid_agg_rx->reorder_lock. - */ -#define HT_RX_REORDER_BUF_TIMEOUT (HZ / 10) - -static void ieee80211_sta_reorder_release(struct ieee80211_hw *hw, - struct tid_ampdu_rx *tid_agg_rx) -{ - int index, j; - - lockdep_assert_held(&tid_agg_rx->reorder_lock); - - /* release the buffer until next missing frame */ - index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % - tid_agg_rx->buf_size; - if (!tid_agg_rx->reorder_buf[index] && - tid_agg_rx->stored_mpdu_num) { - /* - * No buffers ready to be released, but check whether any - * frames in the reorder buffer have timed out. - */ - int skipped = 1; - for (j = (index + 1) % tid_agg_rx->buf_size; j != index; - j = (j + 1) % tid_agg_rx->buf_size) { - if (!tid_agg_rx->reorder_buf[j]) { - skipped++; - continue; - } - if (skipped && - !time_after(jiffies, tid_agg_rx->reorder_time[j] + - HT_RX_REORDER_BUF_TIMEOUT)) - goto set_release_timer; - -#ifdef CONFIG_MAC80211_HT_DEBUG - if (net_ratelimit()) - wiphy_debug(hw->wiphy, - "release an RX reorder frame due to timeout on earlier frames\n"); -#endif - ieee80211_release_reorder_frame(hw, tid_agg_rx, j); - - /* - * Increment the head seq# also for the skipped slots. - */ - tid_agg_rx->head_seq_num = - (tid_agg_rx->head_seq_num + skipped) & SEQ_MASK; - skipped = 0; - } - } else while (tid_agg_rx->reorder_buf[index]) { - ieee80211_release_reorder_frame(hw, tid_agg_rx, index); - index = seq_sub(tid_agg_rx->head_seq_num, tid_agg_rx->ssn) % - tid_agg_rx->buf_size; - } - - if (tid_agg_rx->stored_mpdu_num) { - j = index = seq_sub(tid_agg_rx->head_seq_num, - tid_agg_rx->ssn) % tid_agg_rx->buf_size; - - for (; j != (index - 1) % tid_agg_rx->buf_size; - j = (j + 1) % tid_agg_rx->buf_size) { - if (tid_agg_rx->reorder_buf[j]) - break; - } - - set_release_timer: - - mod_timer(&tid_agg_rx->reorder_timer, - tid_agg_rx->reorder_time[j] + 1 + - HT_RX_REORDER_BUF_TIMEOUT); - } else { - del_timer(&tid_agg_rx->reorder_timer); - } -} - -/* - * As this function belongs to the RX path it must be under - * rcu_read_lock protection. It returns false if the frame - * can be processed immediately, true if it was consumed. - */ -static bool ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw, - struct tid_ampdu_rx *tid_agg_rx, - struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - u16 sc = le16_to_cpu(hdr->seq_ctrl); - u16 mpdu_seq_num = (sc & IEEE80211_SCTL_SEQ) >> 4; - u16 head_seq_num, buf_size; - int index; - bool ret = true; - - spin_lock(&tid_agg_rx->reorder_lock); - - buf_size = tid_agg_rx->buf_size; - head_seq_num = tid_agg_rx->head_seq_num; - - /* frame with out of date sequence number */ - if (seq_less(mpdu_seq_num, head_seq_num)) { - dev_kfree_skb(skb); - goto out; - } - - /* - * If frame the sequence number exceeds our buffering window - * size release some previous frames to make room for this one. - */ - if (!seq_less(mpdu_seq_num, head_seq_num + buf_size)) { - head_seq_num = seq_inc(seq_sub(mpdu_seq_num, buf_size)); - /* release stored frames up to new head to stack */ - ieee80211_release_reorder_frames(hw, tid_agg_rx, head_seq_num); - } - - /* Now the new frame is always in the range of the reordering buffer */ - - index = seq_sub(mpdu_seq_num, tid_agg_rx->ssn) % tid_agg_rx->buf_size; - - /* check if we already stored this frame */ - if (tid_agg_rx->reorder_buf[index]) { - dev_kfree_skb(skb); - goto out; - } - - /* - * If the current MPDU is in the right order and nothing else - * is stored we can process it directly, no need to buffer it. - * If it is first but there's something stored, we may be able - * to release frames after this one. - */ - if (mpdu_seq_num == tid_agg_rx->head_seq_num && - tid_agg_rx->stored_mpdu_num == 0) { - tid_agg_rx->head_seq_num = seq_inc(tid_agg_rx->head_seq_num); - ret = false; - goto out; - } - - /* put the frame in the reordering buffer */ - tid_agg_rx->reorder_buf[index] = skb; - tid_agg_rx->reorder_time[index] = jiffies; - tid_agg_rx->stored_mpdu_num++; - ieee80211_sta_reorder_release(hw, tid_agg_rx); - - out: - spin_unlock(&tid_agg_rx->reorder_lock); - return ret; -} - -/* - * Reorder MPDUs from A-MPDUs, keeping them on a buffer. Returns - * true if the MPDU was buffered, false if it should be processed. - */ -static void ieee80211_rx_reorder_ampdu(struct ieee80211_rx_data *rx) -{ - struct sk_buff *skb = rx->skb; - struct ieee80211_local *local = rx->local; - struct ieee80211_hw *hw = &local->hw; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct sta_info *sta = rx->sta; - struct tid_ampdu_rx *tid_agg_rx; - u16 sc; - u8 tid, ack_policy; - - if (!ieee80211_is_data_qos(hdr->frame_control)) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ieee80211_rx_reorder_ampdu - OCBActivated -- exit immediately\n"); -#endif - goto dont_reorder; - } - /* - * filter the QoS data rx stream according to - * STA/TID and check if this STA/TID is on aggregation - */ - - if (!sta) - goto dont_reorder; - - ack_policy = *ieee80211_get_qos_ctl(hdr) & - IEEE80211_QOS_CTL_ACK_POLICY_MASK; - tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; - - tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); - if (!tid_agg_rx) - goto dont_reorder; - - /* qos null data frames are excluded */ - if (unlikely(hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_NULLFUNC))) - goto dont_reorder; - - /* not part of a BA session */ - if (ack_policy != IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK && - ack_policy != IEEE80211_QOS_CTL_ACK_POLICY_NORMAL) - goto dont_reorder; - - /* not actually part of this BA session */ - if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) - goto dont_reorder; - - /* new, potentially un-ordered, ampdu frame - process it */ - - /* reset session timer */ - if (tid_agg_rx->timeout) - mod_timer(&tid_agg_rx->session_timer, - TU_TO_EXP_TIME(tid_agg_rx->timeout)); - - /* if this mpdu is fragmented - terminate rx aggregation session */ - sc = le16_to_cpu(hdr->seq_ctrl); - if (sc & IEEE80211_SCTL_FRAG) { - skb->pkt_type = IEEE80211_SDATA_QUEUE_TYPE_FRAME; - skb_queue_tail(&rx->sdata->skb_queue, skb); - ieee80211_queue_work(&local->hw, &rx->sdata->work); - return; - } - - /* - * No locking needed -- we will only ever process one - * RX packet at a time, and thus own tid_agg_rx. All - * other code manipulating it needs to (and does) make - * sure that we cannot get to it any more before doing - * anything with it. - */ - if (ieee80211_sta_manage_reorder_buf(hw, tid_agg_rx, skb)) - return; - - dont_reorder: - skb_queue_tail(&local->rx_skb_queue, skb); -} - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_check(struct ieee80211_rx_data *rx) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ieee80211_rx_h_check \n"); -#endif - - /* Drop duplicate 802.11 retransmissions (IEEE 802.11 Chap. 9.2.9) */ - /* - * [PLATA] do not enter here (on the first reception as we do not have a rx->sta and probably for all other reception).. - * - */ - if (rx->sta && !is_multicast_ether_addr(hdr->addr1)) { - if (unlikely(ieee80211_has_retry(hdr->frame_control) && - rx->sta->last_seq_ctrl[rx->seqno_idx] == - hdr->seq_ctrl)) { - if (status->rx_flags & IEEE80211_RX_RA_MATCH) { - rx->local->dot11FrameDuplicateCount++; - rx->sta->num_duplicates++; - } - return RX_DROP_UNUSABLE; - } else - rx->sta->last_seq_ctrl[rx->seqno_idx] = hdr->seq_ctrl; - } - - if (unlikely(rx->skb->len < 16)) { - I802_DEBUG_INC(rx->local->rx_handlers_drop_short); - return RX_DROP_MONITOR; - } - - /* Drop disallowed frame classes based on STA auth/assoc state; - * IEEE 802.11, Chap 5.5. - * - * mac80211 filters only based on association state, i.e. it drops - * Class 3 frames from not associated stations. hostapd sends - * deauth/disassoc frames when needed. In addition, hostapd is - * responsible for filtering on both auth and assoc states. - */ - - if (ieee80211_vif_is_mesh(&rx->sdata->vif)) - return ieee80211_rx_mesh_check(rx); - - /* - * [PLATA] we do not enter here, as we are in ADHOC mode - */ - if (unlikely((ieee80211_is_data(hdr->frame_control) || - ieee80211_is_pspoll(hdr->frame_control)) && - rx->sdata->vif.type != NL80211_IFTYPE_ADHOC && - rx->sdata->vif.type != NL80211_IFTYPE_WDS && - (!rx->sta || !test_sta_flag(rx->sta, WLAN_STA_ASSOC)))) { // [PLATA] - either data or PS poll and not ADHOC and either no station or not associated -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- OCB Activated...should not enter here..\n"); -#endif - /* - * accept port control frames from the AP even when it's not - * yet marked ASSOC to prevent a race where we don't set the - * assoc bit quickly enough before it sends the first frame - */ - if (rx->sta && rx->sdata->vif.type == NL80211_IFTYPE_STATION && - ieee80211_is_data_present(hdr->frame_control)) { - u16 ethertype; - u8 *payload; - - payload = rx->skb->data + - ieee80211_hdrlen(hdr->frame_control); - ethertype = (payload[6] << 8) | payload[7]; - if (cpu_to_be16(ethertype) == - rx->sdata->control_port_protocol) - return RX_CONTINUE; - } - - if (rx->sdata->vif.type == NL80211_IFTYPE_AP && - cfg80211_rx_spurious_frame(rx->sdata->dev, - hdr->addr2, - GFP_ATOMIC)) - return RX_DROP_UNUSABLE; - - return RX_DROP_MONITOR; - } - - return RX_CONTINUE; -} - - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx) -{ - struct sk_buff *skb = rx->skb; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - int keyidx; - int hdrlen; - ieee80211_rx_result result = RX_DROP_UNUSABLE; - struct ieee80211_key *sta_ptk = NULL; - int mmie_keyidx = -1; - __le16 fc; - - /* - * Key selection 101 - * - * There are four types of keys: - * - GTK (group keys) - * - IGTK (group keys for management frames) - * - PTK (pairwise keys) - * - STK (station-to-station pairwise keys) - * - * When selecting a key, we have to distinguish between multicast - * (including broadcast) and unicast frames, the latter can only - * use PTKs and STKs while the former always use GTKs and IGTKs. - * Unless, of course, actual WEP keys ("pre-RSNA") are used, then - * unicast frames can also use key indices like GTKs. Hence, if we - * don't have a PTK/STK we check the key index for a WEP key. - * - * Note that in a regular BSS, multicast frames are sent by the - * AP only, associated stations unicast the frame to the AP first - * which then multicasts it on their behalf. - * - * There is also a slight problem in IBSS mode: GTKs are negotiated - * with each station, that is something we don't currently handle. - * The spec seems to expect that one negotiates the same key with - * every station but there's no such requirement; VLANs could be - * possible. - */ - - /* - * No point in finding a key and decrypting if the frame is neither - * addressed to us nor a multicast frame. - */ - if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) - return RX_CONTINUE; - - /* start without a key */ - rx->key = NULL; - - if (rx->sta) - sta_ptk = rcu_dereference(rx->sta->ptk); - - fc = hdr->frame_control; - - if (!ieee80211_has_protected(fc)) - mmie_keyidx = ieee80211_get_mmie_keyidx(rx->skb); - - if (!is_multicast_ether_addr(hdr->addr1) && sta_ptk) { - rx->key = sta_ptk; - if ((status->flag & RX_FLAG_DECRYPTED) && - (status->flag & RX_FLAG_IV_STRIPPED)) - return RX_CONTINUE; - /* Skip decryption if the frame is not protected. */ - if (!ieee80211_has_protected(fc)) - return RX_CONTINUE; - } else if (mmie_keyidx >= 0) { - /* Broadcast/multicast robust management frame / BIP */ - if ((status->flag & RX_FLAG_DECRYPTED) && - (status->flag & RX_FLAG_IV_STRIPPED)) - return RX_CONTINUE; - - if (mmie_keyidx < NUM_DEFAULT_KEYS || - mmie_keyidx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) - return RX_DROP_MONITOR; /* unexpected BIP keyidx */ - if (rx->sta) - rx->key = rcu_dereference(rx->sta->gtk[mmie_keyidx]); - if (!rx->key) - rx->key = rcu_dereference(rx->sdata->keys[mmie_keyidx]); - } else if (!ieee80211_has_protected(fc)) { - /* - * The frame was not protected, so skip decryption. However, we - * need to set rx->key if there is a key that could have been - * used so that the frame may be dropped if encryption would - * have been expected. - */ - struct ieee80211_key *key = NULL; - struct ieee80211_sub_if_data *sdata = rx->sdata; - int i; - - if (ieee80211_is_mgmt(fc) && - is_multicast_ether_addr(hdr->addr1) && - (key = rcu_dereference(rx->sdata->default_mgmt_key))) - rx->key = key; - else { - if (rx->sta) { - for (i = 0; i < NUM_DEFAULT_KEYS; i++) { - key = rcu_dereference(rx->sta->gtk[i]); - if (key) - break; - } - } - if (!key) { - for (i = 0; i < NUM_DEFAULT_KEYS; i++) { - key = rcu_dereference(sdata->keys[i]); - if (key) - break; - } - } - if (key) - rx->key = key; - } - return RX_CONTINUE; - } else { - u8 keyid; - /* - * The device doesn't give us the IV so we won't be - * able to look up the key. That's ok though, we - * don't need to decrypt the frame, we just won't - * be able to keep statistics accurate. - * Except for key threshold notifications, should - * we somehow allow the driver to tell us which key - * the hardware used if this flag is set? - */ - if ((status->flag & RX_FLAG_DECRYPTED) && - (status->flag & RX_FLAG_IV_STRIPPED)) - return RX_CONTINUE; - - hdrlen = ieee80211_hdrlen(fc); - - if (rx->skb->len < 8 + hdrlen) - return RX_DROP_UNUSABLE; /* TODO: count this? */ - - /* - * no need to call ieee80211_wep_get_keyidx, - * it verifies a bunch of things we've done already - */ - skb_copy_bits(rx->skb, hdrlen + 3, &keyid, 1); - keyidx = keyid >> 6; - - /* check per-station GTK first, if multicast packet */ - if (is_multicast_ether_addr(hdr->addr1) && rx->sta) - rx->key = rcu_dereference(rx->sta->gtk[keyidx]); - - /* if not found, try default key */ - if (!rx->key) { - rx->key = rcu_dereference(rx->sdata->keys[keyidx]); - - /* - * RSNA-protected unicast frames should always be - * sent with pairwise or station-to-station keys, - * but for WEP we allow using a key index as well. - */ - if (rx->key && - rx->key->conf.cipher != WLAN_CIPHER_SUITE_WEP40 && - rx->key->conf.cipher != WLAN_CIPHER_SUITE_WEP104 && - !is_multicast_ether_addr(hdr->addr1)) - rx->key = NULL; - } - } - - if (rx->key) { - if (unlikely(rx->key->flags & KEY_FLAG_TAINTED)) - return RX_DROP_MONITOR; - - rx->key->tx_rx_count++; - /* TODO: add threshold stuff again */ - } else { - return RX_DROP_MONITOR; - } - - switch (rx->key->conf.cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - result = ieee80211_crypto_wep_decrypt(rx); - break; - case WLAN_CIPHER_SUITE_TKIP: - result = ieee80211_crypto_tkip_decrypt(rx); - break; - case WLAN_CIPHER_SUITE_CCMP: - result = ieee80211_crypto_ccmp_decrypt(rx); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - result = ieee80211_crypto_aes_cmac_decrypt(rx); - break; - default: - /* - * We can reach here only with HW-only algorithms - * but why didn't it decrypt the frame?! - */ - return RX_DROP_UNUSABLE; - } - - /* the hdr variable is invalid after the decrypt handlers */ - - /* either the frame has been decrypted or will be dropped */ - status->flag |= RX_FLAG_DECRYPTED; - - return result; -} - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_check_more_data(struct ieee80211_rx_data *rx) -{ - struct ieee80211_local *local; - struct ieee80211_hdr *hdr; - struct sk_buff *skb; - - local = rx->local; - skb = rx->skb; - hdr = (struct ieee80211_hdr *) skb->data; - - if (!local->pspolling) - return RX_CONTINUE; - - if (!ieee80211_has_fromds(hdr->frame_control)) - /* this is not from AP */ - return RX_CONTINUE; - - if (!ieee80211_is_data(hdr->frame_control)) - return RX_CONTINUE; - - if (!ieee80211_has_moredata(hdr->frame_control)) { - /* AP has no more frames buffered for us */ - local->pspolling = false; - return RX_CONTINUE; - } - - /* more data bit is set, let's request a new frame from the AP */ - ieee80211_send_pspoll(local, rx->sdata); - - return RX_CONTINUE; -} - -static void ap_sta_ps_start(struct sta_info *sta) -{ - struct ieee80211_sub_if_data *sdata = sta->sdata; - struct ieee80211_local *local = sdata->local; - - atomic_inc(&sdata->bss->num_sta_ps); - set_sta_flag(sta, WLAN_STA_PS_STA); - if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS)) - drv_sta_notify(local, sdata, STA_NOTIFY_SLEEP, &sta->sta); -#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG - printk(KERN_DEBUG "%s: STA %pM aid %d enters power save mode\n", - sdata->name, sta->sta.addr, sta->sta.aid); -#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ -} - -static void ap_sta_ps_end(struct sta_info *sta) -{ -#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG - printk(KERN_DEBUG "%s: STA %pM aid %d exits power save mode\n", - sta->sdata->name, sta->sta.addr, sta->sta.aid); -#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ - - if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) { -#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG - printk(KERN_DEBUG "%s: STA %pM aid %d driver-ps-blocked\n", - sta->sdata->name, sta->sta.addr, sta->sta.aid); -#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ - return; - } - - ieee80211_sta_ps_deliver_wakeup(sta); -} - -int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start) -{ - struct sta_info *sta_inf = container_of(sta, struct sta_info, sta); - bool in_ps; - - WARN_ON(!(sta_inf->local->hw.flags & IEEE80211_HW_AP_LINK_PS)); - - /* Don't let the same PS state be set twice */ - in_ps = test_sta_flag(sta_inf, WLAN_STA_PS_STA); - if ((start && in_ps) || (!start && !in_ps)) - return -EINVAL; - - if (start) - ap_sta_ps_start(sta_inf); - else - ap_sta_ps_end(sta_inf); - - return 0; -} -EXPORT_SYMBOL(ieee80211_sta_ps_transition); - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_uapsd_and_pspoll(struct ieee80211_rx_data *rx) -{ - struct ieee80211_sub_if_data *sdata = rx->sdata; - struct ieee80211_hdr *hdr = (void *)rx->skb->data; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - int tid, ac; - - if (!rx->sta || !(status->rx_flags & IEEE80211_RX_RA_MATCH)) - return RX_CONTINUE; - - if (sdata->vif.type != NL80211_IFTYPE_AP && - sdata->vif.type != NL80211_IFTYPE_AP_VLAN) - return RX_CONTINUE; - - /* - * The device handles station powersave, so don't do anything about - * uAPSD and PS-Poll frames (the latter shouldn't even come up from - * it to mac80211 since they're handled.) - */ - if (sdata->local->hw.flags & IEEE80211_HW_AP_LINK_PS) - return RX_CONTINUE; - - /* - * Don't do anything if the station isn't already asleep. In - * the uAPSD case, the station will probably be marked asleep, - * in the PS-Poll case the station must be confused ... - */ - if (!test_sta_flag(rx->sta, WLAN_STA_PS_STA)) - return RX_CONTINUE; - - if (unlikely(ieee80211_is_pspoll(hdr->frame_control))) { - if (!test_sta_flag(rx->sta, WLAN_STA_SP)) { - if (!test_sta_flag(rx->sta, WLAN_STA_PS_DRIVER)) - ieee80211_sta_ps_deliver_poll_response(rx->sta); - else - set_sta_flag(rx->sta, WLAN_STA_PSPOLL); - } - - /* Free PS Poll skb here instead of returning RX_DROP that would - * count as an dropped frame. */ - dev_kfree_skb(rx->skb); - - return RX_QUEUED; - } else if (!ieee80211_has_morefrags(hdr->frame_control) && - !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) && - ieee80211_has_pm(hdr->frame_control) && - (ieee80211_is_data_qos(hdr->frame_control) || - ieee80211_is_qos_nullfunc(hdr->frame_control))) { - tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; - ac = ieee802_1d_to_ac[tid & 7]; - - /* - * If this AC is not trigger-enabled do nothing. - * - * NB: This could/should check a separate bitmap of trigger- - * enabled queues, but for now we only implement uAPSD w/o - * TSPEC changes to the ACs, so they're always the same. - */ - if (!(rx->sta->sta.uapsd_queues & BIT(ac))) - return RX_CONTINUE; - - /* if we are in a service period, do nothing */ - if (test_sta_flag(rx->sta, WLAN_STA_SP)) - return RX_CONTINUE; - - if (!test_sta_flag(rx->sta, WLAN_STA_PS_DRIVER)) - ieee80211_sta_ps_deliver_uapsd(rx->sta); - else - set_sta_flag(rx->sta, WLAN_STA_UAPSD); - } - - return RX_CONTINUE; -} - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) -{ - struct sta_info *sta = rx->sta; - struct sk_buff *skb = rx->skb; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ieee80211_rx_h_sta_process \n"); -#endif - - if (!sta) - return RX_CONTINUE; - - /* - * Update last_rx only for IBSS packets which are for the current - * BSSID to avoid keeping the current IBSS network alive in cases - * where other STAs start using different BSSID. - */ - if (rx->sdata->vif.type == NL80211_IFTYPE_ADHOC) { - u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len, - NL80211_IFTYPE_ADHOC); - if (compare_ether_addr(bssid, rx->sdata->u.ibss.bssid) == 0) { - sta->last_rx = jiffies; - if (ieee80211_is_data(hdr->frame_control)) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ADHOC and OCBActivated -- updating the RX statistics \n"); -#endif - sta->last_rx_rate_idx = status->rate_idx; - sta->last_rx_rate_flag = status->flag; - } - } - } else if (!is_multicast_ether_addr(hdr->addr1)) { - /* - * Mesh beacons will update last_rx when if they are found to - * match the current local configuration when processed. - */ - sta->last_rx = jiffies; - if (ieee80211_is_data(hdr->frame_control)) { - sta->last_rx_rate_idx = status->rate_idx; - sta->last_rx_rate_flag = status->flag; - } - } - - if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) - return RX_CONTINUE; - - if (rx->sdata->vif.type == NL80211_IFTYPE_STATION) - ieee80211_sta_rx_notify(rx->sdata, hdr); - - sta->rx_fragments++; - sta->rx_bytes += rx->skb->len; - if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { - sta->last_signal = status->signal; - ewma_add(&sta->avg_signal, -status->signal); - } - - /* - * Change STA power saving mode only at the end of a frame - * exchange sequence. - */ - if (!(sta->local->hw.flags & IEEE80211_HW_AP_LINK_PS) && - !ieee80211_has_morefrags(hdr->frame_control) && - !(status->rx_flags & IEEE80211_RX_DEFERRED_RELEASE) && - (rx->sdata->vif.type == NL80211_IFTYPE_AP || - rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) { - if (test_sta_flag(sta, WLAN_STA_PS_STA)) { - /* - * Ignore doze->wake transitions that are - * indicated by non-data frames, the standard - * is unclear here, but for example going to - * PS mode and then scanning would cause a - * doze->wake transition for the probe request, - * and that is clearly undesirable. - */ - if (ieee80211_is_data(hdr->frame_control) && - !ieee80211_has_pm(hdr->frame_control)) - ap_sta_ps_end(sta); - } else { - if (ieee80211_has_pm(hdr->frame_control)) - ap_sta_ps_start(sta); - } - } - - /* - * Drop (qos-)data::nullfunc frames silently, since they - * are used only to control station power saving mode. - */ - if (ieee80211_is_nullfunc(hdr->frame_control) || - ieee80211_is_qos_nullfunc(hdr->frame_control)) { - I802_DEBUG_INC(rx->local->rx_handlers_drop_nullfunc); - - /* - * If we receive a 4-addr nullfunc frame from a STA - * that was not moved to a 4-addr STA vlan yet send - * the event to userspace and for older hostapd drop - * the frame to the monitor interface. - */ - if (ieee80211_has_a4(hdr->frame_control) && - (rx->sdata->vif.type == NL80211_IFTYPE_AP || - (rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && - !rx->sdata->u.vlan.sta))) { - if (!test_and_set_sta_flag(sta, WLAN_STA_4ADDR_EVENT)) - cfg80211_rx_unexpected_4addr_frame( - rx->sdata->dev, sta->sta.addr, - GFP_ATOMIC); - return RX_DROP_MONITOR; - } - /* - * Update counter and free packet here to avoid - * counting this as a dropped packed. - */ - sta->rx_packets++; - dev_kfree_skb(rx->skb); - return RX_QUEUED; - } - - return RX_CONTINUE; -} /* ieee80211_rx_h_sta_process */ - -static inline struct ieee80211_fragment_entry * -ieee80211_reassemble_add(struct ieee80211_sub_if_data *sdata, - unsigned int frag, unsigned int seq, int rx_queue, - struct sk_buff **skb) -{ - struct ieee80211_fragment_entry *entry; - int idx; - - idx = sdata->fragment_next; - entry = &sdata->fragments[sdata->fragment_next++]; - if (sdata->fragment_next >= IEEE80211_FRAGMENT_MAX) - sdata->fragment_next = 0; - - if (!skb_queue_empty(&entry->skb_list)) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - struct ieee80211_hdr *hdr = - (struct ieee80211_hdr *) entry->skb_list.next->data; - printk(KERN_DEBUG "%s: RX reassembly removed oldest " - "fragment entry (idx=%d age=%lu seq=%d last_frag=%d " - "addr1=%pM addr2=%pM\n", - sdata->name, idx, - jiffies - entry->first_frag_time, entry->seq, - entry->last_frag, hdr->addr1, hdr->addr2); -#endif - __skb_queue_purge(&entry->skb_list); - } - - __skb_queue_tail(&entry->skb_list, *skb); /* no need for locking */ - *skb = NULL; - entry->first_frag_time = jiffies; - entry->seq = seq; - entry->rx_queue = rx_queue; - entry->last_frag = frag; - entry->ccmp = 0; - entry->extra_len = 0; - - return entry; -} - -static inline struct ieee80211_fragment_entry * -ieee80211_reassemble_find(struct ieee80211_sub_if_data *sdata, - unsigned int frag, unsigned int seq, - int rx_queue, struct ieee80211_hdr *hdr) -{ - struct ieee80211_fragment_entry *entry; - int i, idx; - - idx = sdata->fragment_next; - for (i = 0; i < IEEE80211_FRAGMENT_MAX; i++) { - struct ieee80211_hdr *f_hdr; - - idx--; - if (idx < 0) - idx = IEEE80211_FRAGMENT_MAX - 1; - - entry = &sdata->fragments[idx]; - if (skb_queue_empty(&entry->skb_list) || entry->seq != seq || - entry->rx_queue != rx_queue || - entry->last_frag + 1 != frag) - continue; - - f_hdr = (struct ieee80211_hdr *)entry->skb_list.next->data; - - /* - * Check ftype and addresses are equal, else check next fragment - */ - if (((hdr->frame_control ^ f_hdr->frame_control) & - cpu_to_le16(IEEE80211_FCTL_FTYPE)) || - compare_ether_addr(hdr->addr1, f_hdr->addr1) != 0 || - compare_ether_addr(hdr->addr2, f_hdr->addr2) != 0) - continue; - - if (time_after(jiffies, entry->first_frag_time + 2 * HZ)) { - __skb_queue_purge(&entry->skb_list); - continue; - } - return entry; - } - - return NULL; -} - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) -{ - struct ieee80211_hdr *hdr; - u16 sc; - __le16 fc; - unsigned int frag, seq; - struct ieee80211_fragment_entry *entry; - struct sk_buff *skb; - struct ieee80211_rx_status *status; - - hdr = (struct ieee80211_hdr *)rx->skb->data; - fc = hdr->frame_control; - sc = le16_to_cpu(hdr->seq_ctrl); - frag = sc & IEEE80211_SCTL_FRAG; - - if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || - (rx->skb)->len < 24 || - is_multicast_ether_addr(hdr->addr1))) { - /* not fragmented */ - goto out; - } - I802_DEBUG_INC(rx->local->rx_handlers_fragments); - - if (skb_linearize(rx->skb)) - return RX_DROP_UNUSABLE; - - /* - * skb_linearize() might change the skb->data and - * previously cached variables (in this case, hdr) need to - * be refreshed with the new data. - */ - hdr = (struct ieee80211_hdr *)rx->skb->data; - seq = (sc & IEEE80211_SCTL_SEQ) >> 4; - - if (frag == 0) { - /* This is the first fragment of a new frame. */ - entry = ieee80211_reassemble_add(rx->sdata, frag, seq, - rx->seqno_idx, &(rx->skb)); - if (rx->key && rx->key->conf.cipher == WLAN_CIPHER_SUITE_CCMP && - ieee80211_has_protected(fc)) { - int queue = rx->security_idx; - /* Store CCMP PN so that we can verify that the next - * fragment has a sequential PN value. */ - entry->ccmp = 1; - memcpy(entry->last_pn, - rx->key->u.ccmp.rx_pn[queue], - CCMP_PN_LEN); - } - return RX_QUEUED; - } - - /* This is a fragment for a frame that should already be pending in - * fragment cache. Add this fragment to the end of the pending entry. - */ - entry = ieee80211_reassemble_find(rx->sdata, frag, seq, - rx->seqno_idx, hdr); - if (!entry) { - I802_DEBUG_INC(rx->local->rx_handlers_drop_defrag); - return RX_DROP_MONITOR; - } - - /* Verify that MPDUs within one MSDU have sequential PN values. - * (IEEE 802.11i, 8.3.3.4.5) */ - if (entry->ccmp) { - int i; - u8 pn[CCMP_PN_LEN], *rpn; - int queue; - if (!rx->key || rx->key->conf.cipher != WLAN_CIPHER_SUITE_CCMP) - return RX_DROP_UNUSABLE; - memcpy(pn, entry->last_pn, CCMP_PN_LEN); - for (i = CCMP_PN_LEN - 1; i >= 0; i--) { - pn[i]++; - if (pn[i]) - break; - } - queue = rx->security_idx; - rpn = rx->key->u.ccmp.rx_pn[queue]; - if (memcmp(pn, rpn, CCMP_PN_LEN)) - return RX_DROP_UNUSABLE; - memcpy(entry->last_pn, pn, CCMP_PN_LEN); - } - - skb_pull(rx->skb, ieee80211_hdrlen(fc)); - __skb_queue_tail(&entry->skb_list, rx->skb); - entry->last_frag = frag; - entry->extra_len += rx->skb->len; - if (ieee80211_has_morefrags(fc)) { - rx->skb = NULL; - return RX_QUEUED; - } - - rx->skb = __skb_dequeue(&entry->skb_list); - if (skb_tailroom(rx->skb) < entry->extra_len) { - I802_DEBUG_INC(rx->local->rx_expand_skb_head2); - if (unlikely(pskb_expand_head(rx->skb, 0, entry->extra_len, - GFP_ATOMIC))) { - I802_DEBUG_INC(rx->local->rx_handlers_drop_defrag); - __skb_queue_purge(&entry->skb_list); - return RX_DROP_UNUSABLE; - } - } - while ((skb = __skb_dequeue(&entry->skb_list))) { - memcpy(skb_put(rx->skb, skb->len), skb->data, skb->len); - dev_kfree_skb(skb); - } - - /* Complete frame has been reassembled - process it now */ - status = IEEE80211_SKB_RXCB(rx->skb); - status->rx_flags |= IEEE80211_RX_FRAGMENTED; - - out: - if (rx->sta) - rx->sta->rx_packets++; - if (is_multicast_ether_addr(hdr->addr1)) - rx->local->dot11MulticastReceivedFrameCount++; - else - ieee80211_led_rx(rx->local); - return RX_CONTINUE; -} - -static int -ieee80211_802_1x_port_control(struct ieee80211_rx_data *rx) -{ - /* - * [PLATA] allow frames here even if we are not authorized, under the condition we are in the OCB mode... - */ - if (unlikely(!rx->sta || - (!test_sta_flag(rx->sta, WLAN_STA_AUTHORIZED) && !test_sta_flag(rx->sta, WLAN_STA_OCB)) )) - return -EACCES; - - return 0; -} - -static int -ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc) -{ - struct sk_buff *skb = rx->skb; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - - /* - * Pass through unencrypted frames if the hardware has - * decrypted them already. - */ - if (status->flag & RX_FLAG_DECRYPTED) - return 0; - - /* - * [PLATA] Pass through unencrypted frames when the OCB is activated - * first in this version of PLATA we do not support encryption - * second, the encryption is done at a higher layer - */ - if ((rx->local->hw.wiphy->dot11OCBActivated == 1) && (rx->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) - return 0; - - /* Drop unencrypted frames if key is set. */ - if (unlikely(!ieee80211_has_protected(fc) && - !ieee80211_is_nullfunc(fc) && - ieee80211_is_data(fc) && - (rx->key || rx->sdata->drop_unencrypted))) - return -EACCES; - - return 0; -} - -static int -ieee80211_drop_unencrypted_mgmt(struct ieee80211_rx_data *rx) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - __le16 fc = hdr->frame_control; - - /* - * Pass through unencrypted frames if the hardware has - * decrypted them already. - */ - if (status->flag & RX_FLAG_DECRYPTED) - return 0; - - if (rx->sta && test_sta_flag(rx->sta, WLAN_STA_MFP)) { - if (unlikely(!ieee80211_has_protected(fc) && - ieee80211_is_unicast_robust_mgmt_frame(rx->skb) && - rx->key)) { - if (ieee80211_is_deauth(fc)) - cfg80211_send_unprot_deauth(rx->sdata->dev, - rx->skb->data, - rx->skb->len); - else if (ieee80211_is_disassoc(fc)) - cfg80211_send_unprot_disassoc(rx->sdata->dev, - rx->skb->data, - rx->skb->len); - return -EACCES; - } - /* BIP does not use Protected field, so need to check MMIE */ - if (unlikely(ieee80211_is_multicast_robust_mgmt_frame(rx->skb) && - ieee80211_get_mmie_keyidx(rx->skb) < 0)) { - if (ieee80211_is_deauth(fc)) - cfg80211_send_unprot_deauth(rx->sdata->dev, - rx->skb->data, - rx->skb->len); - else if (ieee80211_is_disassoc(fc)) - cfg80211_send_unprot_disassoc(rx->sdata->dev, - rx->skb->data, - rx->skb->len); - return -EACCES; - } - /* - * When using MFP, Action frames are not allowed prior to - * having configured keys. - */ - if (unlikely(ieee80211_is_action(fc) && !rx->key && - ieee80211_is_robust_mgmt_frame( - (struct ieee80211_hdr *) rx->skb->data))) - return -EACCES; - } - - return 0; -} - -static int -__ieee80211_data_to_8023(struct ieee80211_rx_data *rx, bool *port_control) -{ - struct ieee80211_sub_if_data *sdata = rx->sdata; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; - bool check_port_control = false; - struct ethhdr *ehdr; - int ret; - - *port_control = false; - if (ieee80211_has_a4(hdr->frame_control) && - sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta) - return -1; - - if (sdata->vif.type == NL80211_IFTYPE_STATION && - !!sdata->u.mgd.use_4addr != !!ieee80211_has_a4(hdr->frame_control)) { - - if (!sdata->u.mgd.use_4addr) - return -1; - else - check_port_control = true; - } - - if (is_multicast_ether_addr(hdr->addr1) && - sdata->vif.type == NL80211_IFTYPE_AP_VLAN && sdata->u.vlan.sta) - return -1; - - ret = ieee80211_data_to_8023(rx->skb, sdata->vif.addr, sdata->vif.type); - if (ret < 0) - return ret; - - ehdr = (struct ethhdr *) rx->skb->data; - if (ehdr->h_proto == rx->sdata->control_port_protocol) - *port_control = true; - else if (check_port_control) - return -1; - - return 0; -} - -/* - * requires that rx->skb is a frame with ethernet header - */ -static bool ieee80211_frame_allowed(struct ieee80211_rx_data *rx, __le16 fc) -{ - static const u8 pae_group_addr[ETH_ALEN] __aligned(2) - = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 }; - struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; - - /* - * Allow EAPOL frames to us/the PAE group address regardless - * of whether the frame was encrypted or not. - */ - /* - * [PLATA] - we need to initialize these values otherwise we might drop the frame - * - we keep it here, if the frame if for us - */ - if (ehdr->h_proto == rx->sdata->control_port_protocol && - (compare_ether_addr(ehdr->h_dest, rx->sdata->vif.addr) == 0 || - compare_ether_addr(ehdr->h_dest, pae_group_addr) == 0)) - return true; - - /* - * [PLATA] added some flags - we allow the frame even if not in AUTHORIZED mode (but in the OCB mode) or if unencrypted but with OCB activated - */ - if (ieee80211_802_1x_port_control(rx) || - ieee80211_drop_unencrypted(rx, fc)) - return false; - - return true; -} - -/* - * requires that rx->skb is a frame with ethernet header - * - * [PLATA] TODO - check what it means for the ADHOC mode with OCB activated - * - as we only communicate directly, no relaying (no turn back to wireless) - * - this method should not do anything. But we may have to bypass it - */ -static void -ieee80211_deliver_skb(struct ieee80211_rx_data *rx) -{ - struct ieee80211_sub_if_data *sdata = rx->sdata; - struct net_device *dev = sdata->dev; - struct sk_buff *skb, *xmit_skb; - struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; - struct sta_info *dsta; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - - skb = rx->skb; - xmit_skb = NULL; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ieee80211_deliver_skb -- in case the MAC should relay it -- with OCBActivated, it should never... \n"); -#endif - - if ((sdata->vif.type == NL80211_IFTYPE_AP || - sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && - !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && - (status->rx_flags & IEEE80211_RX_RA_MATCH) && - (sdata->vif.type != NL80211_IFTYPE_AP_VLAN || !sdata->u.vlan.sta)) { - if (is_multicast_ether_addr(ehdr->h_dest)) { - /* - * send multicast frames both to higher layers in - * local net stack and back to the wireless medium - */ - xmit_skb = skb_copy(skb, GFP_ATOMIC); - if (!xmit_skb && net_ratelimit()) - printk(KERN_DEBUG "%s: failed to clone " - "multicast frame\n", dev->name); - } else { - dsta = sta_info_get(sdata, skb->data); - if (dsta) { - /* - * The destination station is associated to - * this AP (in this VLAN), so send the frame - * directly to it and do not pass it to local - * net stack. - */ - xmit_skb = skb; - skb = NULL; - } - } - } - - if (skb) { - int align __maybe_unused; - -#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS - /* - * 'align' will only take the values 0 or 2 here - * since all frames are required to be aligned - * to 2-byte boundaries when being passed to - * mac80211. That also explains the __skb_push() - * below. - */ - align = ((unsigned long)(skb->data + sizeof(struct ethhdr))) & 3; - if (align) { - if (WARN_ON(skb_headroom(skb) < 3)) { - dev_kfree_skb(skb); - skb = NULL; - } else { - u8 *data = skb->data; - size_t len = skb_headlen(skb); - skb->data -= align; - memmove(skb->data, data, len); - skb_set_tail_pointer(skb, len); - } - } -#endif - - if (skb) { - /* deliver to local stack */ - skb->protocol = eth_type_trans(skb, dev); - memset(skb->cb, 0, sizeof(skb->cb)); - netif_receive_skb(skb); - } - } - - if (xmit_skb) { - /* - * Send to wireless media and increase priority by 256 to - * keep the received priority instead of reclassifying - * the frame (see cfg80211_classify8021d). - */ - xmit_skb->priority += 256; - xmit_skb->protocol = htons(ETH_P_802_3); - skb_reset_network_header(xmit_skb); - skb_reset_mac_header(xmit_skb); - dev_queue_xmit(xmit_skb); - } -} - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx) -{ - struct net_device *dev = rx->sdata->dev; - struct sk_buff *skb = rx->skb; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - __le16 fc = hdr->frame_control; - struct sk_buff_head frame_list; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - - if (unlikely(!ieee80211_is_data(fc))) - return RX_CONTINUE; - - if (unlikely(!ieee80211_is_data_present(fc))) - return RX_DROP_MONITOR; - - if (!(status->rx_flags & IEEE80211_RX_AMSDU)) - return RX_CONTINUE; - - if (ieee80211_has_a4(hdr->frame_control) && - rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && - !rx->sdata->u.vlan.sta) - return RX_DROP_UNUSABLE; - - if (is_multicast_ether_addr(hdr->addr1) && - ((rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && - rx->sdata->u.vlan.sta) || - (rx->sdata->vif.type == NL80211_IFTYPE_STATION && - rx->sdata->u.mgd.use_4addr))) - return RX_DROP_UNUSABLE; - - skb->dev = dev; - __skb_queue_head_init(&frame_list); - - if (skb_linearize(skb)) - return RX_DROP_UNUSABLE; - - ieee80211_amsdu_to_8023s(skb, &frame_list, dev->dev_addr, - rx->sdata->vif.type, - rx->local->hw.extra_tx_headroom, true); - - while (!skb_queue_empty(&frame_list)) { - rx->skb = __skb_dequeue(&frame_list); - - if (!ieee80211_frame_allowed(rx, fc)) { - dev_kfree_skb(rx->skb); - continue; - } - dev->stats.rx_packets++; - dev->stats.rx_bytes += rx->skb->len; - - ieee80211_deliver_skb(rx); - } - - return RX_QUEUED; -} - -#ifdef CONFIG_MAC80211_MESH -static ieee80211_rx_result -ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) -{ - struct ieee80211_hdr *fwd_hdr, *hdr; - struct ieee80211_tx_info *info; - struct ieee80211s_hdr *mesh_hdr; - struct sk_buff *skb = rx->skb, *fwd_skb; - struct ieee80211_local *local = rx->local; - struct ieee80211_sub_if_data *sdata = rx->sdata; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; - __le16 reason = cpu_to_le16(WLAN_REASON_MESH_PATH_NOFORWARD); - u16 q, hdrlen; - - hdr = (struct ieee80211_hdr *) skb->data; - hdrlen = ieee80211_hdrlen(hdr->frame_control); - mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); - - /* frame is in RMC, don't forward */ - if (ieee80211_is_data(hdr->frame_control) && - is_multicast_ether_addr(hdr->addr1) && - mesh_rmc_check(hdr->addr3, mesh_hdr, rx->sdata)) - return RX_DROP_MONITOR; - - if (!ieee80211_is_data(hdr->frame_control)) - return RX_CONTINUE; - - if (!mesh_hdr->ttl) - return RX_DROP_MONITOR; - - if (mesh_hdr->flags & MESH_FLAGS_AE) { - struct mesh_path *mppath; - char *proxied_addr; - char *mpp_addr; - - if (is_multicast_ether_addr(hdr->addr1)) { - mpp_addr = hdr->addr3; - proxied_addr = mesh_hdr->eaddr1; - } else { - mpp_addr = hdr->addr4; - proxied_addr = mesh_hdr->eaddr2; - } - - rcu_read_lock(); - mppath = mpp_path_lookup(proxied_addr, sdata); - if (!mppath) { - mpp_path_add(proxied_addr, mpp_addr, sdata); - } else { - spin_lock_bh(&mppath->state_lock); - if (compare_ether_addr(mppath->mpp, mpp_addr) != 0) - memcpy(mppath->mpp, mpp_addr, ETH_ALEN); - spin_unlock_bh(&mppath->state_lock); - } - rcu_read_unlock(); - } - - /* Frame has reached destination. Don't forward */ - if (!is_multicast_ether_addr(hdr->addr1) && - compare_ether_addr(sdata->vif.addr, hdr->addr3) == 0) - return RX_CONTINUE; - - q = ieee80211_select_queue_80211(local, skb, hdr); - if (ieee80211_queue_stopped(&local->hw, q)) { - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion); - return RX_DROP_MONITOR; - } - skb_set_queue_mapping(skb, q); - - if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) - goto out; - - if (!--mesh_hdr->ttl) { - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); - return RX_DROP_MONITOR; - } - - if (!ifmsh->mshcfg.dot11MeshForwarding) - goto out; - - fwd_skb = skb_copy(skb, GFP_ATOMIC); - if (!fwd_skb) { - if (net_ratelimit()) - printk(KERN_DEBUG "%s: failed to clone mesh frame\n", - sdata->name); - goto out; - } - - fwd_hdr = (struct ieee80211_hdr *) fwd_skb->data; - info = IEEE80211_SKB_CB(fwd_skb); - memset(info, 0, sizeof(*info)); - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; - info->control.vif = &rx->sdata->vif; - info->control.jiffies = jiffies; - if (is_multicast_ether_addr(fwd_hdr->addr1)) { - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_mcast); - memcpy(fwd_hdr->addr2, sdata->vif.addr, ETH_ALEN); - } else if (!mesh_nexthop_lookup(fwd_skb, sdata)) { - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_unicast); - } else { - /* unable to resolve next hop */ - mesh_path_error_tx(ifmsh->mshcfg.element_ttl, fwd_hdr->addr3, - 0, reason, fwd_hdr->addr2, sdata); - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_no_route); - kfree_skb(fwd_skb); - return RX_DROP_MONITOR; - } - - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); - ieee80211_add_pending_skb(local, fwd_skb); - out: - if (is_multicast_ether_addr(hdr->addr1) || - sdata->dev->flags & IFF_PROMISC) - return RX_CONTINUE; - else - return RX_DROP_MONITOR; -} -#endif - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_data(struct ieee80211_rx_data *rx) -{ - struct ieee80211_sub_if_data *sdata = rx->sdata; - struct ieee80211_local *local = rx->local; - struct net_device *dev = sdata->dev; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; - __le16 fc = hdr->frame_control; - bool port_control; - int err; - - if (unlikely(!ieee80211_is_data(hdr->frame_control))) - return RX_CONTINUE; - - if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) - return RX_DROP_MONITOR; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ieee80211_rx_h_data \n"); -#endif - - /* - * Send unexpected-4addr-frame event to hostapd. For older versions, - * also drop the frame to cooked monitor interfaces. - */ - /* - * [PLATA] when OCB is activated, we cannot use 4addr mode...(only three) - * - in this method, we configured the interface for NOT using 4-addr - */ - if (ieee80211_has_a4(hdr->frame_control) && - sdata->vif.type == NL80211_IFTYPE_AP) { - if (rx->sta && - !test_and_set_sta_flag(rx->sta, WLAN_STA_4ADDR_EVENT)) - cfg80211_rx_unexpected_4addr_frame( - rx->sdata->dev, rx->sta->sta.addr, GFP_ATOMIC); - return RX_DROP_MONITOR; - } - - err = __ieee80211_data_to_8023(rx, &port_control); - if (unlikely(err)) { - return RX_DROP_UNUSABLE; - } - - /* [PLATA] Don't need to check for authorization when OCB mode is activated */ - if ((local->hw.wiphy->dot11OCBActivated == 0) && !(local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - - if (!ieee80211_frame_allowed(rx, fc)) { - return RX_DROP_MONITOR; - } - } - - if (rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && - unlikely(port_control) && sdata->bss) { - sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, - u.ap); - dev = sdata->dev; - rx->sdata = sdata; - } - - rx->skb->dev = dev; - - dev->stats.rx_packets++; - dev->stats.rx_bytes += rx->skb->len; - - if (local->ps_sdata && local->hw.conf.dynamic_ps_timeout > 0 && - !is_multicast_ether_addr( - ((struct ethhdr *)rx->skb->data)->h_dest) && - (!local->scanning && - !test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state))) { - mod_timer(&local->dynamic_ps_timer, jiffies + - msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); - } - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- RX almost completed -- delivering the packet to SKB \n"); -#endif - ieee80211_deliver_skb(rx); - - return RX_QUEUED; -} - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx) -{ - struct ieee80211_local *local = rx->local; - struct ieee80211_hw *hw = &local->hw; - struct sk_buff *skb = rx->skb; - struct ieee80211_bar *bar = (struct ieee80211_bar *)skb->data; - struct tid_ampdu_rx *tid_agg_rx; - u16 start_seq_num; - u16 tid; - - if (likely(!ieee80211_is_ctl(bar->frame_control))) - return RX_CONTINUE; - - if (ieee80211_is_back_req(bar->frame_control)) { - struct { - __le16 control, start_seq_num; - } __packed bar_data; - - if (!rx->sta) - return RX_DROP_MONITOR; - - if (skb_copy_bits(skb, offsetof(struct ieee80211_bar, control), - &bar_data, sizeof(bar_data))) - return RX_DROP_MONITOR; - - tid = le16_to_cpu(bar_data.control) >> 12; - - tid_agg_rx = rcu_dereference(rx->sta->ampdu_mlme.tid_rx[tid]); - if (!tid_agg_rx) - return RX_DROP_MONITOR; - - start_seq_num = le16_to_cpu(bar_data.start_seq_num) >> 4; - - /* reset session timer */ - if (tid_agg_rx->timeout) - mod_timer(&tid_agg_rx->session_timer, - TU_TO_EXP_TIME(tid_agg_rx->timeout)); - - spin_lock(&tid_agg_rx->reorder_lock); - /* release stored frames up to start of BAR */ - ieee80211_release_reorder_frames(hw, tid_agg_rx, start_seq_num); - spin_unlock(&tid_agg_rx->reorder_lock); - - kfree_skb(skb); - return RX_QUEUED; - } - - /* - * After this point, we only want management frames, - * so we can drop all remaining control frames to - * cooked monitor interfaces. - */ - return RX_DROP_MONITOR; -} - -static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - size_t len) -{ - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *resp; - - if (compare_ether_addr(mgmt->da, sdata->vif.addr) != 0) { - /* Not to own unicast address */ - return; - } - - if (compare_ether_addr(mgmt->sa, sdata->u.mgd.bssid) != 0 || - compare_ether_addr(mgmt->bssid, sdata->u.mgd.bssid) != 0) { - /* Not from the current AP or not associated yet. */ - return; - } - - if (len < 24 + 1 + sizeof(resp->u.action.u.sa_query)) { - /* Too short SA Query request frame */ - return; - } - - skb = dev_alloc_skb(sizeof(*resp) + local->hw.extra_tx_headroom); - if (skb == NULL) - return; - - skb_reserve(skb, local->hw.extra_tx_headroom); - resp = (struct ieee80211_mgmt *) skb_put(skb, 24); - memset(resp, 0, 24); - memcpy(resp->da, mgmt->sa, ETH_ALEN); - memcpy(resp->sa, sdata->vif.addr, ETH_ALEN); - memcpy(resp->bssid, sdata->u.mgd.bssid, ETH_ALEN); - resp->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - skb_put(skb, 1 + sizeof(resp->u.action.u.sa_query)); - resp->u.action.category = WLAN_CATEGORY_SA_QUERY; - resp->u.action.u.sa_query.action = WLAN_ACTION_SA_QUERY_RESPONSE; - memcpy(resp->u.action.u.sa_query.trans_id, - mgmt->u.action.u.sa_query.trans_id, - WLAN_SA_QUERY_TR_ID_LEN); - - ieee80211_tx_skb(sdata, skb); -} - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx) -{ - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - - /* - * From here on, look only at management frames. - * Data and control frames are already handled, - * and unknown (reserved) frames are useless. - */ - if (rx->skb->len < 24) - return RX_DROP_MONITOR; - - if (!ieee80211_is_mgmt(mgmt->frame_control)) - return RX_DROP_MONITOR; - - if (rx->sdata->vif.type == NL80211_IFTYPE_AP && - ieee80211_is_beacon(mgmt->frame_control) && - !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) { - int sig = 0; - - if (rx->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) - sig = status->signal; - - cfg80211_report_obss_beacon(rx->local->hw.wiphy, - rx->skb->data, rx->skb->len, - status->freq, sig, GFP_ATOMIC); - rx->flags |= IEEE80211_RX_BEACON_REPORTED; - } - - if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) - return RX_DROP_MONITOR; - - if (ieee80211_drop_unencrypted_mgmt(rx)) - return RX_DROP_UNUSABLE; - - return RX_CONTINUE; -} - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_action(struct ieee80211_rx_data *rx) -{ - struct ieee80211_local *local = rx->local; - struct ieee80211_sub_if_data *sdata = rx->sdata; - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - int len = rx->skb->len; - - if (!ieee80211_is_action(mgmt->frame_control)) - return RX_CONTINUE; - - /* drop too small frames */ - if (len < IEEE80211_MIN_ACTION_SIZE) - return RX_DROP_UNUSABLE; - - if (!rx->sta && mgmt->u.action.category != WLAN_CATEGORY_PUBLIC) - return RX_DROP_UNUSABLE; - - if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) - return RX_DROP_UNUSABLE; - - switch (mgmt->u.action.category) { - case WLAN_CATEGORY_HT: - /* reject HT action frames from stations not supporting HT */ - if (!rx->sta->sta.ht_cap.ht_supported) - goto invalid; - - if (sdata->vif.type != NL80211_IFTYPE_STATION && - sdata->vif.type != NL80211_IFTYPE_MESH_POINT && - sdata->vif.type != NL80211_IFTYPE_AP_VLAN && - sdata->vif.type != NL80211_IFTYPE_AP && - sdata->vif.type != NL80211_IFTYPE_ADHOC) - break; - - /* verify action & smps_control are present */ - if (len < IEEE80211_MIN_ACTION_SIZE + 2) - goto invalid; - - switch (mgmt->u.action.u.ht_smps.action) { - case WLAN_HT_ACTION_SMPS: { - struct ieee80211_supported_band *sband; - u8 smps; - - /* convert to HT capability */ - switch (mgmt->u.action.u.ht_smps.smps_control) { - case WLAN_HT_SMPS_CONTROL_DISABLED: - smps = WLAN_HT_CAP_SM_PS_DISABLED; - break; - case WLAN_HT_SMPS_CONTROL_STATIC: - smps = WLAN_HT_CAP_SM_PS_STATIC; - break; - case WLAN_HT_SMPS_CONTROL_DYNAMIC: - smps = WLAN_HT_CAP_SM_PS_DYNAMIC; - break; - default: - goto invalid; - } - smps <<= IEEE80211_HT_CAP_SM_PS_SHIFT; - - /* if no change do nothing */ - if ((rx->sta->sta.ht_cap.cap & - IEEE80211_HT_CAP_SM_PS) == smps) - goto handled; - - rx->sta->sta.ht_cap.cap &= ~IEEE80211_HT_CAP_SM_PS; - rx->sta->sta.ht_cap.cap |= smps; - - sband = rx->local->hw.wiphy->bands[status->band]; - - rate_control_rate_update( - local, sband, rx->sta, - IEEE80211_RC_SMPS_CHANGED, - ieee80211_get_tx_channel_type( - local, local->_oper_channel_type)); - goto handled; - } - default: - goto invalid; - } - - break; - case WLAN_CATEGORY_BACK: - if (sdata->vif.type != NL80211_IFTYPE_STATION && - sdata->vif.type != NL80211_IFTYPE_MESH_POINT && - sdata->vif.type != NL80211_IFTYPE_AP_VLAN && - sdata->vif.type != NL80211_IFTYPE_AP && - sdata->vif.type != NL80211_IFTYPE_ADHOC) - break; - - /* verify action_code is present */ - if (len < IEEE80211_MIN_ACTION_SIZE + 1) - break; - - switch (mgmt->u.action.u.addba_req.action_code) { - case WLAN_ACTION_ADDBA_REQ: - if (len < (IEEE80211_MIN_ACTION_SIZE + - sizeof(mgmt->u.action.u.addba_req))) - goto invalid; - break; - case WLAN_ACTION_ADDBA_RESP: - if (len < (IEEE80211_MIN_ACTION_SIZE + - sizeof(mgmt->u.action.u.addba_resp))) - goto invalid; - break; - case WLAN_ACTION_DELBA: - if (len < (IEEE80211_MIN_ACTION_SIZE + - sizeof(mgmt->u.action.u.delba))) - goto invalid; - break; - default: - goto invalid; - } - - goto queue; - case WLAN_CATEGORY_SPECTRUM_MGMT: - if (local->hw.conf.channel->band != IEEE80211_BAND_5GHZ) - break; - - if (sdata->vif.type != NL80211_IFTYPE_STATION) - break; - - /* verify action_code is present */ - if (len < IEEE80211_MIN_ACTION_SIZE + 1) - break; - - switch (mgmt->u.action.u.measurement.action_code) { - case WLAN_ACTION_SPCT_MSR_REQ: - if (len < (IEEE80211_MIN_ACTION_SIZE + - sizeof(mgmt->u.action.u.measurement))) - break; - ieee80211_process_measurement_req(sdata, mgmt, len); - goto handled; - case WLAN_ACTION_SPCT_CHL_SWITCH: - if (len < (IEEE80211_MIN_ACTION_SIZE + - sizeof(mgmt->u.action.u.chan_switch))) - break; - - if (sdata->vif.type != NL80211_IFTYPE_STATION) - break; - - if (compare_ether_addr(mgmt->bssid, sdata->u.mgd.bssid)) - break; - - goto queue; - } - break; - case WLAN_CATEGORY_SA_QUERY: - if (len < (IEEE80211_MIN_ACTION_SIZE + - sizeof(mgmt->u.action.u.sa_query))) - break; - - switch (mgmt->u.action.u.sa_query.action) { - case WLAN_ACTION_SA_QUERY_REQUEST: - if (sdata->vif.type != NL80211_IFTYPE_STATION) - break; - ieee80211_process_sa_query_req(sdata, mgmt, len); - goto handled; - } - break; - case WLAN_CATEGORY_SELF_PROTECTED: - switch (mgmt->u.action.u.self_prot.action_code) { - case WLAN_SP_MESH_PEERING_OPEN: - case WLAN_SP_MESH_PEERING_CLOSE: - case WLAN_SP_MESH_PEERING_CONFIRM: - if (!ieee80211_vif_is_mesh(&sdata->vif)) - goto invalid; - if (sdata->u.mesh.security != IEEE80211_MESH_SEC_NONE) - /* userspace handles this frame */ - break; - goto queue; - case WLAN_SP_MGK_INFORM: - case WLAN_SP_MGK_ACK: - if (!ieee80211_vif_is_mesh(&sdata->vif)) - goto invalid; - break; - } - break; - case WLAN_CATEGORY_MESH_ACTION: - if (!ieee80211_vif_is_mesh(&sdata->vif)) - break; - if (mesh_action_is_path_sel(mgmt) && - (!mesh_path_sel_is_hwmp(sdata))) - break; - goto queue; - } - - return RX_CONTINUE; - - invalid: - status->rx_flags |= IEEE80211_RX_MALFORMED_ACTION_FRM; - /* will return in the next handlers */ - return RX_CONTINUE; - - handled: - if (rx->sta) - rx->sta->rx_packets++; - dev_kfree_skb(rx->skb); - return RX_QUEUED; - - queue: - rx->skb->pkt_type = IEEE80211_SDATA_QUEUE_TYPE_FRAME; - skb_queue_tail(&sdata->skb_queue, rx->skb); - ieee80211_queue_work(&local->hw, &sdata->work); - if (rx->sta) - rx->sta->rx_packets++; - return RX_QUEUED; -} - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx) -{ - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - int sig = 0; - - /* skip known-bad action frames and return them in the next handler */ - if (status->rx_flags & IEEE80211_RX_MALFORMED_ACTION_FRM) - return RX_CONTINUE; - - /* - * Getting here means the kernel doesn't know how to handle - * it, but maybe userspace does ... include returned frames - * so userspace can register for those to know whether ones - * it transmitted were processed or returned. - */ - - if (rx->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) - sig = status->signal; - - if (cfg80211_rx_mgmt(rx->sdata->dev, status->freq, sig, - rx->skb->data, rx->skb->len, - GFP_ATOMIC)) { - if (rx->sta) - rx->sta->rx_packets++; - dev_kfree_skb(rx->skb); - return RX_QUEUED; - } - - - return RX_CONTINUE; -} - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_action_return(struct ieee80211_rx_data *rx) -{ - struct ieee80211_local *local = rx->local; - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data; - struct sk_buff *nskb; - struct ieee80211_sub_if_data *sdata = rx->sdata; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(rx->skb); - - if (!ieee80211_is_action(mgmt->frame_control)) - return RX_CONTINUE; - - /* - * For AP mode, hostapd is responsible for handling any action - * frames that we didn't handle, including returning unknown - * ones. For all other modes we will return them to the sender, - * setting the 0x80 bit in the action category, as required by - * 802.11-2007 7.3.1.11. - * Newer versions of hostapd shall also use the management frame - * registration mechanisms, but older ones still use cooked - * monitor interfaces so push all frames there. - */ - if (!(status->rx_flags & IEEE80211_RX_MALFORMED_ACTION_FRM) && - (sdata->vif.type == NL80211_IFTYPE_AP || - sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) - return RX_DROP_MONITOR; - - /* do not return rejected action frames */ - if (mgmt->u.action.category & 0x80) - return RX_DROP_UNUSABLE; - - nskb = skb_copy_expand(rx->skb, local->hw.extra_tx_headroom, 0, - GFP_ATOMIC); - if (nskb) { - struct ieee80211_mgmt *nmgmt = (void *)nskb->data; - - nmgmt->u.action.category |= 0x80; - memcpy(nmgmt->da, nmgmt->sa, ETH_ALEN); - memcpy(nmgmt->sa, rx->sdata->vif.addr, ETH_ALEN); - - memset(nskb->cb, 0, sizeof(nskb->cb)); - - ieee80211_tx_skb(rx->sdata, nskb); - } - dev_kfree_skb(rx->skb); - return RX_QUEUED; -} - -static ieee80211_rx_result debug_noinline -ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) -{ - struct ieee80211_sub_if_data *sdata = rx->sdata; - struct ieee80211_mgmt *mgmt = (void *)rx->skb->data; - __le16 stype; - - stype = mgmt->frame_control & cpu_to_le16(IEEE80211_FCTL_STYPE); - - if (!ieee80211_vif_is_mesh(&sdata->vif) && - sdata->vif.type != NL80211_IFTYPE_ADHOC && - sdata->vif.type != NL80211_IFTYPE_STATION) - return RX_DROP_MONITOR; - - switch (stype) { - case cpu_to_le16(IEEE80211_STYPE_AUTH): - case cpu_to_le16(IEEE80211_STYPE_BEACON): - case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP): - /* process for all: mesh, mlme, ibss */ - break; - case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP): - case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP): - case cpu_to_le16(IEEE80211_STYPE_DEAUTH): - case cpu_to_le16(IEEE80211_STYPE_DISASSOC): - if (is_multicast_ether_addr(mgmt->da) && - !is_broadcast_ether_addr(mgmt->da)) - return RX_DROP_MONITOR; - - /* process only for station */ - if (sdata->vif.type != NL80211_IFTYPE_STATION) - return RX_DROP_MONITOR; - break; - case cpu_to_le16(IEEE80211_STYPE_PROBE_REQ): - /* process only for ibss */ - if (sdata->vif.type != NL80211_IFTYPE_ADHOC) - return RX_DROP_MONITOR; - break; - default: - return RX_DROP_MONITOR; - } - - /* queue up frame and kick off work to process it */ - rx->skb->pkt_type = IEEE80211_SDATA_QUEUE_TYPE_FRAME; - skb_queue_tail(&sdata->skb_queue, rx->skb); - ieee80211_queue_work(&rx->local->hw, &sdata->work); - if (rx->sta) - rx->sta->rx_packets++; - - return RX_QUEUED; -} - -/* TODO: use IEEE80211_RX_FRAGMENTED */ -static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx, - struct ieee80211_rate *rate) -{ - struct ieee80211_sub_if_data *sdata; - struct ieee80211_local *local = rx->local; - struct sk_buff *skb = rx->skb, *skb2; - struct net_device *prev_dev = NULL; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - int needed_headroom; - - /* - * If cooked monitor has been processed already, then - * don't do it again. If not, set the flag. - */ - if (rx->flags & IEEE80211_RX_CMNTR) - goto out_free_skb; - rx->flags |= IEEE80211_RX_CMNTR; - - /* If there are no cooked monitor interfaces, just free the SKB */ - if (!local->cooked_mntrs) - goto out_free_skb; - - /* room for the radiotap header based on driver features */ - needed_headroom = ieee80211_rx_radiotap_len(local, status); - - if (skb_headroom(skb) < needed_headroom && - pskb_expand_head(skb, needed_headroom, 0, GFP_ATOMIC)) - goto out_free_skb; - - /* prepend radiotap information */ - ieee80211_add_rx_radiotap_header(local, skb, rate, needed_headroom); - - skb_set_mac_header(skb, 0); - skb->ip_summed = CHECKSUM_UNNECESSARY; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = htons(ETH_P_802_2); - - list_for_each_entry_rcu(sdata, &local->interfaces, list) { - if (!ieee80211_sdata_running(sdata)) - continue; - - if (sdata->vif.type != NL80211_IFTYPE_MONITOR || - !(sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES)) - continue; - - if (prev_dev) { - skb2 = skb_clone(skb, GFP_ATOMIC); - if (skb2) { - skb2->dev = prev_dev; - netif_receive_skb(skb2); - } - } - - prev_dev = sdata->dev; - sdata->dev->stats.rx_packets++; - sdata->dev->stats.rx_bytes += skb->len; - } - - if (prev_dev) { - skb->dev = prev_dev; - netif_receive_skb(skb); - return; - } - - out_free_skb: - dev_kfree_skb(skb); -} - -static void ieee80211_rx_handlers_result(struct ieee80211_rx_data *rx, - ieee80211_rx_result res) -{ - switch (res) { - case RX_DROP_MONITOR: - I802_DEBUG_INC(rx->sdata->local->rx_handlers_drop); - if (rx->sta) - rx->sta->rx_dropped++; - /* fall through */ - case RX_CONTINUE: { - struct ieee80211_rate *rate = NULL; - struct ieee80211_supported_band *sband; - struct ieee80211_rx_status *status; - - status = IEEE80211_SKB_RXCB((rx->skb)); - - sband = rx->local->hw.wiphy->bands[status->band]; - if (!(status->flag & RX_FLAG_HT)) - rate = &sband->bitrates[status->rate_idx]; - - ieee80211_rx_cooked_monitor(rx, rate); - break; - } - case RX_DROP_UNUSABLE: - I802_DEBUG_INC(rx->sdata->local->rx_handlers_drop); - if (rx->sta) - rx->sta->rx_dropped++; - dev_kfree_skb(rx->skb); - break; - case RX_QUEUED: - I802_DEBUG_INC(rx->sdata->local->rx_handlers_queued); - break; - } -} - -static void ieee80211_rx_handlers(struct ieee80211_rx_data *rx) -{ - ieee80211_rx_result res = RX_DROP_MONITOR; - struct sk_buff *skb; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ieee80211_rx_handlers \n"); -#endif - -#define CALL_RXH(rxh) \ - do { \ - res = rxh(rx); \ - if (res != RX_CONTINUE) \ - goto rxh_next; \ - } while (0); - - spin_lock(&rx->local->rx_skb_queue.lock); - if (rx->local->running_rx_handler) - goto unlock; - - rx->local->running_rx_handler = true; - - while ((skb = __skb_dequeue(&rx->local->rx_skb_queue))) { - spin_unlock(&rx->local->rx_skb_queue.lock); - - /* - * all the other fields are valid across frames - * that belong to an aMPDU since they are on the - * same TID from the same station - */ - rx->skb = skb; - if((rx->local->hw.wiphy->dot11OCBActivated == 0) || !(rx->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) - { - CALL_RXH(ieee80211_rx_h_decrypt) // [PLATA] - no use for the OCB mode - CALL_RXH(ieee80211_rx_h_check_more_data) // [PLATA] - no use as we do not POLL in OCB - CALL_RXH(ieee80211_rx_h_uapsd_and_pspoll) // [PLATA] - no use as we do not poll (if AD_HOC, return) - } - CALL_RXH(ieee80211_rx_h_sta_process) // [PLATA]: does not do much but should not interfer.. - - if((rx->local->hw.wiphy->dot11OCBActivated == 0) || !(rx->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) - { - CALL_RXH(ieee80211_rx_h_defragment) // [PLATA] - fragmentation NOT supported so far.. - } - - if((rx->local->hw.wiphy->dot11OCBActivated == 0) || !(rx->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) - { - CALL_RXH(ieee80211_rx_h_michael_mic_verify) // [PLATA]: probably not necessary as no encryption - } - /* must be after MMIC verify so header is counted in MPDU mic */ -#ifdef CONFIG_MAC80211_MESH - if (ieee80211_vif_is_mesh(&rx->sdata->vif)) - CALL_RXH(ieee80211_rx_h_mesh_fwding); -#endif - CALL_RXH(ieee80211_rx_h_amsdu) // [PLATA]: can be left here..no change - // [PLATA] should probably avoid this method...as only used to put back a packet to the skb for AP relaying.. - CALL_RXH(ieee80211_rx_h_data) // [PLATA]: to double check..important calls (to deliver_skb notably - uncompleted part...TBC - /* - * [PLATA] - in this version of PLATA, we do not support these frames...or the OCB activated ignores management frames - * - * !!!! IMPORTANT !!!! - the previous call will exist in case of data packets (it returns RX_QUEUED and as such jumps to rxh_next) - * - so the rest of the code should always be ignored in this version of PLATA (we only support DATA packets) - */ - if((rx->local->hw.wiphy->dot11OCBActivated == 0) || !(rx->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) - { - CALL_RXH(ieee80211_rx_h_ctrl); // [PLATA] - not important, we do not have control frames - CALL_RXH(ieee80211_rx_h_mgmt_check) // [PLATA] - if OCB is activated, ignore as we do not have management frames (we do not monitor using beacons..) - CALL_RXH(ieee80211_rx_h_action) // [PLATA] - not sure..probably not useful - CALL_RXH(ieee80211_rx_h_userspace_mgmt) // [PLATA] - can be ignored...we do not use managmenet at userspace yet - - CALL_RXH(ieee80211_rx_h_action_return) // [PLATA] - linked to the action method..not useful here - - CALL_RXH(ieee80211_rx_h_mgmt) // [PLATA] - when OCB is activated, we shall not enter this method (we do not process mgmt frames such as auth, beacons, assoc etc.. - } - - rxh_next: - ieee80211_rx_handlers_result(rx, res); -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ieee80211_rx_handlers -- RX completed at MAC -- finishing process \n"); -#endif - spin_lock(&rx->local->rx_skb_queue.lock); -#undef CALL_RXH - } - - rx->local->running_rx_handler = false; - - unlock: - spin_unlock(&rx->local->rx_skb_queue.lock); -} - -static void ieee80211_invoke_rx_handlers(struct ieee80211_rx_data *rx) -{ - ieee80211_rx_result res = RX_DROP_MONITOR; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ieee80211_invoke_rx_handers \n"); -#endif - -#define CALL_RXH(rxh) \ - do { \ - res = rxh(rx); \ - if (res != RX_CONTINUE) \ - goto rxh_next; \ - } while (0); - - /* - * [PLATA] - we exit immediately if OCB is activated - */ - CALL_RXH(ieee80211_rx_h_passive_scan) - /* - * [PLATA] we do not do much in this part, as we do not do retransmission (and we most probably do not have a rx->sta) and we are ADHOC mode. - * - worst case: we update the receiving statistics.. - */ - CALL_RXH(ieee80211_rx_h_check) - - ieee80211_rx_reorder_ampdu(rx); - - ieee80211_rx_handlers(rx); - return; - - rxh_next: - ieee80211_rx_handlers_result(rx, res); - -#undef CALL_RXH -} - -/* - * This function makes calls into the RX path, therefore - * it has to be invoked under RCU read lock. - */ -void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) -{ - struct ieee80211_rx_data rx = { - .sta = sta, - .sdata = sta->sdata, - .local = sta->local, - /* This is OK -- must be QoS data frame */ - .security_idx = tid, - .seqno_idx = tid, - .flags = 0, - }; - struct tid_ampdu_rx *tid_agg_rx; - - tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); - if (!tid_agg_rx) - return; - - spin_lock(&tid_agg_rx->reorder_lock); - ieee80211_sta_reorder_release(&sta->local->hw, tid_agg_rx); - spin_unlock(&tid_agg_rx->reorder_lock); - - ieee80211_rx_handlers(&rx); -} - -/* main receive path */ -/* - * [PLATA] - considering the ADHOC mode and OCB activated, we - */ - -static int prepare_for_handlers(struct ieee80211_rx_data *rx, - struct ieee80211_hdr *hdr) -{ - struct ieee80211_sub_if_data *sdata = rx->sdata; - struct sk_buff *skb = rx->skb; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - u8 *bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type); // [PLATA] - should return the WildCard BSSID - int multicast = is_multicast_ether_addr(hdr->addr1); - - switch (sdata->vif.type) { - case NL80211_IFTYPE_STATION: - if (!bssid && !sdata->u.mgd.use_4addr) // no BSSID and not using all 4 addresses (as we would not have a BSSID in that case) - return 0; - if (!multicast && - compare_ether_addr(sdata->vif.addr, hdr->addr1) != 0) { // packet NOT for me - if (!(sdata->dev->flags & IFF_PROMISC) || - sdata->u.mgd.use_4addr) // if not Promi. mode OR if I use all four addresses - return 0; - status->rx_flags &= ~IEEE80211_RX_RA_MATCH; - } - break; - case NL80211_IFTYPE_ADHOC: - if (!bssid) - return 0; - if (ieee80211_is_beacon(hdr->frame_control)) { - return 1; - } - else if (!ieee80211_bssid_match(bssid, sdata->u.ibss.bssid)) { // do not have the same BSSID - [PLATA] - should not enter here as the wildcard BSSID makes it return true - if (!(status->rx_flags & IEEE80211_RX_IN_SCAN)) // not in SCAN MODE - return 0; - status->rx_flags &= ~IEEE80211_RX_RA_MATCH; - } else if (!multicast && - compare_ether_addr(sdata->vif.addr, - hdr->addr1) != 0) { // [PLATA]: not a multicast and packet is NOT for me TODO what about broadcast?? - if (!(sdata->dev->flags & IFF_PROMISC)) // not in Promisc Mode - return 0; - status->rx_flags &= ~IEEE80211_RX_RA_MATCH; - } else if (!rx->sta) { // [PLATA] do we enter here?? ...probably upon a first receive from an uknown IF, and if multicast, or broadcast or unicast and packet for me - int rate_idx; - if (status->flag & RX_FLAG_HT) // [PLATA] - we do not enter here... - rate_idx = 0; /* TODO: HT rates */ - else - rate_idx = status->rate_idx; - /* - * [PLATA] In OCB Mode, as we do not use Beacon, there is a high chance that a receiving STA does not have a reference to the sender STA - * - we enter here, even though we will not do much - * - as in OCB (similary to the IBSS and BSS using a wildcard BSSID), we have spontaneous communication and as such do not create an entry for remote sta - */ - - ieee80211_ibss_rx_no_sta(sdata, bssid, hdr->addr2, - BIT(rate_idx)); // trigger an IBSS receive...in case the local STA does not have a sta reference for the original sender in this IBSS (said differently, it means this sender was not part of the IBSS)... - } - break; - case NL80211_IFTYPE_MESH_POINT: - if (!multicast && - compare_ether_addr(sdata->vif.addr, - hdr->addr1) != 0) { - if (!(sdata->dev->flags & IFF_PROMISC)) - return 0; - - status->rx_flags &= ~IEEE80211_RX_RA_MATCH; - } - break; - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_AP: - if (!bssid) { - if (compare_ether_addr(sdata->vif.addr, - hdr->addr1)) - return 0; - } else if (!ieee80211_bssid_match(bssid, - sdata->vif.addr)) { - /* - * Accept public action frames even when the - * BSSID doesn't match, this is used for P2P - * and location updates. Note that mac80211 - * itself never looks at these frames. - */ - if (!(status->rx_flags & IEEE80211_RX_IN_SCAN) && - ieee80211_is_public_action(hdr, skb->len)) - return 1; - if (!(status->rx_flags & IEEE80211_RX_IN_SCAN) && - !ieee80211_is_beacon(hdr->frame_control)) - return 0; - status->rx_flags &= ~IEEE80211_RX_RA_MATCH; - } - break; - case NL80211_IFTYPE_WDS: - if (bssid || !ieee80211_is_data(hdr->frame_control)) - return 0; - if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2)) - return 0; - break; - default: - /* should never get here */ - WARN_ON(1); - break; - } - - return 1; -} - -/* - * This function returns whether or not the SKB - * was destined for RX processing or not, which, - * if consume is true, is equivalent to whether - * or not the skb was consumed. - */ -static bool ieee80211_prepare_and_rx_handle(struct ieee80211_rx_data *rx, - struct sk_buff *skb, bool consume) -{ - struct ieee80211_local *local = rx->local; - struct ieee80211_sub_if_data *sdata = rx->sdata; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_hdr *hdr = (void *)skb->data; - int prepares; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- %s ieee80211_prepare_and_rx_handle \n", sdata->name); -#endif - - rx->skb = skb; - status->rx_flags |= IEEE80211_RX_RA_MATCH; - prepares = prepare_for_handlers(rx, hdr); // [PLATA] - check to be completed..important filter flags - - if (!prepares) - return false; - - if (!consume) { // [PLATA] - first time we call it (we did not consume the SKB so far) - very likely in case of BROADCAST - skb = skb_copy(skb, GFP_ATOMIC); - if (!skb) { - if (net_ratelimit()) - wiphy_debug(local->hw.wiphy, - "failed to copy skb for %s\n", - sdata->name); - return true; - } - - rx->skb = skb; - } - - ieee80211_invoke_rx_handlers(rx); - return true; -} - -/* - * This is the actual Rx frames handler. as it blongs to Rx path it must - * be called with rcu_read_lock protection. - */ -static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_sub_if_data *sdata; - struct ieee80211_hdr *hdr; - __le16 fc; - struct ieee80211_rx_data rx; - struct ieee80211_sub_if_data *prev; - struct sta_info *sta, *tmp, *prev_sta; - int err = 0; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- __ieee80211_rx_handle_packet \n"); -#endif - - fc = ((struct ieee80211_hdr *)skb->data)->frame_control; - memset(&rx, 0, sizeof(rx)); - rx.skb = skb; - rx.local = local; - - if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc)) - local->dot11ReceivedFragmentCount++; - - if (unlikely(test_bit(SCAN_HW_SCANNING, &local->scanning) || - test_bit(SCAN_SW_SCANNING, &local->scanning))) - status->rx_flags |= IEEE80211_RX_IN_SCAN; - - if (ieee80211_is_mgmt(fc)) - err = skb_linearize(skb); - else - err = !pskb_may_pull(skb, ieee80211_hdrlen(fc)); - - if (err) { - dev_kfree_skb(skb); - return; - } - - hdr = (struct ieee80211_hdr *)skb->data; - /* - * [PLATA] even for non-QoS packet, we still need to get a queue priority (here 0 as we only have one queue) - */ - ieee80211_parse_qos(&rx); - ieee80211_verify_alignment(&rx); - - if (ieee80211_is_data(fc)) { - prev_sta = NULL; - - /* - * [PLATA] - hdr->addr2 is the source address - check if the STA has already been registered by this local sta - */ - for_each_sta_info(local, hdr->addr2, sta, tmp) { - if (!prev_sta) { - prev_sta = sta; - continue; - } - - rx.sta = prev_sta; - rx.sdata = prev_sta->sdata; -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- %s cycling over all known remote sta for address %pM \n", sdata->name, hdr->addr2); -#endif - ieee80211_prepare_and_rx_handle(&rx, skb, false); - - prev_sta = sta; - } - - if (prev_sta) { - rx.sta = prev_sta; - rx.sdata = prev_sta->sdata; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- %s LAST cycling over all known remote sta for address %pM \n", sdata->name, hdr->addr2); -#endif - if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) - return; - goto out; - } - } - - prev = NULL; - - list_for_each_entry_rcu(sdata, &local->interfaces, list) { - if (!ieee80211_sdata_running(sdata)) - continue; - - if (sdata->vif.type == NL80211_IFTYPE_MONITOR || - sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - continue; - - /* - * frame is destined for this interface, but if it's - * not also for the previous one we handle that after - * the loop to avoid copying the SKB once too much - */ - - if (!prev) { - prev = sdata; - continue; - } - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- %s cycling over all interfaces attached \n", sdata->name); -#endif - - rx.sta = sta_info_get_bss(prev, hdr->addr2); - rx.sdata = prev; - ieee80211_prepare_and_rx_handle(&rx, skb, false); - - prev = sdata; - } - - if (prev) { - rx.sta = sta_info_get_bss(prev, hdr->addr2); - rx.sdata = prev; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- %s LAST cycling over all interfaces attached \n", sdata->name); -#endif - - if (ieee80211_prepare_and_rx_handle(&rx, skb, true)) - return; - } - - out: - dev_kfree_skb(skb); -} - -/* - * This is the receive path handler. It is called by a low level driver when an - * 802.11 MPDU is received from the hardware. - */ -void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_rate *rate = NULL; - struct ieee80211_supported_band *sband; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - - WARN_ON_ONCE(softirq_count() == 0); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- DRIVER Called ieee80211_rx - Entering MAC for RX mode -- \n"); -#endif - - if (WARN_ON(status->band < 0 || - status->band >= IEEE80211_NUM_BANDS)) - goto drop; - - sband = local->hw.wiphy->bands[status->band]; - if (WARN_ON(!sband)) - goto drop; - - /* - * If we're suspending, it is possible although not too likely - * that we'd be receiving frames after having already partially - * quiesced the stack. We can't process such frames then since - * that might, for example, cause stations to be added or other - * driver callbacks be invoked. - */ - if (unlikely(local->quiescing || local->suspended)) - goto drop; - - /* - * The same happens when we're not even started, - * but that's worth a warning. - */ - if (WARN_ON(!local->started)) - goto drop; - - if (likely(!(status->flag & RX_FLAG_FAILED_PLCP_CRC))) { - /* - * Validate the rate, unless a PLCP error means that - * we probably can't have a valid rate here anyway. - */ - - if (status->flag & RX_FLAG_HT) { - /* - * rate_idx is MCS index, which can be [0-76] - * as documented on: - * - * http://wireless.kernel.org/en/developers/Documentation/ieee80211/802.11n - * - * Anything else would be some sort of driver or - * hardware error. The driver should catch hardware - * errors. - */ - if (WARN((status->rate_idx < 0 || - status->rate_idx > 76), - "Rate marked as an HT rate but passed " - "status->rate_idx is not " - "an MCS index [0-76]: %d (0x%02x)\n", - status->rate_idx, - status->rate_idx)) - goto drop; - } else { - if (WARN_ON(status->rate_idx < 0 || - status->rate_idx >= sband->n_bitrates)) - goto drop; - rate = &sband->bitrates[status->rate_idx]; - } - } - - status->rx_flags = 0; - - /* - * key references and virtual interfaces are protected using RCU - * and this requires that we are in a read-side RCU section during - * receive processing - */ - rcu_read_lock(); - - /* - * Frames with failed FCS/PLCP checksum are not returned, - * all other frames are returned without radiotap header - * if it was previously present. - * Also, frames with less than 16 bytes are dropped. - */ - /* - * [PLATA] - we do not support monitoring in this version of PLATA - * - we should bypass it... - */ - /*skb = ieee80211_rx_monitor(local, skb, rate); - if (!skb) { - rcu_read_unlock(); - return; - }*/ - - ieee80211_tpt_led_trig_rx(local, - ((struct ieee80211_hdr *)skb->data)->frame_control, - skb->len); - __ieee80211_rx_handle_packet(hw, skb); - - rcu_read_unlock(); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- RX Process at MAC -- Complete\n"); -#endif - return; - drop: - printk(KERN_DEBUG "-- RX Process at MAC -- Drop\n"); - kfree_skb(skb); -} -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) -EXPORT_SYMBOL(ieee80211_rx); -#else -EXPORT_SYMBOL(mac80211_ieee80211_rx); -#endif - - -/* This is a version of the rx handler that can be called from hard irq - * context. Post the skb on the queue and schedule the tasklet */ -void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - struct ieee80211_local *local = hw_to_local(hw); - - BUILD_BUG_ON(sizeof(struct ieee80211_rx_status) > sizeof(skb->cb)); - - skb->pkt_type = IEEE80211_RX_MSG; - skb_queue_tail(&local->skb_queue, skb); - tasklet_schedule(&local->tasklet); -} -EXPORT_SYMBOL(ieee80211_rx_irqsafe); diff --git a/openairITS/mac/DOT11/net/mac80211/scan.c b/openairITS/mac/DOT11/net/mac80211/scan.c deleted file mode 100644 index c70e1767713..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/scan.c +++ /dev/null @@ -1,974 +0,0 @@ -/* - * Scanning implementation - * - * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi> - * Copyright 2004, Instant802 Networks, Inc. - * Copyright 2005, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007, Michael Wu <flamingice@sourmilk.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/if_arp.h> -#include <linux/etherdevice.h> -#include <linux/rtnetlink.h> -#include <linux/pm_qos.h> -#include <net/sch_generic.h> -#include <linux/slab.h> -#include <linux/export.h> -#include <net/mac80211.h> - -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "mesh.h" - -#define IEEE80211_PROBE_DELAY (HZ / 33) -#define IEEE80211_CHANNEL_TIME (HZ / 33) -#define IEEE80211_PASSIVE_CHANNEL_TIME (HZ / 8) - -struct ieee80211_bss * -ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, - u8 *ssid, u8 ssid_len) -{ - struct cfg80211_bss *cbss; - - cbss = cfg80211_get_bss(local->hw.wiphy, - ieee80211_get_channel(local->hw.wiphy, freq), - bssid, ssid, ssid_len, 0, 0); - if (!cbss) - return NULL; - return (void *)cbss->priv; -} - -static void ieee80211_rx_bss_free(struct cfg80211_bss *cbss) -{ - struct ieee80211_bss *bss = (void *)cbss->priv; - - kfree(bss_mesh_id(bss)); - kfree(bss_mesh_cfg(bss)); -} - -void ieee80211_rx_bss_put(struct ieee80211_local *local, - struct ieee80211_bss *bss) -{ - if (!bss) - return; - cfg80211_put_bss(container_of((void *)bss, struct cfg80211_bss, priv)); -} - -static bool is_uapsd_supported(struct ieee802_11_elems *elems) -{ - u8 qos_info; - - if (elems->wmm_info && elems->wmm_info_len == 7 - && elems->wmm_info[5] == 1) - qos_info = elems->wmm_info[6]; - else if (elems->wmm_param && elems->wmm_param_len == 24 - && elems->wmm_param[5] == 1) - qos_info = elems->wmm_param[6]; - else - /* no valid wmm information or parameter element found */ - return false; - - return qos_info & IEEE80211_WMM_IE_AP_QOSINFO_UAPSD; -} - -struct ieee80211_bss * -ieee80211_bss_info_update(struct ieee80211_local *local, - struct ieee80211_rx_status *rx_status, - struct ieee80211_mgmt *mgmt, - size_t len, - struct ieee802_11_elems *elems, - struct ieee80211_channel *channel, - bool beacon) -{ - struct cfg80211_bss *cbss; - struct ieee80211_bss *bss; - int clen, srlen; - s32 signal = 0; - - if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) - signal = rx_status->signal * 100; - else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) - signal = (rx_status->signal * 100) / local->hw.max_signal; - - cbss = cfg80211_inform_bss_frame(local->hw.wiphy, channel, - mgmt, len, signal, GFP_ATOMIC); - - if (!cbss) - return NULL; - - cbss->free_priv = ieee80211_rx_bss_free; - bss = (void *)cbss->priv; - - if (elems->parse_error) { - if (beacon) - bss->corrupt_data |= IEEE80211_BSS_CORRUPT_BEACON; - else - bss->corrupt_data |= IEEE80211_BSS_CORRUPT_PROBE_RESP; - } else { - if (beacon) - bss->corrupt_data &= ~IEEE80211_BSS_CORRUPT_BEACON; - else - bss->corrupt_data &= ~IEEE80211_BSS_CORRUPT_PROBE_RESP; - } - - /* save the ERP value so that it is available at association time */ - if (elems->erp_info && elems->erp_info_len >= 1 && - (!elems->parse_error || - !(bss->valid_data & IEEE80211_BSS_VALID_ERP))) { - bss->erp_value = elems->erp_info[0]; - bss->has_erp_value = true; - if (!elems->parse_error) - bss->valid_data |= IEEE80211_BSS_VALID_ERP; - } - - if (elems->tim && (!elems->parse_error || - !(bss->valid_data & IEEE80211_BSS_VALID_DTIM))) { - struct ieee80211_tim_ie *tim_ie = - (struct ieee80211_tim_ie *)elems->tim; - bss->dtim_period = tim_ie->dtim_period; - if (!elems->parse_error) - bss->valid_data |= IEEE80211_BSS_VALID_DTIM; - } - - /* If the beacon had no TIM IE, or it was invalid, use 1 */ - if (beacon && !bss->dtim_period) - bss->dtim_period = 1; - - /* replace old supported rates if we get new values */ - if (!elems->parse_error || - !(bss->valid_data & IEEE80211_BSS_VALID_RATES)) { - srlen = 0; - if (elems->supp_rates) { - clen = IEEE80211_MAX_SUPP_RATES; - if (clen > elems->supp_rates_len) - clen = elems->supp_rates_len; - memcpy(bss->supp_rates, elems->supp_rates, clen); - srlen += clen; - } - if (elems->ext_supp_rates) { - clen = IEEE80211_MAX_SUPP_RATES - srlen; - if (clen > elems->ext_supp_rates_len) - clen = elems->ext_supp_rates_len; - memcpy(bss->supp_rates + srlen, elems->ext_supp_rates, - clen); - srlen += clen; - } - if (srlen) { - bss->supp_rates_len = srlen; - if (!elems->parse_error) - bss->valid_data |= IEEE80211_BSS_VALID_RATES; - } - } - - if (!elems->parse_error || - !(bss->valid_data & IEEE80211_BSS_VALID_WMM)) { - bss->wmm_used = elems->wmm_param || elems->wmm_info; - bss->uapsd_supported = is_uapsd_supported(elems); - if (!elems->parse_error) - bss->valid_data |= IEEE80211_BSS_VALID_WMM; - } - - if (!beacon) - bss->last_probe_resp = jiffies; - - return bss; -} - -ieee80211_rx_result -ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) -{ - struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_mgmt *mgmt; - struct ieee80211_bss *bss; - u8 *elements; - struct ieee80211_channel *channel; - size_t baselen; - int freq; - __le16 fc; - bool presp, beacon = false; - struct ieee802_11_elems elems; - - if (skb->len < 2) - return RX_DROP_UNUSABLE; - - mgmt = (struct ieee80211_mgmt *) skb->data; - fc = mgmt->frame_control; - - if (ieee80211_is_ctl(fc)) - return RX_CONTINUE; - - if (skb->len < 24) - return RX_CONTINUE; - - presp = ieee80211_is_probe_resp(fc); - if (presp) { - /* ignore ProbeResp to foreign address */ - if (compare_ether_addr(mgmt->da, sdata->vif.addr)) - return RX_DROP_MONITOR; - - presp = true; - elements = mgmt->u.probe_resp.variable; - baselen = offsetof(struct ieee80211_mgmt, u.probe_resp.variable); - } else { - beacon = ieee80211_is_beacon(fc); - baselen = offsetof(struct ieee80211_mgmt, u.beacon.variable); - elements = mgmt->u.beacon.variable; - } - - if (!presp && !beacon) - return RX_CONTINUE; - - if (baselen > skb->len) - return RX_DROP_MONITOR; - - ieee802_11_parse_elems(elements, skb->len - baselen, &elems); - - if (elems.ds_params && elems.ds_params_len == 1) - freq = ieee80211_channel_to_frequency(elems.ds_params[0], - rx_status->band); - else - freq = rx_status->freq; - - channel = ieee80211_get_channel(sdata->local->hw.wiphy, freq); - - if (!channel || channel->flags & IEEE80211_CHAN_DISABLED) - return RX_DROP_MONITOR; - - bss = ieee80211_bss_info_update(sdata->local, rx_status, - mgmt, skb->len, &elems, - channel, beacon); - if (bss) - ieee80211_rx_bss_put(sdata->local, bss); - - if (channel == sdata->local->oper_channel) - return RX_CONTINUE; - - dev_kfree_skb(skb); - return RX_QUEUED; -} - -/* return false if no more work */ -static bool ieee80211_prep_hw_scan(struct ieee80211_local *local) -{ - struct cfg80211_scan_request *req = local->scan_req; - enum ieee80211_band band; - int i, ielen, n_chans; - - do { - if (local->hw_scan_band == IEEE80211_NUM_BANDS) - return false; - - band = local->hw_scan_band; - n_chans = 0; - for (i = 0; i < req->n_channels; i++) { - if (req->channels[i]->band == band) { - local->hw_scan_req->channels[n_chans] = - req->channels[i]; - n_chans++; - } - } - - local->hw_scan_band++; - } while (!n_chans); - - local->hw_scan_req->n_channels = n_chans; - - ielen = ieee80211_build_preq_ies(local, (u8 *)local->hw_scan_req->ie, - req->ie, req->ie_len, band, - req->rates[band], 0); - local->hw_scan_req->ie_len = ielen; - local->hw_scan_req->no_cck = req->no_cck; - - return true; -} - -static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted, - bool was_hw_scan) -{ - struct ieee80211_local *local = hw_to_local(hw); - - lockdep_assert_held(&local->mtx); - - /* - * It's ok to abort a not-yet-running scan (that - * we have one at all will be verified by checking - * local->scan_req next), but not to complete it - * successfully. - */ - if (WARN_ON(!local->scanning && !aborted)) - aborted = true; - - if (WARN_ON(!local->scan_req)) - return; - - if (was_hw_scan && !aborted && ieee80211_prep_hw_scan(local)) { - int rc = drv_hw_scan(local, local->scan_sdata, local->hw_scan_req); - if (rc == 0) - return; - } - - kfree(local->hw_scan_req); - local->hw_scan_req = NULL; - - if (local->scan_req != local->int_scan_req) - cfg80211_scan_done(local->scan_req, aborted); - local->scan_req = NULL; - local->scan_sdata = NULL; - - local->scanning = 0; - local->scan_channel = NULL; - - /* Set power back to normal operating levels. */ - ieee80211_hw_config(local, 0); - - if (!was_hw_scan) { - ieee80211_configure_filter(local); - drv_sw_scan_complete(local); - ieee80211_offchannel_return(local, true); - } - - ieee80211_recalc_idle(local); - - ieee80211_mlme_notify_scan_completed(local); - ieee80211_ibss_notify_scan_completed(local); - ieee80211_mesh_notify_scan_completed(local); - ieee80211_queue_work(&local->hw, &local->work_work); -} - -void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) -{ - struct ieee80211_local *local = hw_to_local(hw); - - trace_api_scan_completed(local, aborted); - - set_bit(SCAN_COMPLETED, &local->scanning); - if (aborted) - set_bit(SCAN_ABORTED, &local->scanning); - ieee80211_queue_delayed_work(&local->hw, &local->scan_work, 0); -} -EXPORT_SYMBOL(ieee80211_scan_completed); - -static int ieee80211_start_sw_scan(struct ieee80211_local *local) -{ - /* - * Hardware/driver doesn't support hw_scan, so use software - * scanning instead. First send a nullfunc frame with power save - * bit on so that AP will buffer the frames for us while we are not - * listening, then send probe requests to each channel and wait for - * the responses. After all channels are scanned, tune back to the - * original channel and send a nullfunc frame with power save bit - * off to trigger the AP to send us all the buffered frames. - * - * Note that while local->sw_scanning is true everything else but - * nullfunc frames and probe requests will be dropped in - * ieee80211_tx_h_check_assoc(). - */ - drv_sw_scan_start(local); - - local->leave_oper_channel_time = jiffies; - local->next_scan_state = SCAN_DECISION; - local->scan_channel_idx = 0; - - ieee80211_offchannel_stop_vifs(local, true); - - ieee80211_configure_filter(local); - - /* We need to set power level at maximum rate for scanning. */ - ieee80211_hw_config(local, 0); - - ieee80211_queue_delayed_work(&local->hw, - &local->scan_work, 0); - - return 0; -} - - -static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, - struct cfg80211_scan_request *req) -{ - struct ieee80211_local *local = sdata->local; - int rc; - - lockdep_assert_held(&local->mtx); - - if (local->scan_req) - return -EBUSY; - - if (!list_empty(&local->work_list)) { - /* wait for the work to finish/time out */ - local->scan_req = req; - local->scan_sdata = sdata; - return 0; - } - - if (local->ops->hw_scan) { - u8 *ies; - - local->hw_scan_req = kmalloc( - sizeof(*local->hw_scan_req) + - req->n_channels * sizeof(req->channels[0]) + - 2 + IEEE80211_MAX_SSID_LEN + local->scan_ies_len + - req->ie_len, GFP_KERNEL); - if (!local->hw_scan_req) - return -ENOMEM; - - local->hw_scan_req->ssids = req->ssids; - local->hw_scan_req->n_ssids = req->n_ssids; - ies = (u8 *)local->hw_scan_req + - sizeof(*local->hw_scan_req) + - req->n_channels * sizeof(req->channels[0]); - local->hw_scan_req->ie = ies; - - local->hw_scan_band = 0; - - /* - * After allocating local->hw_scan_req, we must - * go through until ieee80211_prep_hw_scan(), so - * anything that might be changed here and leave - * this function early must not go after this - * allocation. - */ - } - - local->scan_req = req; - local->scan_sdata = sdata; - - if (local->ops->hw_scan) - __set_bit(SCAN_HW_SCANNING, &local->scanning); - else - __set_bit(SCAN_SW_SCANNING, &local->scanning); - - ieee80211_recalc_idle(local); - - if (local->ops->hw_scan) { - WARN_ON(!ieee80211_prep_hw_scan(local)); - rc = drv_hw_scan(local, sdata, local->hw_scan_req); - } else - rc = ieee80211_start_sw_scan(local); - - if (rc) { - kfree(local->hw_scan_req); - local->hw_scan_req = NULL; - local->scanning = 0; - - ieee80211_recalc_idle(local); - - local->scan_req = NULL; - local->scan_sdata = NULL; - } - - return rc; -} - -static unsigned long -ieee80211_scan_get_channel_time(struct ieee80211_channel *chan) -{ - /* - * TODO: channel switching also consumes quite some time, - * add that delay as well to get a better estimation - */ - if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) - return IEEE80211_PASSIVE_CHANNEL_TIME; - return IEEE80211_PROBE_DELAY + IEEE80211_CHANNEL_TIME; -} - -static void ieee80211_scan_state_decision(struct ieee80211_local *local, - unsigned long *next_delay) -{ - bool associated = false; - bool tx_empty = true; - bool bad_latency; - bool listen_int_exceeded; - unsigned long min_beacon_int = 0; - struct ieee80211_sub_if_data *sdata; - struct ieee80211_channel *next_chan; - - /* - * check if at least one STA interface is associated, - * check if at least one STA interface has pending tx frames - * and grab the lowest used beacon interval - */ - mutex_lock(&local->iflist_mtx); - list_for_each_entry(sdata, &local->interfaces, list) { - if (!ieee80211_sdata_running(sdata)) - continue; - - if (sdata->vif.type == NL80211_IFTYPE_STATION) { - if (sdata->u.mgd.associated) { - associated = true; - - if (sdata->vif.bss_conf.beacon_int < - min_beacon_int || min_beacon_int == 0) - min_beacon_int = - sdata->vif.bss_conf.beacon_int; - - if (!qdisc_all_tx_empty(sdata->dev)) { - tx_empty = false; - break; - } - } - } - } - mutex_unlock(&local->iflist_mtx); - - next_chan = local->scan_req->channels[local->scan_channel_idx]; - - /* - * we're currently scanning a different channel, let's - * see if we can scan another channel without interfering - * with the current traffic situation. - * - * Since we don't know if the AP has pending frames for us - * we can only check for our tx queues and use the current - * pm_qos requirements for rx. Hence, if no tx traffic occurs - * at all we will scan as many channels in a row as the pm_qos - * latency allows us to. Additionally we also check for the - * currently negotiated listen interval to prevent losing - * frames unnecessarily. - * - * Otherwise switch back to the operating channel. - */ - - bad_latency = time_after(jiffies + - ieee80211_scan_get_channel_time(next_chan), - local->leave_oper_channel_time + - usecs_to_jiffies(pm_qos_request(PM_QOS_NETWORK_LATENCY))); - - listen_int_exceeded = time_after(jiffies + - ieee80211_scan_get_channel_time(next_chan), - local->leave_oper_channel_time + - usecs_to_jiffies(min_beacon_int * 1024) * - local->hw.conf.listen_interval); - - if (associated && (!tx_empty || bad_latency || listen_int_exceeded)) - local->next_scan_state = SCAN_SUSPEND; - else - local->next_scan_state = SCAN_SET_CHANNEL; - - *next_delay = 0; -} - -static void ieee80211_scan_state_set_channel(struct ieee80211_local *local, - unsigned long *next_delay) -{ - int skip; - struct ieee80211_channel *chan; - - skip = 0; - chan = local->scan_req->channels[local->scan_channel_idx]; - - local->scan_channel = chan; - - if (ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL)) - skip = 1; - - /* advance state machine to next channel/band */ - local->scan_channel_idx++; - - if (skip) { - /* if we skip this channel return to the decision state */ - local->next_scan_state = SCAN_DECISION; - return; - } - - /* - * Probe delay is used to update the NAV, cf. 11.1.3.2.2 - * (which unfortunately doesn't say _why_ step a) is done, - * but it waits for the probe delay or until a frame is - * received - and the received frame would update the NAV). - * For now, we do not support waiting until a frame is - * received. - * - * In any case, it is not necessary for a passive scan. - */ - if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN || - !local->scan_req->n_ssids) { - *next_delay = IEEE80211_PASSIVE_CHANNEL_TIME; - local->next_scan_state = SCAN_DECISION; - return; - } - - /* active scan, send probes */ - *next_delay = IEEE80211_PROBE_DELAY; - local->next_scan_state = SCAN_SEND_PROBE; -} - -static void ieee80211_scan_state_send_probe(struct ieee80211_local *local, - unsigned long *next_delay) -{ - int i; - struct ieee80211_sub_if_data *sdata = local->scan_sdata; - enum ieee80211_band band = local->hw.conf.channel->band; - - for (i = 0; i < local->scan_req->n_ssids; i++) - ieee80211_send_probe_req( - sdata, NULL, - local->scan_req->ssids[i].ssid, - local->scan_req->ssids[i].ssid_len, - local->scan_req->ie, local->scan_req->ie_len, - local->scan_req->rates[band], false, - local->scan_req->no_cck); - - /* - * After sending probe requests, wait for probe responses - * on the channel. - */ - *next_delay = IEEE80211_CHANNEL_TIME; - local->next_scan_state = SCAN_DECISION; -} - -static void ieee80211_scan_state_suspend(struct ieee80211_local *local, - unsigned long *next_delay) -{ - /* switch back to the operating channel */ - local->scan_channel = NULL; - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); - - /* - * Re-enable vifs and beaconing. Leave PS - * in off-channel state..will put that back - * on-channel at the end of scanning. - */ - ieee80211_offchannel_return(local, false); - - *next_delay = HZ / 5; - /* afterwards, resume scan & go to next channel */ - local->next_scan_state = SCAN_RESUME; -} - -static void ieee80211_scan_state_resume(struct ieee80211_local *local, - unsigned long *next_delay) -{ - /* PS already is in off-channel mode */ - ieee80211_offchannel_stop_vifs(local, false); - - if (local->ops->flush) { - drv_flush(local, false); - *next_delay = 0; - } else - *next_delay = HZ / 10; - - /* remember when we left the operating channel */ - local->leave_oper_channel_time = jiffies; - - /* advance to the next channel to be scanned */ - local->next_scan_state = SCAN_SET_CHANNEL; -} - -void ieee80211_scan_work(struct work_struct *work) -{ - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, scan_work.work); - struct ieee80211_sub_if_data *sdata; - unsigned long next_delay = 0; - bool aborted, hw_scan; - - mutex_lock(&local->mtx); - - sdata = local->scan_sdata; - - if (test_and_clear_bit(SCAN_COMPLETED, &local->scanning)) { - aborted = test_and_clear_bit(SCAN_ABORTED, &local->scanning); - goto out_complete; - } - - if (!sdata || !local->scan_req) - goto out; - - if (local->scan_req && !local->scanning) { - struct cfg80211_scan_request *req = local->scan_req; - int rc; - - local->scan_req = NULL; - local->scan_sdata = NULL; - - rc = __ieee80211_start_scan(sdata, req); - if (rc) { - /* need to complete scan in cfg80211 */ - local->scan_req = req; - aborted = true; - goto out_complete; - } else - goto out; - } - - /* - * Avoid re-scheduling when the sdata is going away. - */ - if (!ieee80211_sdata_running(sdata)) { - aborted = true; - goto out_complete; - } - - /* - * as long as no delay is required advance immediately - * without scheduling a new work - */ - do { - if (!ieee80211_sdata_running(sdata)) { - aborted = true; - goto out_complete; - } - - switch (local->next_scan_state) { - case SCAN_DECISION: - /* if no more bands/channels left, complete scan */ - if (local->scan_channel_idx >= local->scan_req->n_channels) { - aborted = false; - goto out_complete; - } - ieee80211_scan_state_decision(local, &next_delay); - break; - case SCAN_SET_CHANNEL: - ieee80211_scan_state_set_channel(local, &next_delay); - break; - case SCAN_SEND_PROBE: - ieee80211_scan_state_send_probe(local, &next_delay); - break; - case SCAN_SUSPEND: - ieee80211_scan_state_suspend(local, &next_delay); - break; - case SCAN_RESUME: - ieee80211_scan_state_resume(local, &next_delay); - break; - } - } while (next_delay == 0); - - ieee80211_queue_delayed_work(&local->hw, &local->scan_work, next_delay); - goto out; - -out_complete: - hw_scan = test_bit(SCAN_HW_SCANNING, &local->scanning); - __ieee80211_scan_completed(&local->hw, aborted, hw_scan); -out: - mutex_unlock(&local->mtx); -} - -int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, - struct cfg80211_scan_request *req) -{ - int res; - - mutex_lock(&sdata->local->mtx); - res = __ieee80211_start_scan(sdata, req); - mutex_unlock(&sdata->local->mtx); - - return res; -} - -int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, - const u8 *ssid, u8 ssid_len, - struct ieee80211_channel *chan) -{ - struct ieee80211_local *local = sdata->local; - int ret = -EBUSY; - enum ieee80211_band band; - - mutex_lock(&local->mtx); - - /* busy scanning */ - if (local->scan_req) - goto unlock; - - /* fill internal scan request */ - if (!chan) { - int i, nchan = 0; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - if (!local->hw.wiphy->bands[band]) - continue; - for (i = 0; - i < local->hw.wiphy->bands[band]->n_channels; - i++) { - local->int_scan_req->channels[nchan] = - &local->hw.wiphy->bands[band]->channels[i]; - nchan++; - } - } - - local->int_scan_req->n_channels = nchan; - } else { - local->int_scan_req->channels[0] = chan; - local->int_scan_req->n_channels = 1; - } - - local->int_scan_req->ssids = &local->scan_ssid; - local->int_scan_req->n_ssids = 1; - memcpy(local->int_scan_req->ssids[0].ssid, ssid, IEEE80211_MAX_SSID_LEN); - local->int_scan_req->ssids[0].ssid_len = ssid_len; - - ret = __ieee80211_start_scan(sdata, sdata->local->int_scan_req); - unlock: - mutex_unlock(&local->mtx); - return ret; -} - -/* - * Only call this function when a scan can't be queued -- under RTNL. - */ -void ieee80211_scan_cancel(struct ieee80211_local *local) -{ - /* - * We are canceling software scan, or deferred scan that was not - * yet really started (see __ieee80211_start_scan ). - * - * Regarding hardware scan: - * - we can not call __ieee80211_scan_completed() as when - * SCAN_HW_SCANNING bit is set this function change - * local->hw_scan_req to operate on 5G band, what race with - * driver which can use local->hw_scan_req - * - * - we can not cancel scan_work since driver can schedule it - * by ieee80211_scan_completed(..., true) to finish scan - * - * Hence we only call the cancel_hw_scan() callback, but the low-level - * driver is still responsible for calling ieee80211_scan_completed() - * after the scan was completed/aborted. - */ - - mutex_lock(&local->mtx); - if (!local->scan_req) - goto out; - - if (test_bit(SCAN_HW_SCANNING, &local->scanning)) { - if (local->ops->cancel_hw_scan) - drv_cancel_hw_scan(local, local->scan_sdata); - goto out; - } - - /* - * If the work is currently running, it must be blocked on - * the mutex, but we'll set scan_sdata = NULL and it'll - * simply exit once it acquires the mutex. - */ - cancel_delayed_work(&local->scan_work); - /* and clean up */ - __ieee80211_scan_completed(&local->hw, true, false); -out: - mutex_unlock(&local->mtx); -} - -int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, - struct cfg80211_sched_scan_request *req) -{ - struct ieee80211_local *local = sdata->local; - int ret, i; - - mutex_lock(&sdata->local->mtx); - - if (local->sched_scanning) { - ret = -EBUSY; - goto out; - } - - if (!local->ops->sched_scan_start) { - ret = -ENOTSUPP; - goto out; - } - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) { - local->sched_scan_ies.ie[i] = kzalloc(2 + - IEEE80211_MAX_SSID_LEN + - local->scan_ies_len + - req->ie_len, - GFP_KERNEL); - if (!local->sched_scan_ies.ie[i]) { - ret = -ENOMEM; - goto out_free; - } - - local->sched_scan_ies.len[i] = - ieee80211_build_preq_ies(local, - local->sched_scan_ies.ie[i], - req->ie, req->ie_len, i, - (u32) -1, 0); - } - - ret = drv_sched_scan_start(local, sdata, req, - &local->sched_scan_ies); - if (ret == 0) { - local->sched_scanning = true; - goto out; - } - -out_free: - while (i > 0) - kfree(local->sched_scan_ies.ie[--i]); -out: - mutex_unlock(&sdata->local->mtx); - return ret; -} - -int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - int ret = 0, i; - - mutex_lock(&sdata->local->mtx); - - if (!local->ops->sched_scan_stop) { - ret = -ENOTSUPP; - goto out; - } - - if (local->sched_scanning) { - for (i = 0; i < IEEE80211_NUM_BANDS; i++) - kfree(local->sched_scan_ies.ie[i]); - - drv_sched_scan_stop(local, sdata); - local->sched_scanning = false; - } -out: - mutex_unlock(&sdata->local->mtx); - - return ret; -} - -void ieee80211_sched_scan_results(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - trace_api_sched_scan_results(local); - - cfg80211_sched_scan_results(hw->wiphy); -} -EXPORT_SYMBOL(ieee80211_sched_scan_results); - -void ieee80211_sched_scan_stopped_work(struct work_struct *work) -{ - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, - sched_scan_stopped_work); - int i; - - mutex_lock(&local->mtx); - - if (!local->sched_scanning) { - mutex_unlock(&local->mtx); - return; - } - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) - kfree(local->sched_scan_ies.ie[i]); - - local->sched_scanning = false; - - mutex_unlock(&local->mtx); - - cfg80211_sched_scan_stopped(local->hw.wiphy); -} - -void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw) -{ - struct ieee80211_local *local = hw_to_local(hw); - - trace_api_sched_scan_stopped(local); - - ieee80211_queue_work(&local->hw, &local->sched_scan_stopped_work); -} -EXPORT_SYMBOL(ieee80211_sched_scan_stopped); diff --git a/openairITS/mac/DOT11/net/mac80211/spectmgmt.c b/openairITS/mac/DOT11/net/mac80211/spectmgmt.c deleted file mode 100644 index 578eea3fc04..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/spectmgmt.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * spectrum management - * - * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi> - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007, Michael Wu <flamingice@sourmilk.net> - * Copyright 2007-2008, Intel Corporation - * Copyright 2008, Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/ieee80211.h> -#include <net/cfg80211.h> -#include <net/mac80211.h> -#include "ieee80211_i.h" -#include "sta_info.h" -#include "wme.h" - -static void ieee80211_send_refuse_measurement_request(struct ieee80211_sub_if_data *sdata, - struct ieee80211_msrment_ie *request_ie, - const u8 *da, const u8 *bssid, - u8 dialog_token) -{ - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *msr_report; - - skb = dev_alloc_skb(sizeof(*msr_report) + local->hw.extra_tx_headroom + - sizeof(struct ieee80211_msrment_ie)); - if (!skb) - return; - - skb_reserve(skb, local->hw.extra_tx_headroom); - msr_report = (struct ieee80211_mgmt *)skb_put(skb, 24); - memset(msr_report, 0, 24); - memcpy(msr_report->da, da, ETH_ALEN); - memcpy(msr_report->sa, sdata->vif.addr, ETH_ALEN); - memcpy(msr_report->bssid, bssid, ETH_ALEN); - msr_report->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_ACTION); - - skb_put(skb, 1 + sizeof(msr_report->u.action.u.measurement)); - msr_report->u.action.category = WLAN_CATEGORY_SPECTRUM_MGMT; - msr_report->u.action.u.measurement.action_code = - WLAN_ACTION_SPCT_MSR_RPRT; - msr_report->u.action.u.measurement.dialog_token = dialog_token; - - msr_report->u.action.u.measurement.element_id = WLAN_EID_MEASURE_REPORT; - msr_report->u.action.u.measurement.length = - sizeof(struct ieee80211_msrment_ie); - - memset(&msr_report->u.action.u.measurement.msr_elem, 0, - sizeof(struct ieee80211_msrment_ie)); - msr_report->u.action.u.measurement.msr_elem.token = request_ie->token; - msr_report->u.action.u.measurement.msr_elem.mode |= - IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED; - msr_report->u.action.u.measurement.msr_elem.type = request_ie->type; - - ieee80211_tx_skb(sdata, skb); -} - -void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, - struct ieee80211_mgmt *mgmt, - size_t len) -{ - /* - * Ignoring measurement request is spec violation. - * Mandatory measurements must be reported optional - * measurements might be refused or reported incapable - * For now just refuse - * TODO: Answer basic measurement as unmeasured - */ - ieee80211_send_refuse_measurement_request(sdata, - &mgmt->u.action.u.measurement.msr_elem, - mgmt->sa, mgmt->bssid, - mgmt->u.action.u.measurement.dialog_token); -} diff --git a/openairITS/mac/DOT11/net/mac80211/sta_info.c b/openairITS/mac/DOT11/net/mac80211/sta_info.c deleted file mode 100644 index 045fdaa75ed..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/sta_info.c +++ /dev/null @@ -1,1443 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/module.h> -#include <linux/init.h> -#include <linux/etherdevice.h> -#include <linux/netdevice.h> -#include <linux/types.h> -#include <linux/slab.h> -#include <linux/skbuff.h> -#include <linux/if_arp.h> -#include <linux/timer.h> -#include <linux/rtnetlink.h> - -#include <net/mac80211.h> -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "rate.h" -#include "sta_info.h" -#include "debugfs_sta.h" -#include "mesh.h" -#include "wme.h" - -/** - * DOC: STA information lifetime rules - * - * STA info structures (&struct sta_info) are managed in a hash table - * for faster lookup and a list for iteration. They are managed using - * RCU, i.e. access to the list and hash table is protected by RCU. - * - * Upon allocating a STA info structure with sta_info_alloc(), the caller - * owns that structure. It must then insert it into the hash table using - * either sta_info_insert() or sta_info_insert_rcu(); only in the latter - * case (which acquires an rcu read section but must not be called from - * within one) will the pointer still be valid after the call. Note that - * the caller may not do much with the STA info before inserting it, in - * particular, it may not start any mesh peer link management or add - * encryption keys. - * - * When the insertion fails (sta_info_insert()) returns non-zero), the - * structure will have been freed by sta_info_insert()! - * - * Station entries are added by mac80211 when you establish a link with a - * peer. This means different things for the different type of interfaces - * we support. For a regular station this mean we add the AP sta when we - * receive an association response from the AP. For IBSS this occurs when - * get to know about a peer on the same IBSS. For WDS we add the sta for - * the peer immediately upon device open. When using AP mode we add stations - * for each respective station upon request from userspace through nl80211. - * - * In order to remove a STA info structure, various sta_info_destroy_*() - * calls are available. - * - * There is no concept of ownership on a STA entry, each structure is - * owned by the global hash table/list until it is removed. All users of - * the structure need to be RCU protected so that the structure won't be - * freed before they are done using it. - */ - -/* Caller must hold local->sta_mtx */ -static int sta_info_hash_del(struct ieee80211_local *local, - struct sta_info *sta) -{ - struct sta_info *s; - - s = rcu_dereference_protected(local->sta_hash[STA_HASH(sta->sta.addr)], - lockdep_is_held(&local->sta_mtx)); - if (!s) - return -ENOENT; - if (s == sta) { - rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], - s->hnext); - return 0; - } - - while (rcu_access_pointer(s->hnext) && - rcu_access_pointer(s->hnext) != sta) - s = rcu_dereference_protected(s->hnext, - lockdep_is_held(&local->sta_mtx)); - if (rcu_access_pointer(s->hnext)) { - rcu_assign_pointer(s->hnext, sta->hnext); - return 0; - } - - return -ENOENT; -} - -/* protected by RCU */ -struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, - const u8 *addr) -{ - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - - sta = rcu_dereference_check(local->sta_hash[STA_HASH(addr)], - lockdep_is_held(&local->sta_mtx)); - while (sta) { - if (sta->sdata == sdata && - compare_ether_addr(sta->sta.addr, addr) == 0) - break; - sta = rcu_dereference_check(sta->hnext, - lockdep_is_held(&local->sta_mtx)); - } - return sta; -} - -/* - * Get sta info either from the specified interface - * or from one of its vlans - * - * [PLATA] - checks that the interface BSS is the same as the BSS in the packet. - * - here, if we have a BSS ID Wildcard BSSID in the sta AND in each packet, we should pass - */ -struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata, - const u8 *addr) -{ - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - - sta = rcu_dereference_check(local->sta_hash[STA_HASH(addr)], - lockdep_is_held(&local->sta_mtx)); - while (sta) { - if ((sta->sdata == sdata || - (sta->sdata->bss && sta->sdata->bss == sdata->bss)) && - compare_ether_addr(sta->sta.addr, addr) == 0) - break; - sta = rcu_dereference_check(sta->hnext, - lockdep_is_held(&local->sta_mtx)); - } - return sta; -} - -struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, - int idx) -{ - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - int i = 0; - - list_for_each_entry_rcu(sta, &local->sta_list, list) { - if (sdata != sta->sdata) - continue; - if (i < idx) { - ++i; - continue; - } - return sta; - } - - return NULL; -} - -/** - * sta_info_free - free STA - * - * @local: pointer to the global information - * @sta: STA info to free - * - * This function must undo everything done by sta_info_alloc() - * that may happen before sta_info_insert(). It may only be - * called when sta_info_insert() has not been attempted (and - * if that fails, the station is freed anyway.) - */ -void sta_info_free(struct ieee80211_local *local, struct sta_info *sta) -{ - if (sta->rate_ctrl) - rate_control_free_sta(sta); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(local->hw.wiphy, "Destroyed STA %pM\n", sta->sta.addr); -#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ - - kfree(sta); -} - -/* Caller must hold local->sta_mtx */ -static void sta_info_hash_add(struct ieee80211_local *local, - struct sta_info *sta) -{ - lockdep_assert_held(&local->sta_mtx); - sta->hnext = local->sta_hash[STA_HASH(sta->sta.addr)]; - rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], sta); -} - -static void sta_unblock(struct work_struct *wk) -{ - struct sta_info *sta; - - sta = container_of(wk, struct sta_info, drv_unblock_wk); - - if (sta->dead) - return; - - if (!test_sta_flag(sta, WLAN_STA_PS_STA)) { - local_bh_disable(); - ieee80211_sta_ps_deliver_wakeup(sta); - local_bh_enable(); - } else if (test_and_clear_sta_flag(sta, WLAN_STA_PSPOLL)) { - clear_sta_flag(sta, WLAN_STA_PS_DRIVER); - - local_bh_disable(); - ieee80211_sta_ps_deliver_poll_response(sta); - local_bh_enable(); - } else if (test_and_clear_sta_flag(sta, WLAN_STA_UAPSD)) { - clear_sta_flag(sta, WLAN_STA_PS_DRIVER); - - local_bh_disable(); - ieee80211_sta_ps_deliver_uapsd(sta); - local_bh_enable(); - } else - clear_sta_flag(sta, WLAN_STA_PS_DRIVER); -} - -static int sta_prepare_rate_control(struct ieee80211_local *local, - struct sta_info *sta, gfp_t gfp) -{ - if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) - return 0; - - sta->rate_ctrl = local->rate_ctrl; - sta->rate_ctrl_priv = rate_control_alloc_sta(sta->rate_ctrl, - &sta->sta, gfp); - if (!sta->rate_ctrl_priv) - return -ENOMEM; - - return 0; -} - -struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, - const u8 *addr, gfp_t gfp) -{ - struct ieee80211_local *local = sdata->local; - struct sta_info *sta; - struct timespec uptime; - int i; - - sta = kzalloc(sizeof(*sta) + local->hw.sta_data_size, gfp); - if (!sta) - return NULL; - - spin_lock_init(&sta->lock); - INIT_WORK(&sta->drv_unblock_wk, sta_unblock); - INIT_WORK(&sta->ampdu_mlme.work, ieee80211_ba_session_work); - mutex_init(&sta->ampdu_mlme.mtx); - - memcpy(sta->sta.addr, addr, ETH_ALEN); - sta->local = local; - sta->sdata = sdata; - sta->last_rx = jiffies; - - sta->sta_state = IEEE80211_STA_NONE; - - do_posix_clock_monotonic_gettime(&uptime); - sta->last_connected = uptime.tv_sec; - ewma_init(&sta->avg_signal, 1024, 8); - - if (sta_prepare_rate_control(local, sta, gfp)) { - kfree(sta); - return NULL; - } - - for (i = 0; i < STA_TID_NUM; i++) { - /* - * timer_to_tid must be initialized with identity mapping - * to enable session_timer's data differentiation. See - * sta_rx_agg_session_timer_expired for usage. - */ - sta->timer_to_tid[i] = i; - } - for (i = 0; i < IEEE80211_NUM_ACS; i++) { - skb_queue_head_init(&sta->ps_tx_buf[i]); - skb_queue_head_init(&sta->tx_filtered[i]); - } - - for (i = 0; i < NUM_RX_DATA_QUEUES; i++) - sta->last_seq_ctrl[i] = cpu_to_le16(USHRT_MAX); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(local->hw.wiphy, "Allocated STA %pM\n", sta->sta.addr); -#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ - -#ifdef CONFIG_MAC80211_MESH - sta->plink_state = NL80211_PLINK_LISTEN; - init_timer(&sta->plink_timer); -#endif - - return sta; -} - -static int sta_info_insert_check(struct sta_info *sta) -{ - struct ieee80211_sub_if_data *sdata = sta->sdata; - - /* - * Can't be a WARN_ON because it can be triggered through a race: - * something inserts a STA (on one CPU) without holding the RTNL - * and another CPU turns off the net device. - */ - if (unlikely(!ieee80211_sdata_running(sdata))) - return -ENETDOWN; - - if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->vif.addr) == 0 || - is_multicast_ether_addr(sta->sta.addr))) - return -EINVAL; - - return 0; -} - -static int sta_info_insert_drv_state(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata, - struct sta_info *sta) -{ - enum ieee80211_sta_state state; - int err = 0; - - for (state = IEEE80211_STA_NOTEXIST; state < sta->sta_state; state++) { - err = drv_sta_state(local, sdata, sta, state, state + 1); - if (err) - break; - } - - if (!err) { - /* - * Drivers using legacy sta_add/sta_remove callbacks only - * get uploaded set to true after sta_add is called. - */ - if (!local->ops->sta_add) - sta->uploaded = true; - return 0; - } - - if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { - printk(KERN_DEBUG - "%s: failed to move IBSS STA %pM to state %d (%d) - keeping it anyway.\n", - sdata->name, sta->sta.addr, state + 1, err); - err = 0; - } - - /* unwind on error */ - for (; state > IEEE80211_STA_NOTEXIST; state--) - WARN_ON(drv_sta_state(local, sdata, sta, state, state - 1)); - - return err; -} - -/* - * should be called with sta_mtx locked - * this function replaces the mutex lock - * with a RCU lock - */ -static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU) -{ - struct ieee80211_local *local = sta->local; - struct ieee80211_sub_if_data *sdata = sta->sdata; - struct station_info sinfo; - int err = 0; - - lockdep_assert_held(&local->sta_mtx); - - /* check if STA exists already */ - if (sta_info_get_bss(sdata, sta->sta.addr)) { - err = -EEXIST; - goto out_err; - } - - /* notify driver */ - err = sta_info_insert_drv_state(local, sdata, sta); - if (err) - goto out_err; - - local->num_sta++; - local->sta_generation++; - smp_mb(); - - /* make the station visible */ - sta_info_hash_add(local, sta); - - list_add(&sta->list, &local->sta_list); - - set_sta_flag(sta, WLAN_STA_INSERTED); - - ieee80211_sta_debugfs_add(sta); - rate_control_add_sta_debugfs(sta); - - memset(&sinfo, 0, sizeof(sinfo)); - sinfo.filled = 0; - sinfo.generation = local->sta_generation; - cfg80211_new_sta(sdata->dev, sta->sta.addr, &sinfo, GFP_KERNEL); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(local->hw.wiphy, "Inserted STA %pM\n", sta->sta.addr); -#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ - - /* move reference to rcu-protected */ - rcu_read_lock(); - mutex_unlock(&local->sta_mtx); - - if (ieee80211_vif_is_mesh(&sdata->vif)) - mesh_accept_plinks_update(sdata); - - return 0; - out_err: - mutex_unlock(&local->sta_mtx); - rcu_read_lock(); - return err; -} - -int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU) -{ - struct ieee80211_local *local = sta->local; - int err = 0; - - might_sleep(); - - err = sta_info_insert_check(sta); - if (err) { - rcu_read_lock(); - goto out_free; - } - - mutex_lock(&local->sta_mtx); - - err = sta_info_insert_finish(sta); - if (err) - goto out_free; - - return 0; - out_free: - BUG_ON(!err); - sta_info_free(local, sta); - return err; -} - -int sta_info_insert(struct sta_info *sta) -{ - int err = sta_info_insert_rcu(sta); - - rcu_read_unlock(); - - return err; -} - -static inline void __bss_tim_set(struct ieee80211_if_ap *bss, u16 aid) -{ - /* - * This format has been mandated by the IEEE specifications, - * so this line may not be changed to use the __set_bit() format. - */ - bss->tim[aid / 8] |= (1 << (aid % 8)); -} - -static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, u16 aid) -{ - /* - * This format has been mandated by the IEEE specifications, - * so this line may not be changed to use the __clear_bit() format. - */ - bss->tim[aid / 8] &= ~(1 << (aid % 8)); -} - -static unsigned long ieee80211_tids_for_ac(int ac) -{ - /* If we ever support TIDs > 7, this obviously needs to be adjusted */ - switch (ac) { - case IEEE80211_AC_VO: - return BIT(6) | BIT(7); - case IEEE80211_AC_VI: - return BIT(4) | BIT(5); - case IEEE80211_AC_BE: - return BIT(0) | BIT(3); - case IEEE80211_AC_BK: - return BIT(1) | BIT(2); - default: - WARN_ON(1); - return 0; - } -} - -void sta_info_recalc_tim(struct sta_info *sta) -{ - struct ieee80211_local *local = sta->local; - struct ieee80211_if_ap *bss = sta->sdata->bss; - unsigned long flags; - bool indicate_tim = false; - u8 ignore_for_tim = sta->sta.uapsd_queues; - int ac; - - if (WARN_ON_ONCE(!sta->sdata->bss)) - return; - - /* No need to do anything if the driver does all */ - if (local->hw.flags & IEEE80211_HW_AP_LINK_PS) - return; - - if (sta->dead) - goto done; - - /* - * If all ACs are delivery-enabled then we should build - * the TIM bit for all ACs anyway; if only some are then - * we ignore those and build the TIM bit using only the - * non-enabled ones. - */ - if (ignore_for_tim == BIT(IEEE80211_NUM_ACS) - 1) - ignore_for_tim = 0; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { - unsigned long tids; - - if (ignore_for_tim & BIT(ac)) - continue; - - indicate_tim |= !skb_queue_empty(&sta->tx_filtered[ac]) || - !skb_queue_empty(&sta->ps_tx_buf[ac]); - if (indicate_tim) - break; - - tids = ieee80211_tids_for_ac(ac); - - indicate_tim |= - sta->driver_buffered_tids & tids; - } - - done: - spin_lock_irqsave(&local->tim_lock, flags); - - if (indicate_tim) - __bss_tim_set(bss, sta->sta.aid); - else - __bss_tim_clear(bss, sta->sta.aid); - - if (local->ops->set_tim) { - local->tim_in_locked_section = true; - drv_set_tim(local, &sta->sta, indicate_tim); - local->tim_in_locked_section = false; - } - - spin_unlock_irqrestore(&local->tim_lock, flags); -} - -static bool sta_info_buffer_expired(struct sta_info *sta, struct sk_buff *skb) -{ - struct ieee80211_tx_info *info; - int timeout; - - if (!skb) - return false; - - info = IEEE80211_SKB_CB(skb); - - /* Timeout: (2 * listen_interval * beacon_int * 1024 / 1000000) sec */ - timeout = (sta->listen_interval * - sta->sdata->vif.bss_conf.beacon_int * - 32 / 15625) * HZ; - if (timeout < STA_TX_BUFFER_EXPIRE) - timeout = STA_TX_BUFFER_EXPIRE; - return time_after(jiffies, info->control.jiffies + timeout); -} - - -static bool sta_info_cleanup_expire_buffered_ac(struct ieee80211_local *local, - struct sta_info *sta, int ac) -{ - unsigned long flags; - struct sk_buff *skb; - - /* - * First check for frames that should expire on the filtered - * queue. Frames here were rejected by the driver and are on - * a separate queue to avoid reordering with normal PS-buffered - * frames. They also aren't accounted for right now in the - * total_ps_buffered counter. - */ - for (;;) { - spin_lock_irqsave(&sta->tx_filtered[ac].lock, flags); - skb = skb_peek(&sta->tx_filtered[ac]); - if (sta_info_buffer_expired(sta, skb)) - skb = __skb_dequeue(&sta->tx_filtered[ac]); - else - skb = NULL; - spin_unlock_irqrestore(&sta->tx_filtered[ac].lock, flags); - - /* - * Frames are queued in order, so if this one - * hasn't expired yet we can stop testing. If - * we actually reached the end of the queue we - * also need to stop, of course. - */ - if (!skb) - break; - dev_kfree_skb(skb); - } - - /* - * Now also check the normal PS-buffered queue, this will - * only find something if the filtered queue was emptied - * since the filtered frames are all before the normal PS - * buffered frames. - */ - for (;;) { - spin_lock_irqsave(&sta->ps_tx_buf[ac].lock, flags); - skb = skb_peek(&sta->ps_tx_buf[ac]); - if (sta_info_buffer_expired(sta, skb)) - skb = __skb_dequeue(&sta->ps_tx_buf[ac]); - else - skb = NULL; - spin_unlock_irqrestore(&sta->ps_tx_buf[ac].lock, flags); - - /* - * frames are queued in order, so if this one - * hasn't expired yet (or we reached the end of - * the queue) we can stop testing - */ - if (!skb) - break; - - local->total_ps_buffered--; -#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG - printk(KERN_DEBUG "Buffered frame expired (STA %pM)\n", - sta->sta.addr); -#endif - dev_kfree_skb(skb); - } - - /* - * Finally, recalculate the TIM bit for this station -- it might - * now be clear because the station was too slow to retrieve its - * frames. - */ - sta_info_recalc_tim(sta); - - /* - * Return whether there are any frames still buffered, this is - * used to check whether the cleanup timer still needs to run, - * if there are no frames we don't need to rearm the timer. - */ - return !(skb_queue_empty(&sta->ps_tx_buf[ac]) && - skb_queue_empty(&sta->tx_filtered[ac])); -} - -static bool sta_info_cleanup_expire_buffered(struct ieee80211_local *local, - struct sta_info *sta) -{ - bool have_buffered = false; - int ac; - - /* This is only necessary for stations on BSS interfaces */ - if (!sta->sdata->bss) - return false; - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) - have_buffered |= - sta_info_cleanup_expire_buffered_ac(local, sta, ac); - - return have_buffered; -} - -int __must_check __sta_info_destroy(struct sta_info *sta) -{ - struct ieee80211_local *local; - struct ieee80211_sub_if_data *sdata; - int ret, i, ac; - struct tid_ampdu_tx *tid_tx; - - might_sleep(); - - if (!sta) - return -ENOENT; - - local = sta->local; - sdata = sta->sdata; - - lockdep_assert_held(&local->sta_mtx); - - /* - * Before removing the station from the driver and - * rate control, it might still start new aggregation - * sessions -- block that to make sure the tear-down - * will be sufficient. - */ - set_sta_flag(sta, WLAN_STA_BLOCK_BA); - ieee80211_sta_tear_down_BA_sessions(sta, true); - - ret = sta_info_hash_del(local, sta); - if (ret) - return ret; - - list_del(&sta->list); - - mutex_lock(&local->key_mtx); - for (i = 0; i < NUM_DEFAULT_KEYS; i++) - __ieee80211_key_free(key_mtx_dereference(local, sta->gtk[i])); - if (sta->ptk) - __ieee80211_key_free(key_mtx_dereference(local, sta->ptk)); - mutex_unlock(&local->key_mtx); - - sta->dead = true; - - local->num_sta--; - local->sta_generation++; - - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - RCU_INIT_POINTER(sdata->u.vlan.sta, NULL); - - while (sta->sta_state > IEEE80211_STA_NONE) { - ret = sta_info_move_state(sta, sta->sta_state - 1); - if (ret) { - WARN_ON_ONCE(1); - break; - } - } - - if (sta->uploaded) { - ret = drv_sta_state(local, sdata, sta, IEEE80211_STA_NONE, - IEEE80211_STA_NOTEXIST); - WARN_ON_ONCE(ret != 0); - } - - /* - * At this point, after we wait for an RCU grace period, - * neither mac80211 nor the driver can reference this - * sta struct any more except by still existing timers - * associated with this station that we clean up below. - */ - synchronize_rcu(); - - if (test_sta_flag(sta, WLAN_STA_PS_STA)) { - BUG_ON(!sdata->bss); - - clear_sta_flag(sta, WLAN_STA_PS_STA); - - atomic_dec(&sdata->bss->num_sta_ps); - sta_info_recalc_tim(sta); - } - - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { - local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]); - __skb_queue_purge(&sta->ps_tx_buf[ac]); - __skb_queue_purge(&sta->tx_filtered[ac]); - } - -#ifdef CONFIG_MAC80211_MESH - if (ieee80211_vif_is_mesh(&sdata->vif)) - mesh_accept_plinks_update(sdata); -#endif - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - wiphy_debug(local->hw.wiphy, "Removed STA %pM\n", sta->sta.addr); -#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ - cancel_work_sync(&sta->drv_unblock_wk); - - cfg80211_del_sta(sdata->dev, sta->sta.addr, GFP_KERNEL); - - rate_control_remove_sta_debugfs(sta); - ieee80211_sta_debugfs_remove(sta); - -#ifdef CONFIG_MAC80211_MESH - if (ieee80211_vif_is_mesh(&sta->sdata->vif)) { - mesh_plink_deactivate(sta); - del_timer_sync(&sta->plink_timer); - } -#endif - - /* - * Destroy aggregation state here. It would be nice to wait for the - * driver to finish aggregation stop and then clean up, but for now - * drivers have to handle aggregation stop being requested, followed - * directly by station destruction. - */ - for (i = 0; i < STA_TID_NUM; i++) { - tid_tx = rcu_dereference_raw(sta->ampdu_mlme.tid_tx[i]); - if (!tid_tx) - continue; - __skb_queue_purge(&tid_tx->pending); - kfree(tid_tx); - } - - sta_info_free(local, sta); - - return 0; -} - -int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata, const u8 *addr) -{ - struct sta_info *sta; - int ret; - - mutex_lock(&sdata->local->sta_mtx); - sta = sta_info_get(sdata, addr); - ret = __sta_info_destroy(sta); - mutex_unlock(&sdata->local->sta_mtx); - - return ret; -} - -int sta_info_destroy_addr_bss(struct ieee80211_sub_if_data *sdata, - const u8 *addr) -{ - struct sta_info *sta; - int ret; - - mutex_lock(&sdata->local->sta_mtx); - sta = sta_info_get_bss(sdata, addr); - ret = __sta_info_destroy(sta); - mutex_unlock(&sdata->local->sta_mtx); - - return ret; -} - -static void sta_info_cleanup(unsigned long data) -{ - struct ieee80211_local *local = (struct ieee80211_local *) data; - struct sta_info *sta; - bool timer_needed = false; - - rcu_read_lock(); - list_for_each_entry_rcu(sta, &local->sta_list, list) - if (sta_info_cleanup_expire_buffered(local, sta)) - timer_needed = true; - rcu_read_unlock(); - - if (local->quiescing) - return; - - if (!timer_needed) - return; - - mod_timer(&local->sta_cleanup, - round_jiffies(jiffies + STA_INFO_CLEANUP_INTERVAL)); -} - -void sta_info_init(struct ieee80211_local *local) -{ - spin_lock_init(&local->tim_lock); - mutex_init(&local->sta_mtx); - INIT_LIST_HEAD(&local->sta_list); - - setup_timer(&local->sta_cleanup, sta_info_cleanup, - (unsigned long)local); -} - -void sta_info_stop(struct ieee80211_local *local) -{ - del_timer(&local->sta_cleanup); - sta_info_flush(local, NULL); -} - -/** - * sta_info_flush - flush matching STA entries from the STA table - * - * Returns the number of removed STA entries. - * - * @local: local interface data - * @sdata: matching rule for the net device (sta->dev) or %NULL to match all STAs - */ -int sta_info_flush(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata) -{ - struct sta_info *sta, *tmp; - int ret = 0; - - might_sleep(); - - mutex_lock(&local->sta_mtx); - list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { - if (!sdata || sdata == sta->sdata) { - WARN_ON(__sta_info_destroy(sta)); - ret++; - } - } - mutex_unlock(&local->sta_mtx); - - return ret; -} - -void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, - unsigned long exp_time) -{ - struct ieee80211_local *local = sdata->local; - struct sta_info *sta, *tmp; - - mutex_lock(&local->sta_mtx); - - list_for_each_entry_safe(sta, tmp, &local->sta_list, list) { - if (sdata != sta->sdata) - continue; - - if (time_after(jiffies, sta->last_rx + exp_time)) { -#ifdef CONFIG_MAC80211_IBSS_DEBUG - printk(KERN_DEBUG "%s: expiring inactive STA %pM\n", - sdata->name, sta->sta.addr); -#endif - WARN_ON(__sta_info_destroy(sta)); - } - } - - mutex_unlock(&local->sta_mtx); -} - -struct ieee80211_sta *ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, - const u8 *addr, - const u8 *localaddr) -{ - struct sta_info *sta, *nxt; - - /* - * Just return a random station if localaddr is NULL - * ... first in list. - */ - for_each_sta_info(hw_to_local(hw), addr, sta, nxt) { - if (localaddr && - compare_ether_addr(sta->sdata->vif.addr, localaddr) != 0) - continue; - if (!sta->uploaded) - return NULL; - return &sta->sta; - } - - return NULL; -} -EXPORT_SYMBOL_GPL(ieee80211_find_sta_by_ifaddr); - -struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif, - const u8 *addr) -{ - struct sta_info *sta; - - if (!vif) - return NULL; - - sta = sta_info_get_bss(vif_to_sdata(vif), addr); - if (!sta) - return NULL; - - if (!sta->uploaded) - return NULL; - - return &sta->sta; -} -EXPORT_SYMBOL(ieee80211_find_sta); - -static void clear_sta_ps_flags(void *_sta) -{ - struct sta_info *sta = _sta; - struct ieee80211_sub_if_data *sdata = sta->sdata; - - clear_sta_flag(sta, WLAN_STA_PS_DRIVER); - if (test_and_clear_sta_flag(sta, WLAN_STA_PS_STA)) - atomic_dec(&sdata->bss->num_sta_ps); -} - -/* powersave support code */ -void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) -{ - struct ieee80211_sub_if_data *sdata = sta->sdata; - struct ieee80211_local *local = sdata->local; - struct sk_buff_head pending; - int filtered = 0, buffered = 0, ac; - - clear_sta_flag(sta, WLAN_STA_SP); - - BUILD_BUG_ON(BITS_TO_LONGS(STA_TID_NUM) > 1); - sta->driver_buffered_tids = 0; - - if (!(local->hw.flags & IEEE80211_HW_AP_LINK_PS)) - drv_sta_notify(local, sdata, STA_NOTIFY_AWAKE, &sta->sta); - - skb_queue_head_init(&pending); - - /* Send all buffered frames to the station */ - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { - int count = skb_queue_len(&pending), tmp; - - skb_queue_splice_tail_init(&sta->tx_filtered[ac], &pending); - tmp = skb_queue_len(&pending); - filtered += tmp - count; - count = tmp; - - skb_queue_splice_tail_init(&sta->ps_tx_buf[ac], &pending); - tmp = skb_queue_len(&pending); - buffered += tmp - count; - } - - ieee80211_add_pending_skbs_fn(local, &pending, clear_sta_ps_flags, sta); - - local->total_ps_buffered -= buffered; - - sta_info_recalc_tim(sta); - -#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG - printk(KERN_DEBUG "%s: STA %pM aid %d sending %d filtered/%d PS frames " - "since STA not sleeping anymore\n", sdata->name, - sta->sta.addr, sta->sta.aid, filtered, buffered); -#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ -} - -static void ieee80211_send_null_response(struct ieee80211_sub_if_data *sdata, - struct sta_info *sta, int tid, - enum ieee80211_frame_release_type reason) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_qos_hdr *nullfunc; - struct sk_buff *skb; - int size = sizeof(*nullfunc); - __le16 fc; - bool qos = test_sta_flag(sta, WLAN_STA_WME); - struct ieee80211_tx_info *info; - - if (qos) { - fc = cpu_to_le16(IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_QOS_NULLFUNC | - IEEE80211_FCTL_FROMDS); - } else { - size -= 2; - fc = cpu_to_le16(IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_NULLFUNC | - IEEE80211_FCTL_FROMDS); - } - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + size); - if (!skb) - return; - - skb_reserve(skb, local->hw.extra_tx_headroom); - - nullfunc = (void *) skb_put(skb, size); - nullfunc->frame_control = fc; - nullfunc->duration_id = 0; - memcpy(nullfunc->addr1, sta->sta.addr, ETH_ALEN); - memcpy(nullfunc->addr2, sdata->vif.addr, ETH_ALEN); - memcpy(nullfunc->addr3, sdata->vif.addr, ETH_ALEN); - - skb->priority = tid; - skb_set_queue_mapping(skb, ieee802_1d_to_ac[tid]); - if (qos) { - nullfunc->qos_ctrl = cpu_to_le16(tid); - - if (reason == IEEE80211_FRAME_RELEASE_UAPSD) - nullfunc->qos_ctrl |= - cpu_to_le16(IEEE80211_QOS_CTL_EOSP); - } - - info = IEEE80211_SKB_CB(skb); - - /* - * Tell TX path to send this frame even though the - * STA may still remain is PS mode after this frame - * exchange. Also set EOSP to indicate this packet - * ends the poll/service period. - */ - info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER | - IEEE80211_TX_STATUS_EOSP | - IEEE80211_TX_CTL_REQ_TX_STATUS; - - drv_allow_buffered_frames(local, sta, BIT(tid), 1, reason, false); - - ieee80211_xmit(sdata, skb); -} - -static void -ieee80211_sta_ps_deliver_response(struct sta_info *sta, - int n_frames, u8 ignored_acs, - enum ieee80211_frame_release_type reason) -{ - struct ieee80211_sub_if_data *sdata = sta->sdata; - struct ieee80211_local *local = sdata->local; - bool found = false; - bool more_data = false; - int ac; - unsigned long driver_release_tids = 0; - struct sk_buff_head frames; - - /* Service or PS-Poll period starts */ - set_sta_flag(sta, WLAN_STA_SP); - - __skb_queue_head_init(&frames); - - /* - * Get response frame(s) and more data bit for it. - */ - for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { - unsigned long tids; - - if (ignored_acs & BIT(ac)) - continue; - - tids = ieee80211_tids_for_ac(ac); - - if (!found) { - driver_release_tids = sta->driver_buffered_tids & tids; - if (driver_release_tids) { - found = true; - } else { - struct sk_buff *skb; - - while (n_frames > 0) { - skb = skb_dequeue(&sta->tx_filtered[ac]); - if (!skb) { - skb = skb_dequeue( - &sta->ps_tx_buf[ac]); - if (skb) - local->total_ps_buffered--; - } - if (!skb) - break; - n_frames--; - found = true; - __skb_queue_tail(&frames, skb); - } - } - - /* - * If the driver has data on more than one TID then - * certainly there's more data if we release just a - * single frame now (from a single TID). - */ - if (reason == IEEE80211_FRAME_RELEASE_PSPOLL && - hweight16(driver_release_tids) > 1) { - more_data = true; - driver_release_tids = - BIT(ffs(driver_release_tids) - 1); - break; - } - } - - if (!skb_queue_empty(&sta->tx_filtered[ac]) || - !skb_queue_empty(&sta->ps_tx_buf[ac])) { - more_data = true; - break; - } - } - - if (!found) { - int tid; - - /* - * For PS-Poll, this can only happen due to a race condition - * when we set the TIM bit and the station notices it, but - * before it can poll for the frame we expire it. - * - * For uAPSD, this is said in the standard (11.2.1.5 h): - * At each unscheduled SP for a non-AP STA, the AP shall - * attempt to transmit at least one MSDU or MMPDU, but no - * more than the value specified in the Max SP Length field - * in the QoS Capability element from delivery-enabled ACs, - * that are destined for the non-AP STA. - * - * Since we have no other MSDU/MMPDU, transmit a QoS null frame. - */ - - /* This will evaluate to 1, 3, 5 or 7. */ - tid = 7 - ((ffs(~ignored_acs) - 1) << 1); - - ieee80211_send_null_response(sdata, sta, tid, reason); - return; - } - - if (!driver_release_tids) { - struct sk_buff_head pending; - struct sk_buff *skb; - int num = 0; - u16 tids = 0; - - skb_queue_head_init(&pending); - - while ((skb = __skb_dequeue(&frames))) { - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (void *) skb->data; - u8 *qoshdr = NULL; - - num++; - - /* - * Tell TX path to send this frame even though the - * STA may still remain is PS mode after this frame - * exchange. - */ - info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER; - - /* - * Use MoreData flag to indicate whether there are - * more buffered frames for this STA - */ - if (more_data || !skb_queue_empty(&frames)) - hdr->frame_control |= - cpu_to_le16(IEEE80211_FCTL_MOREDATA); - else - hdr->frame_control &= - cpu_to_le16(~IEEE80211_FCTL_MOREDATA); - - if (ieee80211_is_data_qos(hdr->frame_control) || - ieee80211_is_qos_nullfunc(hdr->frame_control)) - qoshdr = ieee80211_get_qos_ctl(hdr); - - /* set EOSP for the frame */ - if (reason == IEEE80211_FRAME_RELEASE_UAPSD && - qoshdr && skb_queue_empty(&frames)) - *qoshdr |= IEEE80211_QOS_CTL_EOSP; - - info->flags |= IEEE80211_TX_STATUS_EOSP | - IEEE80211_TX_CTL_REQ_TX_STATUS; - - if (qoshdr) - tids |= BIT(*qoshdr & IEEE80211_QOS_CTL_TID_MASK); - else - tids |= BIT(0); - - __skb_queue_tail(&pending, skb); - } - - drv_allow_buffered_frames(local, sta, tids, num, - reason, more_data); - - ieee80211_add_pending_skbs(local, &pending); - - sta_info_recalc_tim(sta); - } else { - /* - * We need to release a frame that is buffered somewhere in the - * driver ... it'll have to handle that. - * Note that, as per the comment above, it'll also have to see - * if there is more than just one frame on the specific TID that - * we're releasing from, and it needs to set the more-data bit - * accordingly if we tell it that there's no more data. If we do - * tell it there's more data, then of course the more-data bit - * needs to be set anyway. - */ - drv_release_buffered_frames(local, sta, driver_release_tids, - n_frames, reason, more_data); - - /* - * Note that we don't recalculate the TIM bit here as it would - * most likely have no effect at all unless the driver told us - * that the TID became empty before returning here from the - * release function. - * Either way, however, when the driver tells us that the TID - * became empty we'll do the TIM recalculation. - */ - } -} - -void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta) -{ - u8 ignore_for_response = sta->sta.uapsd_queues; - - /* - * If all ACs are delivery-enabled then we should reply - * from any of them, if only some are enabled we reply - * only from the non-enabled ones. - */ - if (ignore_for_response == BIT(IEEE80211_NUM_ACS) - 1) - ignore_for_response = 0; - - ieee80211_sta_ps_deliver_response(sta, 1, ignore_for_response, - IEEE80211_FRAME_RELEASE_PSPOLL); -} - -void ieee80211_sta_ps_deliver_uapsd(struct sta_info *sta) -{ - int n_frames = sta->sta.max_sp; - u8 delivery_enabled = sta->sta.uapsd_queues; - - /* - * If we ever grow support for TSPEC this might happen if - * the TSPEC update from hostapd comes in between a trigger - * frame setting WLAN_STA_UAPSD in the RX path and this - * actually getting called. - */ - if (!delivery_enabled) - return; - - switch (sta->sta.max_sp) { - case 1: - n_frames = 2; - break; - case 2: - n_frames = 4; - break; - case 3: - n_frames = 6; - break; - case 0: - /* XXX: what is a good value? */ - n_frames = 8; - break; - } - - ieee80211_sta_ps_deliver_response(sta, n_frames, ~delivery_enabled, - IEEE80211_FRAME_RELEASE_UAPSD); -} - -void ieee80211_sta_block_awake(struct ieee80211_hw *hw, - struct ieee80211_sta *pubsta, bool block) -{ - struct sta_info *sta = container_of(pubsta, struct sta_info, sta); - - trace_api_sta_block_awake(sta->local, pubsta, block); - - if (block) - set_sta_flag(sta, WLAN_STA_PS_DRIVER); - else if (test_sta_flag(sta, WLAN_STA_PS_DRIVER)) - ieee80211_queue_work(hw, &sta->drv_unblock_wk); -} -EXPORT_SYMBOL(ieee80211_sta_block_awake); - -void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta) -{ - struct sta_info *sta = container_of(pubsta, struct sta_info, sta); - struct ieee80211_local *local = sta->local; - struct sk_buff *skb; - struct skb_eosp_msg_data *data; - - trace_api_eosp(local, pubsta); - - skb = alloc_skb(0, GFP_ATOMIC); - if (!skb) { - /* too bad ... but race is better than loss */ - clear_sta_flag(sta, WLAN_STA_SP); - return; - } - - data = (void *)skb->cb; - memcpy(data->sta, pubsta->addr, ETH_ALEN); - memcpy(data->iface, sta->sdata->vif.addr, ETH_ALEN); - skb->pkt_type = IEEE80211_EOSP_MSG; - skb_queue_tail(&local->skb_queue, skb); - tasklet_schedule(&local->tasklet); -} -EXPORT_SYMBOL(ieee80211_sta_eosp_irqsafe); - -void ieee80211_sta_set_buffered(struct ieee80211_sta *pubsta, - u8 tid, bool buffered) -{ - struct sta_info *sta = container_of(pubsta, struct sta_info, sta); - - if (WARN_ON(tid >= STA_TID_NUM)) - return; - - if (buffered) - set_bit(tid, &sta->driver_buffered_tids); - else - clear_bit(tid, &sta->driver_buffered_tids); - - sta_info_recalc_tim(sta); -} -EXPORT_SYMBOL(ieee80211_sta_set_buffered); - -/* - * [PLATA] - to check the impact of the OCB mode in this... - */ -int sta_info_move_state(struct sta_info *sta, - enum ieee80211_sta_state new_state) -{ - might_sleep(); - - if (sta->sta_state == new_state) - return 0; - - /* check allowed transitions first */ - - switch (new_state) { - case IEEE80211_STA_NONE: - if (sta->sta_state != IEEE80211_STA_AUTH) - return -EINVAL; - break; - case IEEE80211_STA_AUTH: - if (sta->sta_state != IEEE80211_STA_NONE && - sta->sta_state != IEEE80211_STA_ASSOC) - return -EINVAL; - break; - case IEEE80211_STA_ASSOC: - if (sta->sta_state != IEEE80211_STA_AUTH && - sta->sta_state != IEEE80211_STA_AUTHORIZED) - return -EINVAL; - break; - case IEEE80211_STA_AUTHORIZED: - if (sta->sta_state != IEEE80211_STA_ASSOC) - return -EINVAL; - break; - default: - WARN(1, "invalid state %d", new_state); - return -EINVAL; - } - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "%s: moving STA %pM to state %d\n", - sta->sdata->name, sta->sta.addr, new_state); -#endif - - /* - * notify the driver before the actual changes so it can - * fail the transition - */ - if (test_sta_flag(sta, WLAN_STA_INSERTED)) { - int err = drv_sta_state(sta->local, sta->sdata, sta, - sta->sta_state, new_state); - if (err) - return err; - } - - /* reflect the change in all state variables */ - - switch (new_state) { - case IEEE80211_STA_NONE: - if (sta->sta_state == IEEE80211_STA_AUTH) - clear_bit(WLAN_STA_AUTH, &sta->_flags); - break; - case IEEE80211_STA_AUTH: - if (sta->sta_state == IEEE80211_STA_NONE) - set_bit(WLAN_STA_AUTH, &sta->_flags); - else if (sta->sta_state == IEEE80211_STA_ASSOC) - clear_bit(WLAN_STA_ASSOC, &sta->_flags); - break; - case IEEE80211_STA_ASSOC: - if (sta->sta_state == IEEE80211_STA_AUTH) { - set_bit(WLAN_STA_ASSOC, &sta->_flags); - } else if (sta->sta_state == IEEE80211_STA_AUTHORIZED) { - if (sta->sdata->vif.type == NL80211_IFTYPE_AP) - atomic_dec(&sta->sdata->u.ap.num_sta_authorized); - clear_bit(WLAN_STA_AUTHORIZED, &sta->_flags); - } - break; - case IEEE80211_STA_AUTHORIZED: - if (sta->sta_state == IEEE80211_STA_ASSOC) { - if (sta->sdata->vif.type == NL80211_IFTYPE_AP) - atomic_inc(&sta->sdata->u.ap.num_sta_authorized); - set_bit(WLAN_STA_AUTHORIZED, &sta->_flags); - } - break; - default: - break; - } - - sta->sta_state = new_state; - - return 0; -} diff --git a/openairITS/mac/DOT11/net/mac80211/sta_info.h b/openairITS/mac/DOT11/net/mac80211/sta_info.h deleted file mode 100644 index 21d92a1eb36..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/sta_info.h +++ /dev/null @@ -1,544 +0,0 @@ -/* - * Copyright 2002-2005, Devicescape Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef STA_INFO_H -#define STA_INFO_H - -#include <linux/list.h> -#include <linux/types.h> -#include <linux/if_ether.h> -#include <linux/workqueue.h> -#include <linux/average.h> -#include <linux/etherdevice.h> -#include "key.h" - -/** - * enum ieee80211_sta_info_flags - Stations flags - * - * These flags are used with &struct sta_info's @flags member, but - * only indirectly with set_sta_flag() and friends. - * - * @WLAN_STA_AUTH: Station is authenticated. - * @WLAN_STA_ASSOC: Station is associated. - * @WLAN_STA_PS_STA: Station is in power-save mode - * @WLAN_STA_AUTHORIZED: Station is authorized to send/receive traffic. - * This bit is always checked so needs to be enabled for all stations - * when virtual port control is not in use. - * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble - * frames. - * @WLAN_STA_WME: Station is a QoS-STA. - * @WLAN_STA_WDS: Station is one of our WDS peers. - * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the - * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next - * frame to this station is transmitted. - * @WLAN_STA_MFP: Management frame protection is used with this STA. - * @WLAN_STA_BLOCK_BA: Used to deny ADDBA requests (both TX and RX) - * during suspend/resume and station removal. - * @WLAN_STA_PS_DRIVER: driver requires keeping this station in - * power-save mode logically to flush frames that might still - * be in the queues - * @WLAN_STA_PSPOLL: Station sent PS-poll while driver was keeping - * station in power-save mode, reply when the driver unblocks. - * @WLAN_STA_TDLS_PEER: Station is a TDLS peer. - * @WLAN_STA_TDLS_PEER_AUTH: This TDLS peer is authorized to send direct - * packets. This means the link is enabled. - * @WLAN_STA_UAPSD: Station requested unscheduled SP while driver was - * keeping station in power-save mode, reply when the driver - * unblocks the station. - * @WLAN_STA_SP: Station is in a service period, so don't try to - * reply to other uAPSD trigger frames or PS-Poll. - * @WLAN_STA_4ADDR_EVENT: 4-addr event was already sent for this frame. - * @WLAN_STA_INSERTED: This station is inserted into the hash table. - * @WLAN_STA_RATE_CONTROL: rate control was initialized for this station. - * @WLAN_STA_OCB: station is with the OCB activated - means none of the previous states - */ -enum ieee80211_sta_info_flags { - WLAN_STA_AUTH, - WLAN_STA_ASSOC, - WLAN_STA_PS_STA, - WLAN_STA_AUTHORIZED, - WLAN_STA_SHORT_PREAMBLE, - WLAN_STA_WME, - WLAN_STA_WDS, - WLAN_STA_CLEAR_PS_FILT, - WLAN_STA_MFP, - WLAN_STA_BLOCK_BA, - WLAN_STA_PS_DRIVER, - WLAN_STA_PSPOLL, - WLAN_STA_TDLS_PEER, - WLAN_STA_TDLS_PEER_AUTH, - WLAN_STA_UAPSD, - WLAN_STA_SP, - WLAN_STA_4ADDR_EVENT, - WLAN_STA_INSERTED, - WLAN_STA_RATE_CONTROL, - WLAN_STA_OCB, //[PLATA] - added this flag to show that we are not in one of the previous states... TODO initialize it... -}; - -#define STA_TID_NUM 16 -#define ADDBA_RESP_INTERVAL HZ -#define HT_AGG_MAX_RETRIES 15 -#define HT_AGG_BURST_RETRIES 3 -#define HT_AGG_RETRIES_PERIOD (15 * HZ) - -#define HT_AGG_STATE_DRV_READY 0 -#define HT_AGG_STATE_RESPONSE_RECEIVED 1 -#define HT_AGG_STATE_OPERATIONAL 2 -#define HT_AGG_STATE_STOPPING 3 -#define HT_AGG_STATE_WANT_START 4 -#define HT_AGG_STATE_WANT_STOP 5 - -/** - * struct tid_ampdu_tx - TID aggregation information (Tx). - * - * @rcu_head: rcu head for freeing structure - * @session_timer: check if we keep Tx-ing on the TID (by timeout value) - * @addba_resp_timer: timer for peer's response to addba request - * @pending: pending frames queue -- use sta's spinlock to protect - * @dialog_token: dialog token for aggregation session - * @timeout: session timeout value to be filled in ADDBA requests - * @state: session state (see above) - * @stop_initiator: initiator of a session stop - * @tx_stop: TX DelBA frame when stopping - * @buf_size: reorder buffer size at receiver - * @failed_bar_ssn: ssn of the last failed BAR tx attempt - * @bar_pending: BAR needs to be re-sent - * - * This structure's lifetime is managed by RCU, assignments to - * the array holding it must hold the aggregation mutex. - * - * The TX path can access it under RCU lock-free if, and - * only if, the state has the flag %HT_AGG_STATE_OPERATIONAL - * set. Otherwise, the TX path must also acquire the spinlock - * and re-check the state, see comments in the tx code - * touching it. - */ -struct tid_ampdu_tx { - struct rcu_head rcu_head; - struct timer_list session_timer; - struct timer_list addba_resp_timer; - struct sk_buff_head pending; - unsigned long state; - u16 timeout; - u8 dialog_token; - u8 stop_initiator; - bool tx_stop; - u8 buf_size; - - u16 failed_bar_ssn; - bool bar_pending; -}; - -/** - * struct tid_ampdu_rx - TID aggregation information (Rx). - * - * @reorder_buf: buffer to reorder incoming aggregated MPDUs - * @reorder_time: jiffies when skb was added - * @session_timer: check if peer keeps Tx-ing on the TID (by timeout value) - * @reorder_timer: releases expired frames from the reorder buffer. - * @head_seq_num: head sequence number in reordering buffer. - * @stored_mpdu_num: number of MPDUs in reordering buffer - * @ssn: Starting Sequence Number expected to be aggregated. - * @buf_size: buffer size for incoming A-MPDUs - * @timeout: reset timer value (in TUs). - * @dialog_token: dialog token for aggregation session - * @rcu_head: RCU head used for freeing this struct - * @reorder_lock: serializes access to reorder buffer, see below. - * - * This structure's lifetime is managed by RCU, assignments to - * the array holding it must hold the aggregation mutex. - * - * The @reorder_lock is used to protect the members of this - * struct, except for @timeout, @buf_size and @dialog_token, - * which are constant across the lifetime of the struct (the - * dialog token being used only for debugging). - */ -struct tid_ampdu_rx { - struct rcu_head rcu_head; - spinlock_t reorder_lock; - struct sk_buff **reorder_buf; - unsigned long *reorder_time; - struct timer_list session_timer; - struct timer_list reorder_timer; - u16 head_seq_num; - u16 stored_mpdu_num; - u16 ssn; - u16 buf_size; - u16 timeout; - u8 dialog_token; -}; - -/** - * struct sta_ampdu_mlme - STA aggregation information. - * - * @tid_rx: aggregation info for Rx per TID -- RCU protected - * @tid_tx: aggregation info for Tx per TID - * @tid_start_tx: sessions where start was requested - * @addba_req_num: number of times addBA request has been sent. - * @last_addba_req_time: timestamp of the last addBA request. - * @dialog_token_allocator: dialog token enumerator for each new session; - * @work: work struct for starting/stopping aggregation - * @tid_rx_timer_expired: bitmap indicating on which TIDs the - * RX timer expired until the work for it runs - * @tid_rx_stop_requested: bitmap indicating which BA sessions per TID the - * driver requested to close until the work for it runs - * @mtx: mutex to protect all TX data (except non-NULL assignments - * to tid_tx[idx], which are protected by the sta spinlock) - */ -struct sta_ampdu_mlme { - struct mutex mtx; - /* rx */ - struct tid_ampdu_rx __rcu *tid_rx[STA_TID_NUM]; - unsigned long tid_rx_timer_expired[BITS_TO_LONGS(STA_TID_NUM)]; - unsigned long tid_rx_stop_requested[BITS_TO_LONGS(STA_TID_NUM)]; - /* tx */ - struct work_struct work; - struct tid_ampdu_tx __rcu *tid_tx[STA_TID_NUM]; - struct tid_ampdu_tx *tid_start_tx[STA_TID_NUM]; - unsigned long last_addba_req_time[STA_TID_NUM]; - u8 addba_req_num[STA_TID_NUM]; - u8 dialog_token_allocator; -}; - - -/** - * struct sta_info - STA information - * - * This structure collects information about a station that - * mac80211 is communicating with. - * - * @list: global linked list entry - * @hnext: hash table linked list pointer - * @local: pointer to the global information - * @sdata: virtual interface this station belongs to - * @ptk: peer key negotiated with this station, if any - * @gtk: group keys negotiated with this station, if any - * @rate_ctrl: rate control algorithm reference - * @rate_ctrl_priv: rate control private per-STA pointer - * @last_tx_rate: rate used for last transmit, to report to userspace as - * "the" transmit rate - * @last_rx_rate_idx: rx status rate index of the last data packet - * @last_rx_rate_flag: rx status flag of the last data packet - * @lock: used for locking all fields that require locking, see comments - * in the header file. - * @drv_unblock_wk: used for driver PS unblocking - * @listen_interval: listen interval of this station, when we're acting as AP - * @_flags: STA flags, see &enum ieee80211_sta_info_flags, do not use directly - * @ps_tx_buf: buffers (per AC) of frames to transmit to this station - * when it leaves power saving state or polls - * @tx_filtered: buffers (per AC) of frames we already tried to - * transmit but were filtered by hardware due to STA having - * entered power saving state, these are also delivered to - * the station when it leaves powersave or polls for frames - * @driver_buffered_tids: bitmap of TIDs the driver has data buffered on - * @rx_packets: Number of MSDUs received from this STA - * @rx_bytes: Number of bytes received from this STA - * @wep_weak_iv_count: number of weak WEP IVs received from this station - * @last_rx: time (in jiffies) when last frame was received from this STA - * @last_connected: time (in seconds) when a station got connected - * @num_duplicates: number of duplicate frames received from this STA - * @rx_fragments: number of received MPDUs - * @rx_dropped: number of dropped MPDUs from this STA - * @last_signal: signal of last received frame from this STA - * @avg_signal: moving average of signal of received frames from this STA - * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue) - * @tx_filtered_count: number of frames the hardware filtered for this STA - * @tx_retry_failed: number of frames that failed retry - * @tx_retry_count: total number of retries for frames to this STA - * @fail_avg: moving percentage of failed MSDUs - * @tx_packets: number of RX/TX MSDUs - * @tx_bytes: number of bytes transmitted to this STA - * @tx_fragments: number of transmitted MPDUs - * @tid_seq: per-TID sequence numbers for sending to this STA - * @ampdu_mlme: A-MPDU state machine state - * @timer_to_tid: identity mapping to ID timers - * @llid: Local link ID - * @plid: Peer link ID - * @reason: Cancel reason on PLINK_HOLDING state - * @plink_retries: Retries in establishment - * @ignore_plink_timer: ignore the peer-link timer (used internally) - * @plink_state: peer link state - * @plink_timeout: timeout of peer link - * @plink_timer: peer link watch timer - * @plink_timer_was_running: used by suspend/resume to restore timers - * @debugfs: debug filesystem info - * @dead: set to true when sta is unlinked - * @uploaded: set to true when sta is uploaded to the driver - * @lost_packets: number of consecutive lost packets - * @sta: station information we share with the driver - * @sta_state: duplicates information about station state (for debug) - * @beacon_loss_count: number of times beacon loss has triggered - */ -struct sta_info { - /* General information, mostly static */ - struct list_head list; - struct sta_info __rcu *hnext; - struct ieee80211_local *local; - struct ieee80211_sub_if_data *sdata; - struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS]; - struct ieee80211_key __rcu *ptk; - struct rate_control_ref *rate_ctrl; - void *rate_ctrl_priv; - spinlock_t lock; - - struct work_struct drv_unblock_wk; - - u16 listen_interval; - - bool dead; - - bool uploaded; - - enum ieee80211_sta_state sta_state; - - /* use the accessors defined below */ - unsigned long _flags; - - /* - * STA powersave frame queues, no more than the internal - * locking required. - */ - struct sk_buff_head ps_tx_buf[IEEE80211_NUM_ACS]; - struct sk_buff_head tx_filtered[IEEE80211_NUM_ACS]; - unsigned long driver_buffered_tids; - - /* Updated from RX path only, no locking requirements */ - unsigned long rx_packets, rx_bytes; - unsigned long wep_weak_iv_count; - unsigned long last_rx; - long last_connected; - unsigned long num_duplicates; - unsigned long rx_fragments; - unsigned long rx_dropped; - int last_signal; - struct ewma avg_signal; - /* Plus 1 for non-QoS frames */ - __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES + 1]; - - /* Updated from TX status path only, no locking requirements */ - unsigned long tx_filtered_count; - unsigned long tx_retry_failed, tx_retry_count; - /* moving percentage of failed MSDUs */ - unsigned int fail_avg; - - /* Updated from TX path only, no locking requirements */ - unsigned long tx_packets; - unsigned long tx_bytes; - unsigned long tx_fragments; - struct ieee80211_tx_rate last_tx_rate; - int last_rx_rate_idx; - int last_rx_rate_flag; - u16 tid_seq[IEEE80211_QOS_CTL_TID_MASK + 1]; - - /* - * Aggregation information, locked with lock. - */ - struct sta_ampdu_mlme ampdu_mlme; - u8 timer_to_tid[STA_TID_NUM]; - -#ifdef CONFIG_MAC80211_MESH - /* - * Mesh peer link attributes - * TODO: move to a sub-structure that is referenced with pointer? - */ - __le16 llid; - __le16 plid; - __le16 reason; - u8 plink_retries; - bool ignore_plink_timer; - bool plink_timer_was_running; - enum nl80211_plink_state plink_state; - u32 plink_timeout; - struct timer_list plink_timer; -#endif - -#ifdef CONFIG_MAC80211_DEBUGFS - struct sta_info_debugfsdentries { - struct dentry *dir; - bool add_has_run; - } debugfs; -#endif - - unsigned int lost_packets; - unsigned int beacon_loss_count; - - /* keep last! */ - struct ieee80211_sta sta; -}; - -static inline enum nl80211_plink_state sta_plink_state(struct sta_info *sta) -{ -#ifdef CONFIG_MAC80211_MESH - return sta->plink_state; -#endif - return NL80211_PLINK_LISTEN; -} - -static inline void set_sta_flag(struct sta_info *sta, - enum ieee80211_sta_info_flags flag) -{ - WARN_ON(flag == WLAN_STA_AUTH || - flag == WLAN_STA_ASSOC || - flag == WLAN_STA_AUTHORIZED); - set_bit(flag, &sta->_flags); -} - -static inline void clear_sta_flag(struct sta_info *sta, - enum ieee80211_sta_info_flags flag) -{ - WARN_ON(flag == WLAN_STA_AUTH || - flag == WLAN_STA_ASSOC || - flag == WLAN_STA_AUTHORIZED); - clear_bit(flag, &sta->_flags); -} - -static inline int test_sta_flag(struct sta_info *sta, - enum ieee80211_sta_info_flags flag) -{ - return test_bit(flag, &sta->_flags); -} - -static inline int test_and_clear_sta_flag(struct sta_info *sta, - enum ieee80211_sta_info_flags flag) -{ - WARN_ON(flag == WLAN_STA_AUTH || - flag == WLAN_STA_ASSOC || - flag == WLAN_STA_AUTHORIZED); - return test_and_clear_bit(flag, &sta->_flags); -} - -static inline int test_and_set_sta_flag(struct sta_info *sta, - enum ieee80211_sta_info_flags flag) -{ - WARN_ON(flag == WLAN_STA_AUTH || - flag == WLAN_STA_ASSOC || - flag == WLAN_STA_AUTHORIZED); - return test_and_set_bit(flag, &sta->_flags); -} - -int sta_info_move_state(struct sta_info *sta, - enum ieee80211_sta_state new_state); - -static inline void sta_info_pre_move_state(struct sta_info *sta, - enum ieee80211_sta_state new_state) -{ - int ret; - - WARN_ON_ONCE(test_sta_flag(sta, WLAN_STA_INSERTED)); - - ret = sta_info_move_state(sta, new_state); - WARN_ON_ONCE(ret); -} - - -void ieee80211_assign_tid_tx(struct sta_info *sta, int tid, - struct tid_ampdu_tx *tid_tx); - -static inline struct tid_ampdu_tx * -rcu_dereference_protected_tid_tx(struct sta_info *sta, int tid) -{ - return rcu_dereference_protected(sta->ampdu_mlme.tid_tx[tid], - lockdep_is_held(&sta->lock) || - lockdep_is_held(&sta->ampdu_mlme.mtx)); -} - -#define STA_HASH_SIZE 256 -#define STA_HASH(sta) (sta[5]) - - -/* Maximum number of frames to buffer per power saving station per AC */ -#define STA_MAX_TX_BUFFER 64 - -/* Minimum buffered frame expiry time. If STA uses listen interval that is - * smaller than this value, the minimum value here is used instead. */ -#define STA_TX_BUFFER_EXPIRE (10 * HZ) - -/* How often station data is cleaned up (e.g., expiration of buffered frames) - */ -#define STA_INFO_CLEANUP_INTERVAL (10 * HZ) - -/* - * Get a STA info, must be under RCU read lock. - */ -struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, - const u8 *addr); - -struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata, - const u8 *addr); - -static inline -void for_each_sta_info_type_check(struct ieee80211_local *local, - const u8 *addr, - struct sta_info *sta, - struct sta_info *nxt) -{ -} - -#define for_each_sta_info(local, _addr, _sta, nxt) \ - for ( /* initialise loop */ \ - _sta = rcu_dereference(local->sta_hash[STA_HASH(_addr)]),\ - nxt = _sta ? rcu_dereference(_sta->hnext) : NULL; \ - /* typecheck */ \ - for_each_sta_info_type_check(local, (_addr), _sta, nxt),\ - /* continue condition */ \ - _sta; \ - /* advance loop */ \ - _sta = nxt, \ - nxt = _sta ? rcu_dereference(_sta->hnext) : NULL \ - ) \ - /* compare address and run code only if it matches */ \ - if (compare_ether_addr(_sta->sta.addr, (_addr)) == 0) - -/* - * Get STA info by index, BROKEN! - */ -struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata, - int idx); -/* - * Create a new STA info, caller owns returned structure - * until sta_info_insert(). - */ -struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, - const u8 *addr, gfp_t gfp); - -void sta_info_free(struct ieee80211_local *local, struct sta_info *sta); - -/* - * Insert STA info into hash table/list, returns zero or a - * -EEXIST if (if the same MAC address is already present). - * - * Calling the non-rcu version makes the caller relinquish, - * the _rcu version calls read_lock_rcu() and must be called - * without it held. - */ -int sta_info_insert(struct sta_info *sta); -int sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU); - -int __must_check __sta_info_destroy(struct sta_info *sta); -int sta_info_destroy_addr(struct ieee80211_sub_if_data *sdata, - const u8 *addr); -int sta_info_destroy_addr_bss(struct ieee80211_sub_if_data *sdata, - const u8 *addr); - -void sta_info_recalc_tim(struct sta_info *sta); - -void sta_info_init(struct ieee80211_local *local); -void sta_info_stop(struct ieee80211_local *local); -int sta_info_flush(struct ieee80211_local *local, - struct ieee80211_sub_if_data *sdata); -void sta_set_rate_info_tx(struct sta_info *sta, - const struct ieee80211_tx_rate *rate, - struct rate_info *rinfo); -void ieee80211_sta_expire(struct ieee80211_sub_if_data *sdata, - unsigned long exp_time); - -void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta); -void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta); -void ieee80211_sta_ps_deliver_uapsd(struct sta_info *sta); - -#endif /* STA_INFO_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/status.c b/openairITS/mac/DOT11/net/mac80211/status.c deleted file mode 100644 index 5f8f89e89d6..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/status.c +++ /dev/null @@ -1,662 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2008-2010 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/export.h> -#include <linux/etherdevice.h> -#include <net/mac80211.h> -#include <asm/unaligned.h> -#include "ieee80211_i.h" -#include "rate.h" -#include "mesh.h" -#include "led.h" -#include "wme.h" - - -void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, - struct sk_buff *skb) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - int tmp; - - skb->pkt_type = IEEE80211_TX_STATUS_MSG; - skb_queue_tail(info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS ? - &local->skb_queue : &local->skb_queue_unreliable, skb); - tmp = skb_queue_len(&local->skb_queue) + - skb_queue_len(&local->skb_queue_unreliable); - while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT && - (skb = skb_dequeue(&local->skb_queue_unreliable))) { - dev_kfree_skb_irq(skb); - tmp--; - I802_DEBUG_INC(local->tx_status_drop); - } - tasklet_schedule(&local->tasklet); -} -EXPORT_SYMBOL(ieee80211_tx_status_irqsafe); - -static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, - struct sta_info *sta, - struct sk_buff *skb) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (void *)skb->data; - int ac; - - /* - * This skb 'survived' a round-trip through the driver, and - * hopefully the driver didn't mangle it too badly. However, - * we can definitely not rely on the control information - * being correct. Clear it so we don't get junk there, and - * indicate that it needs new processing, but must not be - * modified/encrypted again. - */ - memset(&info->control, 0, sizeof(info->control)); - - info->control.jiffies = jiffies; - info->control.vif = &sta->sdata->vif; - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING | - IEEE80211_TX_INTFL_RETRANSMISSION; - info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS; - - sta->tx_filtered_count++; - - /* - * Clear more-data bit on filtered frames, it might be set - * but later frames might time out so it might have to be - * clear again ... It's all rather unlikely (this frame - * should time out first, right?) but let's not confuse - * peers unnecessarily. - */ - if (hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) - hdr->frame_control &= ~cpu_to_le16(IEEE80211_FCTL_MOREDATA); - - if (ieee80211_is_data_qos(hdr->frame_control)) { - u8 *p = ieee80211_get_qos_ctl(hdr); - int tid = *p & IEEE80211_QOS_CTL_TID_MASK; - - /* - * Clear EOSP if set, this could happen e.g. - * if an absence period (us being a P2P GO) - * shortens the SP. - */ - if (*p & IEEE80211_QOS_CTL_EOSP) - *p &= ~IEEE80211_QOS_CTL_EOSP; - ac = ieee802_1d_to_ac[tid & 7]; - } else { - ac = IEEE80211_AC_BE; - } - - /* - * Clear the TX filter mask for this STA when sending the next - * packet. If the STA went to power save mode, this will happen - * when it wakes up for the next time. - */ - set_sta_flag(sta, WLAN_STA_CLEAR_PS_FILT); - - /* - * This code races in the following way: - * - * (1) STA sends frame indicating it will go to sleep and does so - * (2) hardware/firmware adds STA to filter list, passes frame up - * (3) hardware/firmware processes TX fifo and suppresses a frame - * (4) we get TX status before having processed the frame and - * knowing that the STA has gone to sleep. - * - * This is actually quite unlikely even when both those events are - * processed from interrupts coming in quickly after one another or - * even at the same time because we queue both TX status events and - * RX frames to be processed by a tasklet and process them in the - * same order that they were received or TX status last. Hence, there - * is no race as long as the frame RX is processed before the next TX - * status, which drivers can ensure, see below. - * - * Note that this can only happen if the hardware or firmware can - * actually add STAs to the filter list, if this is done by the - * driver in response to set_tim() (which will only reduce the race - * this whole filtering tries to solve, not completely solve it) - * this situation cannot happen. - * - * To completely solve this race drivers need to make sure that they - * (a) don't mix the irq-safe/not irq-safe TX status/RX processing - * functions and - * (b) always process RX events before TX status events if ordering - * can be unknown, for example with different interrupt status - * bits. - * (c) if PS mode transitions are manual (i.e. the flag - * %IEEE80211_HW_AP_LINK_PS is set), always process PS state - * changes before calling TX status events if ordering can be - * unknown. - */ - if (test_sta_flag(sta, WLAN_STA_PS_STA) && - skb_queue_len(&sta->tx_filtered[ac]) < STA_MAX_TX_BUFFER) { - skb_queue_tail(&sta->tx_filtered[ac], skb); - sta_info_recalc_tim(sta); - - if (!timer_pending(&local->sta_cleanup)) - mod_timer(&local->sta_cleanup, - round_jiffies(jiffies + - STA_INFO_CLEANUP_INTERVAL)); - return; - } - - if (!test_sta_flag(sta, WLAN_STA_PS_STA) && - !(info->flags & IEEE80211_TX_INTFL_RETRIED)) { - /* Software retry the packet once */ - info->flags |= IEEE80211_TX_INTFL_RETRIED; - ieee80211_add_pending_skb(local, skb); - return; - } - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - if (net_ratelimit()) - wiphy_debug(local->hw.wiphy, - "dropped TX filtered frame, queue_len=%d PS=%d @%lu\n", - skb_queue_len(&sta->tx_filtered[ac]), - !!test_sta_flag(sta, WLAN_STA_PS_STA), jiffies); -#endif - dev_kfree_skb(skb); -} - -static void ieee80211_check_pending_bar(struct sta_info *sta, u8 *addr, u8 tid) -{ - struct tid_ampdu_tx *tid_tx; - - tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); - if (!tid_tx || !tid_tx->bar_pending) - return; - - tid_tx->bar_pending = false; - ieee80211_send_bar(&sta->sdata->vif, addr, tid, tid_tx->failed_bar_ssn); -} - -static void ieee80211_frame_acked(struct sta_info *sta, struct sk_buff *skb) -{ - struct ieee80211_mgmt *mgmt = (void *) skb->data; - struct ieee80211_local *local = sta->local; - struct ieee80211_sub_if_data *sdata = sta->sdata; - - if (ieee80211_is_data_qos(mgmt->frame_control)) { - struct ieee80211_hdr *hdr = (void *) skb->data; - u8 *qc = ieee80211_get_qos_ctl(hdr); - u16 tid = qc[0] & 0xf; - - ieee80211_check_pending_bar(sta, hdr->addr1, tid); - } - - if (ieee80211_is_action(mgmt->frame_control) && - sdata->vif.type == NL80211_IFTYPE_STATION && - mgmt->u.action.category == WLAN_CATEGORY_HT && - mgmt->u.action.u.ht_smps.action == WLAN_HT_ACTION_SMPS) { - /* - * This update looks racy, but isn't -- if we come - * here we've definitely got a station that we're - * talking to, and on a managed interface that can - * only be the AP. And the only other place updating - * this variable is before we're associated. - */ - switch (mgmt->u.action.u.ht_smps.smps_control) { - case WLAN_HT_SMPS_CONTROL_DYNAMIC: - sta->sdata->u.mgd.ap_smps = IEEE80211_SMPS_DYNAMIC; - break; - case WLAN_HT_SMPS_CONTROL_STATIC: - sta->sdata->u.mgd.ap_smps = IEEE80211_SMPS_STATIC; - break; - case WLAN_HT_SMPS_CONTROL_DISABLED: - default: /* shouldn't happen since we don't send that */ - sta->sdata->u.mgd.ap_smps = IEEE80211_SMPS_OFF; - break; - } - - ieee80211_queue_work(&local->hw, &local->recalc_smps); - } -} - -static void ieee80211_set_bar_pending(struct sta_info *sta, u8 tid, u16 ssn) -{ - struct tid_ampdu_tx *tid_tx; - - tid_tx = rcu_dereference(sta->ampdu_mlme.tid_tx[tid]); - if (!tid_tx) - return; - - tid_tx->failed_bar_ssn = ssn; - tid_tx->bar_pending = true; -} - -static int ieee80211_tx_radiotap_len(struct ieee80211_tx_info *info) -{ - int len = sizeof(struct ieee80211_radiotap_header); - - /* IEEE80211_RADIOTAP_RATE rate */ - if (info->status.rates[0].idx >= 0 && - !(info->status.rates[0].flags & IEEE80211_TX_RC_MCS)) - len += 2; - - /* IEEE80211_RADIOTAP_TX_FLAGS */ - len += 2; - - /* IEEE80211_RADIOTAP_DATA_RETRIES */ - len += 1; - - /* IEEE80211_TX_RC_MCS */ - if (info->status.rates[0].idx >= 0 && - info->status.rates[0].flags & IEEE80211_TX_RC_MCS) - len += 3; - - return len; -} - -static void ieee80211_add_tx_radiotap_header(struct ieee80211_supported_band - *sband, struct sk_buff *skb, - int retry_count, int rtap_len) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_radiotap_header *rthdr; - unsigned char *pos; - u16 txflags; - - rthdr = (struct ieee80211_radiotap_header *) skb_push(skb, rtap_len); - - memset(rthdr, 0, rtap_len); - rthdr->it_len = cpu_to_le16(rtap_len); - rthdr->it_present = - cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) | - (1 << IEEE80211_RADIOTAP_DATA_RETRIES)); - pos = (unsigned char *)(rthdr + 1); - - /* - * XXX: Once radiotap gets the bitmap reset thing the vendor - * extensions proposal contains, we can actually report - * the whole set of tries we did. - */ - - /* IEEE80211_RADIOTAP_RATE */ - if (info->status.rates[0].idx >= 0 && - !(info->status.rates[0].flags & IEEE80211_TX_RC_MCS)) { - rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_RATE); - *pos = sband->bitrates[info->status.rates[0].idx].bitrate / 5; - /* padding for tx flags */ - pos += 2; - } - - /* IEEE80211_RADIOTAP_TX_FLAGS */ - txflags = 0; - if (!(info->flags & IEEE80211_TX_STAT_ACK) && - !is_multicast_ether_addr(hdr->addr1)) - txflags |= IEEE80211_RADIOTAP_F_TX_FAIL; - - if ((info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) || - (info->status.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)) - txflags |= IEEE80211_RADIOTAP_F_TX_CTS; - else if (info->status.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) - txflags |= IEEE80211_RADIOTAP_F_TX_RTS; - - put_unaligned_le16(txflags, pos); - pos += 2; - - /* IEEE80211_RADIOTAP_DATA_RETRIES */ - /* for now report the total retry_count */ - *pos = retry_count; - pos++; - - /* IEEE80211_TX_RC_MCS */ - if (info->status.rates[0].idx >= 0 && - info->status.rates[0].flags & IEEE80211_TX_RC_MCS) { - rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS); - pos[0] = IEEE80211_RADIOTAP_MCS_HAVE_MCS | - IEEE80211_RADIOTAP_MCS_HAVE_GI | - IEEE80211_RADIOTAP_MCS_HAVE_BW; - if (info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI) - pos[1] |= IEEE80211_RADIOTAP_MCS_SGI; - if (info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) - pos[1] |= IEEE80211_RADIOTAP_MCS_BW_40; - if (info->status.rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD) - pos[1] |= IEEE80211_RADIOTAP_MCS_FMT_GF; - pos[2] = info->status.rates[0].idx; - pos += 3; - } - -} - -/* - * Use a static threshold for now, best value to be determined - * by testing ... - * Should it depend on: - * - on # of retransmissions - * - current throughput (higher value for higher tpt)? - */ -#define STA_LOST_PKT_THRESHOLD 50 - -void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - struct sk_buff *skb2; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - __le16 fc; - struct ieee80211_supported_band *sband; - struct ieee80211_sub_if_data *sdata; - struct net_device *prev_dev = NULL; - struct sta_info *sta, *tmp; - int retry_count = -1, i; - int rates_idx = -1; - bool send_to_cooked; - bool acked; - struct ieee80211_bar *bar; - int rtap_len; - - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { - if (info->status.rates[i].idx < 0) { - break; - } else if (i >= hw->max_report_rates) { - /* the HW cannot have attempted that rate */ - info->status.rates[i].idx = -1; - info->status.rates[i].count = 0; - break; - } - - retry_count += info->status.rates[i].count; - } - rates_idx = i - 1; - - if (retry_count < 0) - retry_count = 0; - - rcu_read_lock(); - - sband = local->hw.wiphy->bands[info->band]; - fc = hdr->frame_control; - - for_each_sta_info(local, hdr->addr1, sta, tmp) { - /* skip wrong virtual interface */ - if (compare_ether_addr(hdr->addr2, sta->sdata->vif.addr)) - continue; - - if (info->flags & IEEE80211_TX_STATUS_EOSP) - clear_sta_flag(sta, WLAN_STA_SP); - - acked = !!(info->flags & IEEE80211_TX_STAT_ACK); - if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) { - /* - * The STA is in power save mode, so assume - * that this TX packet failed because of that. - */ - ieee80211_handle_filtered_frame(local, sta, skb); - rcu_read_unlock(); - return; - } - - if ((local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) && - (rates_idx != -1)) - sta->last_tx_rate = info->status.rates[rates_idx]; - - if ((info->flags & IEEE80211_TX_STAT_AMPDU_NO_BACK) && - (ieee80211_is_data_qos(fc))) { - u16 tid, ssn; - u8 *qc; - - qc = ieee80211_get_qos_ctl(hdr); - tid = qc[0] & 0xf; - ssn = ((le16_to_cpu(hdr->seq_ctrl) + 0x10) - & IEEE80211_SCTL_SEQ); - ieee80211_send_bar(&sta->sdata->vif, hdr->addr1, - tid, ssn); - } - - if (!acked && ieee80211_is_back_req(fc)) { - u16 tid, control; - - /* - * BAR failed, store the last SSN and retry sending - * the BAR when the next unicast transmission on the - * same TID succeeds. - */ - bar = (struct ieee80211_bar *) skb->data; - control = le16_to_cpu(bar->control); - if (!(control & IEEE80211_BAR_CTRL_MULTI_TID)) { - u16 ssn = le16_to_cpu(bar->start_seq_num); - - tid = (control & - IEEE80211_BAR_CTRL_TID_INFO_MASK) >> - IEEE80211_BAR_CTRL_TID_INFO_SHIFT; - - ieee80211_set_bar_pending(sta, tid, ssn); - } - } - - if (info->flags & IEEE80211_TX_STAT_TX_FILTERED) { - ieee80211_handle_filtered_frame(local, sta, skb); - rcu_read_unlock(); - return; - } else { - if (!acked) - sta->tx_retry_failed++; - sta->tx_retry_count += retry_count; - } - - rate_control_tx_status(local, sband, sta, skb); - if (ieee80211_vif_is_mesh(&sta->sdata->vif)) - ieee80211s_update_metric(local, sta, skb); - - if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked) - ieee80211_frame_acked(sta, skb); - - if ((sta->sdata->vif.type == NL80211_IFTYPE_STATION) && - (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS)) - ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data, acked); - - if (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) { - if (info->flags & IEEE80211_TX_STAT_ACK) { - if (sta->lost_packets) - sta->lost_packets = 0; - } else if (++sta->lost_packets >= STA_LOST_PKT_THRESHOLD) { - cfg80211_cqm_pktloss_notify(sta->sdata->dev, - sta->sta.addr, - sta->lost_packets, - GFP_ATOMIC); - sta->lost_packets = 0; - } - } - } - - rcu_read_unlock(); - - ieee80211_led_tx(local, 0); - - /* SNMP counters - * Fragments are passed to low-level drivers as separate skbs, so these - * are actually fragments, not frames. Update frame counters only for - * the first fragment of the frame. */ - if (info->flags & IEEE80211_TX_STAT_ACK) { - if (ieee80211_is_first_frag(hdr->seq_ctrl)) { - local->dot11TransmittedFrameCount++; - if (is_multicast_ether_addr(hdr->addr1)) - local->dot11MulticastTransmittedFrameCount++; - if (retry_count > 0) - local->dot11RetryCount++; - if (retry_count > 1) - local->dot11MultipleRetryCount++; - } - - /* This counter shall be incremented for an acknowledged MPDU - * with an individual address in the address 1 field or an MPDU - * with a multicast address in the address 1 field of type Data - * or Management. */ - if (!is_multicast_ether_addr(hdr->addr1) || - ieee80211_is_data(fc) || - ieee80211_is_mgmt(fc)) - local->dot11TransmittedFragmentCount++; - } else { - if (ieee80211_is_first_frag(hdr->seq_ctrl)) - local->dot11FailedCount++; - } - - if (ieee80211_is_nullfunc(fc) && ieee80211_has_pm(fc) && - (local->hw.flags & IEEE80211_HW_REPORTS_TX_ACK_STATUS) && - !(info->flags & IEEE80211_TX_CTL_INJECTED) && - local->ps_sdata && !(local->scanning)) { - if (info->flags & IEEE80211_TX_STAT_ACK) { - local->ps_sdata->u.mgd.flags |= - IEEE80211_STA_NULLFUNC_ACKED; - } else - mod_timer(&local->dynamic_ps_timer, jiffies + - msecs_to_jiffies(10)); - } - - if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) { - u64 cookie = (unsigned long)skb; - - if (ieee80211_is_nullfunc(hdr->frame_control) || - ieee80211_is_qos_nullfunc(hdr->frame_control)) { - acked = info->flags & IEEE80211_TX_STAT_ACK; - - cfg80211_probe_status(skb->dev, hdr->addr1, - cookie, acked, GFP_ATOMIC); - } else { - struct ieee80211_work *wk; - - rcu_read_lock(); - list_for_each_entry_rcu(wk, &local->work_list, list) { - if (wk->type != IEEE80211_WORK_OFFCHANNEL_TX) - continue; - if (wk->offchan_tx.frame != skb) - continue; - wk->offchan_tx.status = true; - break; - } - rcu_read_unlock(); - if (local->hw_roc_skb_for_status == skb) { - cookie = local->hw_roc_cookie ^ 2; - local->hw_roc_skb_for_status = NULL; - } - - cfg80211_mgmt_tx_status( - skb->dev, cookie, skb->data, skb->len, - !!(info->flags & IEEE80211_TX_STAT_ACK), - GFP_ATOMIC); - } - } - - if (unlikely(info->ack_frame_id)) { - struct sk_buff *ack_skb; - unsigned long flags; - - spin_lock_irqsave(&local->ack_status_lock, flags); - ack_skb = idr_find(&local->ack_status_frames, - info->ack_frame_id); - if (ack_skb) - idr_remove(&local->ack_status_frames, - info->ack_frame_id); - spin_unlock_irqrestore(&local->ack_status_lock, flags); - - /* consumes ack_skb */ - if (ack_skb) - skb_complete_wifi_ack(ack_skb, - info->flags & IEEE80211_TX_STAT_ACK); - } - - /* this was a transmitted frame, but now we want to reuse it */ - skb_orphan(skb); - - /* Need to make a copy before skb->cb gets cleared */ - send_to_cooked = !!(info->flags & IEEE80211_TX_CTL_INJECTED) || - !(ieee80211_is_data(fc)); - - /* - * This is a bit racy but we can avoid a lot of work - * with this test... - */ - if (!local->monitors && (!send_to_cooked || !local->cooked_mntrs)) { - dev_kfree_skb(skb); - return; - } - - /* send frame to monitor interfaces now */ - rtap_len = ieee80211_tx_radiotap_len(info); - if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { - printk(KERN_ERR "ieee80211_tx_status: headroom too small\n"); - dev_kfree_skb(skb); - return; - } - ieee80211_add_tx_radiotap_header(sband, skb, retry_count, rtap_len); - - /* XXX: is this sufficient for BPF? */ - skb_set_mac_header(skb, 0); - skb->ip_summed = CHECKSUM_UNNECESSARY; - skb->pkt_type = PACKET_OTHERHOST; - skb->protocol = htons(ETH_P_802_2); - memset(skb->cb, 0, sizeof(skb->cb)); - - rcu_read_lock(); - list_for_each_entry_rcu(sdata, &local->interfaces, list) { - if (sdata->vif.type == NL80211_IFTYPE_MONITOR) { - if (!ieee80211_sdata_running(sdata)) - continue; - - if ((sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) && - !send_to_cooked) - continue; - - if (prev_dev) { - skb2 = skb_clone(skb, GFP_ATOMIC); - if (skb2) { - skb2->dev = prev_dev; - netif_rx(skb2); - } - } - - prev_dev = sdata->dev; - } - } - if (prev_dev) { - skb->dev = prev_dev; - netif_rx(skb); - skb = NULL; - } - rcu_read_unlock(); - dev_kfree_skb(skb); -} -EXPORT_SYMBOL(ieee80211_tx_status); - -void ieee80211_report_low_ack(struct ieee80211_sta *pubsta, u32 num_packets) -{ - struct sta_info *sta = container_of(pubsta, struct sta_info, sta); - cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr, - num_packets, GFP_ATOMIC); -} -EXPORT_SYMBOL(ieee80211_report_low_ack); - -void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - if (unlikely(info->ack_frame_id)) { - struct sk_buff *ack_skb; - unsigned long flags; - - spin_lock_irqsave(&local->ack_status_lock, flags); - ack_skb = idr_find(&local->ack_status_frames, - info->ack_frame_id); - if (ack_skb) - idr_remove(&local->ack_status_frames, - info->ack_frame_id); - spin_unlock_irqrestore(&local->ack_status_lock, flags); - - /* consumes ack_skb */ - if (ack_skb) - dev_kfree_skb_any(ack_skb); - } - - dev_kfree_skb_any(skb); -} -EXPORT_SYMBOL(ieee80211_free_txskb); diff --git a/openairITS/mac/DOT11/net/mac80211/tkip.c b/openairITS/mac/DOT11/net/mac80211/tkip.c deleted file mode 100644 index 51077a956a8..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/tkip.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright 2002-2004, Instant802 Networks, Inc. - * Copyright 2005, Devicescape Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#include <linux/kernel.h> -#include <linux/bitops.h> -#include <linux/types.h> -#include <linux/netdevice.h> -#include <linux/export.h> -#include <asm/unaligned.h> - -#include <net/mac80211.h> -#include "driver-ops.h" -#include "key.h" -#include "tkip.h" -#include "wep.h" - -#define PHASE1_LOOP_COUNT 8 - -/* - * 2-byte by 2-byte subset of the full AES S-box table; second part of this - * table is identical to first part but byte-swapped - */ -static const u16 tkip_sbox[256] = -{ - 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, - 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, - 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, - 0x41EC, 0xB367, 0x5FFD, 0x45EA, 0x23BF, 0x53F7, 0xE496, 0x9B5B, - 0x75C2, 0xE11C, 0x3DAE, 0x4C6A, 0x6C5A, 0x7E41, 0xF502, 0x834F, - 0x685C, 0x51F4, 0xD134, 0xF908, 0xE293, 0xAB73, 0x6253, 0x2A3F, - 0x080C, 0x9552, 0x4665, 0x9D5E, 0x3028, 0x37A1, 0x0A0F, 0x2FB5, - 0x0E09, 0x2436, 0x1B9B, 0xDF3D, 0xCD26, 0x4E69, 0x7FCD, 0xEA9F, - 0x121B, 0x1D9E, 0x5874, 0x342E, 0x362D, 0xDCB2, 0xB4EE, 0x5BFB, - 0xA4F6, 0x764D, 0xB761, 0x7DCE, 0x527B, 0xDD3E, 0x5E71, 0x1397, - 0xA6F5, 0xB968, 0x0000, 0xC12C, 0x4060, 0xE31F, 0x79C8, 0xB6ED, - 0xD4BE, 0x8D46, 0x67D9, 0x724B, 0x94DE, 0x98D4, 0xB0E8, 0x854A, - 0xBB6B, 0xC52A, 0x4FE5, 0xED16, 0x86C5, 0x9AD7, 0x6655, 0x1194, - 0x8ACF, 0xE910, 0x0406, 0xFE81, 0xA0F0, 0x7844, 0x25BA, 0x4BE3, - 0xA2F3, 0x5DFE, 0x80C0, 0x058A, 0x3FAD, 0x21BC, 0x7048, 0xF104, - 0x63DF, 0x77C1, 0xAF75, 0x4263, 0x2030, 0xE51A, 0xFD0E, 0xBF6D, - 0x814C, 0x1814, 0x2635, 0xC32F, 0xBEE1, 0x35A2, 0x88CC, 0x2E39, - 0x9357, 0x55F2, 0xFC82, 0x7A47, 0xC8AC, 0xBAE7, 0x322B, 0xE695, - 0xC0A0, 0x1998, 0x9ED1, 0xA37F, 0x4466, 0x547E, 0x3BAB, 0x0B83, - 0x8CCA, 0xC729, 0x6BD3, 0x283C, 0xA779, 0xBCE2, 0x161D, 0xAD76, - 0xDB3B, 0x6456, 0x744E, 0x141E, 0x92DB, 0x0C0A, 0x486C, 0xB8E4, - 0x9F5D, 0xBD6E, 0x43EF, 0xC4A6, 0x39A8, 0x31A4, 0xD337, 0xF28B, - 0xD532, 0x8B43, 0x6E59, 0xDAB7, 0x018C, 0xB164, 0x9CD2, 0x49E0, - 0xD8B4, 0xACFA, 0xF307, 0xCF25, 0xCAAF, 0xF48E, 0x47E9, 0x1018, - 0x6FD5, 0xF088, 0x4A6F, 0x5C72, 0x3824, 0x57F1, 0x73C7, 0x9751, - 0xCB23, 0xA17C, 0xE89C, 0x3E21, 0x96DD, 0x61DC, 0x0D86, 0x0F85, - 0xE090, 0x7C42, 0x71C4, 0xCCAA, 0x90D8, 0x0605, 0xF701, 0x1C12, - 0xC2A3, 0x6A5F, 0xAEF9, 0x69D0, 0x1791, 0x9958, 0x3A27, 0x27B9, - 0xD938, 0xEB13, 0x2BB3, 0x2233, 0xD2BB, 0xA970, 0x0789, 0x33A7, - 0x2DB6, 0x3C22, 0x1592, 0xC920, 0x8749, 0xAAFF, 0x5078, 0xA57A, - 0x038F, 0x59F8, 0x0980, 0x1A17, 0x65DA, 0xD731, 0x84C6, 0xD0B8, - 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, -}; - -static u16 tkipS(u16 val) -{ - return tkip_sbox[val & 0xff] ^ swab16(tkip_sbox[val >> 8]); -} - -static u8 *write_tkip_iv(u8 *pos, u16 iv16) -{ - *pos++ = iv16 >> 8; - *pos++ = ((iv16 >> 8) | 0x20) & 0x7f; - *pos++ = iv16 & 0xFF; - return pos; -} - -/* - * P1K := Phase1(TA, TK, TSC) - * TA = transmitter address (48 bits) - * TK = dot11DefaultKeyValue or dot11KeyMappingValue (128 bits) - * TSC = TKIP sequence counter (48 bits, only 32 msb bits used) - * P1K: 80 bits - */ -static void tkip_mixing_phase1(const u8 *tk, struct tkip_ctx *ctx, - const u8 *ta, u32 tsc_IV32) -{ - int i, j; - u16 *p1k = ctx->p1k; - - p1k[0] = tsc_IV32 & 0xFFFF; - p1k[1] = tsc_IV32 >> 16; - p1k[2] = get_unaligned_le16(ta + 0); - p1k[3] = get_unaligned_le16(ta + 2); - p1k[4] = get_unaligned_le16(ta + 4); - - for (i = 0; i < PHASE1_LOOP_COUNT; i++) { - j = 2 * (i & 1); - p1k[0] += tkipS(p1k[4] ^ get_unaligned_le16(tk + 0 + j)); - p1k[1] += tkipS(p1k[0] ^ get_unaligned_le16(tk + 4 + j)); - p1k[2] += tkipS(p1k[1] ^ get_unaligned_le16(tk + 8 + j)); - p1k[3] += tkipS(p1k[2] ^ get_unaligned_le16(tk + 12 + j)); - p1k[4] += tkipS(p1k[3] ^ get_unaligned_le16(tk + 0 + j)) + i; - } - ctx->state = TKIP_STATE_PHASE1_DONE; - ctx->p1k_iv32 = tsc_IV32; -} - -static void tkip_mixing_phase2(const u8 *tk, struct tkip_ctx *ctx, - u16 tsc_IV16, u8 *rc4key) -{ - u16 ppk[6]; - const u16 *p1k = ctx->p1k; - int i; - - ppk[0] = p1k[0]; - ppk[1] = p1k[1]; - ppk[2] = p1k[2]; - ppk[3] = p1k[3]; - ppk[4] = p1k[4]; - ppk[5] = p1k[4] + tsc_IV16; - - ppk[0] += tkipS(ppk[5] ^ get_unaligned_le16(tk + 0)); - ppk[1] += tkipS(ppk[0] ^ get_unaligned_le16(tk + 2)); - ppk[2] += tkipS(ppk[1] ^ get_unaligned_le16(tk + 4)); - ppk[3] += tkipS(ppk[2] ^ get_unaligned_le16(tk + 6)); - ppk[4] += tkipS(ppk[3] ^ get_unaligned_le16(tk + 8)); - ppk[5] += tkipS(ppk[4] ^ get_unaligned_le16(tk + 10)); - ppk[0] += ror16(ppk[5] ^ get_unaligned_le16(tk + 12), 1); - ppk[1] += ror16(ppk[0] ^ get_unaligned_le16(tk + 14), 1); - ppk[2] += ror16(ppk[1], 1); - ppk[3] += ror16(ppk[2], 1); - ppk[4] += ror16(ppk[3], 1); - ppk[5] += ror16(ppk[4], 1); - - rc4key = write_tkip_iv(rc4key, tsc_IV16); - *rc4key++ = ((ppk[5] ^ get_unaligned_le16(tk)) >> 1) & 0xFF; - - for (i = 0; i < 6; i++) - put_unaligned_le16(ppk[i], rc4key + 2 * i); -} - -/* Add TKIP IV and Ext. IV at @pos. @iv0, @iv1, and @iv2 are the first octets - * of the IV. Returns pointer to the octet following IVs (i.e., beginning of - * the packet payload). */ -u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key) -{ - lockdep_assert_held(&key->u.tkip.txlock); - - pos = write_tkip_iv(pos, key->u.tkip.tx.iv16); - *pos++ = (key->conf.keyidx << 6) | (1 << 5) /* Ext IV */; - put_unaligned_le32(key->u.tkip.tx.iv32, pos); - return pos + 4; -} - -static void ieee80211_compute_tkip_p1k(struct ieee80211_key *key, u32 iv32) -{ - struct ieee80211_sub_if_data *sdata = key->sdata; - struct tkip_ctx *ctx = &key->u.tkip.tx; - const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; - - lockdep_assert_held(&key->u.tkip.txlock); - - /* - * Update the P1K when the IV32 is different from the value it - * had when we last computed it (or when not initialised yet). - * This might flip-flop back and forth if packets are processed - * out-of-order due to the different ACs, but then we have to - * just compute the P1K more often. - */ - if (ctx->p1k_iv32 != iv32 || ctx->state == TKIP_STATE_NOT_INIT) - tkip_mixing_phase1(tk, ctx, sdata->vif.addr, iv32); -} - -void ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *keyconf, - u32 iv32, u16 *p1k) -{ - struct ieee80211_key *key = (struct ieee80211_key *) - container_of(keyconf, struct ieee80211_key, conf); - struct tkip_ctx *ctx = &key->u.tkip.tx; - unsigned long flags; - - spin_lock_irqsave(&key->u.tkip.txlock, flags); - ieee80211_compute_tkip_p1k(key, iv32); - memcpy(p1k, ctx->p1k, sizeof(ctx->p1k)); - spin_unlock_irqrestore(&key->u.tkip.txlock, flags); -} -EXPORT_SYMBOL(ieee80211_get_tkip_p1k_iv); - -void ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf, - const u8 *ta, u32 iv32, u16 *p1k) -{ - const u8 *tk = &keyconf->key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; - struct tkip_ctx ctx; - - tkip_mixing_phase1(tk, &ctx, ta, iv32); - memcpy(p1k, ctx.p1k, sizeof(ctx.p1k)); -} -EXPORT_SYMBOL(ieee80211_get_tkip_rx_p1k); - -void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf, - struct sk_buff *skb, u8 *p2k) -{ - struct ieee80211_key *key = (struct ieee80211_key *) - container_of(keyconf, struct ieee80211_key, conf); - const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; - struct tkip_ctx *ctx = &key->u.tkip.tx; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control); - u32 iv32 = get_unaligned_le32(&data[4]); - u16 iv16 = data[2] | (data[0] << 8); - unsigned long flags; - - spin_lock_irqsave(&key->u.tkip.txlock, flags); - ieee80211_compute_tkip_p1k(key, iv32); - tkip_mixing_phase2(tk, ctx, iv16, p2k); - spin_unlock_irqrestore(&key->u.tkip.txlock, flags); -} -EXPORT_SYMBOL(ieee80211_get_tkip_p2k); - -/* - * Encrypt packet payload with TKIP using @key. @pos is a pointer to the - * beginning of the buffer containing payload. This payload must include - * the IV/Ext.IV and space for (taildroom) four octets for ICV. - * @payload_len is the length of payload (_not_ including IV/ICV length). - * @ta is the transmitter addresses. - */ -int ieee80211_tkip_encrypt_data(struct crypto_cipher *tfm, - struct ieee80211_key *key, - struct sk_buff *skb, - u8 *payload, size_t payload_len) -{ - u8 rc4key[16]; - - ieee80211_get_tkip_p2k(&key->conf, skb, rc4key); - - return ieee80211_wep_encrypt_data(tfm, rc4key, 16, - payload, payload_len); -} - -/* Decrypt packet payload with TKIP using @key. @pos is a pointer to the - * beginning of the buffer containing IEEE 802.11 header payload, i.e., - * including IV, Ext. IV, real data, Michael MIC, ICV. @payload_len is the - * length of payload, including IV, Ext. IV, MIC, ICV. */ -int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, - struct ieee80211_key *key, - u8 *payload, size_t payload_len, u8 *ta, - u8 *ra, int only_iv, int queue, - u32 *out_iv32, u16 *out_iv16) -{ - u32 iv32; - u32 iv16; - u8 rc4key[16], keyid, *pos = payload; - int res; - const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY]; - - if (payload_len < 12) - return -1; - - iv16 = (pos[0] << 8) | pos[2]; - keyid = pos[3]; - iv32 = get_unaligned_le32(pos + 4); - pos += 8; -#ifdef CONFIG_MAC80211_TKIP_DEBUG - { - int i; - printk(KERN_DEBUG "TKIP decrypt: data(len=%zd)", payload_len); - for (i = 0; i < payload_len; i++) - printk(" %02x", payload[i]); - printk("\n"); - printk(KERN_DEBUG "TKIP decrypt: iv16=%04x iv32=%08x\n", - iv16, iv32); - } -#endif - - if (!(keyid & (1 << 5))) - return TKIP_DECRYPT_NO_EXT_IV; - - if ((keyid >> 6) != key->conf.keyidx) - return TKIP_DECRYPT_INVALID_KEYIDX; - - if (key->u.tkip.rx[queue].state != TKIP_STATE_NOT_INIT && - (iv32 < key->u.tkip.rx[queue].iv32 || - (iv32 == key->u.tkip.rx[queue].iv32 && - iv16 <= key->u.tkip.rx[queue].iv16))) { -#ifdef CONFIG_MAC80211_TKIP_DEBUG - printk(KERN_DEBUG "TKIP replay detected for RX frame from " - "%pM (RX IV (%04x,%02x) <= prev. IV (%04x,%02x)\n", - ta, - iv32, iv16, key->u.tkip.rx[queue].iv32, - key->u.tkip.rx[queue].iv16); -#endif - return TKIP_DECRYPT_REPLAY; - } - - if (only_iv) { - res = TKIP_DECRYPT_OK; - key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED; - goto done; - } - - if (key->u.tkip.rx[queue].state == TKIP_STATE_NOT_INIT || - key->u.tkip.rx[queue].iv32 != iv32) { - /* IV16 wrapped around - perform TKIP phase 1 */ - tkip_mixing_phase1(tk, &key->u.tkip.rx[queue], ta, iv32); -#ifdef CONFIG_MAC80211_TKIP_DEBUG - { - int i; - u8 key_offset = NL80211_TKIP_DATA_OFFSET_ENCR_KEY; - printk(KERN_DEBUG "TKIP decrypt: Phase1 TA=%pM" - " TK=", ta); - for (i = 0; i < 16; i++) - printk("%02x ", - key->conf.key[key_offset + i]); - printk("\n"); - printk(KERN_DEBUG "TKIP decrypt: P1K="); - for (i = 0; i < 5; i++) - printk("%04x ", key->u.tkip.rx[queue].p1k[i]); - printk("\n"); - } -#endif - } - if (key->local->ops->update_tkip_key && - key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE && - key->u.tkip.rx[queue].state != TKIP_STATE_PHASE1_HW_UPLOADED) { - struct ieee80211_sub_if_data *sdata = key->sdata; - - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) - sdata = container_of(key->sdata->bss, - struct ieee80211_sub_if_data, u.ap); - drv_update_tkip_key(key->local, sdata, &key->conf, key->sta, - iv32, key->u.tkip.rx[queue].p1k); - key->u.tkip.rx[queue].state = TKIP_STATE_PHASE1_HW_UPLOADED; - } - - tkip_mixing_phase2(tk, &key->u.tkip.rx[queue], iv16, rc4key); -#ifdef CONFIG_MAC80211_TKIP_DEBUG - { - int i; - printk(KERN_DEBUG "TKIP decrypt: Phase2 rc4key="); - for (i = 0; i < 16; i++) - printk("%02x ", rc4key[i]); - printk("\n"); - } -#endif - - res = ieee80211_wep_decrypt_data(tfm, rc4key, 16, pos, payload_len - 12); - done: - if (res == TKIP_DECRYPT_OK) { - /* - * Record previously received IV, will be copied into the - * key information after MIC verification. It is possible - * that we don't catch replays of fragments but that's ok - * because the Michael MIC verication will then fail. - */ - *out_iv32 = iv32; - *out_iv16 = iv16; - } - - return res; -} diff --git a/openairITS/mac/DOT11/net/mac80211/tkip.h b/openairITS/mac/DOT11/net/mac80211/tkip.h deleted file mode 100644 index e3ecb659b90..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/tkip.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2002-2004, Instant802 Networks, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef TKIP_H -#define TKIP_H - -#include <linux/types.h> -#include <linux/crypto.h> -#include "key.h" - -u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key); - -int ieee80211_tkip_encrypt_data(struct crypto_cipher *tfm, - struct ieee80211_key *key, - struct sk_buff *skb, - u8 *payload, size_t payload_len); - -enum { - TKIP_DECRYPT_OK = 0, - TKIP_DECRYPT_NO_EXT_IV = -1, - TKIP_DECRYPT_INVALID_KEYIDX = -2, - TKIP_DECRYPT_REPLAY = -3, -}; -int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm, - struct ieee80211_key *key, - u8 *payload, size_t payload_len, u8 *ta, - u8 *ra, int only_iv, int queue, - u32 *out_iv32, u16 *out_iv16); - -#endif /* TKIP_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/tx.c b/openairITS/mac/DOT11/net/mac80211/tx.c deleted file mode 100644 index 612c6f962aa..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/tx.c +++ /dev/null @@ -1,2886 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * - * Transmit and frame generation functions. - */ - -#include <linux/kernel.h> -#include <linux/slab.h> -#include <linux/skbuff.h> -#include <linux/etherdevice.h> -#include <linux/bitmap.h> -#include <linux/rcupdate.h> -#include <linux/export.h> -#include <net/net_namespace.h> -#include <net/ieee80211_radiotap.h> -#include <net/cfg80211.h> -#include <net/mac80211.h> -#include <asm/unaligned.h> - -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "led.h" -#include "mesh.h" -#include "wep.h" -#include "wpa.h" -#include "wme.h" -#include "rate.h" - -/* misc utils */ - -static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, - struct sk_buff *skb, int group_addr, - int next_frag_len) -{ - int rate, mrate, erp, dur, i; - struct ieee80211_rate *txrate; - struct ieee80211_local *local = tx->local; - struct ieee80211_supported_band *sband; - struct ieee80211_hdr *hdr; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - /* assume HW handles this */ - if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS) - return 0; - - /* uh huh? */ - if (WARN_ON_ONCE(info->control.rates[0].idx < 0)) - return 0; - - sband = local->hw.wiphy->bands[tx->channel->band]; - txrate = &sband->bitrates[info->control.rates[0].idx]; - - erp = txrate->flags & IEEE80211_RATE_ERP_G; - - /* - * data and mgmt (except PS Poll): - * - during CFP: 32768 - * - during contention period: - * if addr1 is group address: 0 - * if more fragments = 0 and addr1 is individual address: time to - * transmit one ACK plus SIFS - * if more fragments = 1 and addr1 is individual address: time to - * transmit next fragment plus 2 x ACK plus 3 x SIFS - * - * IEEE 802.11, 9.6: - * - control response frame (CTS or ACK) shall be transmitted using the - * same rate as the immediately previous frame in the frame exchange - * sequence, if this rate belongs to the PHY mandatory rates, or else - * at the highest possible rate belonging to the PHY rates in the - * BSSBasicRateSet - */ - hdr = (struct ieee80211_hdr *)skb->data; - if (ieee80211_is_ctl(hdr->frame_control)) { - /* TODO: These control frames are not currently sent by - * mac80211, but should they be implemented, this function - * needs to be updated to support duration field calculation. - * - * RTS: time needed to transmit pending data/mgmt frame plus - * one CTS frame plus one ACK frame plus 3 x SIFS - * CTS: duration of immediately previous RTS minus time - * required to transmit CTS and its SIFS - * ACK: 0 if immediately previous directed data/mgmt had - * more=0, with more=1 duration in ACK frame is duration - * from previous frame minus time needed to transmit ACK - * and its SIFS - * PS Poll: BIT(15) | BIT(14) | aid - */ - return 0; - } - - /* data/mgmt */ - if (0 /* FIX: data/mgmt during CFP */) - return cpu_to_le16(32768); - - if (group_addr) /* Group address as the destination - no ACK */ - return 0; - - /* Individual destination address: - * IEEE 802.11, Ch. 9.6 (after IEEE 802.11g changes) - * CTS and ACK frames shall be transmitted using the highest rate in - * basic rate set that is less than or equal to the rate of the - * immediately previous frame and that is using the same modulation - * (CCK or OFDM). If no basic rate set matches with these requirements, - * the highest mandatory rate of the PHY that is less than or equal to - * the rate of the previous frame is used. - * Mandatory rates for IEEE 802.11g PHY: 1, 2, 5.5, 11, 6, 12, 24 Mbps - */ - rate = -1; - /* use lowest available if everything fails */ - mrate = sband->bitrates[0].bitrate; - for (i = 0; i < sband->n_bitrates; i++) { - struct ieee80211_rate *r = &sband->bitrates[i]; - - if (r->bitrate > txrate->bitrate) - break; - - if (tx->sdata->vif.bss_conf.basic_rates & BIT(i)) - rate = r->bitrate; - - /* - * [PLATA] to check what to do with the two other bands. My feeling is that we should - * 1) define a flag IEEE80211_RATE_MANDATORY_P to 6Mbps - * 2) assigns it for the flag... - * Note: to check the mandatory rate for 800MHz - */ - switch (sband->band) { - case IEEE80211_BAND_5_9GHZ: - if (r->flags & IEEE80211_RATE_MANDATORY_P) - mrate = r->bitrate; - break; - case IEEE80211_BAND_0_8GHZ: - if (r->flags & IEEE80211_RATE_MANDATORY_P) - mrate = r->bitrate; - break; - case IEEE80211_BAND_2GHZ: { - u32 flag; - if (tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) - flag = IEEE80211_RATE_MANDATORY_G; - else - flag = IEEE80211_RATE_MANDATORY_B; - if (r->flags & flag) - mrate = r->bitrate; - break; - } - case IEEE80211_BAND_5GHZ: - if (r->flags & IEEE80211_RATE_MANDATORY_A) - mrate = r->bitrate; - break; - case IEEE80211_NUM_BANDS: - WARN_ON(1); - break; - } - } - if (rate == -1) { - /* No matching basic rate found; use highest suitable mandatory - * PHY rate */ - rate = mrate; - } - - /* Don't calculate ACKs for QoS Frames with NoAck Policy set */ - if (ieee80211_is_data_qos(hdr->frame_control) && - *(ieee80211_get_qos_ctl(hdr)) | IEEE80211_QOS_CTL_ACK_POLICY_NOACK) - dur = 0; - else - /* Time needed to transmit ACK - * (10 bytes + 4-byte FCS = 112 bits) plus SIFS; rounded up - * to closest integer */ - dur = ieee80211_frame_duration(local, 10, rate, erp, - tx->sdata->vif.bss_conf.use_short_preamble); - - if (next_frag_len) { - /* Frame is fragmented: duration increases with time needed to - * transmit next fragment plus ACK and 2 x SIFS. */ - dur *= 2; /* ACK + SIFS */ - /* next fragment */ - dur += ieee80211_frame_duration(local, next_frag_len, - txrate->bitrate, erp, - tx->sdata->vif.bss_conf.use_short_preamble); - } - - return cpu_to_le16(dur); -} - -static inline int is_ieee80211_device(struct ieee80211_local *local, - struct net_device *dev) -{ - return local == wdev_priv(dev->ieee80211_ptr); -} - -/* tx handlers */ -static ieee80211_tx_result debug_noinline -ieee80211_tx_h_dynamic_ps(struct ieee80211_tx_data *tx) -{ - struct ieee80211_local *local = tx->local; - struct ieee80211_if_managed *ifmgd; - - /* driver doesn't support power save */ - if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) - return TX_CONTINUE; - - /* hardware does dynamic power save */ - if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) - return TX_CONTINUE; - - /* dynamic power save disabled */ - if (local->hw.conf.dynamic_ps_timeout <= 0) - return TX_CONTINUE; - - /* we are scanning, don't enable power save */ - if (local->scanning) - return TX_CONTINUE; - - if (!local->ps_sdata) - return TX_CONTINUE; - - /* No point if we're going to suspend */ - if (local->quiescing) - return TX_CONTINUE; - - /* dynamic ps is supported only in managed mode */ - if (tx->sdata->vif.type != NL80211_IFTYPE_STATION) - return TX_CONTINUE; - - ifmgd = &tx->sdata->u.mgd; - - /* - * Don't wakeup from power save if u-apsd is enabled, voip ac has - * u-apsd enabled and the frame is in voip class. This effectively - * means that even if all access categories have u-apsd enabled, in - * practise u-apsd is only used with the voip ac. This is a - * workaround for the case when received voip class packets do not - * have correct qos tag for some reason, due the network or the - * peer application. - * - * Note: ifmgd->uapsd_queues access is racy here. If the value is - * changed via debugfs, user needs to reassociate manually to have - * everything in sync. - */ - if ((ifmgd->flags & IEEE80211_STA_UAPSD_ENABLED) - && (ifmgd->uapsd_queues & IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) - && skb_get_queue_mapping(tx->skb) == 0) - return TX_CONTINUE; - - if (local->hw.conf.flags & IEEE80211_CONF_PS) { - ieee80211_stop_queues_by_reason(&local->hw, - IEEE80211_QUEUE_STOP_REASON_PS); - ifmgd->flags &= ~IEEE80211_STA_NULLFUNC_ACKED; - ieee80211_queue_work(&local->hw, - &local->dynamic_ps_disable_work); - } - - /* Don't restart the timer if we're not disassociated */ - if (!ifmgd->associated) - return TX_CONTINUE; - - mod_timer(&local->dynamic_ps_timer, jiffies + - msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); - - return TX_CONTINUE; -} - -/* - * [PLATA] - when OCB is activated, this method should either not be called, or not do anything... - */ -static ieee80211_tx_result debug_noinline -ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) -{ - - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - bool assoc = false; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- handlers -- ieee80211_tx_h_check_assoc \n"); -#endif - - if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) - return TX_CONTINUE; - - if (unlikely(test_bit(SCAN_SW_SCANNING, &tx->local->scanning)) && - test_bit(SDATA_STATE_OFFCHANNEL, &tx->sdata->state) && - !ieee80211_is_probe_req(hdr->frame_control) && - !ieee80211_is_nullfunc(hdr->frame_control)) - /* - * When software scanning only nullfunc frames (to notify - * the sleep state to the AP) and probe requests (for the - * active scan) are allowed, all other frames should not be - * sent and we should not get here, but if we do - * nonetheless, drop them to avoid sending them - * off-channel. See the link below and - * ieee80211_start_scan() for more. - * - * http://article.gmane.org/gmane.linux.kernel.wireless.general/30089 - */ - return TX_DROP; - - if (tx->sdata->vif.type == NL80211_IFTYPE_WDS) - return TX_CONTINUE; - - if (tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT) - return TX_CONTINUE; - - if (tx->flags & IEEE80211_TX_PS_BUFFERED) - return TX_CONTINUE; - - if (tx->sta) - assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC); - - if (likely(tx->flags & IEEE80211_TX_UNICAST)) { - if (unlikely(!assoc && - ieee80211_is_data(hdr->frame_control))) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "%s: dropped data frame to not " - "associated station %pM\n", - tx->sdata->name, hdr->addr1); -#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ - I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); - return TX_DROP; - } - } else if (unlikely(tx->sdata->vif.type == NL80211_IFTYPE_AP && - ieee80211_is_data(hdr->frame_control) && - !atomic_read(&tx->sdata->u.ap.num_sta_authorized))) { - /* - * No associated STAs - no need to send multicast - * frames. - */ - return TX_DROP; - } - - // [PLATA]: to clarify here: if I read well, if I am AD-HOC and BROADCAST, no change are required (no need to be associated...)...,right? - return TX_CONTINUE; -} - -/* This function is called whenever the AP is about to exceed the maximum limit - * of buffered frames for power saving STAs. This situation should not really - * happen often during normal operation, so dropping the oldest buffered packet - * from each queue should be OK to make some room for new frames. */ -static void purge_old_ps_buffers(struct ieee80211_local *local) -{ - int total = 0, purged = 0; - struct sk_buff *skb; - struct ieee80211_sub_if_data *sdata; - struct sta_info *sta; - - /* - * virtual interfaces are protected by RCU - */ - rcu_read_lock(); - - list_for_each_entry_rcu(sdata, &local->interfaces, list) { - struct ieee80211_if_ap *ap; - if (sdata->vif.type != NL80211_IFTYPE_AP) - continue; - ap = &sdata->u.ap; - skb = skb_dequeue(&ap->ps_bc_buf); - if (skb) { - purged++; - dev_kfree_skb(skb); - } - total += skb_queue_len(&ap->ps_bc_buf); - } - - /* - * Drop one frame from each station from the lowest-priority - * AC that has frames at all. - */ - list_for_each_entry_rcu(sta, &local->sta_list, list) { - int ac; - - for (ac = IEEE80211_AC_BK; ac >= IEEE80211_AC_VO; ac--) { - skb = skb_dequeue(&sta->ps_tx_buf[ac]); - total += skb_queue_len(&sta->ps_tx_buf[ac]); - if (skb) { - purged++; - dev_kfree_skb(skb); - break; - } - } - } - - rcu_read_unlock(); - - local->total_ps_buffered = total; -#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG - wiphy_debug(local->hw.wiphy, "PS buffers full - purged %d frames\n", - purged); -#endif -} - -static ieee80211_tx_result -ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; - - /* - * broadcast/multicast frame - * - * If any of the associated stations is in power save mode, - * the frame is buffered to be sent after DTIM beacon frame. - * This is done either by the hardware or us. - */ - - /* powersaving STAs only in AP/VLAN mode */ - if (!tx->sdata->bss) - return TX_CONTINUE; - - /* no buffering for ordered frames */ - if (ieee80211_has_order(hdr->frame_control)) - return TX_CONTINUE; - - /* no stations in PS mode */ - if (!atomic_read(&tx->sdata->bss->num_sta_ps)) - return TX_CONTINUE; - - info->flags |= IEEE80211_TX_CTL_SEND_AFTER_DTIM; - - /* device releases frame after DTIM beacon */ - if (!(tx->local->hw.flags & IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING)) - return TX_CONTINUE; - - /* buffered in mac80211 */ - if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) - purge_old_ps_buffers(tx->local); - - if (skb_queue_len(&tx->sdata->bss->ps_bc_buf) >= AP_MAX_BC_BUFFER) { -#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG - if (net_ratelimit()) - printk(KERN_DEBUG "%s: BC TX buffer full - dropping the oldest frame\n", - tx->sdata->name); -#endif - dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); - } else - tx->local->total_ps_buffered++; - - skb_queue_tail(&tx->sdata->bss->ps_bc_buf, tx->skb); - - return TX_QUEUED; -} - -static int ieee80211_use_mfp(__le16 fc, struct sta_info *sta, - struct sk_buff *skb) -{ - if (!ieee80211_is_mgmt(fc)) - return 0; - - if (sta == NULL || !test_sta_flag(sta, WLAN_STA_MFP)) - return 0; - - if (!ieee80211_is_robust_mgmt_frame((struct ieee80211_hdr *) - skb->data)) - return 0; - - return 1; -} - -static ieee80211_tx_result -ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) -{ - struct sta_info *sta = tx->sta; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; - struct ieee80211_local *local = tx->local; - - if (unlikely(!sta)) - return TX_CONTINUE; - - if (unlikely((test_sta_flag(sta, WLAN_STA_PS_STA) || - test_sta_flag(sta, WLAN_STA_PS_DRIVER)) && - !(info->flags & IEEE80211_TX_CTL_NO_PS_BUFFER))) { - int ac = skb_get_queue_mapping(tx->skb); - - /* only deauth, disassoc and action are bufferable MMPDUs */ - if (ieee80211_is_mgmt(hdr->frame_control) && - !ieee80211_is_deauth(hdr->frame_control) && - !ieee80211_is_disassoc(hdr->frame_control) && - !ieee80211_is_action(hdr->frame_control)) { - info->flags |= IEEE80211_TX_CTL_NO_PS_BUFFER; - return TX_CONTINUE; - } - -#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG - printk(KERN_DEBUG "STA %pM aid %d: PS buffer for AC %d\n", - sta->sta.addr, sta->sta.aid, ac); -#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ - if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) - purge_old_ps_buffers(tx->local); - if (skb_queue_len(&sta->ps_tx_buf[ac]) >= STA_MAX_TX_BUFFER) { - struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf[ac]); -#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG - if (net_ratelimit()) - printk(KERN_DEBUG "%s: STA %pM TX buffer for " - "AC %d full - dropping oldest frame\n", - tx->sdata->name, sta->sta.addr, ac); -#endif - dev_kfree_skb(old); - } else - tx->local->total_ps_buffered++; - - info->control.jiffies = jiffies; - info->control.vif = &tx->sdata->vif; - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; - skb_queue_tail(&sta->ps_tx_buf[ac], tx->skb); - - if (!timer_pending(&local->sta_cleanup)) - mod_timer(&local->sta_cleanup, - round_jiffies(jiffies + - STA_INFO_CLEANUP_INTERVAL)); - - /* - * We queued up some frames, so the TIM bit might - * need to be set, recalculate it. - */ - sta_info_recalc_tim(sta); - - return TX_QUEUED; - } -#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG - else if (unlikely(test_sta_flag(sta, WLAN_STA_PS_STA))) { - printk(KERN_DEBUG - "%s: STA %pM in PS mode, but polling/in SP -> send frame\n", - tx->sdata->name, sta->sta.addr); - } -#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ - - return TX_CONTINUE; -} - -static ieee80211_tx_result debug_noinline -ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx) -{ - if (unlikely(tx->flags & IEEE80211_TX_PS_BUFFERED)) - return TX_CONTINUE; - - if (tx->flags & IEEE80211_TX_UNICAST) - return ieee80211_tx_h_unicast_ps_buf(tx); - else - return ieee80211_tx_h_multicast_ps_buf(tx); -} - -static ieee80211_tx_result debug_noinline -ieee80211_tx_h_check_control_port_protocol(struct ieee80211_tx_data *tx) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - - if (unlikely(tx->sdata->control_port_protocol == tx->skb->protocol && - tx->sdata->control_port_no_encrypt)) - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - - return TX_CONTINUE; -} - -static ieee80211_tx_result debug_noinline -ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) -{ - struct ieee80211_key *key = NULL; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; - - if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) - tx->key = NULL; - else if (tx->sta && (key = rcu_dereference(tx->sta->ptk))) - tx->key = key; - else if (ieee80211_is_mgmt(hdr->frame_control) && - is_multicast_ether_addr(hdr->addr1) && - ieee80211_is_robust_mgmt_frame(hdr) && - (key = rcu_dereference(tx->sdata->default_mgmt_key))) - tx->key = key; - else if (is_multicast_ether_addr(hdr->addr1) && - (key = rcu_dereference(tx->sdata->default_multicast_key))) - tx->key = key; - else if (!is_multicast_ether_addr(hdr->addr1) && - (key = rcu_dereference(tx->sdata->default_unicast_key))) - tx->key = key; - else if (tx->sdata->drop_unencrypted && - (tx->skb->protocol != tx->sdata->control_port_protocol) && - !(info->flags & IEEE80211_TX_CTL_INJECTED) && - (!ieee80211_is_robust_mgmt_frame(hdr) || - (ieee80211_is_action(hdr->frame_control) && - tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP)))) { - I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); - return TX_DROP; - } else - tx->key = NULL; - - if (tx->key) { - bool skip_hw = false; - - tx->key->tx_rx_count++; - /* TODO: add threshold stuff again */ - - switch (tx->key->conf.cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - case WLAN_CIPHER_SUITE_TKIP: - if (!ieee80211_is_data_present(hdr->frame_control)) - tx->key = NULL; - break; - case WLAN_CIPHER_SUITE_CCMP: - if (!ieee80211_is_data_present(hdr->frame_control) && - !ieee80211_use_mfp(hdr->frame_control, tx->sta, - tx->skb)) - tx->key = NULL; - else - skip_hw = (tx->key->conf.flags & - IEEE80211_KEY_FLAG_SW_MGMT) && - ieee80211_is_mgmt(hdr->frame_control); - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - if (!ieee80211_is_mgmt(hdr->frame_control)) - tx->key = NULL; - break; - } - - if (unlikely(tx->key && tx->key->flags & KEY_FLAG_TAINTED)) - return TX_DROP; - - if (!skip_hw && tx->key && - tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) - info->control.hw_key = &tx->key->conf; - } - - return TX_CONTINUE; -} - -static ieee80211_tx_result debug_noinline -ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - struct ieee80211_hdr *hdr = (void *)tx->skb->data; - struct ieee80211_supported_band *sband; - struct ieee80211_rate *rate; - int i; - u32 len; - bool inval = false, rts = false, short_preamble = false; - struct ieee80211_tx_rate_control txrc; - bool assoc = false; - - memset(&txrc, 0, sizeof(txrc)); - - sband = tx->local->hw.wiphy->bands[tx->channel->band]; - - len = min_t(u32, tx->skb->len + FCS_LEN, - tx->local->hw.wiphy->frag_threshold); - - /* set up the tx rate control struct we give the RC algo */ - txrc.hw = &tx->local->hw; - txrc.sband = sband; - txrc.bss_conf = &tx->sdata->vif.bss_conf; - txrc.skb = tx->skb; - txrc.reported_rate.idx = -1; - txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[tx->channel->band]; - if (txrc.rate_idx_mask == (1 << sband->n_bitrates) - 1) - txrc.max_rate_idx = -1; - else - txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; - memcpy(txrc.rate_idx_mcs_mask, - tx->sdata->rc_rateidx_mcs_mask[tx->channel->band], - sizeof(txrc.rate_idx_mcs_mask)); - txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP || - tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT || - tx->sdata->vif.type == NL80211_IFTYPE_ADHOC); - - /* set up RTS protection if desired */ - if (len > tx->local->hw.wiphy->rts_threshold) { - txrc.rts = rts = true; - } - - /* - * Use short preamble if the BSS can handle it, but not for - * management frames unless we know the receiver can handle - * that -- the management frame might be to a station that - * just wants a probe response. - */ - if (tx->sdata->vif.bss_conf.use_short_preamble && - (ieee80211_is_data(hdr->frame_control) || - (tx->sta && test_sta_flag(tx->sta, WLAN_STA_SHORT_PREAMBLE)))) - txrc.short_preamble = short_preamble = true; - - if (tx->sta) - assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC); - - /* - * Lets not bother rate control if we're associated and cannot - * talk to the sta. This should not happen. - */ - if (WARN(test_bit(SCAN_SW_SCANNING, &tx->local->scanning) && assoc && - !rate_usable_index_exists(sband, &tx->sta->sta), - "%s: Dropped data frame as no usable bitrate found while " - "scanning and associated. Target station: " - "%pM on %d GHz band\n", - tx->sdata->name, hdr->addr1, - tx->channel->band ? 5 : 2)) - return TX_DROP; - - /* - * If we're associated with the sta at this point we know we can at - * least send the frame at the lowest bit rate. - */ - rate_control_get_rate(tx->sdata, tx->sta, &txrc); - - if (unlikely(info->control.rates[0].idx < 0)) - return TX_DROP; - - if (txrc.reported_rate.idx < 0) { - txrc.reported_rate = info->control.rates[0]; - if (tx->sta && ieee80211_is_data(hdr->frame_control)) - tx->sta->last_tx_rate = txrc.reported_rate; - } else if (tx->sta) - tx->sta->last_tx_rate = txrc.reported_rate; - - if (unlikely(!info->control.rates[0].count)) - info->control.rates[0].count = 1; - - if (WARN_ON_ONCE((info->control.rates[0].count > 1) && - (info->flags & IEEE80211_TX_CTL_NO_ACK))) - info->control.rates[0].count = 1; - - if (is_multicast_ether_addr(hdr->addr1)) { - /* - * XXX: verify the rate is in the basic rateset - */ - return TX_CONTINUE; - } - - /* - * set up the RTS/CTS rate as the fastest basic rate - * that is not faster than the data rate - * - * XXX: Should this check all retry rates? - */ - if (!(info->control.rates[0].flags & IEEE80211_TX_RC_MCS)) { - s8 baserate = 0; - - rate = &sband->bitrates[info->control.rates[0].idx]; - - for (i = 0; i < sband->n_bitrates; i++) { - /* must be a basic rate */ - if (!(tx->sdata->vif.bss_conf.basic_rates & BIT(i))) - continue; - /* must not be faster than the data rate */ - if (sband->bitrates[i].bitrate > rate->bitrate) - continue; - /* maximum */ - if (sband->bitrates[baserate].bitrate < - sband->bitrates[i].bitrate) - baserate = i; - } - - info->control.rts_cts_rate_idx = baserate; - } - - for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { - /* - * make sure there's no valid rate following - * an invalid one, just in case drivers don't - * take the API seriously to stop at -1. - */ - if (inval) { - info->control.rates[i].idx = -1; - continue; - } - if (info->control.rates[i].idx < 0) { - inval = true; - continue; - } - - /* - * For now assume MCS is already set up correctly, this - * needs to be fixed. - */ - if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS) { - WARN_ON(info->control.rates[i].idx > 76); - continue; - } - - /* set up RTS protection if desired */ - if (rts) - info->control.rates[i].flags |= - IEEE80211_TX_RC_USE_RTS_CTS; - - /* RC is busted */ - if (WARN_ON_ONCE(info->control.rates[i].idx >= - sband->n_bitrates)) { - info->control.rates[i].idx = -1; - continue; - } - - rate = &sband->bitrates[info->control.rates[i].idx]; - - /* set up short preamble */ - if (short_preamble && - rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) - info->control.rates[i].flags |= - IEEE80211_TX_RC_USE_SHORT_PREAMBLE; - - /* set up G protection */ - if (!rts && tx->sdata->vif.bss_conf.use_cts_prot && - rate->flags & IEEE80211_RATE_ERP_G) - info->control.rates[i].flags |= - IEEE80211_TX_RC_USE_CTS_PROTECT; - } - - return TX_CONTINUE; -} - -static ieee80211_tx_result debug_noinline -ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; - u16 *seq; - u8 *qc; - int tid; - - /* - * Packet injection may want to control the sequence - * number, if we have no matching interface then we - * neither assign one ourselves nor ask the driver to. - */ - if (unlikely(info->control.vif->type == NL80211_IFTYPE_MONITOR)) - return TX_CONTINUE; - - if (unlikely(ieee80211_is_ctl(hdr->frame_control))) - return TX_CONTINUE; - - if (ieee80211_hdrlen(hdr->frame_control) < 24) - return TX_CONTINUE; - - if (ieee80211_is_qos_nullfunc(hdr->frame_control)) - return TX_CONTINUE; - - /* - * Anything but QoS data that has a sequence number field - * (is long enough) gets a sequence number from the global - * counter. - */ - if (!ieee80211_is_data_qos(hdr->frame_control)) { - /* driver should assign sequence number */ - info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; - /* for pure STA mode without beacons, we can do it */ - hdr->seq_ctrl = cpu_to_le16(tx->sdata->sequence_number); - tx->sdata->sequence_number += 0x10; - return TX_CONTINUE; - } - - /* - * This should be true for injected/management frames only, for - * management frames we have set the IEEE80211_TX_CTL_ASSIGN_SEQ - * above since they are not QoS-data frames. - */ - if (!tx->sta) - return TX_CONTINUE; - - /* include per-STA, per-TID sequence counter */ - - qc = ieee80211_get_qos_ctl(hdr); - tid = *qc & IEEE80211_QOS_CTL_TID_MASK; - seq = &tx->sta->tid_seq[tid]; - - hdr->seq_ctrl = cpu_to_le16(*seq); - - /* Increase the sequence number. */ - *seq = (*seq + 0x10) & IEEE80211_SCTL_SEQ; - - return TX_CONTINUE; -} - -static int ieee80211_fragment(struct ieee80211_tx_data *tx, - struct sk_buff *skb, int hdrlen, - int frag_threshold) -{ - struct ieee80211_local *local = tx->local; - struct ieee80211_tx_info *info; - struct sk_buff *tmp; - int per_fragm = frag_threshold - hdrlen - FCS_LEN; - int pos = hdrlen + per_fragm; - int rem = skb->len - hdrlen - per_fragm; - - if (WARN_ON(rem < 0)) - return -EINVAL; - - /* first fragment was already added to queue by caller */ - - while (rem) { - int fraglen = per_fragm; - - if (fraglen > rem) - fraglen = rem; - rem -= fraglen; - tmp = dev_alloc_skb(local->tx_headroom + - frag_threshold + - IEEE80211_ENCRYPT_HEADROOM + - IEEE80211_ENCRYPT_TAILROOM); - if (!tmp) - return -ENOMEM; - - __skb_queue_tail(&tx->skbs, tmp); - - skb_reserve(tmp, local->tx_headroom + - IEEE80211_ENCRYPT_HEADROOM); - /* copy control information */ - memcpy(tmp->cb, skb->cb, sizeof(tmp->cb)); - - info = IEEE80211_SKB_CB(tmp); - info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT | - IEEE80211_TX_CTL_FIRST_FRAGMENT); - - if (rem) - info->flags |= IEEE80211_TX_CTL_MORE_FRAMES; - - skb_copy_queue_mapping(tmp, skb); - tmp->priority = skb->priority; - tmp->dev = skb->dev; - - /* copy header and data */ - memcpy(skb_put(tmp, hdrlen), skb->data, hdrlen); - memcpy(skb_put(tmp, fraglen), skb->data + pos, fraglen); - - pos += fraglen; - } - - /* adjust first fragment's length */ - skb->len = hdrlen + per_fragm; - return 0; -} - -static ieee80211_tx_result debug_noinline -ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) -{ - struct sk_buff *skb = tx->skb; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (void *)skb->data; - int frag_threshold = tx->local->hw.wiphy->frag_threshold; - int hdrlen; - int fragnum; - - /* no matter what happens, tx->skb moves to tx->skbs */ - __skb_queue_tail(&tx->skbs, skb); - tx->skb = NULL; - - if (info->flags & IEEE80211_TX_CTL_DONTFRAG) - return TX_CONTINUE; - - if (tx->local->ops->set_frag_threshold) - return TX_CONTINUE; - - /* - * Warn when submitting a fragmented A-MPDU frame and drop it. - * This scenario is handled in ieee80211_tx_prepare but extra - * caution taken here as fragmented ampdu may cause Tx stop. - */ - if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) - return TX_DROP; - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - - /* internal error, why isn't DONTFRAG set? */ - if (WARN_ON(skb->len + FCS_LEN <= frag_threshold)) - return TX_DROP; - - /* - * Now fragment the frame. This will allocate all the fragments and - * chain them (using skb as the first fragment) to skb->next. - * During transmission, we will remove the successfully transmitted - * fragments from this list. When the low-level driver rejects one - * of the fragments then we will simply pretend to accept the skb - * but store it away as pending. - */ - if (ieee80211_fragment(tx, skb, hdrlen, frag_threshold)) - return TX_DROP; - - /* update duration/seq/flags of fragments */ - fragnum = 0; - - skb_queue_walk(&tx->skbs, skb) { - int next_len; - const __le16 morefrags = cpu_to_le16(IEEE80211_FCTL_MOREFRAGS); - - hdr = (void *)skb->data; - info = IEEE80211_SKB_CB(skb); - - if (!skb_queue_is_last(&tx->skbs, skb)) { - hdr->frame_control |= morefrags; - /* - * No multi-rate retries for fragmented frames, that - * would completely throw off the NAV at other STAs. - */ - info->control.rates[1].idx = -1; - info->control.rates[2].idx = -1; - info->control.rates[3].idx = -1; - info->control.rates[4].idx = -1; - BUILD_BUG_ON(IEEE80211_TX_MAX_RATES != 5); - info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; - } else { - hdr->frame_control &= ~morefrags; - next_len = 0; - } - hdr->seq_ctrl |= cpu_to_le16(fragnum & IEEE80211_SCTL_FRAG); - fragnum++; - } - - return TX_CONTINUE; -} - -static ieee80211_tx_result debug_noinline -ieee80211_tx_h_stats(struct ieee80211_tx_data *tx) -{ - struct sk_buff *skb; - - if (!tx->sta) - return TX_CONTINUE; - - tx->sta->tx_packets++; - skb_queue_walk(&tx->skbs, skb) { - tx->sta->tx_fragments++; - tx->sta->tx_bytes += skb->len; - } - - return TX_CONTINUE; -} - -static ieee80211_tx_result debug_noinline -ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx) -{ - if (!tx->key) - return TX_CONTINUE; - - switch (tx->key->conf.cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - return ieee80211_crypto_wep_encrypt(tx); - case WLAN_CIPHER_SUITE_TKIP: - return ieee80211_crypto_tkip_encrypt(tx); - case WLAN_CIPHER_SUITE_CCMP: - return ieee80211_crypto_ccmp_encrypt(tx); - case WLAN_CIPHER_SUITE_AES_CMAC: - return ieee80211_crypto_aes_cmac_encrypt(tx); - default: - return ieee80211_crypto_hw_encrypt(tx); - } - - return TX_DROP; -} - -static ieee80211_tx_result debug_noinline -ieee80211_tx_h_calculate_duration(struct ieee80211_tx_data *tx) -{ - struct sk_buff *skb; - struct ieee80211_hdr *hdr; - int next_len; - bool group_addr; - - skb_queue_walk(&tx->skbs, skb) { - hdr = (void *) skb->data; - if (unlikely(ieee80211_is_pspoll(hdr->frame_control))) - break; /* must not overwrite AID */ - if (!skb_queue_is_last(&tx->skbs, skb)) { - struct sk_buff *next = skb_queue_next(&tx->skbs, skb); - next_len = next->len; - } else - next_len = 0; - group_addr = is_multicast_ether_addr(hdr->addr1); - - hdr->duration_id = - ieee80211_duration(tx, skb, group_addr, next_len); - } - - return TX_CONTINUE; -} - -/* actual transmit path */ - -static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, - struct sk_buff *skb, - struct ieee80211_tx_info *info, - struct tid_ampdu_tx *tid_tx, - int tid) -{ - bool queued = false; - bool reset_agg_timer = false; - struct sk_buff *purge_skb = NULL; - - if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) { - info->flags |= IEEE80211_TX_CTL_AMPDU; - reset_agg_timer = true; - } else if (test_bit(HT_AGG_STATE_WANT_START, &tid_tx->state)) { - /* - * nothing -- this aggregation session is being started - * but that might still fail with the driver - */ - } else { - spin_lock(&tx->sta->lock); - /* - * Need to re-check now, because we may get here - * - * 1) in the window during which the setup is actually - * already done, but not marked yet because not all - * packets are spliced over to the driver pending - * queue yet -- if this happened we acquire the lock - * either before or after the splice happens, but - * need to recheck which of these cases happened. - * - * 2) during session teardown, if the OPERATIONAL bit - * was cleared due to the teardown but the pointer - * hasn't been assigned NULL yet (or we loaded it - * before it was assigned) -- in this case it may - * now be NULL which means we should just let the - * packet pass through because splicing the frames - * back is already done. - */ - tid_tx = rcu_dereference_protected_tid_tx(tx->sta, tid); - - if (!tid_tx) { - /* do nothing, let packet pass through */ - } else if (test_bit(HT_AGG_STATE_OPERATIONAL, &tid_tx->state)) { - info->flags |= IEEE80211_TX_CTL_AMPDU; - reset_agg_timer = true; - } else { - queued = true; - info->control.vif = &tx->sdata->vif; - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING; - __skb_queue_tail(&tid_tx->pending, skb); - if (skb_queue_len(&tid_tx->pending) > STA_MAX_TX_BUFFER) - purge_skb = __skb_dequeue(&tid_tx->pending); - } - spin_unlock(&tx->sta->lock); - - if (purge_skb) - dev_kfree_skb(purge_skb); - } - - /* reset session timer */ - if (reset_agg_timer && tid_tx->timeout) - mod_timer(&tid_tx->session_timer, - TU_TO_EXP_TIME(tid_tx->timeout)); - - return queued; -} - -/* - * initialises @tx - */ -static ieee80211_tx_result -ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, - struct ieee80211_tx_data *tx, - struct sk_buff *skb) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_hdr *hdr; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - int tid; - u8 *qc; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "--ieee80211_tx_prepare \n"); -#endif - - memset(tx, 0, sizeof(*tx)); - tx->skb = skb; - tx->local = local; - tx->sdata = sdata; - tx->channel = local->hw.conf.channel; - __skb_queue_head_init(&tx->skbs); - - /* - * If this flag is set to true anywhere, and we get here, - * we are doing the needed processing, so remove the flag - * now. - */ - info->flags &= ~IEEE80211_TX_INTFL_NEED_TXPROCESSING; - - hdr = (struct ieee80211_hdr *) skb->data; - - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { - tx->sta = rcu_dereference(sdata->u.vlan.sta); - if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) - return TX_DROP; - } else if (info->flags & IEEE80211_TX_CTL_INJECTED) { - tx->sta = sta_info_get_bss(sdata, hdr->addr1); - } - /* - * [PLATA] - in OCBActivated we should very likely enter here - */ - if (!tx->sta) - tx->sta = sta_info_get(sdata, hdr->addr1); - - if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && - !ieee80211_is_qos_nullfunc(hdr->frame_control) && - (local->hw.flags & IEEE80211_HW_AMPDU_AGGREGATION) && - !(local->hw.flags & IEEE80211_HW_TX_AMPDU_SETUP_IN_HW)) { - struct tid_ampdu_tx *tid_tx; - - qc = ieee80211_get_qos_ctl(hdr); - tid = *qc & IEEE80211_QOS_CTL_TID_MASK; - - tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]); - if (tid_tx) { - bool queued; - - queued = ieee80211_tx_prep_agg(tx, skb, info, - tid_tx, tid); - - if (unlikely(queued)) - return TX_QUEUED; - } - } - - if (is_multicast_ether_addr(hdr->addr1)) { - tx->flags &= ~IEEE80211_TX_UNICAST; - info->flags |= IEEE80211_TX_CTL_NO_ACK; - } else - tx->flags |= IEEE80211_TX_UNICAST; - - if (!(info->flags & IEEE80211_TX_CTL_DONTFRAG)) { - if (!(tx->flags & IEEE80211_TX_UNICAST) || - skb->len + FCS_LEN <= local->hw.wiphy->frag_threshold || - info->flags & IEEE80211_TX_CTL_AMPDU) - info->flags |= IEEE80211_TX_CTL_DONTFRAG; - } - - if (!tx->sta) - info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; - else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT)) - info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; - - info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT; - - return TX_CONTINUE; -} - -static bool ieee80211_tx_frags(struct ieee80211_local *local, - struct ieee80211_vif *vif, - struct ieee80211_sta *sta, - struct sk_buff_head *skbs, - bool txpending) -{ - struct sk_buff *skb, *tmp; - struct ieee80211_tx_info *info; - unsigned long flags; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- -- ieee80211_tx_frags \n"); -#endif - - skb_queue_walk_safe(skbs, skb, tmp) { - int q = skb_get_queue_mapping(skb); - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - if (local->queue_stop_reasons[q] || - (!txpending && !skb_queue_empty(&local->pending[q]))) { - /* - * Since queue is stopped, queue up frames for later - * transmission from the tx-pending tasklet when the - * queue is woken again. - */ - if (txpending) - skb_queue_splice_init(skbs, &local->pending[q]); - else - skb_queue_splice_tail_init(skbs, - &local->pending[q]); - - spin_unlock_irqrestore(&local->queue_stop_reason_lock, - flags); - return false; - } - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); - - info = IEEE80211_SKB_CB(skb); - info->control.vif = vif; - info->control.sta = sta; - - __skb_unlink(skb, skbs); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- TX Completed at MAC -- calling the Driver -- -- \n"); -#endif - drv_tx(local, skb); - } - - return true; -} - -/* - * Returns false if the frame couldn't be transmitted but was queued instead. - */ -static bool __ieee80211_tx(struct ieee80211_local *local, - struct sk_buff_head *skbs, int led_len, - struct sta_info *sta, bool txpending) -{ - struct ieee80211_tx_info *info; - struct ieee80211_sub_if_data *sdata; - struct ieee80211_vif *vif; - struct ieee80211_sta *pubsta; - struct sk_buff *skb; - bool result = true; - __le16 fc; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- __ieee80211_tx \n"); -#endif - - if (WARN_ON(skb_queue_empty(skbs))) - return true; - - skb = skb_peek(skbs); - fc = ((struct ieee80211_hdr *)skb->data)->frame_control; - info = IEEE80211_SKB_CB(skb); - sdata = vif_to_sdata(info->control.vif); - if (sta && !sta->uploaded) - sta = NULL; - - if (sta) - pubsta = &sta->sta; - else - pubsta = NULL; - - switch (sdata->vif.type) { - case NL80211_IFTYPE_MONITOR: - sdata = NULL; - vif = NULL; - break; - case NL80211_IFTYPE_AP_VLAN: - sdata = container_of(sdata->bss, - struct ieee80211_sub_if_data, u.ap); - /* fall through */ - default: - vif = &sdata->vif; - break; - } - - if (local->ops->tx_frags) - drv_tx_frags(local, vif, pubsta, skbs); - else - result = ieee80211_tx_frags(local, vif, pubsta, skbs, - txpending); - - ieee80211_tpt_led_trig_tx(local, fc, led_len); - ieee80211_led_tx(local, 1); - - WARN_ON_ONCE(!skb_queue_empty(skbs)); - - return result; -} - -/* - * Invoke TX handlers, return 0 on success and non-zero if the - * frame was dropped or queued. - * - * [PLATA] - main method to be modified when OCB is activated - */ -static int invoke_tx_handlers(struct ieee80211_tx_data *tx) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); - ieee80211_tx_result res = TX_DROP; - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- invoke_tx_handlers \n"); -#endif - -#define CALL_TXH(txh) \ - do { \ - res = txh(tx); \ - if (res != TX_CONTINUE) \ - goto txh_done; \ - } while (0) - - // no power saving mode when OCB is activated - if((tx->local->hw.wiphy->dot11OCBActivated == 0) || !(tx->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - /* - * [PLATA] - not necessary (we do not do Power saving so far) - */ - CALL_TXH(ieee80211_tx_h_dynamic_ps); - } - - /* - * [PLATA] - check that scanning is false, check that if unicast and not assoc, we return true; for broadcast and AD_HOC, it is always true - */ - if((tx->local->hw.wiphy->dot11OCBActivated == 0) || !(tx->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - CALL_TXH(ieee80211_tx_h_check_assoc); - } - - // no power saving and no key management - if((tx->local->hw.wiphy->dot11OCBActivated == 0) || !(tx->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - CALL_TXH(ieee80211_tx_h_ps_buf); // [PLATA] - bypass as no PS - CALL_TXH(ieee80211_tx_h_check_control_port_protocol); // [PLATA] ignoring with the right flags...as we do not encrypt anyways - CALL_TXH(ieee80211_tx_h_select_key); // [PLATA] - directly (test OCBActivated..) - } - - if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)) { - CALL_TXH(ieee80211_tx_h_rate_ctrl); - } - - if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) { - __skb_queue_tail(&tx->skbs, tx->skb); - tx->skb = NULL; - goto txh_done; - } - - if((tx->local->hw.wiphy->dot11OCBActivated == 0) || !(tx->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - CALL_TXH(ieee80211_tx_h_michael_mic_add); // [PLATA] - ignore - } - CALL_TXH(ieee80211_tx_h_sequence); // [PLATA] - keep it for statistics, as no impact - CALL_TXH(ieee80211_tx_h_fragment); // [PLATA] - keep it, no impact if flags correctly set (IEEE80211_TX_CTL_DONTFRAG) - /* handlers after fragment must be aware of tx info fragmentation! */ - CALL_TXH(ieee80211_tx_h_stats); // [PLATA] - keep it for statistics: no impact - - if((tx->local->hw.wiphy->dot11OCBActivated == 0) || !(tx->local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - CALL_TXH(ieee80211_tx_h_encrypt); // [PLATA] - bypass if with check on OCBActivated - } - if (!(tx->local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL)) - CALL_TXH(ieee80211_tx_h_calculate_duration); -#undef CALL_TXH - - txh_done: - if (unlikely(res == TX_DROP)) { - I802_DEBUG_INC(tx->local->tx_handlers_drop); - if (tx->skb) - dev_kfree_skb(tx->skb); - else - __skb_queue_purge(&tx->skbs); - return -1; - } else if (unlikely(res == TX_QUEUED)) { - I802_DEBUG_INC(tx->local->tx_handlers_queued); - return -1; - } - - return 0; -} - -/* - * Returns false if the frame couldn't be transmitted but was queued instead. - */ -static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb, bool txpending) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_tx_data tx; - ieee80211_tx_result res_prepare; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - bool result = true; - int led_len; - - if (unlikely(skb->len < 10)) { - dev_kfree_skb(skb); - return true; - } - - rcu_read_lock(); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "--ieee80211_tx\n"); -#endif - - /* initialises tx */ - led_len = skb->len; - /* - * [PLATA] - nothing specific if we set the right flags... - */ - res_prepare = ieee80211_tx_prepare(sdata, &tx, skb); - - if (unlikely(res_prepare == TX_DROP)) { - dev_kfree_skb(skb); - goto out; - } else if (unlikely(res_prepare == TX_QUEUED)) { - goto out; - } - - tx.channel = local->hw.conf.channel; - info->band = tx.channel->band; - - /* - * [PLATA] in the next method, we shortcut the 802.11 state machine - */ - if (!invoke_tx_handlers(&tx)) - result = __ieee80211_tx(local, &tx.skbs, led_len, - tx.sta, txpending); - out: - rcu_read_unlock(); - return result; -} - -/* device xmit handlers */ - -static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb, - int head_need, bool may_encrypt) -{ - struct ieee80211_local *local = sdata->local; - int tail_need = 0; - - if (may_encrypt && sdata->crypto_tx_tailroom_needed_cnt) { - tail_need = IEEE80211_ENCRYPT_TAILROOM; - tail_need -= skb_tailroom(skb); - tail_need = max_t(int, tail_need, 0); - } - - if (skb_cloned(skb)) - I802_DEBUG_INC(local->tx_expand_skb_head_cloned); - else if (head_need || tail_need) - I802_DEBUG_INC(local->tx_expand_skb_head); - else - return 0; - - if (pskb_expand_head(skb, head_need, tail_need, GFP_ATOMIC)) { - wiphy_debug(local->hw.wiphy, - "failed to reallocate TX buffer\n"); - return -ENOMEM; - } - - return 0; -} - -void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - int headroom; - bool may_encrypt; - - rcu_read_lock(); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- ieee80211_xmit \n"); -#endif - - /* - * [PLATA] - should be false - DONE in driver... - */ - may_encrypt = !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT); - - headroom = local->tx_headroom; - if (may_encrypt) - headroom += IEEE80211_ENCRYPT_HEADROOM; - headroom -= skb_headroom(skb); - headroom = max_t(int, 0, headroom); - - if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) { - dev_kfree_skb(skb); - rcu_read_unlock(); - return; - } - - hdr = (struct ieee80211_hdr *) skb->data; - - info->control.vif = &sdata->vif; - - if (ieee80211_vif_is_mesh(&sdata->vif) && - ieee80211_is_data(hdr->frame_control) && - !is_multicast_ether_addr(hdr->addr1)) - if (mesh_nexthop_resolve(skb, sdata)) { - /* skb queued: don't free */ - rcu_read_unlock(); - return; - } - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) - /* Older kernels do not have the select_queue callback */ - skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb)); -#endif - /* - * [PLATA] - if we have the flag that QoS is not enable, we bypass this - * - for this version of PLATA - we do not allow QoS Data (MUST be done in frame control of the packet) - * - as such, next method returns immediately - */ - ieee80211_set_qos_hdr(sdata, skb); - ieee80211_tx(sdata, skb, false); - rcu_read_unlock(); -} - -static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb) -{ - struct ieee80211_radiotap_iterator iterator; - struct ieee80211_radiotap_header *rthdr = - (struct ieee80211_radiotap_header *) skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len, - NULL); - u16 txflags; - - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT | - IEEE80211_TX_CTL_DONTFRAG; - - /* - * for every radiotap entry that is present - * (ieee80211_radiotap_iterator_next returns -ENOENT when no more - * entries present, or -EINVAL on error) - */ - - while (!ret) { - ret = ieee80211_radiotap_iterator_next(&iterator); - - if (ret) - continue; - - /* see if this argument is something we can use */ - switch (iterator.this_arg_index) { - /* - * You must take care when dereferencing iterator.this_arg - * for multibyte types... the pointer is not aligned. Use - * get_unaligned((type *)iterator.this_arg) to dereference - * iterator.this_arg for type "type" safely on all arches. - */ - case IEEE80211_RADIOTAP_FLAGS: - if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) { - /* - * this indicates that the skb we have been - * handed has the 32-bit FCS CRC at the end... - * we should react to that by snipping it off - * because it will be recomputed and added - * on transmission - */ - if (skb->len < (iterator._max_length + FCS_LEN)) - return false; - - skb_trim(skb, skb->len - FCS_LEN); - } - if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP) - info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT; - if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) - info->flags &= ~IEEE80211_TX_CTL_DONTFRAG; - break; - - case IEEE80211_RADIOTAP_TX_FLAGS: - txflags = get_unaligned_le16(iterator.this_arg); - if (txflags & IEEE80211_RADIOTAP_F_TX_NOACK) - info->flags |= IEEE80211_TX_CTL_NO_ACK; - break; - - /* - * Please update the file - * Documentation/networking/mac80211-injection.txt - * when parsing new fields here. - */ - - default: - break; - } - } - - if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */ - return false; - - /* - * remove the radiotap header - * iterator->_max_length was sanity-checked against - * skb->len by iterator init - */ - skb_pull(skb, iterator._max_length); - - return true; -} - -netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); - struct ieee80211_channel *chan = local->hw.conf.channel; - struct ieee80211_radiotap_header *prthdr = - (struct ieee80211_radiotap_header *)skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_hdr *hdr; - struct ieee80211_sub_if_data *tmp_sdata, *sdata; - u16 len_rthdr; - int hdrlen; - - /* - * Frame injection is not allowed if beaconing is not allowed - * or if we need radar detection. Beaconing is usually not allowed when - * the mode or operation (Adhoc, AP, Mesh) does not support DFS. - * Passive scan is also used in world regulatory domains where - * your country is not known and as such it should be treated as - * NO TX unless the channel is explicitly allowed in which case - * your current regulatory domain would not have the passive scan - * flag. - * - * Since AP mode uses monitor interfaces to inject/TX management - * frames we can make AP mode the exception to this rule once it - * supports radar detection as its implementation can deal with - * radar detection by itself. We can do that later by adding a - * monitor flag interfaces used for AP support. - */ - if ((chan->flags & (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_RADAR | - IEEE80211_CHAN_PASSIVE_SCAN))) - goto fail; - - /* check for not even having the fixed radiotap header part */ - if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) - goto fail; /* too short to be possibly valid */ - - /* is it a header version we can trust to find length from? */ - if (unlikely(prthdr->it_version)) - goto fail; /* only version 0 is supported */ - - /* then there must be a radiotap header with a length we can use */ - len_rthdr = ieee80211_get_radiotap_len(skb->data); - - /* does the skb contain enough to deliver on the alleged length? */ - if (unlikely(skb->len < len_rthdr)) - goto fail; /* skb too short for claimed rt header extent */ - - /* - * fix up the pointers accounting for the radiotap - * header still being in there. We are being given - * a precooked IEEE80211 header so no need for - * normal processing - */ - skb_set_mac_header(skb, len_rthdr); - /* - * these are just fixed to the end of the rt area since we - * don't have any better information and at this point, nobody cares - */ - skb_set_network_header(skb, len_rthdr); - skb_set_transport_header(skb, len_rthdr); - - if (skb->len < len_rthdr + 2) - goto fail; - - hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr); - hdrlen = ieee80211_hdrlen(hdr->frame_control); - - if (skb->len < len_rthdr + hdrlen) - goto fail; - - /* - * Initialize skb->protocol if the injected frame is a data frame - * carrying a rfc1042 header - */ - if (ieee80211_is_data(hdr->frame_control) && - skb->len >= len_rthdr + hdrlen + sizeof(rfc1042_header) + 2) { - u8 *payload = (u8 *)hdr + hdrlen; - - if (compare_ether_addr(payload, rfc1042_header) == 0) - skb->protocol = cpu_to_be16((payload[6] << 8) | - payload[7]); - } - - memset(info, 0, sizeof(*info)); - - info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS | - IEEE80211_TX_CTL_INJECTED; - - /* process and remove the injection radiotap header */ - if (!ieee80211_parse_tx_radiotap(skb)) - goto fail; - - rcu_read_lock(); - - /* - * We process outgoing injected frames that have a local address - * we handle as though they are non-injected frames. - * This code here isn't entirely correct, the local MAC address - * isn't always enough to find the interface to use; for proper - * VLAN/WDS support we will need a different mechanism (which - * likely isn't going to be monitor interfaces). - */ - sdata = IEEE80211_DEV_TO_SUB_IF(dev); - - list_for_each_entry_rcu(tmp_sdata, &local->interfaces, list) { - if (!ieee80211_sdata_running(tmp_sdata)) - continue; - if (tmp_sdata->vif.type == NL80211_IFTYPE_MONITOR || - tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN || - tmp_sdata->vif.type == NL80211_IFTYPE_WDS) - continue; - if (compare_ether_addr(tmp_sdata->vif.addr, hdr->addr2) == 0) { - sdata = tmp_sdata; - break; - } - } - - ieee80211_xmit(sdata, skb); - rcu_read_unlock(); - - return NETDEV_TX_OK; - -fail: - dev_kfree_skb(skb); - return NETDEV_TX_OK; /* meaning, we dealt with the skb */ -} - -/** - * ieee80211_subif_start_xmit - netif start_xmit function for Ethernet-type - * subinterfaces (wlan#, WDS, and VLAN interfaces) - * @skb: packet to be sent - * @dev: incoming interface - * - * Returns: 0 on success (and frees skb in this case) or 1 on failure (skb will - * not be freed, and caller is responsible for either retrying later or freeing - * skb). - * - * This function takes in an Ethernet header and encapsulates it with suitable - * IEEE 802.11 header based on which interface the packet is coming in. The - * encapsulated packet will then be passed to master interface, wlan#.11, for - * transmission (through low-level driver). - */ -/* - * [PLATA] we start here... - */ -netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, - struct net_device *dev) -{ - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); - struct ieee80211_local *local = sdata->local; - struct ieee80211_tx_info *info; - int ret = NETDEV_TX_BUSY, head_need; - u16 ethertype, hdrlen, meshhdrlen = 0; - __le16 fc; - struct ieee80211_hdr hdr; - struct ieee80211s_hdr mesh_hdr __maybe_unused; - struct mesh_path __maybe_unused *mppath = NULL; - const u8 *encaps_data; - int encaps_len, skip_header_bytes; - int nh_pos, h_pos; - struct sta_info *sta = NULL; - bool wme_sta = false, authorized = false, tdls_auth = false; - bool tdls_direct = false; - bool multicast; - u32 info_flags = 0; - u16 info_id = 0; - char wildcard_bssid_init = 0xFF; - - if (unlikely(skb->len < ETH_HLEN)) { - ret = NETDEV_TX_OK; - goto fail; - } - - /* convert Ethernet header to proper 802.11 header (based on - * operation mode) */ - ethertype = (skb->data[12] << 8) | skb->data[13]; - fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- ieee80211_subif_start_xmit \n"); -#endif - - switch (sdata->vif.type) { - case NL80211_IFTYPE_AP_VLAN: - rcu_read_lock(); - sta = rcu_dereference(sdata->u.vlan.sta); - if (sta) { - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); - /* RA TA DA SA */ - memcpy(hdr.addr1, sta->sta.addr, ETH_ALEN); - memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); - memcpy(hdr.addr3, skb->data, ETH_ALEN); - memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); - hdrlen = 30; - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED); - wme_sta = test_sta_flag(sta, WLAN_STA_WME); - } - rcu_read_unlock(); - if (sta) - break; - /* fall through */ - case NL80211_IFTYPE_AP: - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); - /* DA BSSID SA */ - memcpy(hdr.addr1, skb->data, ETH_ALEN); - memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); - memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); - hdrlen = 24; - break; - case NL80211_IFTYPE_WDS: - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); - /* RA TA DA SA */ - memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); - memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); - memcpy(hdr.addr3, skb->data, ETH_ALEN); - memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); - hdrlen = 30; - break; -#ifdef CONFIG_MAC80211_MESH - case NL80211_IFTYPE_MESH_POINT: - if (!sdata->u.mesh.mshcfg.dot11MeshTTL) { - /* Do not send frames with mesh_ttl == 0 */ - sdata->u.mesh.mshstats.dropped_frames_ttl++; - ret = NETDEV_TX_OK; - goto fail; - } - rcu_read_lock(); - if (!is_multicast_ether_addr(skb->data)) - mppath = mpp_path_lookup(skb->data, sdata); - - /* - * Use address extension if it is a packet from - * another interface or if we know the destination - * is being proxied by a portal (i.e. portal address - * differs from proxied address) - */ - if (compare_ether_addr(sdata->vif.addr, - skb->data + ETH_ALEN) == 0 && - !(mppath && compare_ether_addr(mppath->mpp, skb->data))) { - hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, - skb->data, skb->data + ETH_ALEN); - rcu_read_unlock(); - meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr, - sdata, NULL, NULL); - } else { - int is_mesh_mcast = 1; - const u8 *mesh_da; - - if (is_multicast_ether_addr(skb->data)) - /* DA TA mSA AE:SA */ - mesh_da = skb->data; - else { - static const u8 bcast[ETH_ALEN] = - { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - if (mppath) { - /* RA TA mDA mSA AE:DA SA */ - mesh_da = mppath->mpp; - is_mesh_mcast = 0; - } else { - /* DA TA mSA AE:SA */ - mesh_da = bcast; - } - } - hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, - mesh_da, sdata->vif.addr); - rcu_read_unlock(); - if (is_mesh_mcast) - meshhdrlen = - ieee80211_new_mesh_header(&mesh_hdr, - sdata, - skb->data + ETH_ALEN, - NULL); - else - meshhdrlen = - ieee80211_new_mesh_header(&mesh_hdr, - sdata, - skb->data, - skb->data + ETH_ALEN); - - } - break; -#endif - case NL80211_IFTYPE_STATION: - if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) { - bool tdls_peer = false; - - rcu_read_lock(); - sta = sta_info_get(sdata, skb->data); - if (sta) { - authorized = test_sta_flag(sta, - WLAN_STA_AUTHORIZED); - wme_sta = test_sta_flag(sta, WLAN_STA_WME); - tdls_peer = test_sta_flag(sta, - WLAN_STA_TDLS_PEER); - tdls_auth = test_sta_flag(sta, - WLAN_STA_TDLS_PEER_AUTH); - } - rcu_read_unlock(); - - /* - * If the TDLS link is enabled, send everything - * directly. Otherwise, allow TDLS setup frames - * to be transmitted indirectly. - */ - tdls_direct = tdls_peer && (tdls_auth || - !(ethertype == ETH_P_TDLS && skb->len > 14 && - skb->data[14] == WLAN_TDLS_SNAP_RFTYPE)); - } - - if (tdls_direct) { - /* link during setup - throw out frames to peer */ - if (!tdls_auth) { - ret = NETDEV_TX_OK; - goto fail; - } - - /* DA SA BSSID */ - memcpy(hdr.addr1, skb->data, ETH_ALEN); - memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); - memcpy(hdr.addr3, sdata->u.mgd.bssid, ETH_ALEN); - hdrlen = 24; - } else if (sdata->u.mgd.use_4addr && - cpu_to_be16(ethertype) != sdata->control_port_protocol) { - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | - IEEE80211_FCTL_TODS); - /* RA TA DA SA */ - memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN); - memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); - memcpy(hdr.addr3, skb->data, ETH_ALEN); - memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); - hdrlen = 30; - } else { - fc |= cpu_to_le16(IEEE80211_FCTL_TODS); - /* BSSID SA DA */ - memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN); - memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); - memcpy(hdr.addr3, skb->data, ETH_ALEN); - hdrlen = 24; - } - break; - case NL80211_IFTYPE_ADHOC: - /* DA SA BSSID */ - memcpy(hdr.addr1, skb->data, ETH_ALEN); - memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- ieee80211_subif_start_xmit - ADHOC mode \n"); -#endif - //[PLATA]: bug fix, & IEEE80211_HW_DOT11OCB_SUPPORTED insted of &= and - //[PLATA]: changes made in tx.c, rx.c, iface.c, cfg.c and main.c - if ((local->hw.wiphy->dot11OCBActivated == 1) && (local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- ieee80211_subif_start_xmit - OCB Enable \n"); -#endif - memset(hdr.addr3,wildcard_bssid_init,ETH_ALEN); //[PLATA]: bug fix, memset to be used instead of memcpy - //fc |= cpu_to_le16(~IEEE80211_FCTL_FROMDS | ~IEEE80211_FCTL_TODS); // [PLATA] we make sure that FROMDS and TODS are both 0 - } - else - memcpy(hdr.addr3, sdata->u.ibss.bssid, ETH_ALEN); - hdrlen = 24; - break; - default: - ret = NETDEV_TX_OK; - goto fail; - } - - /* - * There's no need to try to look up the destination - * if it is a multicast address (which can only happen - * in AP mode) - */ - multicast = is_multicast_ether_addr(hdr.addr1); - if (!multicast) { - rcu_read_lock(); - sta = sta_info_get(sdata, hdr.addr1); - if (sta) { - /* - * [PLATA] if in OCB mode, we are implicitely authorized - */ - if ((local->hw.wiphy->dot11OCBActivated == 1) && (local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- ieee80211_subif_start_xmit - TX Config for OCB Activated \n"); -#endif - authorized = 1; - wme_sta = 0; // [PLATA] on this version of PLATA, we do not support WME - set_sta_flag(sta,WLAN_STA_AUTHORIZED); // do we need these actually? - set_sta_flag(sta,WLAN_STA_AUTH); - set_sta_flag(sta,WLAN_STA_ASSOC); - set_sta_flag(sta,WLAN_STA_OCB); // [PLATA] we block the STA to be in the OCB mode (as not compatible with none of the other states) - we might have to put it to AUTHORIZED - } - else { - authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED); - wme_sta = test_sta_flag(sta, WLAN_STA_WME); - } - } - rcu_read_unlock(); - } - - /* For mesh, the use of the QoS header is mandatory */ - if (ieee80211_vif_is_mesh(&sdata->vif)) - wme_sta = true; - - /* receiver and we are QoS enabled, use a QoS type frame */ - if (wme_sta && local->hw.queues >= 4) { // [PLATA]: this version of PLATA does not support QoS data frames...with wme_sta 0 and 1 single queue, we cannot be QoS - fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA); - hdrlen += 2; - } - - /* - * Drop unicast frames to unauthorised stations unless they are - * EAPOL frames from the local station. - */ - /* - * [PLATA] - should pass here, as we are implicitly authorized. - */ - /* [PLATA] - Bug fix, unicast frames to unauthorised stations dropped only when OCB is not activated */ - if ((local->hw.wiphy->dot11OCBActivated == 0) && !(local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - - if (unlikely(!ieee80211_vif_is_mesh(&sdata->vif) && - !is_multicast_ether_addr(hdr.addr1) && !authorized && - (cpu_to_be16(ethertype) != sdata->control_port_protocol || - compare_ether_addr(sdata->vif.addr, skb->data + ETH_ALEN)))) { -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - if (net_ratelimit()) - printk(KERN_DEBUG "%s: dropped frame to %pM" - " (unauthorized port)\n", dev->name, - hdr.addr1); -#endif - - I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); - - ret = NETDEV_TX_OK; - goto fail; - } - } - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) - if (unlikely(!multicast && skb->sk && - skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) { - struct sk_buff *orig_skb = skb; - - skb = skb_clone(skb, GFP_ATOMIC); - if (skb) { - unsigned long flags; - int id, r; - - spin_lock_irqsave(&local->ack_status_lock, flags); - r = idr_get_new_above(&local->ack_status_frames, - orig_skb, 1, &id); - if (r == -EAGAIN) { - idr_pre_get(&local->ack_status_frames, - GFP_ATOMIC); - r = idr_get_new_above(&local->ack_status_frames, - orig_skb, 1, &id); - } - if (WARN_ON(!id) || id > 0xffff) { - idr_remove(&local->ack_status_frames, id); - r = -ERANGE; - } - spin_unlock_irqrestore(&local->ack_status_lock, flags); - - if (!r) { - info_id = id; - info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; - } else if (skb_shared(skb)) { - kfree_skb(orig_skb); - } else { - kfree_skb(skb); - skb = orig_skb; - } - } else { - /* couldn't clone -- lose tx status ... */ - skb = orig_skb; - } - } -#endif - - /* - * If the skb is shared we need to obtain our own copy. - */ - if (skb_shared(skb)) { - struct sk_buff *tmp_skb = skb; - - /* can't happen -- skb is a clone if info_id != 0 */ - WARN_ON(info_id); - - skb = skb_clone(skb, GFP_ATOMIC); - kfree_skb(tmp_skb); - - if (!skb) { - ret = NETDEV_TX_OK; - goto fail; - } - } - - hdr.frame_control = fc; - hdr.duration_id = 0; - hdr.seq_ctrl = 0; - - skip_header_bytes = ETH_HLEN; - if (ethertype == ETH_P_AARP || ethertype == ETH_P_IPX) { - encaps_data = bridge_tunnel_header; - encaps_len = sizeof(bridge_tunnel_header); - skip_header_bytes -= 2; - } else if (ethertype >= 0x600) { - encaps_data = rfc1042_header; - encaps_len = sizeof(rfc1042_header); - skip_header_bytes -= 2; - } else { - encaps_data = NULL; - encaps_len = 0; - } - - nh_pos = skb_network_header(skb) - skb->data; - h_pos = skb_transport_header(skb) - skb->data; - - skb_pull(skb, skip_header_bytes); - nh_pos -= skip_header_bytes; - h_pos -= skip_header_bytes; - - head_need = hdrlen + encaps_len + meshhdrlen - skb_headroom(skb); - - /* - * So we need to modify the skb header and hence need a copy of - * that. The head_need variable above doesn't, so far, include - * the needed header space that we don't need right away. If we - * can, then we don't reallocate right now but only after the - * frame arrives at the master device (if it does...) - * - * If we cannot, however, then we will reallocate to include all - * the ever needed space. Also, if we need to reallocate it anyway, - * make it big enough for everything we may ever need. - */ - - if (head_need > 0 || skb_cloned(skb)) { - head_need += IEEE80211_ENCRYPT_HEADROOM; - head_need += local->tx_headroom; - head_need = max_t(int, 0, head_need); - if (ieee80211_skb_resize(sdata, skb, head_need, true)) - goto fail; - } - - if (encaps_data) { - memcpy(skb_push(skb, encaps_len), encaps_data, encaps_len); - nh_pos += encaps_len; - h_pos += encaps_len; - } - -#ifdef CONFIG_MAC80211_MESH - if (meshhdrlen > 0) { - memcpy(skb_push(skb, meshhdrlen), &mesh_hdr, meshhdrlen); - nh_pos += meshhdrlen; - h_pos += meshhdrlen; - } -#endif - - if (ieee80211_is_data_qos(fc)) { //[PLATA] - this version of PLATA does not support QoS frame - MUST be false - __le16 *qos_control; - - qos_control = (__le16*) skb_push(skb, 2); - memcpy(skb_push(skb, hdrlen - 2), &hdr, hdrlen - 2); - /* - * Maybe we could actually set some fields here, for now just - * initialise to zero to indicate no special operation. - */ - *qos_control = 0; - } else - memcpy(skb_push(skb, hdrlen), &hdr, hdrlen); - - nh_pos += hdrlen; - h_pos += hdrlen; - - dev->stats.tx_packets++; - dev->stats.tx_bytes += skb->len; - - /* Update skb pointers to various headers since this modified frame - * is going to go through Linux networking code that may potentially - * need things like pointer to IP header. */ - skb_set_mac_header(skb, 0); - skb_set_network_header(skb, nh_pos); - skb_set_transport_header(skb, h_pos); - - info = IEEE80211_SKB_CB(skb); - memset(info, 0, sizeof(*info)); - - dev->trans_start = jiffies; - - /* - * [PLATA] - last flag adjustments to bypass the state machine (according to the PLATA Spec.) - */ - if ((local->hw.wiphy->dot11OCBActivated == 1) && (local->hw.flags & IEEE80211_HW_DOT11OCB_SUPPORTED)) { - info_flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - info_flags |= IEEE80211_TX_CTL_DONTFRAG; - info_flags |= IEEE80211_TX_CTL_NO_ACK; - } - info->flags = info_flags; - info->ack_frame_id = info_id; - - ieee80211_xmit(sdata, skb); - - return NETDEV_TX_OK; - - fail: - if (ret == NETDEV_TX_OK) - dev_kfree_skb(skb); - - return ret; -} - - -/* - * ieee80211_clear_tx_pending may not be called in a context where - * it is possible that it packets could come in again. - */ -void ieee80211_clear_tx_pending(struct ieee80211_local *local) -{ - int i; - - for (i = 0; i < local->hw.queues; i++) - skb_queue_purge(&local->pending[i]); -} - -/* - * Returns false if the frame couldn't be transmitted but was queued instead, - * which in this case means re-queued -- take as an indication to stop sending - * more pending frames. - */ -static bool ieee80211_tx_pending_skb(struct ieee80211_local *local, - struct sk_buff *skb) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - struct ieee80211_sub_if_data *sdata; - struct sta_info *sta; - struct ieee80211_hdr *hdr; - bool result; - - sdata = vif_to_sdata(info->control.vif); - - if (info->flags & IEEE80211_TX_INTFL_NEED_TXPROCESSING) { - result = ieee80211_tx(sdata, skb, true); - } else { - struct sk_buff_head skbs; - - __skb_queue_head_init(&skbs); - __skb_queue_tail(&skbs, skb); - - hdr = (struct ieee80211_hdr *)skb->data; - sta = sta_info_get(sdata, hdr->addr1); - - result = __ieee80211_tx(local, &skbs, skb->len, sta, true); - } - - return result; -} - -/* - * Transmit all pending packets. Called from tasklet. - */ -void ieee80211_tx_pending(unsigned long data) -{ - struct ieee80211_local *local = (struct ieee80211_local *)data; - struct ieee80211_sub_if_data *sdata; - unsigned long flags; - int i; - bool txok; - - rcu_read_lock(); - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - for (i = 0; i < local->hw.queues; i++) { - /* - * If queue is stopped by something other than due to pending - * frames, or we have no pending frames, proceed to next queue. - */ - if (local->queue_stop_reasons[i] || - skb_queue_empty(&local->pending[i])) - continue; - - while (!skb_queue_empty(&local->pending[i])) { - struct sk_buff *skb = __skb_dequeue(&local->pending[i]); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - if (WARN_ON(!info->control.vif)) { - kfree_skb(skb); - continue; - } - - spin_unlock_irqrestore(&local->queue_stop_reason_lock, - flags); - - txok = ieee80211_tx_pending_skb(local, skb); - spin_lock_irqsave(&local->queue_stop_reason_lock, - flags); - if (!txok) - break; - } - - if (skb_queue_empty(&local->pending[i])) - list_for_each_entry_rcu(sdata, &local->interfaces, list) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) - netif_wake_subqueue(sdata->dev, i); -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)) - netif_start_subqueue(sdata->dev, i); -#else - if (ieee80211_all_queues_started(hw)) - netif_wake_queue(sdata->dev); -#endif - } - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); - - rcu_read_unlock(); -} - -/* functions for drivers to get certain frames */ - -static void ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, - struct ieee80211_if_ap *bss, - struct sk_buff *skb, - struct beacon_data *beacon) -{ - u8 *pos, *tim; - int aid0 = 0; - int i, have_bits = 0, n1, n2; - - /* Generate bitmap for TIM only if there are any STAs in power save - * mode. */ - if (atomic_read(&bss->num_sta_ps) > 0) - /* in the hope that this is faster than - * checking byte-for-byte */ - have_bits = !bitmap_empty((unsigned long*)bss->tim, - IEEE80211_MAX_AID+1); - - if (bss->dtim_count == 0) - bss->dtim_count = sdata->vif.bss_conf.dtim_period - 1; - else - bss->dtim_count--; - - tim = pos = (u8 *) skb_put(skb, 6); - *pos++ = WLAN_EID_TIM; - *pos++ = 4; - *pos++ = bss->dtim_count; - *pos++ = sdata->vif.bss_conf.dtim_period; - - if (bss->dtim_count == 0 && !skb_queue_empty(&bss->ps_bc_buf)) - aid0 = 1; - - bss->dtim_bc_mc = aid0 == 1; - - if (have_bits) { - /* Find largest even number N1 so that bits numbered 1 through - * (N1 x 8) - 1 in the bitmap are 0 and number N2 so that bits - * (N2 + 1) x 8 through 2007 are 0. */ - n1 = 0; - for (i = 0; i < IEEE80211_MAX_TIM_LEN; i++) { - if (bss->tim[i]) { - n1 = i & 0xfe; - break; - } - } - n2 = n1; - for (i = IEEE80211_MAX_TIM_LEN - 1; i >= n1; i--) { - if (bss->tim[i]) { - n2 = i; - break; - } - } - - /* Bitmap control */ - *pos++ = n1 | aid0; - /* Part Virt Bitmap */ - skb_put(skb, n2 - n1); - memcpy(pos, bss->tim + n1, n2 - n1 + 1); - - tim[1] = n2 - n1 + 4; - } else { - *pos++ = aid0; /* Bitmap control */ - *pos++ = 0; /* Part Virt Bitmap */ - } -} - -struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - u16 *tim_offset, u16 *tim_length) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct sk_buff *skb = NULL; - struct ieee80211_tx_info *info; - struct ieee80211_sub_if_data *sdata = NULL; - struct ieee80211_if_ap *ap = NULL; - struct beacon_data *beacon; - struct ieee80211_supported_band *sband; - enum ieee80211_band band = local->hw.conf.channel->band; - struct ieee80211_tx_rate_control txrc; - - sband = local->hw.wiphy->bands[band]; - - rcu_read_lock(); - - sdata = vif_to_sdata(vif); - - if (!ieee80211_sdata_running(sdata)) - goto out; - - if (tim_offset) - *tim_offset = 0; - if (tim_length) - *tim_length = 0; - - if (sdata->vif.type == NL80211_IFTYPE_AP) { - ap = &sdata->u.ap; - beacon = rcu_dereference(ap->beacon); - if (beacon) { - /* - * headroom, head length, - * tail length and maximum TIM length - */ - skb = dev_alloc_skb(local->tx_headroom + - beacon->head_len + - beacon->tail_len + 256); - if (!skb) - goto out; - - skb_reserve(skb, local->tx_headroom); - memcpy(skb_put(skb, beacon->head_len), beacon->head, - beacon->head_len); - - /* - * Not very nice, but we want to allow the driver to call - * ieee80211_beacon_get() as a response to the set_tim() - * callback. That, however, is already invoked under the - * sta_lock to guarantee consistent and race-free update - * of the tim bitmap in mac80211 and the driver. - */ - if (local->tim_in_locked_section) { - ieee80211_beacon_add_tim(sdata, ap, skb, - beacon); - } else { - unsigned long flags; - - spin_lock_irqsave(&local->tim_lock, flags); - ieee80211_beacon_add_tim(sdata, ap, skb, - beacon); - spin_unlock_irqrestore(&local->tim_lock, flags); - } - - if (tim_offset) - *tim_offset = beacon->head_len; - if (tim_length) - *tim_length = skb->len - beacon->head_len; - - if (beacon->tail) - memcpy(skb_put(skb, beacon->tail_len), - beacon->tail, beacon->tail_len); - } else - goto out; - } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { - struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; - struct ieee80211_hdr *hdr; - struct sk_buff *presp = rcu_dereference(ifibss->presp); - - if (!presp) - goto out; - - skb = skb_copy(presp, GFP_ATOMIC); - if (!skb) - goto out; - - hdr = (struct ieee80211_hdr *) skb->data; - hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_BEACON); - } else if (ieee80211_vif_is_mesh(&sdata->vif)) { - struct ieee80211_mgmt *mgmt; - u8 *pos; - int hdr_len = offsetof(struct ieee80211_mgmt, u.beacon) + - sizeof(mgmt->u.beacon); - -#ifdef CONFIG_MAC80211_MESH - if (!sdata->u.mesh.mesh_id_len) - goto out; -#endif - - skb = dev_alloc_skb(local->tx_headroom + - hdr_len + - 2 + /* NULL SSID */ - 2 + 8 + /* supported rates */ - 2 + 3 + /* DS params */ - 2 + (IEEE80211_MAX_SUPP_RATES - 8) + - 2 + sizeof(struct ieee80211_ht_cap) + - 2 + sizeof(struct ieee80211_ht_info) + - 2 + sdata->u.mesh.mesh_id_len + - 2 + sizeof(struct ieee80211_meshconf_ie) + - sdata->u.mesh.ie_len); - if (!skb) - goto out; - - skb_reserve(skb, local->hw.extra_tx_headroom); - mgmt = (struct ieee80211_mgmt *) skb_put(skb, hdr_len); - memset(mgmt, 0, hdr_len); - mgmt->frame_control = - cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); - memset(mgmt->da, 0xff, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); - mgmt->u.beacon.beacon_int = - cpu_to_le16(sdata->vif.bss_conf.beacon_int); - mgmt->u.beacon.capab_info |= cpu_to_le16( - sdata->u.mesh.security ? WLAN_CAPABILITY_PRIVACY : 0); - - pos = skb_put(skb, 2); - *pos++ = WLAN_EID_SSID; - *pos++ = 0x0; - - if (ieee80211_add_srates_ie(&sdata->vif, skb) || - mesh_add_ds_params_ie(skb, sdata) || - ieee80211_add_ext_srates_ie(&sdata->vif, skb) || - mesh_add_rsn_ie(skb, sdata) || - mesh_add_ht_cap_ie(skb, sdata) || - mesh_add_ht_info_ie(skb, sdata) || - mesh_add_meshid_ie(skb, sdata) || - mesh_add_meshconf_ie(skb, sdata) || - mesh_add_vendor_ies(skb, sdata)) { - pr_err("o11s: couldn't add ies!\n"); - goto out; - } - } else { - WARN_ON(1); - goto out; - } - - info = IEEE80211_SKB_CB(skb); - - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - info->flags |= IEEE80211_TX_CTL_NO_ACK; - info->band = band; - - memset(&txrc, 0, sizeof(txrc)); - txrc.hw = hw; - txrc.sband = sband; - txrc.bss_conf = &sdata->vif.bss_conf; - txrc.skb = skb; - txrc.reported_rate.idx = -1; - txrc.rate_idx_mask = sdata->rc_rateidx_mask[band]; - if (txrc.rate_idx_mask == (1 << sband->n_bitrates) - 1) - txrc.max_rate_idx = -1; - else - txrc.max_rate_idx = fls(txrc.rate_idx_mask) - 1; - memcpy(txrc.rate_idx_mcs_mask, sdata->rc_rateidx_mcs_mask[band], - sizeof(txrc.rate_idx_mcs_mask)); - txrc.bss = true; - rate_control_get_rate(sdata, NULL, &txrc); - - info->control.vif = vif; - - info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT | - IEEE80211_TX_CTL_ASSIGN_SEQ | - IEEE80211_TX_CTL_FIRST_FRAGMENT; - out: - rcu_read_unlock(); - return skb; -} -EXPORT_SYMBOL(ieee80211_beacon_get_tim); - -struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ieee80211_if_ap *ap = NULL; - struct sk_buff *presp = NULL, *skb = NULL; - struct ieee80211_hdr *hdr; - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - - if (sdata->vif.type != NL80211_IFTYPE_AP) - return NULL; - - rcu_read_lock(); - - ap = &sdata->u.ap; - presp = rcu_dereference(ap->probe_resp); - if (!presp) - goto out; - - skb = skb_copy(presp, GFP_ATOMIC); - if (!skb) - goto out; - - hdr = (struct ieee80211_hdr *) skb->data; - memset(hdr->addr1, 0, sizeof(hdr->addr1)); - -out: - rcu_read_unlock(); - return skb; -} -EXPORT_SYMBOL(ieee80211_proberesp_get); - -struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ieee80211_sub_if_data *sdata; - struct ieee80211_if_managed *ifmgd; - struct ieee80211_pspoll *pspoll; - struct ieee80211_local *local; - struct sk_buff *skb; - - if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) - return NULL; - - sdata = vif_to_sdata(vif); - ifmgd = &sdata->u.mgd; - local = sdata->local; - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*pspoll)); - if (!skb) - return NULL; - - skb_reserve(skb, local->hw.extra_tx_headroom); - - pspoll = (struct ieee80211_pspoll *) skb_put(skb, sizeof(*pspoll)); - memset(pspoll, 0, sizeof(*pspoll)); - pspoll->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | - IEEE80211_STYPE_PSPOLL); - pspoll->aid = cpu_to_le16(ifmgd->aid); - - /* aid in PS-Poll has its two MSBs each set to 1 */ - pspoll->aid |= cpu_to_le16(1 << 15 | 1 << 14); - - memcpy(pspoll->bssid, ifmgd->bssid, ETH_ALEN); - memcpy(pspoll->ta, vif->addr, ETH_ALEN); - - return skb; -} -EXPORT_SYMBOL(ieee80211_pspoll_get); - -struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ieee80211_hdr_3addr *nullfunc; - struct ieee80211_sub_if_data *sdata; - struct ieee80211_if_managed *ifmgd; - struct ieee80211_local *local; - struct sk_buff *skb; - - if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) - return NULL; - - sdata = vif_to_sdata(vif); - ifmgd = &sdata->u.mgd; - local = sdata->local; - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*nullfunc)); - if (!skb) - return NULL; - - skb_reserve(skb, local->hw.extra_tx_headroom); - - nullfunc = (struct ieee80211_hdr_3addr *) skb_put(skb, - sizeof(*nullfunc)); - memset(nullfunc, 0, sizeof(*nullfunc)); - nullfunc->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | - IEEE80211_STYPE_NULLFUNC | - IEEE80211_FCTL_TODS); - memcpy(nullfunc->addr1, ifmgd->bssid, ETH_ALEN); - memcpy(nullfunc->addr2, vif->addr, ETH_ALEN); - memcpy(nullfunc->addr3, ifmgd->bssid, ETH_ALEN); - - return skb; -} -EXPORT_SYMBOL(ieee80211_nullfunc_get); - -struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - const u8 *ssid, size_t ssid_len, - const u8 *ie, size_t ie_len) -{ - struct ieee80211_sub_if_data *sdata; - struct ieee80211_local *local; - struct ieee80211_hdr_3addr *hdr; - struct sk_buff *skb; - size_t ie_ssid_len; - u8 *pos; - - sdata = vif_to_sdata(vif); - local = sdata->local; - ie_ssid_len = 2 + ssid_len; - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*hdr) + - ie_ssid_len + ie_len); - if (!skb) - return NULL; - - skb_reserve(skb, local->hw.extra_tx_headroom); - - hdr = (struct ieee80211_hdr_3addr *) skb_put(skb, sizeof(*hdr)); - memset(hdr, 0, sizeof(*hdr)); - hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_PROBE_REQ); - memset(hdr->addr1, 0xff, ETH_ALEN); - memcpy(hdr->addr2, vif->addr, ETH_ALEN); - memset(hdr->addr3, 0xff, ETH_ALEN); - - pos = skb_put(skb, ie_ssid_len); - *pos++ = WLAN_EID_SSID; - *pos++ = ssid_len; - if (ssid) - memcpy(pos, ssid, ssid_len); - pos += ssid_len; - - if (ie) { - pos = skb_put(skb, ie_len); - memcpy(pos, ie, ie_len); - } - - return skb; -} -EXPORT_SYMBOL(ieee80211_probereq_get); - -void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - const void *frame, size_t frame_len, - const struct ieee80211_tx_info *frame_txctl, - struct ieee80211_rts *rts) -{ - const struct ieee80211_hdr *hdr = frame; - - rts->frame_control = - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS); - rts->duration = ieee80211_rts_duration(hw, vif, frame_len, - frame_txctl); - memcpy(rts->ra, hdr->addr1, sizeof(rts->ra)); - memcpy(rts->ta, hdr->addr2, sizeof(rts->ta)); -} -EXPORT_SYMBOL(ieee80211_rts_get); - -void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, - const void *frame, size_t frame_len, - const struct ieee80211_tx_info *frame_txctl, - struct ieee80211_cts *cts) -{ - const struct ieee80211_hdr *hdr = frame; - - cts->frame_control = - cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS); - cts->duration = ieee80211_ctstoself_duration(hw, vif, - frame_len, frame_txctl); - memcpy(cts->ra, hdr->addr1, sizeof(cts->ra)); -} -EXPORT_SYMBOL(ieee80211_ctstoself_get); - -struct sk_buff * -ieee80211_get_buffered_bc(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct sk_buff *skb = NULL; - struct ieee80211_tx_data tx; - struct ieee80211_sub_if_data *sdata; - struct ieee80211_if_ap *bss = NULL; - struct beacon_data *beacon; - struct ieee80211_tx_info *info; - - sdata = vif_to_sdata(vif); - bss = &sdata->u.ap; - - rcu_read_lock(); - beacon = rcu_dereference(bss->beacon); - - if (sdata->vif.type != NL80211_IFTYPE_AP || !beacon || !beacon->head) - goto out; - - if (bss->dtim_count != 0 || !bss->dtim_bc_mc) - goto out; /* send buffered bc/mc only after DTIM beacon */ - - while (1) { - skb = skb_dequeue(&bss->ps_bc_buf); - if (!skb) - goto out; - local->total_ps_buffered--; - - if (!skb_queue_empty(&bss->ps_bc_buf) && skb->len >= 2) { - struct ieee80211_hdr *hdr = - (struct ieee80211_hdr *) skb->data; - /* more buffered multicast/broadcast frames ==> set - * MoreData flag in IEEE 802.11 header to inform PS - * STAs */ - hdr->frame_control |= - cpu_to_le16(IEEE80211_FCTL_MOREDATA); - } - - if (!ieee80211_tx_prepare(sdata, &tx, skb)) - break; - dev_kfree_skb_any(skb); - } - - info = IEEE80211_SKB_CB(skb); - - tx.flags |= IEEE80211_TX_PS_BUFFERED; - tx.channel = local->hw.conf.channel; - info->band = tx.channel->band; - - if (invoke_tx_handlers(&tx)) - skb = NULL; - out: - rcu_read_unlock(); - - return skb; -} -EXPORT_SYMBOL(ieee80211_get_buffered_bc); - -void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb, int tid) -{ - skb_set_mac_header(skb, 0); - skb_set_network_header(skb, 0); - skb_set_transport_header(skb, 0); - - skb_set_queue_mapping(skb, ieee802_1d_to_ac[tid]); - skb->priority = tid; - - /* - * The other path calling ieee80211_xmit is from the tasklet, - * and while we can handle concurrent transmissions locking - * requirements are that we do not come into tx with bhs on. - */ - local_bh_disable(); - ieee80211_xmit(sdata, skb); - local_bh_enable(); -} diff --git a/openairITS/mac/DOT11/net/mac80211/util.c b/openairITS/mac/DOT11/net/mac80211/util.c deleted file mode 100644 index a9682a66eb2..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/util.c +++ /dev/null @@ -1,1761 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * utilities for mac80211 - */ - -#include <net/mac80211.h> -#include <linux/netdevice.h> -#include <linux/export.h> -#include <linux/types.h> -#include <linux/slab.h> -#include <linux/skbuff.h> -#include <linux/etherdevice.h> -#include <linux/if_arp.h> -#include <linux/bitmap.h> -#include <linux/crc32.h> -#include <net/net_namespace.h> -#include <net/cfg80211.h> -#include <net/rtnetlink.h> - -#include "ieee80211_i.h" -#include "driver-ops.h" -#include "rate.h" -#include "mesh.h" -#include "wme.h" -#include "led.h" -#include "wep.h" - -/* privid for wiphys to determine whether they belong to us or not */ -void *mac80211_wiphy_privid = &mac80211_wiphy_privid; - -struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy) -{ - struct ieee80211_local *local; - BUG_ON(!wiphy); - - local = wiphy_priv(wiphy); - return &local->hw; -} -EXPORT_SYMBOL(wiphy_to_ieee80211_hw); - -u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, - enum nl80211_iftype type) -{ - __le16 fc = hdr->frame_control; - - /* drop ACK/CTS frames and incorrect hdr len (ctrl) */ - if (len < 16) - return NULL; - - if (ieee80211_is_data(fc)) { - if (len < 24) /* drop incorrect hdr len (data) */ - return NULL; - - if (ieee80211_has_a4(fc)) - return NULL; - if (ieee80211_has_tods(fc)) - return hdr->addr1; - if (ieee80211_has_fromds(fc)) - return hdr->addr2; - - return hdr->addr3; - } - - if (ieee80211_is_mgmt(fc)) { - if (len < 24) /* drop incorrect hdr len (mgmt) */ - return NULL; - return hdr->addr3; - } - - if (ieee80211_is_ctl(fc)) { - if(ieee80211_is_pspoll(fc)) - return hdr->addr1; - - if (ieee80211_is_back_req(fc)) { - switch (type) { - case NL80211_IFTYPE_STATION: - return hdr->addr2; - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: - return hdr->addr1; - default: - break; /* fall through to the return */ - } - } - } - - return NULL; -} - -void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx) -{ - struct sk_buff *skb; - struct ieee80211_hdr *hdr; - - skb_queue_walk(&tx->skbs, skb) { - hdr = (struct ieee80211_hdr *) skb->data; - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); - } -} - -int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, - int rate, int erp, int short_preamble) -{ - int dur; - - /* calculate duration (in microseconds, rounded up to next higher - * integer if it includes a fractional microsecond) to send frame of - * len bytes (does not include FCS) at the given rate. Duration will - * also include SIFS. - * - * rate is in 100 kbps, so divident is multiplied by 10 in the - * DIV_ROUND_UP() operations. - */ - - if (local->hw.conf.channel->band == IEEE80211_BAND_5GHZ || erp) { - /* - * OFDM: - * - * N_DBPS = DATARATE x 4 - * N_SYM = Ceiling((16+8xLENGTH+6) / N_DBPS) - * (16 = SIGNAL time, 6 = tail bits) - * TXTIME = T_PREAMBLE + T_SIGNAL + T_SYM x N_SYM + Signal Ext - * - * T_SYM = 4 usec - * 802.11a - 17.5.2: aSIFSTime = 16 usec - * 802.11g - 19.8.4: aSIFSTime = 10 usec + - * signal ext = 6 usec - */ - dur = 16; /* SIFS + signal ext */ - dur += 16; /* 17.3.2.3: T_PREAMBLE = 16 usec */ - dur += 4; /* 17.3.2.3: T_SIGNAL = 4 usec */ - dur += 4 * DIV_ROUND_UP((16 + 8 * (len + 4) + 6) * 10, - 4 * rate); /* T_SYM x N_SYM */ - } else { - /* - * 802.11b or 802.11g with 802.11b compatibility: - * 18.3.4: TXTIME = PreambleLength + PLCPHeaderTime + - * Ceiling(((LENGTH+PBCC)x8)/DATARATE). PBCC=0. - * - * 802.11 (DS): 15.3.3, 802.11b: 18.3.4 - * aSIFSTime = 10 usec - * aPreambleLength = 144 usec or 72 usec with short preamble - * aPLCPHeaderLength = 48 usec or 24 usec with short preamble - */ - dur = 10; /* aSIFSTime = 10 usec */ - dur += short_preamble ? (72 + 24) : (144 + 48); - - dur += DIV_ROUND_UP(8 * (len + 4) * 10, rate); - } - - return dur; -} - -/* Exported duration function for driver use */ -__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - size_t frame_len, - struct ieee80211_rate *rate) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_sub_if_data *sdata; - u16 dur; - int erp; - bool short_preamble = false; - - erp = 0; - if (vif) { - sdata = vif_to_sdata(vif); - short_preamble = sdata->vif.bss_conf.use_short_preamble; - if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) - erp = rate->flags & IEEE80211_RATE_ERP_G; - } - - dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, erp, - short_preamble); - - return cpu_to_le16(dur); -} -EXPORT_SYMBOL(ieee80211_generic_frame_duration); - -__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, size_t frame_len, - const struct ieee80211_tx_info *frame_txctl) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_rate *rate; - struct ieee80211_sub_if_data *sdata; - bool short_preamble; - int erp; - u16 dur; - struct ieee80211_supported_band *sband; - - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - - short_preamble = false; - - rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; - - erp = 0; - if (vif) { - sdata = vif_to_sdata(vif); - short_preamble = sdata->vif.bss_conf.use_short_preamble; - if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) - erp = rate->flags & IEEE80211_RATE_ERP_G; - } - - /* CTS duration */ - dur = ieee80211_frame_duration(local, 10, rate->bitrate, - erp, short_preamble); - /* Data frame duration */ - dur += ieee80211_frame_duration(local, frame_len, rate->bitrate, - erp, short_preamble); - /* ACK duration */ - dur += ieee80211_frame_duration(local, 10, rate->bitrate, - erp, short_preamble); - - return cpu_to_le16(dur); -} -EXPORT_SYMBOL(ieee80211_rts_duration); - -__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - size_t frame_len, - const struct ieee80211_tx_info *frame_txctl) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_rate *rate; - struct ieee80211_sub_if_data *sdata; - bool short_preamble; - int erp; - u16 dur; - struct ieee80211_supported_band *sband; - - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - - short_preamble = false; - - rate = &sband->bitrates[frame_txctl->control.rts_cts_rate_idx]; - erp = 0; - if (vif) { - sdata = vif_to_sdata(vif); - short_preamble = sdata->vif.bss_conf.use_short_preamble; - if (sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) - erp = rate->flags & IEEE80211_RATE_ERP_G; - } - - /* Data frame duration */ - dur = ieee80211_frame_duration(local, frame_len, rate->bitrate, - erp, short_preamble); - if (!(frame_txctl->flags & IEEE80211_TX_CTL_NO_ACK)) { - /* ACK duration */ - dur += ieee80211_frame_duration(local, 10, rate->bitrate, - erp, short_preamble); - } - - return cpu_to_le16(dur); -} -EXPORT_SYMBOL(ieee80211_ctstoself_duration); - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)) -static bool ieee80211_all_queues_started(struct ieee80211_hw *hw) -{ - unsigned int queue; - - for (queue = 0; queue < hw->queues; queue++) - if (ieee80211_queue_stopped(hw, queue)) - return false; - return true; -} -#endif - -static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue, - enum queue_stop_reason reason) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_sub_if_data *sdata; - - trace_wake_queue(local, queue, reason); - - if (WARN_ON(queue >= hw->queues)) - return; - - __clear_bit(reason, &local->queue_stop_reasons[queue]); - - if (local->queue_stop_reasons[queue] != 0) - /* someone still has this queue stopped */ - return; - - if (skb_queue_empty(&local->pending[queue])) { - rcu_read_lock(); - list_for_each_entry_rcu(sdata, &local->interfaces, list) { - if (test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) - continue; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) - netif_wake_subqueue(sdata->dev, queue); -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)) - netif_start_subqueue(sdata->dev, queue); -#else - if (ieee80211_all_queues_started(hw)) - netif_wake_queue(sdata->dev); -#endif - } - rcu_read_unlock(); - } else - tasklet_schedule(&local->tx_pending_tasklet); -} - -void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, - enum queue_stop_reason reason) -{ - struct ieee80211_local *local = hw_to_local(hw); - unsigned long flags; - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - __ieee80211_wake_queue(hw, queue, reason); - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); -} - -void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue) -{ - ieee80211_wake_queue_by_reason(hw, queue, - IEEE80211_QUEUE_STOP_REASON_DRIVER); -} -EXPORT_SYMBOL(ieee80211_wake_queue); - -static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue, - enum queue_stop_reason reason) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_sub_if_data *sdata; - - trace_stop_queue(local, queue, reason); - - if (WARN_ON(queue >= hw->queues)) - return; - - __set_bit(reason, &local->queue_stop_reasons[queue]); - - rcu_read_lock(); - list_for_each_entry_rcu(sdata, &local->interfaces, list) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) - netif_stop_subqueue(sdata->dev, queue); -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)) - netif_stop_subqueue(sdata->dev, queue); -#else - netif_stop_queue(sdata->dev); -#endif - rcu_read_unlock(); -} - -void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, - enum queue_stop_reason reason) -{ - struct ieee80211_local *local = hw_to_local(hw); - unsigned long flags; - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - __ieee80211_stop_queue(hw, queue, reason); - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); -} - -void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue) -{ - ieee80211_stop_queue_by_reason(hw, queue, - IEEE80211_QUEUE_STOP_REASON_DRIVER); -} -EXPORT_SYMBOL(ieee80211_stop_queue); - -void ieee80211_add_pending_skb(struct ieee80211_local *local, - struct sk_buff *skb) -{ - struct ieee80211_hw *hw = &local->hw; - unsigned long flags; - int queue = skb_get_queue_mapping(skb); - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - if (WARN_ON(!info->control.vif)) { - kfree_skb(skb); - return; - } - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - __ieee80211_stop_queue(hw, queue, IEEE80211_QUEUE_STOP_REASON_SKB_ADD); - __skb_queue_tail(&local->pending[queue], skb); - __ieee80211_wake_queue(hw, queue, IEEE80211_QUEUE_STOP_REASON_SKB_ADD); - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); -} - -void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local, - struct sk_buff_head *skbs, - void (*fn)(void *data), void *data) -{ - struct ieee80211_hw *hw = &local->hw; - struct sk_buff *skb; - unsigned long flags; - int queue, i; - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - for (i = 0; i < hw->queues; i++) - __ieee80211_stop_queue(hw, i, - IEEE80211_QUEUE_STOP_REASON_SKB_ADD); - - while ((skb = skb_dequeue(skbs))) { - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - if (WARN_ON(!info->control.vif)) { - kfree_skb(skb); - continue; - } - - queue = skb_get_queue_mapping(skb); - __skb_queue_tail(&local->pending[queue], skb); - } - - if (fn) - fn(data); - - for (i = 0; i < hw->queues; i++) - __ieee80211_wake_queue(hw, i, - IEEE80211_QUEUE_STOP_REASON_SKB_ADD); - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); -} - -void ieee80211_add_pending_skbs(struct ieee80211_local *local, - struct sk_buff_head *skbs) -{ - ieee80211_add_pending_skbs_fn(local, skbs, NULL, NULL); -} - -void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, - enum queue_stop_reason reason) -{ - struct ieee80211_local *local = hw_to_local(hw); - unsigned long flags; - int i; - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - - for (i = 0; i < hw->queues; i++) - __ieee80211_stop_queue(hw, i, reason); - - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); -} - -void ieee80211_stop_queues(struct ieee80211_hw *hw) -{ - ieee80211_stop_queues_by_reason(hw, - IEEE80211_QUEUE_STOP_REASON_DRIVER); -} -EXPORT_SYMBOL(ieee80211_stop_queues); - -int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue) -{ - struct ieee80211_local *local = hw_to_local(hw); - unsigned long flags; - int ret; - - if (WARN_ON(queue >= hw->queues)) - return true; - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - ret = !!local->queue_stop_reasons[queue]; - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); - return ret; -} -EXPORT_SYMBOL(ieee80211_queue_stopped); - -void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, - enum queue_stop_reason reason) -{ - struct ieee80211_local *local = hw_to_local(hw); - unsigned long flags; - int i; - - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - - for (i = 0; i < hw->queues; i++) - __ieee80211_wake_queue(hw, i, reason); - - spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); -} - -void ieee80211_wake_queues(struct ieee80211_hw *hw) -{ - ieee80211_wake_queues_by_reason(hw, IEEE80211_QUEUE_STOP_REASON_DRIVER); -} -EXPORT_SYMBOL(ieee80211_wake_queues); - -void ieee80211_iterate_active_interfaces( - struct ieee80211_hw *hw, - void (*iterator)(void *data, u8 *mac, - struct ieee80211_vif *vif), - void *data) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_sub_if_data *sdata; - - mutex_lock(&local->iflist_mtx); - - list_for_each_entry(sdata, &local->interfaces, list) { - switch (sdata->vif.type) { - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_AP_VLAN: - continue; - default: - break; - } - if (ieee80211_sdata_running(sdata)) - iterator(data, sdata->vif.addr, - &sdata->vif); - } - - mutex_unlock(&local->iflist_mtx); -} -EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces); - -void ieee80211_iterate_active_interfaces_atomic( - struct ieee80211_hw *hw, - void (*iterator)(void *data, u8 *mac, - struct ieee80211_vif *vif), - void *data) -{ - struct ieee80211_local *local = hw_to_local(hw); - struct ieee80211_sub_if_data *sdata; - - rcu_read_lock(); - - list_for_each_entry_rcu(sdata, &local->interfaces, list) { - switch (sdata->vif.type) { - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_AP_VLAN: - continue; - default: - break; - } - if (ieee80211_sdata_running(sdata)) - iterator(data, sdata->vif.addr, - &sdata->vif); - } - - rcu_read_unlock(); -} -EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces_atomic); - -/* - * Nothing should have been stuffed into the workqueue during - * the suspend->resume cycle. If this WARN is seen then there - * is a bug with either the driver suspend or something in - * mac80211 stuffing into the workqueue which we haven't yet - * cleared during mac80211's suspend cycle. - */ -static bool ieee80211_can_queue_work(struct ieee80211_local *local) -{ - if (WARN(local->suspended && !local->resuming, - "queueing ieee80211 work while going to suspend\n")) - return false; - - return true; -} - -void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work) -{ - struct ieee80211_local *local = hw_to_local(hw); - - if (!ieee80211_can_queue_work(local)) - return; - - queue_work(local->workqueue, work); -} -EXPORT_SYMBOL(ieee80211_queue_work); - -void ieee80211_queue_delayed_work(struct ieee80211_hw *hw, - struct delayed_work *dwork, - unsigned long delay) -{ - struct ieee80211_local *local = hw_to_local(hw); - - if (!ieee80211_can_queue_work(local)) - return; - - queue_delayed_work(local->workqueue, dwork, delay); -} -EXPORT_SYMBOL(ieee80211_queue_delayed_work); - -u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, - struct ieee802_11_elems *elems, - u64 filter, u32 crc) -{ - size_t left = len; - u8 *pos = start; - bool calc_crc = filter != 0; - DECLARE_BITMAP(seen_elems, 256); - - bitmap_zero(seen_elems, 256); - memset(elems, 0, sizeof(*elems)); - elems->ie_start = start; - elems->total_len = len; - - while (left >= 2) { - u8 id, elen; - bool elem_parse_failed; - - id = *pos++; - elen = *pos++; - left -= 2; - - if (elen > left) { - elems->parse_error = true; - break; - } - - if (id != WLAN_EID_VENDOR_SPECIFIC && - id != WLAN_EID_QUIET && - test_bit(id, seen_elems)) { - elems->parse_error = true; - left -= elen; - pos += elen; - continue; - } - - if (calc_crc && id < 64 && (filter & (1ULL << id))) - crc = crc32_be(crc, pos - 2, elen + 2); - - elem_parse_failed = false; - - switch (id) { - case WLAN_EID_SSID: - elems->ssid = pos; - elems->ssid_len = elen; - break; - case WLAN_EID_SUPP_RATES: - elems->supp_rates = pos; - elems->supp_rates_len = elen; - break; - case WLAN_EID_FH_PARAMS: - elems->fh_params = pos; - elems->fh_params_len = elen; - break; - case WLAN_EID_DS_PARAMS: - elems->ds_params = pos; - elems->ds_params_len = elen; - break; - case WLAN_EID_CF_PARAMS: - elems->cf_params = pos; - elems->cf_params_len = elen; - break; - case WLAN_EID_TIM: - if (elen >= sizeof(struct ieee80211_tim_ie)) { - elems->tim = (void *)pos; - elems->tim_len = elen; - } else - elem_parse_failed = true; - break; - case WLAN_EID_IBSS_PARAMS: - elems->ibss_params = pos; - elems->ibss_params_len = elen; - break; - case WLAN_EID_CHALLENGE: - elems->challenge = pos; - elems->challenge_len = elen; - break; - case WLAN_EID_VENDOR_SPECIFIC: - if (elen >= 4 && pos[0] == 0x00 && pos[1] == 0x50 && - pos[2] == 0xf2) { - /* Microsoft OUI (00:50:F2) */ - - if (calc_crc) - crc = crc32_be(crc, pos - 2, elen + 2); - - if (pos[3] == 1) { - /* OUI Type 1 - WPA IE */ - elems->wpa = pos; - elems->wpa_len = elen; - } else if (elen >= 5 && pos[3] == 2) { - /* OUI Type 2 - WMM IE */ - if (pos[4] == 0) { - elems->wmm_info = pos; - elems->wmm_info_len = elen; - } else if (pos[4] == 1) { - elems->wmm_param = pos; - elems->wmm_param_len = elen; - } - } - } - break; - case WLAN_EID_RSN: - elems->rsn = pos; - elems->rsn_len = elen; - break; - case WLAN_EID_ERP_INFO: - elems->erp_info = pos; - elems->erp_info_len = elen; - break; - case WLAN_EID_EXT_SUPP_RATES: - elems->ext_supp_rates = pos; - elems->ext_supp_rates_len = elen; - break; - case WLAN_EID_HT_CAPABILITY: - if (elen >= sizeof(struct ieee80211_ht_cap)) - elems->ht_cap_elem = (void *)pos; - else - elem_parse_failed = true; - break; - case WLAN_EID_HT_INFORMATION: - if (elen >= sizeof(struct ieee80211_ht_info)) - elems->ht_info_elem = (void *)pos; - else - elem_parse_failed = true; - break; - case WLAN_EID_MESH_ID: - elems->mesh_id = pos; - elems->mesh_id_len = elen; - break; - case WLAN_EID_MESH_CONFIG: - if (elen >= sizeof(struct ieee80211_meshconf_ie)) - elems->mesh_config = (void *)pos; - else - elem_parse_failed = true; - break; - case WLAN_EID_PEER_MGMT: - elems->peering = pos; - elems->peering_len = elen; - break; - case WLAN_EID_PREQ: - elems->preq = pos; - elems->preq_len = elen; - break; - case WLAN_EID_PREP: - elems->prep = pos; - elems->prep_len = elen; - break; - case WLAN_EID_PERR: - elems->perr = pos; - elems->perr_len = elen; - break; - case WLAN_EID_RANN: - if (elen >= sizeof(struct ieee80211_rann_ie)) - elems->rann = (void *)pos; - else - elem_parse_failed = true; - break; - case WLAN_EID_CHANNEL_SWITCH: - elems->ch_switch_elem = pos; - elems->ch_switch_elem_len = elen; - break; - case WLAN_EID_QUIET: - if (!elems->quiet_elem) { - elems->quiet_elem = pos; - elems->quiet_elem_len = elen; - } - elems->num_of_quiet_elem++; - break; - case WLAN_EID_COUNTRY: - elems->country_elem = pos; - elems->country_elem_len = elen; - break; - case WLAN_EID_PWR_CONSTRAINT: - elems->pwr_constr_elem = pos; - elems->pwr_constr_elem_len = elen; - break; - case WLAN_EID_TIMEOUT_INTERVAL: - elems->timeout_int = pos; - elems->timeout_int_len = elen; - break; - default: - break; - } - - if (elem_parse_failed) - elems->parse_error = true; - else - set_bit(id, seen_elems); - - left -= elen; - pos += elen; - } - - if (left != 0) - elems->parse_error = true; - - return crc; -} - -void ieee802_11_parse_elems(u8 *start, size_t len, - struct ieee802_11_elems *elems) -{ - ieee802_11_parse_elems_crc(start, len, elems, 0, 0); -} - -void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, - bool bss_notify) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_tx_queue_params qparam; - int queue; - bool use_11b; - int aCWmin, aCWmax; - - if (!local->ops->conf_tx) - return; - - memset(&qparam, 0, sizeof(qparam)); - - use_11b = (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ) && - !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); - - for (queue = 0; queue < local->hw.queues; queue++) { - /* Set defaults according to 802.11-2007 Table 7-37 */ - aCWmax = 1023; - if (use_11b) - aCWmin = 31; - else - aCWmin = 15; - - switch (queue) { - case 3: /* AC_BK */ - qparam.cw_max = aCWmax; - qparam.cw_min = aCWmin; - qparam.txop = 0; - qparam.aifs = 7; - break; - default: /* never happens but let's not leave undefined */ - case 2: /* AC_BE */ - qparam.cw_max = aCWmax; - qparam.cw_min = aCWmin; - qparam.txop = 0; - qparam.aifs = 3; - break; - case 1: /* AC_VI */ - qparam.cw_max = aCWmin; - qparam.cw_min = (aCWmin + 1) / 2 - 1; - if (use_11b) - qparam.txop = 6016/32; - else - qparam.txop = 3008/32; - qparam.aifs = 2; - break; - case 0: /* AC_VO */ - qparam.cw_max = (aCWmin + 1) / 2 - 1; - qparam.cw_min = (aCWmin + 1) / 4 - 1; - if (use_11b) - qparam.txop = 3264/32; - else - qparam.txop = 1504/32; - qparam.aifs = 2; - break; - } - - qparam.uapsd = false; - - sdata->tx_conf[queue] = qparam; - drv_conf_tx(local, sdata, queue, &qparam); - } - - /* after reinitialize QoS TX queues setting to default, - * disable QoS at all */ - - if (sdata->vif.type != NL80211_IFTYPE_MONITOR) { - sdata->vif.bss_conf.qos = - sdata->vif.type != NL80211_IFTYPE_STATION; - if (bss_notify) - ieee80211_bss_info_change_notify(sdata, - BSS_CHANGED_QOS); - } -} - -void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, - const size_t supp_rates_len, - const u8 *supp_rates) -{ - struct ieee80211_local *local = sdata->local; - int i, have_higher_than_11mbit = 0; - - /* cf. IEEE 802.11 9.2.12 */ - for (i = 0; i < supp_rates_len; i++) - if ((supp_rates[i] & 0x7f) * 5 > 110) - have_higher_than_11mbit = 1; - - if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && - have_higher_than_11mbit) - sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; - else - sdata->flags &= ~IEEE80211_SDATA_OPERATING_GMODE; - - ieee80211_set_wmm_default(sdata, true); -} - -u32 ieee80211_mandatory_rates(struct ieee80211_local *local, - enum ieee80211_band band) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_rate *bitrates; - u32 mandatory_rates; - enum ieee80211_rate_flags mandatory_flag; - int i; - - sband = local->hw.wiphy->bands[band]; - if (!sband) { - WARN_ON(1); - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - } - - if (band == IEEE80211_BAND_2GHZ) - mandatory_flag = IEEE80211_RATE_MANDATORY_B; - else - mandatory_flag = IEEE80211_RATE_MANDATORY_A; - - bitrates = sband->bitrates; - mandatory_rates = 0; - for (i = 0; i < sband->n_bitrates; i++) - if (bitrates[i].flags & mandatory_flag) - mandatory_rates |= BIT(i); - return mandatory_rates; -} - -void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, - u16 transaction, u16 auth_alg, - u8 *extra, size_t extra_len, const u8 *da, - const u8 *bssid, const u8 *key, u8 key_len, u8 key_idx) -{ - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - int err; - - skb = dev_alloc_skb(local->hw.extra_tx_headroom + - sizeof(*mgmt) + 6 + extra_len); - if (!skb) - return; - - skb_reserve(skb, local->hw.extra_tx_headroom); - - mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24 + 6); - memset(mgmt, 0, 24 + 6); - mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | - IEEE80211_STYPE_AUTH); - memcpy(mgmt->da, da, ETH_ALEN); - memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); - memcpy(mgmt->bssid, bssid, ETH_ALEN); - mgmt->u.auth.auth_alg = cpu_to_le16(auth_alg); - mgmt->u.auth.auth_transaction = cpu_to_le16(transaction); - mgmt->u.auth.status_code = cpu_to_le16(0); - if (extra) - memcpy(skb_put(skb, extra_len), extra, extra_len); - - if (auth_alg == WLAN_AUTH_SHARED_KEY && transaction == 3) { - mgmt->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); - err = ieee80211_wep_encrypt(local, skb, key, key_len, key_idx); - WARN_ON(err); - } - - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - ieee80211_tx_skb(sdata, skb); -} - -int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, - const u8 *ie, size_t ie_len, - enum ieee80211_band band, u32 rate_mask, - u8 channel) -{ - struct ieee80211_supported_band *sband; - u8 *pos; - size_t offset = 0, noffset; - int supp_rates_len, i; - u8 rates[32]; - int num_rates; - int ext_rates_len; - - sband = local->hw.wiphy->bands[band]; - - pos = buffer; - - num_rates = 0; - for (i = 0; i < sband->n_bitrates; i++) { - if ((BIT(i) & rate_mask) == 0) - continue; /* skip rate */ - rates[num_rates++] = (u8) (sband->bitrates[i].bitrate / 5); - } - - supp_rates_len = min_t(int, num_rates, 8); - - *pos++ = WLAN_EID_SUPP_RATES; - *pos++ = supp_rates_len; - memcpy(pos, rates, supp_rates_len); - pos += supp_rates_len; - - /* insert "request information" if in custom IEs */ - if (ie && ie_len) { - static const u8 before_extrates[] = { - WLAN_EID_SSID, - WLAN_EID_SUPP_RATES, - WLAN_EID_REQUEST, - }; - noffset = ieee80211_ie_split(ie, ie_len, - before_extrates, - ARRAY_SIZE(before_extrates), - offset); - memcpy(pos, ie + offset, noffset - offset); - pos += noffset - offset; - offset = noffset; - } - - ext_rates_len = num_rates - supp_rates_len; - if (ext_rates_len > 0) { - *pos++ = WLAN_EID_EXT_SUPP_RATES; - *pos++ = ext_rates_len; - memcpy(pos, rates + supp_rates_len, ext_rates_len); - pos += ext_rates_len; - } - - if (channel && sband->band == IEEE80211_BAND_2GHZ) { - *pos++ = WLAN_EID_DS_PARAMS; - *pos++ = 1; - *pos++ = channel; - } - - /* insert custom IEs that go before HT */ - if (ie && ie_len) { - static const u8 before_ht[] = { - WLAN_EID_SSID, - WLAN_EID_SUPP_RATES, - WLAN_EID_REQUEST, - WLAN_EID_EXT_SUPP_RATES, - WLAN_EID_DS_PARAMS, - WLAN_EID_SUPPORTED_REGULATORY_CLASSES, - }; - noffset = ieee80211_ie_split(ie, ie_len, - before_ht, ARRAY_SIZE(before_ht), - offset); - memcpy(pos, ie + offset, noffset - offset); - pos += noffset - offset; - offset = noffset; - } - - if (sband->ht_cap.ht_supported) - pos = ieee80211_ie_build_ht_cap(pos, &sband->ht_cap, - sband->ht_cap.cap); - - /* - * If adding more here, adjust code in main.c - * that calculates local->scan_ies_len. - */ - - /* add any remaining custom IEs */ - if (ie && ie_len) { - noffset = ie_len; - memcpy(pos, ie + offset, noffset - offset); - pos += noffset - offset; - } - - return pos - buffer; -} - -struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, - u8 *dst, u32 ratemask, - const u8 *ssid, size_t ssid_len, - const u8 *ie, size_t ie_len, - bool directed) -{ - struct ieee80211_local *local = sdata->local; - struct sk_buff *skb; - struct ieee80211_mgmt *mgmt; - size_t buf_len; - u8 *buf; - u8 chan; - - /* FIXME: come up with a proper value */ - buf = kmalloc(200 + ie_len, GFP_KERNEL); - if (!buf) - return NULL; - - /* - * Do not send DS Channel parameter for directed probe requests - * in order to maximize the chance that we get a response. Some - * badly-behaved APs don't respond when this parameter is included. - */ - if (directed) - chan = 0; - else - chan = ieee80211_frequency_to_channel( - local->hw.conf.channel->center_freq); - - buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, - local->hw.conf.channel->band, - ratemask, chan); - - skb = ieee80211_probereq_get(&local->hw, &sdata->vif, - ssid, ssid_len, - buf, buf_len); - if (!skb) - goto out; - - if (dst) { - mgmt = (struct ieee80211_mgmt *) skb->data; - memcpy(mgmt->da, dst, ETH_ALEN); - memcpy(mgmt->bssid, dst, ETH_ALEN); - } - - IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; - - out: - kfree(buf); - - return skb; -} - -void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, - const u8 *ssid, size_t ssid_len, - const u8 *ie, size_t ie_len, - u32 ratemask, bool directed, bool no_cck) -{ - struct sk_buff *skb; - - skb = ieee80211_build_probe_req(sdata, dst, ratemask, ssid, ssid_len, - ie, ie_len, directed); - if (skb) { - if (no_cck) - IEEE80211_SKB_CB(skb)->flags |= - IEEE80211_TX_CTL_NO_CCK_RATE; - ieee80211_tx_skb(sdata, skb); - } -} - -u32 ieee80211_sta_get_rates(struct ieee80211_local *local, - struct ieee802_11_elems *elems, - enum ieee80211_band band) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_rate *bitrates; - size_t num_rates; - u32 supp_rates; - int i, j; - sband = local->hw.wiphy->bands[band]; - - if (!sband) { - WARN_ON(1); - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - } - - bitrates = sband->bitrates; - num_rates = sband->n_bitrates; - supp_rates = 0; - for (i = 0; i < elems->supp_rates_len + - elems->ext_supp_rates_len; i++) { - u8 rate = 0; - int own_rate; - if (i < elems->supp_rates_len) - rate = elems->supp_rates[i]; - else if (elems->ext_supp_rates) - rate = elems->ext_supp_rates - [i - elems->supp_rates_len]; - own_rate = 5 * (rate & 0x7f); - for (j = 0; j < num_rates; j++) - if (bitrates[j].bitrate == own_rate) - supp_rates |= BIT(j); - } - return supp_rates; -} - -void ieee80211_stop_device(struct ieee80211_local *local) -{ - ieee80211_led_radio(local, false); - ieee80211_mod_tpt_led_trig(local, 0, IEEE80211_TPT_LEDTRIG_FL_RADIO); - - cancel_work_sync(&local->reconfig_filter); - - flush_workqueue(local->workqueue); - drv_stop(local); -} - -int ieee80211_reconfig(struct ieee80211_local *local) -{ - struct ieee80211_hw *hw = &local->hw; - struct ieee80211_sub_if_data *sdata; - struct sta_info *sta; - int res, i; - -#ifdef CONFIG_PM - if (local->suspended) - local->resuming = true; - - if (local->wowlan) { - local->wowlan = false; - res = drv_resume(local); - if (res < 0) { - local->resuming = false; - return res; - } - if (res == 0) - goto wake_up; - WARN_ON(res > 1); - /* - * res is 1, which means the driver requested - * to go through a regular reset on wakeup. - */ - } -#endif - /* everything else happens only if HW was up & running */ - if (!local->open_count) - goto wake_up; - - /* - * Upon resume hardware can sometimes be goofy due to - * various platform / driver / bus issues, so restarting - * the device may at times not work immediately. Propagate - * the error. - */ - res = drv_start(local); - if (res) { - WARN(local->suspended, "Hardware became unavailable " - "upon resume. This could be a software issue " - "prior to suspend or a hardware issue.\n"); - return res; - } - - /* setup fragmentation threshold */ - drv_set_frag_threshold(local, hw->wiphy->frag_threshold); - - /* setup RTS threshold */ - drv_set_rts_threshold(local, hw->wiphy->rts_threshold); - - /* reset coverage class */ - drv_set_coverage_class(local, hw->wiphy->coverage_class); - - ieee80211_led_radio(local, true); - ieee80211_mod_tpt_led_trig(local, - IEEE80211_TPT_LEDTRIG_FL_RADIO, 0); - - /* add interfaces */ - list_for_each_entry(sdata, &local->interfaces, list) { - if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN && - sdata->vif.type != NL80211_IFTYPE_MONITOR && - ieee80211_sdata_running(sdata)) - res = drv_add_interface(local, sdata); - } - - /* add STAs back */ - mutex_lock(&local->sta_mtx); - list_for_each_entry(sta, &local->sta_list, list) { - if (sta->uploaded) { - enum ieee80211_sta_state state; - - for (state = IEEE80211_STA_NOTEXIST; - state < sta->sta_state - 1; state++) - WARN_ON(drv_sta_state(local, sta->sdata, sta, - state, state + 1)); - } - } - mutex_unlock(&local->sta_mtx); - - /* reconfigure tx conf */ - list_for_each_entry(sdata, &local->interfaces, list) { - if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN || - sdata->vif.type == NL80211_IFTYPE_MONITOR || - !ieee80211_sdata_running(sdata)) - continue; - - for (i = 0; i < hw->queues; i++) - drv_conf_tx(local, sdata, i, &sdata->tx_conf[i]); - } - - /* reconfigure hardware */ - ieee80211_hw_config(local, ~0); - - ieee80211_configure_filter(local); - - /* Finally also reconfigure all the BSS information */ - list_for_each_entry(sdata, &local->interfaces, list) { - u32 changed; - - if (!ieee80211_sdata_running(sdata)) - continue; - - /* common change flags for all interface types */ - changed = BSS_CHANGED_ERP_CTS_PROT | - BSS_CHANGED_ERP_PREAMBLE | - BSS_CHANGED_ERP_SLOT | - BSS_CHANGED_HT | - BSS_CHANGED_BASIC_RATES | - BSS_CHANGED_BEACON_INT | - BSS_CHANGED_BSSID | - BSS_CHANGED_CQM | - BSS_CHANGED_QOS | - BSS_CHANGED_IDLE; - - switch (sdata->vif.type) { - case NL80211_IFTYPE_STATION: - changed |= BSS_CHANGED_ASSOC | - BSS_CHANGED_ARP_FILTER; - mutex_lock(&sdata->u.mgd.mtx); - ieee80211_bss_info_change_notify(sdata, changed); - mutex_unlock(&sdata->u.mgd.mtx); - break; - case NL80211_IFTYPE_ADHOC: - changed |= BSS_CHANGED_IBSS; - /* fall through */ - case NL80211_IFTYPE_AP: - changed |= BSS_CHANGED_SSID; - - if (sdata->vif.type == NL80211_IFTYPE_AP) - changed |= BSS_CHANGED_AP_PROBE_RESP; - - /* fall through */ - case NL80211_IFTYPE_MESH_POINT: - changed |= BSS_CHANGED_BEACON | - BSS_CHANGED_BEACON_ENABLED; - ieee80211_bss_info_change_notify(sdata, changed); - break; - case NL80211_IFTYPE_WDS: - break; - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_MONITOR: - /* ignore virtual */ - break; - case NL80211_IFTYPE_UNSPECIFIED: - case NUM_NL80211_IFTYPES: - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_P2P_GO: - WARN_ON(1); - break; - } - } - - ieee80211_recalc_ps(local, -1); - - /* - * The sta might be in psm against the ap (e.g. because - * this was the state before a hw restart), so we - * explicitly send a null packet in order to make sure - * it'll sync against the ap (and get out of psm). - */ - if (!(local->hw.conf.flags & IEEE80211_CONF_PS)) { - list_for_each_entry(sdata, &local->interfaces, list) { - if (sdata->vif.type != NL80211_IFTYPE_STATION) - continue; - - ieee80211_send_nullfunc(local, sdata, 0); - } - } - - /* - * Clear the WLAN_STA_BLOCK_BA flag so new aggregation - * sessions can be established after a resume. - * - * Also tear down aggregation sessions since reconfiguring - * them in a hardware restart scenario is not easily done - * right now, and the hardware will have lost information - * about the sessions, but we and the AP still think they - * are active. This is really a workaround though. - */ - if (hw->flags & IEEE80211_HW_AMPDU_AGGREGATION) { - mutex_lock(&local->sta_mtx); - - list_for_each_entry(sta, &local->sta_list, list) { - ieee80211_sta_tear_down_BA_sessions(sta, true); - clear_sta_flag(sta, WLAN_STA_BLOCK_BA); - } - - mutex_unlock(&local->sta_mtx); - } - - /* add back keys */ - list_for_each_entry(sdata, &local->interfaces, list) - if (ieee80211_sdata_running(sdata)) - ieee80211_enable_keys(sdata); - - wake_up: - ieee80211_wake_queues_by_reason(hw, - IEEE80211_QUEUE_STOP_REASON_SUSPEND); - - /* - * If this is for hw restart things are still running. - * We may want to change that later, however. - */ - if (!local->suspended) - return 0; - -#ifdef CONFIG_PM - /* first set suspended false, then resuming */ - local->suspended = false; - mb(); - local->resuming = false; - - list_for_each_entry(sdata, &local->interfaces, list) { - switch(sdata->vif.type) { - case NL80211_IFTYPE_STATION: - ieee80211_sta_restart(sdata); - break; - case NL80211_IFTYPE_ADHOC: - ieee80211_ibss_restart(sdata); - break; - case NL80211_IFTYPE_MESH_POINT: - ieee80211_mesh_restart(sdata); - break; - default: - break; - } - } - - mod_timer(&local->sta_cleanup, jiffies + 1); - - mutex_lock(&local->sta_mtx); - list_for_each_entry(sta, &local->sta_list, list) - mesh_plink_restart(sta); - mutex_unlock(&local->sta_mtx); -#else - WARN_ON(1); -#endif - return 0; -} - -void ieee80211_resume_disconnect(struct ieee80211_vif *vif) -{ - struct ieee80211_sub_if_data *sdata; - struct ieee80211_local *local; - struct ieee80211_key *key; - - if (WARN_ON(!vif)) - return; - - sdata = vif_to_sdata(vif); - local = sdata->local; - - if (WARN_ON(!local->resuming)) - return; - - if (WARN_ON(vif->type != NL80211_IFTYPE_STATION)) - return; - - sdata->flags |= IEEE80211_SDATA_DISCONNECT_RESUME; - - mutex_lock(&local->key_mtx); - list_for_each_entry(key, &sdata->key_list, list) - key->flags |= KEY_FLAG_TAINTED; - mutex_unlock(&local->key_mtx); -} -EXPORT_SYMBOL_GPL(ieee80211_resume_disconnect); - -static int check_mgd_smps(struct ieee80211_if_managed *ifmgd, - enum ieee80211_smps_mode *smps_mode) -{ - if (ifmgd->associated) { - *smps_mode = ifmgd->ap_smps; - - if (*smps_mode == IEEE80211_SMPS_AUTOMATIC) { - if (ifmgd->powersave) - *smps_mode = IEEE80211_SMPS_DYNAMIC; - else - *smps_mode = IEEE80211_SMPS_OFF; - } - - return 1; - } - - return 0; -} - -/* must hold iflist_mtx */ -void ieee80211_recalc_smps(struct ieee80211_local *local) -{ - struct ieee80211_sub_if_data *sdata; - enum ieee80211_smps_mode smps_mode = IEEE80211_SMPS_OFF; - int count = 0; - - lockdep_assert_held(&local->iflist_mtx); - - /* - * This function could be improved to handle multiple - * interfaces better, but right now it makes any - * non-station interfaces force SM PS to be turned - * off. If there are multiple station interfaces it - * could also use the best possible mode, e.g. if - * one is in static and the other in dynamic then - * dynamic is ok. - */ - - list_for_each_entry(sdata, &local->interfaces, list) { - if (!ieee80211_sdata_running(sdata)) - continue; - if (sdata->vif.type != NL80211_IFTYPE_STATION) - goto set; - - count += check_mgd_smps(&sdata->u.mgd, &smps_mode); - - if (count > 1) { - smps_mode = IEEE80211_SMPS_OFF; - break; - } - } - - if (smps_mode == local->smps_mode) - return; - - set: - local->smps_mode = smps_mode; - /* changed flag is auto-detected for this */ - ieee80211_hw_config(local, 0); -} - -static bool ieee80211_id_in_list(const u8 *ids, int n_ids, u8 id) -{ - int i; - - for (i = 0; i < n_ids; i++) - if (ids[i] == id) - return true; - return false; -} - -/** - * ieee80211_ie_split - split an IE buffer according to ordering - * - * @ies: the IE buffer - * @ielen: the length of the IE buffer - * @ids: an array with element IDs that are allowed before - * the split - * @n_ids: the size of the element ID array - * @offset: offset where to start splitting in the buffer - * - * This function splits an IE buffer by updating the @offset - * variable to point to the location where the buffer should be - * split. - * - * It assumes that the given IE buffer is well-formed, this - * has to be guaranteed by the caller! - * - * It also assumes that the IEs in the buffer are ordered - * correctly, if not the result of using this function will not - * be ordered correctly either, i.e. it does no reordering. - * - * The function returns the offset where the next part of the - * buffer starts, which may be @ielen if the entire (remainder) - * of the buffer should be used. - */ -size_t ieee80211_ie_split(const u8 *ies, size_t ielen, - const u8 *ids, int n_ids, size_t offset) -{ - size_t pos = offset; - - while (pos < ielen && ieee80211_id_in_list(ids, n_ids, ies[pos])) - pos += 2 + ies[pos + 1]; - - return pos; -} - -size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset) -{ - size_t pos = offset; - - while (pos < ielen && ies[pos] != WLAN_EID_VENDOR_SPECIFIC) - pos += 2 + ies[pos + 1]; - - return pos; -} - -static void _ieee80211_enable_rssi_reports(struct ieee80211_sub_if_data *sdata, - int rssi_min_thold, - int rssi_max_thold) -{ - trace_api_enable_rssi_reports(sdata, rssi_min_thold, rssi_max_thold); - - if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_STATION)) - return; - - /* - * Scale up threshold values before storing it, as the RSSI averaging - * algorithm uses a scaled up value as well. Change this scaling - * factor if the RSSI averaging algorithm changes. - */ - sdata->u.mgd.rssi_min_thold = rssi_min_thold*16; - sdata->u.mgd.rssi_max_thold = rssi_max_thold*16; -} - -void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif, - int rssi_min_thold, - int rssi_max_thold) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - - WARN_ON(rssi_min_thold == rssi_max_thold || - rssi_min_thold > rssi_max_thold); - - _ieee80211_enable_rssi_reports(sdata, rssi_min_thold, - rssi_max_thold); -} -EXPORT_SYMBOL(ieee80211_enable_rssi_reports); - -void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - - _ieee80211_enable_rssi_reports(sdata, 0, 0); -} -EXPORT_SYMBOL(ieee80211_disable_rssi_reports); - -u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, - u16 cap) -{ - __le16 tmp; - - *pos++ = WLAN_EID_HT_CAPABILITY; - *pos++ = sizeof(struct ieee80211_ht_cap); - memset(pos, 0, sizeof(struct ieee80211_ht_cap)); - - /* capability flags */ - tmp = cpu_to_le16(cap); - memcpy(pos, &tmp, sizeof(u16)); - pos += sizeof(u16); - - /* AMPDU parameters */ - *pos++ = ht_cap->ampdu_factor | - (ht_cap->ampdu_density << - IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); - - /* MCS set */ - memcpy(pos, &ht_cap->mcs, sizeof(ht_cap->mcs)); - pos += sizeof(ht_cap->mcs); - - /* extended capabilities */ - pos += sizeof(__le16); - - /* BF capabilities */ - pos += sizeof(__le32); - - /* antenna selection */ - pos += sizeof(u8); - - return pos; -} - -u8 *ieee80211_ie_build_ht_info(u8 *pos, - struct ieee80211_sta_ht_cap *ht_cap, - struct ieee80211_channel *channel, - enum nl80211_channel_type channel_type) -{ - struct ieee80211_ht_info *ht_info; - /* Build HT Information */ - *pos++ = WLAN_EID_HT_INFORMATION; - *pos++ = sizeof(struct ieee80211_ht_info); - ht_info = (struct ieee80211_ht_info *)pos; - ht_info->control_chan = - ieee80211_frequency_to_channel(channel->center_freq); - switch (channel_type) { - case NL80211_CHAN_HT40MINUS: - ht_info->ht_param = IEEE80211_HT_PARAM_CHA_SEC_BELOW; - break; - case NL80211_CHAN_HT40PLUS: - ht_info->ht_param = IEEE80211_HT_PARAM_CHA_SEC_ABOVE; - break; - case NL80211_CHAN_HT20: - default: - ht_info->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; - break; - } - if (ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) - ht_info->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; - - /* - * Note: According to 802.11n-2009 9.13.3.1, HT Protection field and - * RIFS Mode are reserved in IBSS mode, therefore keep them at 0 - */ - ht_info->operation_mode = 0x0000; - ht_info->stbc_param = 0x0000; - - /* It seems that Basic MCS set and Supported MCS set - are identical for the first 10 bytes */ - memset(&ht_info->basic_set, 0, 16); - memcpy(&ht_info->basic_set, &ht_cap->mcs, 10); - - return pos + sizeof(struct ieee80211_ht_info); -} - -enum nl80211_channel_type -ieee80211_ht_info_to_channel_type(struct ieee80211_ht_info *ht_info) -{ - enum nl80211_channel_type channel_type; - - if (!ht_info) - return NL80211_CHAN_NO_HT; - - switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { - case IEEE80211_HT_PARAM_CHA_SEC_NONE: - channel_type = NL80211_CHAN_HT20; - break; - case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: - channel_type = NL80211_CHAN_HT40PLUS; - break; - case IEEE80211_HT_PARAM_CHA_SEC_BELOW: - channel_type = NL80211_CHAN_HT40MINUS; - break; - default: - channel_type = NL80211_CHAN_NO_HT; - } - - return channel_type; -} - -int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_local *local = sdata->local; - struct ieee80211_supported_band *sband; - int rate; - u8 i, rates, *pos; - - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - rates = sband->n_bitrates; - if (rates > 8) - rates = 8; - - if (skb_tailroom(skb) < rates + 2) - return -ENOMEM; - - pos = skb_put(skb, rates + 2); - *pos++ = WLAN_EID_SUPP_RATES; - *pos++ = rates; - for (i = 0; i < rates; i++) { - rate = sband->bitrates[i].bitrate; - *pos++ = (u8) (rate / 5); - } - - return 0; -} - -int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb) -{ - struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); - struct ieee80211_local *local = sdata->local; - struct ieee80211_supported_band *sband; - int rate; - u8 i, exrates, *pos; - - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; - exrates = sband->n_bitrates; - if (exrates > 8) - exrates -= 8; - else - exrates = 0; - - if (skb_tailroom(skb) < exrates + 2) - return -ENOMEM; - - if (exrates) { - pos = skb_put(skb, exrates + 2); - *pos++ = WLAN_EID_EXT_SUPP_RATES; - *pos++ = exrates; - for (i = 8; i < sband->n_bitrates; i++) { - rate = sband->bitrates[i].bitrate; - *pos++ = (u8) (rate / 5); - } - } - return 0; -} diff --git a/openairITS/mac/DOT11/net/mac80211/wep.c b/openairITS/mac/DOT11/net/mac80211/wep.c deleted file mode 100644 index 7aa31bbfaa3..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/wep.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Software WEP encryption implementation - * Copyright 2002, Jouni Malinen <jkmaline@cc.hut.fi> - * Copyright 2003, Instant802 Networks, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/netdevice.h> -#include <linux/types.h> -#include <linux/random.h> -#include <linux/compiler.h> -#include <linux/crc32.h> -#include <linux/crypto.h> -#include <linux/err.h> -#include <linux/mm.h> -#include <linux/scatterlist.h> -#include <linux/slab.h> -#include <asm/unaligned.h> - -#include <net/mac80211.h> -#include "ieee80211_i.h" -#include "wep.h" - - -int ieee80211_wep_init(struct ieee80211_local *local) -{ - /* start WEP IV from a random value */ - get_random_bytes(&local->wep_iv, WEP_IV_LEN); - - local->wep_tx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(local->wep_tx_tfm)) { - local->wep_rx_tfm = ERR_PTR(-EINVAL); - return PTR_ERR(local->wep_tx_tfm); - } - - local->wep_rx_tfm = crypto_alloc_cipher("arc4", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(local->wep_rx_tfm)) { - crypto_free_cipher(local->wep_tx_tfm); - local->wep_tx_tfm = ERR_PTR(-EINVAL); - return PTR_ERR(local->wep_rx_tfm); - } - - return 0; -} - -void ieee80211_wep_free(struct ieee80211_local *local) -{ - if (!IS_ERR(local->wep_tx_tfm)) - crypto_free_cipher(local->wep_tx_tfm); - if (!IS_ERR(local->wep_rx_tfm)) - crypto_free_cipher(local->wep_rx_tfm); -} - -static inline bool ieee80211_wep_weak_iv(u32 iv, int keylen) -{ - /* - * Fluhrer, Mantin, and Shamir have reported weaknesses in the - * key scheduling algorithm of RC4. At least IVs (KeyByte + 3, - * 0xff, N) can be used to speedup attacks, so avoid using them. - */ - if ((iv & 0xff00) == 0xff00) { - u8 B = (iv >> 16) & 0xff; - if (B >= 3 && B < 3 + keylen) - return true; - } - return false; -} - - -static void ieee80211_wep_get_iv(struct ieee80211_local *local, - int keylen, int keyidx, u8 *iv) -{ - local->wep_iv++; - if (ieee80211_wep_weak_iv(local->wep_iv, keylen)) - local->wep_iv += 0x0100; - - if (!iv) - return; - - *iv++ = (local->wep_iv >> 16) & 0xff; - *iv++ = (local->wep_iv >> 8) & 0xff; - *iv++ = local->wep_iv & 0xff; - *iv++ = keyidx << 6; -} - - -static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, - struct sk_buff *skb, - int keylen, int keyidx) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - unsigned int hdrlen; - u8 *newhdr; - - hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); - - if (WARN_ON(skb_tailroom(skb) < WEP_ICV_LEN || - skb_headroom(skb) < WEP_IV_LEN)) - return NULL; - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - newhdr = skb_push(skb, WEP_IV_LEN); - memmove(newhdr, newhdr + WEP_IV_LEN, hdrlen); - ieee80211_wep_get_iv(local, keylen, keyidx, newhdr + hdrlen); - return newhdr + hdrlen; -} - - -static void ieee80211_wep_remove_iv(struct ieee80211_local *local, - struct sk_buff *skb, - struct ieee80211_key *key) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - unsigned int hdrlen; - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - memmove(skb->data + WEP_IV_LEN, skb->data, hdrlen); - skb_pull(skb, WEP_IV_LEN); -} - - -/* Perform WEP encryption using given key. data buffer must have tailroom - * for 4-byte ICV. data_len must not include this ICV. Note: this function - * does _not_ add IV. data = RC4(data | CRC32(data)) */ -int ieee80211_wep_encrypt_data(struct crypto_cipher *tfm, u8 *rc4key, - size_t klen, u8 *data, size_t data_len) -{ - __le32 icv; - int i; - - if (IS_ERR(tfm)) - return -1; - - icv = cpu_to_le32(~crc32_le(~0, data, data_len)); - put_unaligned(icv, (__le32 *)(data + data_len)); - - crypto_cipher_setkey(tfm, rc4key, klen); - for (i = 0; i < data_len + WEP_ICV_LEN; i++) - crypto_cipher_encrypt_one(tfm, data + i, data + i); - - return 0; -} - - -/* Perform WEP encryption on given skb. 4 bytes of extra space (IV) in the - * beginning of the buffer 4 bytes of extra space (ICV) in the end of the - * buffer will be added. Both IV and ICV will be transmitted, so the - * payload length increases with 8 bytes. - * - * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data)) - */ -int ieee80211_wep_encrypt(struct ieee80211_local *local, - struct sk_buff *skb, - const u8 *key, int keylen, int keyidx) -{ - u8 *iv; - size_t len; - u8 rc4key[3 + WLAN_KEY_LEN_WEP104]; - - iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); - if (!iv) - return -1; - - len = skb->len - (iv + WEP_IV_LEN - skb->data); - - /* Prepend 24-bit IV to RC4 key */ - memcpy(rc4key, iv, 3); - - /* Copy rest of the WEP key (the secret part) */ - memcpy(rc4key + 3, key, keylen); - - /* Add room for ICV */ - skb_put(skb, WEP_ICV_LEN); - - return ieee80211_wep_encrypt_data(local->wep_tx_tfm, rc4key, keylen + 3, - iv + WEP_IV_LEN, len); -} - - -/* Perform WEP decryption using given key. data buffer includes encrypted - * payload, including 4-byte ICV, but _not_ IV. data_len must not include ICV. - * Return 0 on success and -1 on ICV mismatch. */ -int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key, - size_t klen, u8 *data, size_t data_len) -{ - __le32 crc; - int i; - - if (IS_ERR(tfm)) - return -1; - - crypto_cipher_setkey(tfm, rc4key, klen); - for (i = 0; i < data_len + WEP_ICV_LEN; i++) - crypto_cipher_decrypt_one(tfm, data + i, data + i); - - crc = cpu_to_le32(~crc32_le(~0, data, data_len)); - if (memcmp(&crc, data + data_len, WEP_ICV_LEN) != 0) - /* ICV mismatch */ - return -1; - - return 0; -} - - -/* Perform WEP decryption on given skb. Buffer includes whole WEP part of - * the frame: IV (4 bytes), encrypted payload (including SNAP header), - * ICV (4 bytes). skb->len includes both IV and ICV. - * - * Returns 0 if frame was decrypted successfully and ICV was correct and -1 on - * failure. If frame is OK, IV and ICV will be removed, i.e., decrypted payload - * is moved to the beginning of the skb and skb length will be reduced. - */ -static int ieee80211_wep_decrypt(struct ieee80211_local *local, - struct sk_buff *skb, - struct ieee80211_key *key) -{ - u32 klen; - u8 rc4key[3 + WLAN_KEY_LEN_WEP104]; - u8 keyidx; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - unsigned int hdrlen; - size_t len; - int ret = 0; - - if (!ieee80211_has_protected(hdr->frame_control)) - return -1; - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - if (skb->len < hdrlen + WEP_IV_LEN + WEP_ICV_LEN) - return -1; - - len = skb->len - hdrlen - WEP_IV_LEN - WEP_ICV_LEN; - - keyidx = skb->data[hdrlen + 3] >> 6; - - if (!key || keyidx != key->conf.keyidx) - return -1; - - klen = 3 + key->conf.keylen; - - /* Prepend 24-bit IV to RC4 key */ - memcpy(rc4key, skb->data + hdrlen, 3); - - /* Copy rest of the WEP key (the secret part) */ - memcpy(rc4key + 3, key->conf.key, key->conf.keylen); - - if (ieee80211_wep_decrypt_data(local->wep_rx_tfm, rc4key, klen, - skb->data + hdrlen + WEP_IV_LEN, - len)) - ret = -1; - - /* Trim ICV */ - skb_trim(skb, skb->len - WEP_ICV_LEN); - - /* Remove IV */ - memmove(skb->data + WEP_IV_LEN, skb->data, hdrlen); - skb_pull(skb, WEP_IV_LEN); - - return ret; -} - - -static bool ieee80211_wep_is_weak_iv(struct sk_buff *skb, - struct ieee80211_key *key) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - unsigned int hdrlen; - u8 *ivpos; - u32 iv; - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - ivpos = skb->data + hdrlen; - iv = (ivpos[0] << 16) | (ivpos[1] << 8) | ivpos[2]; - - return ieee80211_wep_weak_iv(iv, key->conf.keylen); -} - -ieee80211_rx_result -ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx) -{ - struct sk_buff *skb = rx->skb; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - __le16 fc = hdr->frame_control; - - if (!ieee80211_is_data(fc) && !ieee80211_is_auth(fc)) - return RX_CONTINUE; - - if (!(status->flag & RX_FLAG_DECRYPTED)) { - if (skb_linearize(rx->skb)) - return RX_DROP_UNUSABLE; - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key)) - rx->sta->wep_weak_iv_count++; - if (ieee80211_wep_decrypt(rx->local, rx->skb, rx->key)) - return RX_DROP_UNUSABLE; - } else if (!(status->flag & RX_FLAG_IV_STRIPPED)) { - if (!pskb_may_pull(rx->skb, ieee80211_hdrlen(fc) + WEP_IV_LEN)) - return RX_DROP_UNUSABLE; - if (rx->sta && ieee80211_wep_is_weak_iv(rx->skb, rx->key)) - rx->sta->wep_weak_iv_count++; - ieee80211_wep_remove_iv(rx->local, rx->skb, rx->key); - /* remove ICV */ - if (pskb_trim(rx->skb, rx->skb->len - WEP_ICV_LEN)) - return RX_DROP_UNUSABLE; - } - - return RX_CONTINUE; -} - -static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) -{ - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - - if (!info->control.hw_key) { - if (ieee80211_wep_encrypt(tx->local, skb, tx->key->conf.key, - tx->key->conf.keylen, - tx->key->conf.keyidx)) - return -1; - } else if (info->control.hw_key->flags & - IEEE80211_KEY_FLAG_GENERATE_IV) { - if (!ieee80211_wep_add_iv(tx->local, skb, - tx->key->conf.keylen, - tx->key->conf.keyidx)) - return -1; - } - - return 0; -} - -ieee80211_tx_result -ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx) -{ - struct sk_buff *skb; - - ieee80211_tx_set_protected(tx); - - skb_queue_walk(&tx->skbs, skb) { - if (wep_encrypt_skb(tx, skb) < 0) { - I802_DEBUG_INC(tx->local->tx_handlers_drop_wep); - return TX_DROP; - } - } - - return TX_CONTINUE; -} diff --git a/openairITS/mac/DOT11/net/mac80211/wep.h b/openairITS/mac/DOT11/net/mac80211/wep.h deleted file mode 100644 index 9615749d1f6..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/wep.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Software WEP encryption implementation - * Copyright 2002, Jouni Malinen <jkmaline@cc.hut.fi> - * Copyright 2003, Instant802 Networks, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef WEP_H -#define WEP_H - -#include <linux/skbuff.h> -#include <linux/types.h> -#include "ieee80211_i.h" -#include "key.h" - -int ieee80211_wep_init(struct ieee80211_local *local); -void ieee80211_wep_free(struct ieee80211_local *local); -int ieee80211_wep_encrypt_data(struct crypto_cipher *tfm, u8 *rc4key, - size_t klen, u8 *data, size_t data_len); -int ieee80211_wep_encrypt(struct ieee80211_local *local, - struct sk_buff *skb, - const u8 *key, int keylen, int keyidx); -int ieee80211_wep_decrypt_data(struct crypto_cipher *tfm, u8 *rc4key, - size_t klen, u8 *data, size_t data_len); - -ieee80211_rx_result -ieee80211_crypto_wep_decrypt(struct ieee80211_rx_data *rx); -ieee80211_tx_result -ieee80211_crypto_wep_encrypt(struct ieee80211_tx_data *tx); - -#endif /* WEP_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/wme.c b/openairITS/mac/DOT11/net/mac80211/wme.c deleted file mode 100644 index 3ba8b19fda5..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/wme.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright 2004, Instant802 Networks, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/netdevice.h> -#include <linux/skbuff.h> -#include <linux/module.h> -#include <linux/if_arp.h> -#include <linux/types.h> -#include <net/ip.h> -#include <net/pkt_sched.h> - -#include <net/mac80211.h> -#include "ieee80211_i.h" -#include "wme.h" - -/* Default mapping in classifier to work with default - * queue setup. - */ -const int ieee802_1d_to_ac[8] = { - IEEE80211_AC_BE, - IEEE80211_AC_BK, - IEEE80211_AC_BK, - IEEE80211_AC_BE, - IEEE80211_AC_VI, - IEEE80211_AC_VI, - IEEE80211_AC_VO, - IEEE80211_AC_VO -}; - -static int wme_downgrade_ac(struct sk_buff *skb) -{ - switch (skb->priority) { - case 6: - case 7: - skb->priority = 5; /* VO -> VI */ - return 0; - case 4: - case 5: - skb->priority = 3; /* VI -> BE */ - return 0; - case 0: - case 3: - skb->priority = 2; /* BE -> BK */ - return 0; - default: - return -1; - } -} - -/* Indicate which queue to use for this fully formed 802.11 frame */ -u16 ieee80211_select_queue_80211(struct ieee80211_local *local, - struct sk_buff *skb, - struct ieee80211_hdr *hdr) -{ - u8 *p; - - if (local->hw.queues < 4) - return 0; - - if (!ieee80211_is_data(hdr->frame_control)) { - skb->priority = 7; - return ieee802_1d_to_ac[skb->priority]; - } - if (!ieee80211_is_data_qos(hdr->frame_control)) { - skb->priority = 0; - return ieee802_1d_to_ac[skb->priority]; - } - - p = ieee80211_get_qos_ctl(hdr); - skb->priority = *p & IEEE80211_QOS_CTL_TAG1D_MASK; - - return ieee80211_downgrade_queue(local, skb); -} - -/* Indicate which queue to use. */ -u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb) -{ - struct ieee80211_local *local = sdata->local; - struct sta_info *sta = NULL; - const u8 *ra = NULL; - bool qos = false; - - if (local->hw.queues < 4 || skb->len < 6) { - skb->priority = 0; /* required for correct WPA/11i MIC */ - return min_t(u16, local->hw.queues - 1, IEEE80211_AC_BE); - } - - rcu_read_lock(); - switch (sdata->vif.type) { - case NL80211_IFTYPE_AP_VLAN: - sta = rcu_dereference(sdata->u.vlan.sta); - if (sta) { - qos = test_sta_flag(sta, WLAN_STA_WME); - break; - } - case NL80211_IFTYPE_AP: - ra = skb->data; - break; - case NL80211_IFTYPE_WDS: - ra = sdata->u.wds.remote_addr; - break; -#ifdef CONFIG_MAC80211_MESH - case NL80211_IFTYPE_MESH_POINT: - qos = true; - break; -#endif - case NL80211_IFTYPE_STATION: - ra = sdata->u.mgd.bssid; - break; - case NL80211_IFTYPE_ADHOC: - ra = skb->data; - break; - default: - break; - } - - if (!sta && ra && !is_multicast_ether_addr(ra)) { - sta = sta_info_get(sdata, ra); - if (sta) - qos = test_sta_flag(sta, WLAN_STA_WME); - } - rcu_read_unlock(); - - if (!qos) { - skb->priority = 0; /* required for correct WPA/11i MIC */ - return IEEE80211_AC_BE; - } - - /* use the data classifier to determine what 802.1d tag the - * data frame has */ - skb->priority = cfg80211_classify8021d(skb); - - return ieee80211_downgrade_queue(local, skb); -} - -u16 ieee80211_downgrade_queue(struct ieee80211_local *local, - struct sk_buff *skb) -{ - /* in case we are a client verify acm is not set for this ac */ - while (unlikely(local->wmm_acm & BIT(skb->priority))) { - if (wme_downgrade_ac(skb)) { - /* - * This should not really happen. The AP has marked all - * lower ACs to require admission control which is not - * a reasonable configuration. Allow the frame to be - * transmitted using AC_BK as a workaround. - */ - break; - } - } - - /* look up which queue to use for frames with this 1d tag */ - return ieee802_1d_to_ac[skb->priority]; -} - -void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (void *)skb->data; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - -#ifdef CONFIG_MAC80211_VERBOSE_DEBUG - printk(KERN_DEBUG "-- -- ieee80211_set_qos_hdr \n"); -#endif - - /* Fill in the QoS header if there is one. */ - if (ieee80211_is_data_qos(hdr->frame_control)) { - u8 *p = ieee80211_get_qos_ctl(hdr); - u8 ack_policy, tid; - - tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; - - /* preserve EOSP bit */ - ack_policy = *p & IEEE80211_QOS_CTL_EOSP; - - if (is_multicast_ether_addr(hdr->addr1) || - sdata->noack_map & BIT(tid)) { - ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK; - info->flags |= IEEE80211_TX_CTL_NO_ACK; - } - - /* qos header is 2 bytes */ - *p++ = ack_policy | tid; - *p = ieee80211_vif_is_mesh(&sdata->vif) ? - (IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT >> 8) : 0; - } -} diff --git a/openairITS/mac/DOT11/net/mac80211/wme.h b/openairITS/mac/DOT11/net/mac80211/wme.h deleted file mode 100644 index 94edceb617f..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/wme.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2004, Instant802 Networks, Inc. - * Copyright 2005, Devicescape Software, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef _WME_H -#define _WME_H - -#include <linux/netdevice.h> -#include "ieee80211_i.h" - -extern const int ieee802_1d_to_ac[8]; - -u16 ieee80211_select_queue_80211(struct ieee80211_local *local, - struct sk_buff *skb, - struct ieee80211_hdr *hdr); -u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb); -void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, - struct sk_buff *skb); -u16 ieee80211_downgrade_queue(struct ieee80211_local *local, - struct sk_buff *skb); - - -#endif /* _WME_H */ diff --git a/openairITS/mac/DOT11/net/mac80211/work.c b/openairITS/mac/DOT11/net/mac80211/work.c deleted file mode 100644 index c6e230efa04..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/work.c +++ /dev/null @@ -1,373 +0,0 @@ -/* - * mac80211 work implementation - * - * Copyright 2003-2008, Jouni Malinen <j@w1.fi> - * Copyright 2004, Instant802 Networks, Inc. - * Copyright 2005, Devicescape Software, Inc. - * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> - * Copyright 2007, Michael Wu <flamingice@sourmilk.net> - * Copyright 2009, Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/delay.h> -#include <linux/if_ether.h> -#include <linux/skbuff.h> -#include <linux/if_arp.h> -#include <linux/etherdevice.h> -#include <linux/crc32.h> -#include <linux/slab.h> -#include <net/mac80211.h> -#include <asm/unaligned.h> - -#include "ieee80211_i.h" -#include "rate.h" -#include "driver-ops.h" - -enum work_action { - WORK_ACT_NONE, - WORK_ACT_TIMEOUT, -}; - - -/* utils */ -static inline void ASSERT_WORK_MTX(struct ieee80211_local *local) -{ - lockdep_assert_held(&local->mtx); -} - -/* - * We can have multiple work items (and connection probing) - * scheduling this timer, but we need to take care to only - * reschedule it when it should fire _earlier_ than it was - * asked for before, or if it's not pending right now. This - * function ensures that. Note that it then is required to - * run this function for all timeouts after the first one - * has happened -- the work that runs from this timer will - * do that. - */ -static void run_again(struct ieee80211_local *local, - unsigned long timeout) -{ - ASSERT_WORK_MTX(local); - - if (!timer_pending(&local->work_timer) || - time_before(timeout, local->work_timer.expires)) - mod_timer(&local->work_timer, timeout); -} - -void free_work(struct ieee80211_work *wk) -{ - kfree_rcu(wk, rcu_head); -} - -static enum work_action __must_check -ieee80211_remain_on_channel_timeout(struct ieee80211_work *wk) -{ - /* - * First time we run, do nothing -- the generic code will - * have switched to the right channel etc. - */ - if (!wk->started) { - wk->timeout = jiffies + msecs_to_jiffies(wk->remain.duration); - - cfg80211_ready_on_channel(wk->sdata->dev, (unsigned long) wk, - wk->chan, wk->chan_type, - wk->remain.duration, GFP_KERNEL); - - return WORK_ACT_NONE; - } - - return WORK_ACT_TIMEOUT; -} - -static enum work_action __must_check -ieee80211_offchannel_tx(struct ieee80211_work *wk) -{ - if (!wk->started) { - wk->timeout = jiffies + msecs_to_jiffies(wk->offchan_tx.wait); - - /* - * After this, offchan_tx.frame remains but now is no - * longer a valid pointer -- we still need it as the - * cookie for canceling this work/status matching. - */ - ieee80211_tx_skb(wk->sdata, wk->offchan_tx.frame); - - return WORK_ACT_NONE; - } - - return WORK_ACT_TIMEOUT; -} - -static void ieee80211_work_timer(unsigned long data) -{ - struct ieee80211_local *local = (void *) data; - - if (local->quiescing) - return; - - ieee80211_queue_work(&local->hw, &local->work_work); -} - -static void ieee80211_work_work(struct work_struct *work) -{ - struct ieee80211_local *local = - container_of(work, struct ieee80211_local, work_work); - struct ieee80211_work *wk, *tmp; - LIST_HEAD(free_work); - enum work_action rma; - bool remain_off_channel = false; - - if (local->scanning) - return; - - /* - * ieee80211_queue_work() should have picked up most cases, - * here we'll pick the rest. - */ - if (WARN(local->suspended, "work scheduled while going to suspend\n")) - return; - - mutex_lock(&local->mtx); - - ieee80211_recalc_idle(local); - - list_for_each_entry_safe(wk, tmp, &local->work_list, list) { - bool started = wk->started; - - /* mark work as started if it's on the current off-channel */ - if (!started && local->tmp_channel && - wk->chan == local->tmp_channel && - wk->chan_type == local->tmp_channel_type) { - started = true; - wk->timeout = jiffies; - } - - if (!started && !local->tmp_channel) { - ieee80211_offchannel_stop_vifs(local, true); - - local->tmp_channel = wk->chan; - local->tmp_channel_type = wk->chan_type; - - ieee80211_hw_config(local, 0); - - started = true; - wk->timeout = jiffies; - } - - /* don't try to work with items that aren't started */ - if (!started) - continue; - - if (time_is_after_jiffies(wk->timeout)) { - /* - * This work item isn't supposed to be worked on - * right now, but take care to adjust the timer - * properly. - */ - run_again(local, wk->timeout); - continue; - } - - switch (wk->type) { - default: - WARN_ON(1); - /* nothing */ - rma = WORK_ACT_NONE; - break; - case IEEE80211_WORK_ABORT: - rma = WORK_ACT_TIMEOUT; - break; - case IEEE80211_WORK_REMAIN_ON_CHANNEL: - rma = ieee80211_remain_on_channel_timeout(wk); - break; - case IEEE80211_WORK_OFFCHANNEL_TX: - rma = ieee80211_offchannel_tx(wk); - break; - } - - wk->started = started; - - switch (rma) { - case WORK_ACT_NONE: - /* might have changed the timeout */ - run_again(local, wk->timeout); - break; - case WORK_ACT_TIMEOUT: - list_del_rcu(&wk->list); - synchronize_rcu(); - list_add(&wk->list, &free_work); - break; - default: - WARN(1, "unexpected: %d", rma); - } - } - - list_for_each_entry(wk, &local->work_list, list) { - if (!wk->started) - continue; - if (wk->chan != local->tmp_channel || - wk->chan_type != local->tmp_channel_type) - continue; - remain_off_channel = true; - } - - if (!remain_off_channel && local->tmp_channel) { - local->tmp_channel = NULL; - ieee80211_hw_config(local, 0); - - ieee80211_offchannel_return(local, true); - - /* give connection some time to breathe */ - run_again(local, jiffies + HZ/2); - } - - if (list_empty(&local->work_list) && local->scan_req && - !local->scanning) - ieee80211_queue_delayed_work(&local->hw, - &local->scan_work, - round_jiffies_relative(0)); - - ieee80211_recalc_idle(local); - - mutex_unlock(&local->mtx); - - list_for_each_entry_safe(wk, tmp, &free_work, list) { - wk->done(wk, NULL); - list_del(&wk->list); - kfree(wk); - } -} - -void ieee80211_add_work(struct ieee80211_work *wk) -{ - struct ieee80211_local *local; - - if (WARN_ON(!wk->chan)) - return; - - if (WARN_ON(!wk->sdata)) - return; - - if (WARN_ON(!wk->done)) - return; - - if (WARN_ON(!ieee80211_sdata_running(wk->sdata))) - return; - - wk->started = false; - - local = wk->sdata->local; - mutex_lock(&local->mtx); - list_add_tail(&wk->list, &local->work_list); - mutex_unlock(&local->mtx); - - ieee80211_queue_work(&local->hw, &local->work_work); -} - -void ieee80211_work_init(struct ieee80211_local *local) -{ - INIT_LIST_HEAD(&local->work_list); - setup_timer(&local->work_timer, ieee80211_work_timer, - (unsigned long)local); - INIT_WORK(&local->work_work, ieee80211_work_work); -} - -void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_work *wk; - bool cleanup = false; - - mutex_lock(&local->mtx); - list_for_each_entry(wk, &local->work_list, list) { - if (wk->sdata != sdata) - continue; - cleanup = true; - wk->type = IEEE80211_WORK_ABORT; - wk->started = true; - wk->timeout = jiffies; - } - mutex_unlock(&local->mtx); - - /* run cleanups etc. */ - if (cleanup) - ieee80211_work_work(&local->work_work); - - mutex_lock(&local->mtx); - list_for_each_entry(wk, &local->work_list, list) { - if (wk->sdata != sdata) - continue; - WARN_ON(1); - break; - } - mutex_unlock(&local->mtx); -} - -static enum work_done_result ieee80211_remain_done(struct ieee80211_work *wk, - struct sk_buff *skb) -{ - /* - * We are done serving the remain-on-channel command. - */ - cfg80211_remain_on_channel_expired(wk->sdata->dev, (unsigned long) wk, - wk->chan, wk->chan_type, - GFP_KERNEL); - - return WORK_DONE_DESTROY; -} - -int ieee80211_wk_remain_on_channel(struct ieee80211_sub_if_data *sdata, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, u64 *cookie) -{ - struct ieee80211_work *wk; - - wk = kzalloc(sizeof(*wk), GFP_KERNEL); - if (!wk) - return -ENOMEM; - - wk->type = IEEE80211_WORK_REMAIN_ON_CHANNEL; - wk->chan = chan; - wk->chan_type = channel_type; - wk->sdata = sdata; - wk->done = ieee80211_remain_done; - - wk->remain.duration = duration; - - *cookie = (unsigned long) wk; - - ieee80211_add_work(wk); - - return 0; -} - -int ieee80211_wk_cancel_remain_on_channel(struct ieee80211_sub_if_data *sdata, - u64 cookie) -{ - struct ieee80211_local *local = sdata->local; - struct ieee80211_work *wk, *tmp; - bool found = false; - - mutex_lock(&local->mtx); - list_for_each_entry_safe(wk, tmp, &local->work_list, list) { - if ((unsigned long) wk == cookie) { - wk->timeout = jiffies; - found = true; - break; - } - } - mutex_unlock(&local->mtx); - - if (!found) - return -ENOENT; - - ieee80211_queue_work(&local->hw, &local->work_work); - - return 0; -} diff --git a/openairITS/mac/DOT11/net/mac80211/wpa.c b/openairITS/mac/DOT11/net/mac80211/wpa.c deleted file mode 100644 index 0ae23c60968..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/wpa.c +++ /dev/null @@ -1,684 +0,0 @@ -/* - * Copyright 2002-2004, Instant802 Networks, Inc. - * Copyright 2008, Jouni Malinen <j@w1.fi> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/netdevice.h> -#include <linux/types.h> -#include <linux/skbuff.h> -#include <linux/compiler.h> -#include <linux/ieee80211.h> -#include <linux/gfp.h> -#include <asm/unaligned.h> -#include <net/mac80211.h> -#include <crypto/aes.h> - -#include "ieee80211_i.h" -#include "michael.h" -#include "tkip.h" -#include "aes_ccm.h" -#include "aes_cmac.h" -#include "wpa.h" - -ieee80211_tx_result -ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx) -{ - u8 *data, *key, *mic; - size_t data_len; - unsigned int hdrlen; - struct ieee80211_hdr *hdr; - struct sk_buff *skb = tx->skb; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - int tail; - - hdr = (struct ieee80211_hdr *)skb->data; - if (!tx->key || tx->key->conf.cipher != WLAN_CIPHER_SUITE_TKIP || - skb->len < 24 || !ieee80211_is_data_present(hdr->frame_control)) - return TX_CONTINUE; - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - if (skb->len < hdrlen) - return TX_DROP; - - data = skb->data + hdrlen; - data_len = skb->len - hdrlen; - - if (unlikely(info->flags & IEEE80211_TX_INTFL_TKIP_MIC_FAILURE)) { - /* Need to use software crypto for the test */ - info->control.hw_key = NULL; - } - - if (info->control.hw_key && - (info->flags & IEEE80211_TX_CTL_DONTFRAG || - tx->local->ops->set_frag_threshold) && - !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) { - /* hwaccel - with no need for SW-generated MMIC */ - return TX_CONTINUE; - } - - tail = MICHAEL_MIC_LEN; - if (!info->control.hw_key) - tail += TKIP_ICV_LEN; - - if (WARN_ON(skb_tailroom(skb) < tail || - skb_headroom(skb) < TKIP_IV_LEN)) - return TX_DROP; - - key = &tx->key->conf.key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY]; - mic = skb_put(skb, MICHAEL_MIC_LEN); - michael_mic(key, hdr, data, data_len, mic); - if (unlikely(info->flags & IEEE80211_TX_INTFL_TKIP_MIC_FAILURE)) - mic[0]++; - - return TX_CONTINUE; -} - - -ieee80211_rx_result -ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx) -{ - u8 *data, *key = NULL; - size_t data_len; - unsigned int hdrlen; - u8 mic[MICHAEL_MIC_LEN]; - struct sk_buff *skb = rx->skb; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - - /* - * it makes no sense to check for MIC errors on anything other - * than data frames. - */ - if (!ieee80211_is_data_present(hdr->frame_control)) - return RX_CONTINUE; - - /* - * No way to verify the MIC if the hardware stripped it or - * the IV with the key index. In this case we have solely rely - * on the driver to set RX_FLAG_MMIC_ERROR in the event of a - * MIC failure report. - */ - if (status->flag & (RX_FLAG_MMIC_STRIPPED | RX_FLAG_IV_STRIPPED)) { - if (status->flag & RX_FLAG_MMIC_ERROR) - goto mic_fail; - - if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key) - goto update_iv; - - return RX_CONTINUE; - } - - /* - * Some hardware seems to generate Michael MIC failure reports; even - * though, the frame was not encrypted with TKIP and therefore has no - * MIC. Ignore the flag them to avoid triggering countermeasures. - */ - if (!rx->key || rx->key->conf.cipher != WLAN_CIPHER_SUITE_TKIP || - !(status->flag & RX_FLAG_DECRYPTED)) - return RX_CONTINUE; - - if (rx->sdata->vif.type == NL80211_IFTYPE_AP && rx->key->conf.keyidx) { - /* - * APs with pairwise keys should never receive Michael MIC - * errors for non-zero keyidx because these are reserved for - * group keys and only the AP is sending real multicast - * frames in the BSS. ( - */ - return RX_DROP_UNUSABLE; - } - - if (status->flag & RX_FLAG_MMIC_ERROR) - goto mic_fail; - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - if (skb->len < hdrlen + MICHAEL_MIC_LEN) - return RX_DROP_UNUSABLE; - - if (skb_linearize(rx->skb)) - return RX_DROP_UNUSABLE; - hdr = (void *)skb->data; - - data = skb->data + hdrlen; - data_len = skb->len - hdrlen - MICHAEL_MIC_LEN; - key = &rx->key->conf.key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY]; - michael_mic(key, hdr, data, data_len, mic); - if (memcmp(mic, data + data_len, MICHAEL_MIC_LEN) != 0) - goto mic_fail; - - /* remove Michael MIC from payload */ - skb_trim(skb, skb->len - MICHAEL_MIC_LEN); - -update_iv: - /* update IV in key information to be able to detect replays */ - rx->key->u.tkip.rx[rx->security_idx].iv32 = rx->tkip_iv32; - rx->key->u.tkip.rx[rx->security_idx].iv16 = rx->tkip_iv16; - - return RX_CONTINUE; - -mic_fail: - /* - * In some cases the key can be unset - e.g. a multicast packet, in - * a driver that supports HW encryption. Send up the key idx only if - * the key is set. - */ - mac80211_ev_michael_mic_failure(rx->sdata, - rx->key ? rx->key->conf.keyidx : -1, - (void *) skb->data, NULL, GFP_ATOMIC); - return RX_DROP_UNUSABLE; -} - - -static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_key *key = tx->key; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - unsigned long flags; - unsigned int hdrlen; - int len, tail; - u8 *pos; - - if (info->control.hw_key && - !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV)) { - /* hwaccel - with no need for software-generated IV */ - return 0; - } - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - len = skb->len - hdrlen; - - if (info->control.hw_key) - tail = 0; - else - tail = TKIP_ICV_LEN; - - if (WARN_ON(skb_tailroom(skb) < tail || - skb_headroom(skb) < TKIP_IV_LEN)) - return -1; - - pos = skb_push(skb, TKIP_IV_LEN); - memmove(pos, pos + TKIP_IV_LEN, hdrlen); - pos += hdrlen; - - /* Increase IV for the frame */ - spin_lock_irqsave(&key->u.tkip.txlock, flags); - key->u.tkip.tx.iv16++; - if (key->u.tkip.tx.iv16 == 0) - key->u.tkip.tx.iv32++; - pos = ieee80211_tkip_add_iv(pos, key); - spin_unlock_irqrestore(&key->u.tkip.txlock, flags); - - /* hwaccel - with software IV */ - if (info->control.hw_key) - return 0; - - /* Add room for ICV */ - skb_put(skb, TKIP_ICV_LEN); - - return ieee80211_tkip_encrypt_data(tx->local->wep_tx_tfm, - key, skb, pos, len); -} - - -ieee80211_tx_result -ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx) -{ - struct sk_buff *skb; - - ieee80211_tx_set_protected(tx); - - skb_queue_walk(&tx->skbs, skb) { - if (tkip_encrypt_skb(tx, skb) < 0) - return TX_DROP; - } - - return TX_CONTINUE; -} - - -ieee80211_rx_result -ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data; - int hdrlen, res, hwaccel = 0; - struct ieee80211_key *key = rx->key; - struct sk_buff *skb = rx->skb; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - - if (!ieee80211_is_data(hdr->frame_control)) - return RX_CONTINUE; - - if (!rx->sta || skb->len - hdrlen < 12) - return RX_DROP_UNUSABLE; - - /* it may be possible to optimize this a bit more */ - if (skb_linearize(rx->skb)) - return RX_DROP_UNUSABLE; - hdr = (void *)skb->data; - - /* - * Let TKIP code verify IV, but skip decryption. - * In the case where hardware checks the IV as well, - * we don't even get here, see ieee80211_rx_h_decrypt() - */ - if (status->flag & RX_FLAG_DECRYPTED) - hwaccel = 1; - - res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm, - key, skb->data + hdrlen, - skb->len - hdrlen, rx->sta->sta.addr, - hdr->addr1, hwaccel, rx->security_idx, - &rx->tkip_iv32, - &rx->tkip_iv16); - if (res != TKIP_DECRYPT_OK) - return RX_DROP_UNUSABLE; - - /* Trim ICV */ - skb_trim(skb, skb->len - TKIP_ICV_LEN); - - /* Remove IV */ - memmove(skb->data + TKIP_IV_LEN, skb->data, hdrlen); - skb_pull(skb, TKIP_IV_LEN); - - return RX_CONTINUE; -} - - -static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch, - int encrypted) -{ - __le16 mask_fc; - int a4_included, mgmt; - u8 qos_tid; - u8 *b_0, *aad; - u16 data_len, len_a; - unsigned int hdrlen; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; - - memset(scratch, 0, 6 * AES_BLOCK_SIZE); - - b_0 = scratch + 3 * AES_BLOCK_SIZE; - aad = scratch + 4 * AES_BLOCK_SIZE; - - /* - * Mask FC: zero subtype b4 b5 b6 (if not mgmt) - * Retry, PwrMgt, MoreData; set Protected - */ - mgmt = ieee80211_is_mgmt(hdr->frame_control); - mask_fc = hdr->frame_control; - mask_fc &= ~cpu_to_le16(IEEE80211_FCTL_RETRY | - IEEE80211_FCTL_PM | IEEE80211_FCTL_MOREDATA); - if (!mgmt) - mask_fc &= ~cpu_to_le16(0x0070); - mask_fc |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - len_a = hdrlen - 2; - a4_included = ieee80211_has_a4(hdr->frame_control); - - if (ieee80211_is_data_qos(hdr->frame_control)) - qos_tid = *ieee80211_get_qos_ctl(hdr) & IEEE80211_QOS_CTL_TID_MASK; - else - qos_tid = 0; - - data_len = skb->len - hdrlen - CCMP_HDR_LEN; - if (encrypted) - data_len -= CCMP_MIC_LEN; - - /* First block, b_0 */ - b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */ - /* Nonce: Nonce Flags | A2 | PN - * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7) - */ - b_0[1] = qos_tid | (mgmt << 4); - memcpy(&b_0[2], hdr->addr2, ETH_ALEN); - memcpy(&b_0[8], pn, CCMP_PN_LEN); - /* l(m) */ - put_unaligned_be16(data_len, &b_0[14]); - - /* AAD (extra authenticate-only data) / masked 802.11 header - * FC | A1 | A2 | A3 | SC | [A4] | [QC] */ - put_unaligned_be16(len_a, &aad[0]); - put_unaligned(mask_fc, (__le16 *)&aad[2]); - memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN); - - /* Mask Seq#, leave Frag# */ - aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f; - aad[23] = 0; - - if (a4_included) { - memcpy(&aad[24], hdr->addr4, ETH_ALEN); - aad[30] = qos_tid; - aad[31] = 0; - } else { - memset(&aad[24], 0, ETH_ALEN + IEEE80211_QOS_CTL_LEN); - aad[24] = qos_tid; - } -} - - -static inline void ccmp_pn2hdr(u8 *hdr, u8 *pn, int key_id) -{ - hdr[0] = pn[5]; - hdr[1] = pn[4]; - hdr[2] = 0; - hdr[3] = 0x20 | (key_id << 6); - hdr[4] = pn[3]; - hdr[5] = pn[2]; - hdr[6] = pn[1]; - hdr[7] = pn[0]; -} - - -static inline void ccmp_hdr2pn(u8 *pn, u8 *hdr) -{ - pn[0] = hdr[7]; - pn[1] = hdr[6]; - pn[2] = hdr[5]; - pn[3] = hdr[4]; - pn[4] = hdr[1]; - pn[5] = hdr[0]; -} - - -static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - struct ieee80211_key *key = tx->key; - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); - int hdrlen, len, tail; - u8 *pos; - u8 pn[6]; - u64 pn64; - u8 scratch[6 * AES_BLOCK_SIZE]; - - if (info->control.hw_key && - !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) && - !(info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) { - /* - * hwaccel has no need for preallocated room for CCMP - * header or MIC fields - */ - return 0; - } - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - len = skb->len - hdrlen; - - if (info->control.hw_key) - tail = 0; - else - tail = CCMP_MIC_LEN; - - if (WARN_ON(skb_tailroom(skb) < tail || - skb_headroom(skb) < CCMP_HDR_LEN)) - return -1; - - pos = skb_push(skb, CCMP_HDR_LEN); - memmove(pos, pos + CCMP_HDR_LEN, hdrlen); - - /* the HW only needs room for the IV, but not the actual IV */ - if (info->control.hw_key && - (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)) - return 0; - - hdr = (struct ieee80211_hdr *) pos; - pos += hdrlen; - - pn64 = atomic64_inc_return(&key->u.ccmp.tx_pn); - - pn[5] = pn64; - pn[4] = pn64 >> 8; - pn[3] = pn64 >> 16; - pn[2] = pn64 >> 24; - pn[1] = pn64 >> 32; - pn[0] = pn64 >> 40; - - ccmp_pn2hdr(pos, pn, key->conf.keyidx); - - /* hwaccel - with software CCMP header */ - if (info->control.hw_key) - return 0; - - pos += CCMP_HDR_LEN; - ccmp_special_blocks(skb, pn, scratch, 0); - ieee80211_aes_ccm_encrypt(key->u.ccmp.tfm, scratch, pos, len, - pos, skb_put(skb, CCMP_MIC_LEN)); - - return 0; -} - - -ieee80211_tx_result -ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx) -{ - struct sk_buff *skb; - - ieee80211_tx_set_protected(tx); - - skb_queue_walk(&tx->skbs, skb) { - if (ccmp_encrypt_skb(tx, skb) < 0) - return TX_DROP; - } - - return TX_CONTINUE; -} - - -ieee80211_rx_result -ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data; - int hdrlen; - struct ieee80211_key *key = rx->key; - struct sk_buff *skb = rx->skb; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - u8 pn[CCMP_PN_LEN]; - int data_len; - int queue; - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - - if (!ieee80211_is_data(hdr->frame_control) && - !ieee80211_is_robust_mgmt_frame(hdr)) - return RX_CONTINUE; - - data_len = skb->len - hdrlen - CCMP_HDR_LEN - CCMP_MIC_LEN; - if (!rx->sta || data_len < 0) - return RX_DROP_UNUSABLE; - - if (status->flag & RX_FLAG_DECRYPTED) { - if (!pskb_may_pull(rx->skb, hdrlen + CCMP_HDR_LEN)) - return RX_DROP_UNUSABLE; - } else { - if (skb_linearize(rx->skb)) - return RX_DROP_UNUSABLE; - } - - ccmp_hdr2pn(pn, skb->data + hdrlen); - - queue = rx->security_idx; - - if (memcmp(pn, key->u.ccmp.rx_pn[queue], CCMP_PN_LEN) <= 0) { - key->u.ccmp.replays++; - return RX_DROP_UNUSABLE; - } - - if (!(status->flag & RX_FLAG_DECRYPTED)) { - u8 scratch[6 * AES_BLOCK_SIZE]; - /* hardware didn't decrypt/verify MIC */ - ccmp_special_blocks(skb, pn, scratch, 1); - - if (ieee80211_aes_ccm_decrypt( - key->u.ccmp.tfm, scratch, - skb->data + hdrlen + CCMP_HDR_LEN, data_len, - skb->data + skb->len - CCMP_MIC_LEN, - skb->data + hdrlen + CCMP_HDR_LEN)) - return RX_DROP_UNUSABLE; - } - - memcpy(key->u.ccmp.rx_pn[queue], pn, CCMP_PN_LEN); - - /* Remove CCMP header and MIC */ - if (pskb_trim(skb, skb->len - CCMP_MIC_LEN)) - return RX_DROP_UNUSABLE; - memmove(skb->data + CCMP_HDR_LEN, skb->data, hdrlen); - skb_pull(skb, CCMP_HDR_LEN); - - return RX_CONTINUE; -} - - -static void bip_aad(struct sk_buff *skb, u8 *aad) -{ - /* BIP AAD: FC(masked) || A1 || A2 || A3 */ - - /* FC type/subtype */ - aad[0] = skb->data[0]; - /* Mask FC Retry, PwrMgt, MoreData flags to zero */ - aad[1] = skb->data[1] & ~(BIT(4) | BIT(5) | BIT(6)); - /* A1 || A2 || A3 */ - memcpy(aad + 2, skb->data + 4, 3 * ETH_ALEN); -} - - -static inline void bip_ipn_set64(u8 *d, u64 pn) -{ - *d++ = pn; - *d++ = pn >> 8; - *d++ = pn >> 16; - *d++ = pn >> 24; - *d++ = pn >> 32; - *d = pn >> 40; -} - -static inline void bip_ipn_swap(u8 *d, const u8 *s) -{ - *d++ = s[5]; - *d++ = s[4]; - *d++ = s[3]; - *d++ = s[2]; - *d++ = s[1]; - *d = s[0]; -} - - -ieee80211_tx_result -ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx) -{ - struct sk_buff *skb; - struct ieee80211_tx_info *info; - struct ieee80211_key *key = tx->key; - struct ieee80211_mmie *mmie; - u8 aad[20]; - u64 pn64; - - if (WARN_ON(skb_queue_len(&tx->skbs) != 1)) - return TX_DROP; - - skb = skb_peek(&tx->skbs); - - info = IEEE80211_SKB_CB(skb); - - if (info->control.hw_key) - return TX_CONTINUE; - - if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie))) - return TX_DROP; - - mmie = (struct ieee80211_mmie *) skb_put(skb, sizeof(*mmie)); - mmie->element_id = WLAN_EID_MMIE; - mmie->length = sizeof(*mmie) - 2; - mmie->key_id = cpu_to_le16(key->conf.keyidx); - - /* PN = PN + 1 */ - pn64 = atomic64_inc_return(&key->u.aes_cmac.tx_pn); - - bip_ipn_set64(mmie->sequence_number, pn64); - - bip_aad(skb, aad); - - /* - * MIC = AES-128-CMAC(IGTK, AAD || Management Frame Body || MMIE, 64) - */ - ieee80211_aes_cmac(key->u.aes_cmac.tfm, aad, - skb->data + 24, skb->len - 24, mmie->mic); - - return TX_CONTINUE; -} - - -ieee80211_rx_result -ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx) -{ - struct sk_buff *skb = rx->skb; - struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); - struct ieee80211_key *key = rx->key; - struct ieee80211_mmie *mmie; - u8 aad[20], mic[8], ipn[6]; - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - - if (!ieee80211_is_mgmt(hdr->frame_control)) - return RX_CONTINUE; - - /* management frames are already linear */ - - if (skb->len < 24 + sizeof(*mmie)) - return RX_DROP_UNUSABLE; - - mmie = (struct ieee80211_mmie *) - (skb->data + skb->len - sizeof(*mmie)); - if (mmie->element_id != WLAN_EID_MMIE || - mmie->length != sizeof(*mmie) - 2) - return RX_DROP_UNUSABLE; /* Invalid MMIE */ - - bip_ipn_swap(ipn, mmie->sequence_number); - - if (memcmp(ipn, key->u.aes_cmac.rx_pn, 6) <= 0) { - key->u.aes_cmac.replays++; - return RX_DROP_UNUSABLE; - } - - if (!(status->flag & RX_FLAG_DECRYPTED)) { - /* hardware didn't decrypt/verify MIC */ - bip_aad(skb, aad); - ieee80211_aes_cmac(key->u.aes_cmac.tfm, aad, - skb->data + 24, skb->len - 24, mic); - if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) { - key->u.aes_cmac.icverrors++; - return RX_DROP_UNUSABLE; - } - } - - memcpy(key->u.aes_cmac.rx_pn, ipn, 6); - - /* Remove MMIE */ - skb_trim(skb, skb->len - sizeof(*mmie)); - - return RX_CONTINUE; -} - -ieee80211_tx_result -ieee80211_crypto_hw_encrypt(struct ieee80211_tx_data *tx) -{ - struct sk_buff *skb; - struct ieee80211_tx_info *info = NULL; - - skb_queue_walk(&tx->skbs, skb) { - info = IEEE80211_SKB_CB(skb); - - /* handle hw-only algorithm */ - if (!info->control.hw_key) - return TX_DROP; - } - - ieee80211_tx_set_protected(tx); - - return TX_CONTINUE; -} diff --git a/openairITS/mac/DOT11/net/mac80211/wpa.h b/openairITS/mac/DOT11/net/mac80211/wpa.h deleted file mode 100644 index 07e33f899c7..00000000000 --- a/openairITS/mac/DOT11/net/mac80211/wpa.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2002-2004, Instant802 Networks, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef WPA_H -#define WPA_H - -#include <linux/skbuff.h> -#include <linux/types.h> -#include "ieee80211_i.h" - -ieee80211_tx_result -ieee80211_tx_h_michael_mic_add(struct ieee80211_tx_data *tx); -ieee80211_rx_result -ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx); - -ieee80211_tx_result -ieee80211_crypto_tkip_encrypt(struct ieee80211_tx_data *tx); -ieee80211_rx_result -ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx); - -ieee80211_tx_result -ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx); -ieee80211_rx_result -ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx); - -ieee80211_tx_result -ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx); -ieee80211_rx_result -ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx); -ieee80211_tx_result -ieee80211_crypto_hw_encrypt(struct ieee80211_tx_data *tx); - -#endif /* WPA_H */ diff --git a/openairITS/mac/DOT11/net/wireless/Makefile b/openairITS/mac/DOT11/net/wireless/Makefile deleted file mode 100644 index 2e7ed5e4089..00000000000 --- a/openairITS/mac/DOT11/net/wireless/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -ifdef MAC -obj-$(CONFIG_CFG80211) += cfg80211.o -#obj-$(CONFIG_LIB80211) += lib80211.o -#obj-$(CONFIG_LIB80211_CRYPT_WEP) += lib80211_crypt_wep.o -#obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o -#obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o - -cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o -cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o -cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o -cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o -cfg80211-$(CONFIG_CFG80211_INTERNAL_REGDB) += regdb.o - -ccflags-y += -D__CHECK_ENDIAN__ - -$(obj)/regdb.c: $(src)/db.txt $(src)/genregdb.awk - @$(AWK) -f $(src)/genregdb.awk < $< > $@ - -clean-files := regdb.c -endif - -ifdef ALL -obj-$(CONFIG_CFG80211) += cfg80211.o -obj-$(CONFIG_LIB80211) += lib80211.o -obj-$(CONFIG_LIB80211_CRYPT_WEP) += lib80211_crypt_wep.o -obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o -obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o - -cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o -cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o -cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o -cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o -cfg80211-$(CONFIG_CFG80211_INTERNAL_REGDB) += regdb.o - -ccflags-y += -D__CHECK_ENDIAN__ - -$(obj)/regdb.c: $(src)/db.txt $(src)/genregdb.awk - @$(AWK) -f $(src)/genregdb.awk < $< > $@ - -clean-files := regdb.c -endif - diff --git a/openairITS/mac/DOT11/net/wireless/chan.c b/openairITS/mac/DOT11/net/wireless/chan.c deleted file mode 100644 index 2fcfe0993ca..00000000000 --- a/openairITS/mac/DOT11/net/wireless/chan.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * This file contains helper code to handle channel - * settings and keeping track of what is possible at - * any point in time. - * - * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> - */ - -#include <linux/export.h> -#include <net/cfg80211.h> -#include "core.h" - -struct ieee80211_channel * -rdev_freq_to_chan(struct cfg80211_registered_device *rdev, - int freq, enum nl80211_channel_type channel_type) -{ - struct ieee80211_channel *chan; - struct ieee80211_sta_ht_cap *ht_cap; - - chan = ieee80211_get_channel(&rdev->wiphy, freq); - - /* Primary channel not allowed */ - if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) - return NULL; - - if (channel_type == NL80211_CHAN_HT40MINUS && - chan->flags & IEEE80211_CHAN_NO_HT40MINUS) - return NULL; - else if (channel_type == NL80211_CHAN_HT40PLUS && - chan->flags & IEEE80211_CHAN_NO_HT40PLUS) - return NULL; - - ht_cap = &rdev->wiphy.bands[chan->band]->ht_cap; - - if (channel_type != NL80211_CHAN_NO_HT) { - if (!ht_cap->ht_supported) - return NULL; - - if (channel_type != NL80211_CHAN_HT20 && - (!(ht_cap->cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) || - ht_cap->cap & IEEE80211_HT_CAP_40MHZ_INTOLERANT)) - return NULL; - } - - return chan; -} - -int cfg80211_can_beacon_sec_chan(struct wiphy *wiphy, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type) -{ - struct ieee80211_channel *sec_chan; - int diff; - - switch (channel_type) { - case NL80211_CHAN_HT40PLUS: - diff = 20; - break; - case NL80211_CHAN_HT40MINUS: - diff = -20; - break; - default: - return false; - } - - sec_chan = ieee80211_get_channel(wiphy, chan->center_freq + diff); - if (!sec_chan) - return false; - - /* we'll need a DFS capability later */ - if (sec_chan->flags & (IEEE80211_CHAN_DISABLED | - IEEE80211_CHAN_PASSIVE_SCAN | - IEEE80211_CHAN_NO_IBSS | - IEEE80211_CHAN_RADAR)) - return false; - - return true; -} -EXPORT_SYMBOL(cfg80211_can_beacon_sec_chan); - -int cfg80211_set_freq(struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev, int freq, - enum nl80211_channel_type channel_type) -{ - struct ieee80211_channel *chan; - int result; - - if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) - wdev = NULL; - - if (wdev) { - ASSERT_WDEV_LOCK(wdev); - - if (!netif_running(wdev->netdev)) - return -ENETDOWN; - } - - if (!rdev->ops->set_channel) - return -EOPNOTSUPP; - - chan = rdev_freq_to_chan(rdev, freq, channel_type); - if (!chan) - return -EINVAL; - - /* Both channels should be able to initiate communication */ - if (wdev && (wdev->iftype == NL80211_IFTYPE_ADHOC || - wdev->iftype == NL80211_IFTYPE_AP || - wdev->iftype == NL80211_IFTYPE_AP_VLAN || - wdev->iftype == NL80211_IFTYPE_MESH_POINT || - wdev->iftype == NL80211_IFTYPE_P2P_GO)) { - switch (channel_type) { - case NL80211_CHAN_HT40PLUS: - case NL80211_CHAN_HT40MINUS: - if (!cfg80211_can_beacon_sec_chan(&rdev->wiphy, chan, - channel_type)) { - printk(KERN_DEBUG - "cfg80211: Secondary channel not " - "allowed to initiate communication\n"); - return -EINVAL; - } - break; - default: - break; - } - } - - result = rdev->ops->set_channel(&rdev->wiphy, - wdev ? wdev->netdev : NULL, - chan, channel_type); - if (result) - return result; - - if (wdev) - wdev->channel = chan; - - return 0; -} diff --git a/openairITS/mac/DOT11/net/wireless/core.c b/openairITS/mac/DOT11/net/wireless/core.c deleted file mode 100644 index ba21a0136b4..00000000000 --- a/openairITS/mac/DOT11/net/wireless/core.c +++ /dev/null @@ -1,1107 +0,0 @@ -/* - * This is the linux wireless configuration interface. - * - * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> - */ - -#undef pr_fmt -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include <linux/kernel.h> -#include <linux/printk.h> -#include <linux/if.h> -#include <linux/module.h> -#include <linux/err.h> -#include <linux/list.h> -#include <linux/slab.h> -#include <linux/nl80211.h> -#include <linux/debugfs.h> -#include <linux/notifier.h> -#include <linux/device.h> -#include <linux/etherdevice.h> -#include <linux/rtnetlink.h> -#include <linux/sched.h> -#include <net/genetlink.h> -#include <net/cfg80211.h> -#include "nl80211.h" -#include "core.h" -#include "sysfs.h" -#include "debugfs.h" -#include "wext-compat.h" -#include "ethtool.h" - -/* name for sysfs, %d is appended */ -#define PHY_NAME "phy" - -MODULE_AUTHOR("Johannes Berg"); -MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("wireless configuration support"); - -/* RCU-protected (and cfg80211_mutex for writers) */ -LIST_HEAD(cfg80211_rdev_list); -int cfg80211_rdev_list_generation; - -DEFINE_MUTEX(cfg80211_mutex); - -/* for debugfs */ -static struct dentry *ieee80211_debugfs_dir; - -/* for the cleanup, scan and event works */ -struct workqueue_struct *cfg80211_wq; - -static bool cfg80211_disable_40mhz_24ghz; -module_param(cfg80211_disable_40mhz_24ghz, bool, 0644); -MODULE_PARM_DESC(cfg80211_disable_40mhz_24ghz, - "Disable 40MHz support in the 2.4GHz band"); - -/* requires cfg80211_mutex to be held! */ -struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx) -{ - struct cfg80211_registered_device *result = NULL, *rdev; - - if (!wiphy_idx_valid(wiphy_idx)) - return NULL; - - assert_cfg80211_lock(); - - list_for_each_entry(rdev, &cfg80211_rdev_list, list) { - if (rdev->wiphy_idx == wiphy_idx) { - result = rdev; - break; - } - } - - return result; -} - -int get_wiphy_idx(struct wiphy *wiphy) -{ - struct cfg80211_registered_device *rdev; - if (!wiphy) - return WIPHY_IDX_STALE; - rdev = wiphy_to_dev(wiphy); - return rdev->wiphy_idx; -} - -/* requires cfg80211_rdev_mutex to be held! */ -struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx) -{ - struct cfg80211_registered_device *rdev; - - if (!wiphy_idx_valid(wiphy_idx)) - return NULL; - - assert_cfg80211_lock(); - - rdev = cfg80211_rdev_by_wiphy_idx(wiphy_idx); - if (!rdev) - return NULL; - return &rdev->wiphy; -} - -/* requires cfg80211_mutex to be held! */ -struct cfg80211_registered_device * -__cfg80211_rdev_from_info(struct genl_info *info) -{ - int ifindex; - struct cfg80211_registered_device *bywiphyidx = NULL, *byifidx = NULL; - struct net_device *dev; - int err = -EINVAL; - - assert_cfg80211_lock(); - - if (info->attrs[NL80211_ATTR_WIPHY]) { - bywiphyidx = cfg80211_rdev_by_wiphy_idx( - nla_get_u32(info->attrs[NL80211_ATTR_WIPHY])); - err = -ENODEV; - } - - if (info->attrs[NL80211_ATTR_IFINDEX]) { - ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]); - dev = dev_get_by_index(genl_info_net(info), ifindex); - if (dev) { - if (dev->ieee80211_ptr) - byifidx = - wiphy_to_dev(dev->ieee80211_ptr->wiphy); - dev_put(dev); - } - err = -ENODEV; - } - - if (bywiphyidx && byifidx) { - if (bywiphyidx != byifidx) - return ERR_PTR(-EINVAL); - else - return bywiphyidx; /* == byifidx */ - } - if (bywiphyidx) - return bywiphyidx; - - if (byifidx) - return byifidx; - - return ERR_PTR(err); -} - -struct cfg80211_registered_device * -cfg80211_get_dev_from_info(struct genl_info *info) -{ - struct cfg80211_registered_device *rdev; - - mutex_lock(&cfg80211_mutex); - rdev = __cfg80211_rdev_from_info(info); - - /* if it is not an error we grab the lock on - * it to assure it won't be going away while - * we operate on it */ - if (!IS_ERR(rdev)) - mutex_lock(&rdev->mtx); - - mutex_unlock(&cfg80211_mutex); - - return rdev; -} - -struct cfg80211_registered_device * -cfg80211_get_dev_from_ifindex(struct net *net, int ifindex) -{ - struct cfg80211_registered_device *rdev = ERR_PTR(-ENODEV); - struct net_device *dev; - - mutex_lock(&cfg80211_mutex); - dev = dev_get_by_index(net, ifindex); - if (!dev) - goto out; - if (dev->ieee80211_ptr) { - rdev = wiphy_to_dev(dev->ieee80211_ptr->wiphy); - mutex_lock(&rdev->mtx); - } else - rdev = ERR_PTR(-ENODEV); - dev_put(dev); - out: - mutex_unlock(&cfg80211_mutex); - return rdev; -} - -/* requires cfg80211_mutex to be held */ -int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, - char *newname) -{ - struct cfg80211_registered_device *rdev2; - int wiphy_idx, taken = -1, result, digits; - - assert_cfg80211_lock(); - - /* prohibit calling the thing phy%d when %d is not its number */ - sscanf(newname, PHY_NAME "%d%n", &wiphy_idx, &taken); - if (taken == strlen(newname) && wiphy_idx != rdev->wiphy_idx) { - /* count number of places needed to print wiphy_idx */ - digits = 1; - while (wiphy_idx /= 10) - digits++; - /* - * deny the name if it is phy<idx> where <idx> is printed - * without leading zeroes. taken == strlen(newname) here - */ - if (taken == strlen(PHY_NAME) + digits) - return -EINVAL; - } - - - /* Ignore nop renames */ - if (strcmp(newname, dev_name(&rdev->wiphy.dev)) == 0) - return 0; - - /* Ensure another device does not already have this name. */ - list_for_each_entry(rdev2, &cfg80211_rdev_list, list) - if (strcmp(newname, dev_name(&rdev2->wiphy.dev)) == 0) - return -EINVAL; - - result = device_rename(&rdev->wiphy.dev, newname); - if (result) - return result; - - if (rdev->wiphy.debugfsdir && - !debugfs_rename(rdev->wiphy.debugfsdir->d_parent, - rdev->wiphy.debugfsdir, - rdev->wiphy.debugfsdir->d_parent, - newname)) - pr_err("failed to rename debugfs dir to %s!\n", newname); - - nl80211_notify_dev_rename(rdev); - - return 0; -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) -int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, - struct net *net) -{ - struct wireless_dev *wdev; - int err = 0; - - if (!(rdev->wiphy.flags & WIPHY_FLAG_NETNS_OK)) - return -EOPNOTSUPP; - - list_for_each_entry(wdev, &rdev->netdev_list, list) { - wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL; - err = dev_change_net_namespace(wdev->netdev, net, "wlan%d"); - if (err) - break; - wdev->netdev->features |= NETIF_F_NETNS_LOCAL; - } - - if (err) { - /* failed -- clean up to old netns */ - net = wiphy_net(&rdev->wiphy); - - list_for_each_entry_continue_reverse(wdev, &rdev->netdev_list, - list) { - wdev->netdev->features &= ~NETIF_F_NETNS_LOCAL; - err = dev_change_net_namespace(wdev->netdev, net, - "wlan%d"); - WARN_ON(err); - wdev->netdev->features |= NETIF_F_NETNS_LOCAL; - } - - return err; - } - - wiphy_net_set(&rdev->wiphy, net); - - err = device_rename(&rdev->wiphy.dev, dev_name(&rdev->wiphy.dev)); - WARN_ON(err); - - return 0; -} -#endif - -static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data) -{ - struct cfg80211_registered_device *rdev = data; - - rdev->ops->rfkill_poll(&rdev->wiphy); -} - -static int cfg80211_rfkill_set_block(void *data, bool blocked) -{ - struct cfg80211_registered_device *rdev = data; - struct wireless_dev *wdev; - - if (!blocked) - return 0; - - rtnl_lock(); - mutex_lock(&rdev->devlist_mtx); - - list_for_each_entry(wdev, &rdev->netdev_list, list) - dev_close(wdev->netdev); - - mutex_unlock(&rdev->devlist_mtx); - rtnl_unlock(); - - return 0; -} - -static void cfg80211_rfkill_sync_work(struct work_struct *work) -{ - struct cfg80211_registered_device *rdev; - - rdev = container_of(work, struct cfg80211_registered_device, rfkill_sync); - cfg80211_rfkill_set_block(rdev, rfkill_blocked(rdev->rfkill)); -} - -static void cfg80211_event_work(struct work_struct *work) -{ - struct cfg80211_registered_device *rdev; - - rdev = container_of(work, struct cfg80211_registered_device, - event_work); - - rtnl_lock(); - cfg80211_lock_rdev(rdev); - - cfg80211_process_rdev_events(rdev); - cfg80211_unlock_rdev(rdev); - rtnl_unlock(); -} - -/* exported functions */ - -struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv) -{ - static int wiphy_counter; - - struct cfg80211_registered_device *rdev; - int alloc_size; - - /* - * Make sure the padding is >= the rest of the struct so that we - * always keep it large enough to pad out the entire original - * kernel's struct. We really only need to make sure it's larger - * than the kernel compat is compiled against, but since it'll - * only increase in size make sure it's larger than the current - * version of it. Subtract since it's included. - */ - BUILD_BUG_ON(WIPHY_COMPAT_PAD_SIZE < - sizeof(struct wiphy) - WIPHY_COMPAT_PAD_SIZE); - - WARN_ON(ops->add_key && (!ops->del_key || !ops->set_default_key)); - WARN_ON(ops->auth && (!ops->assoc || !ops->deauth || !ops->disassoc)); - WARN_ON(ops->connect && !ops->disconnect); - WARN_ON(ops->join_ibss && !ops->leave_ibss); - WARN_ON(ops->add_virtual_intf && !ops->del_virtual_intf); - WARN_ON(ops->add_station && !ops->del_station); - WARN_ON(ops->add_mpath && !ops->del_mpath); - WARN_ON(ops->join_mesh && !ops->leave_mesh); - - alloc_size = sizeof(*rdev) + sizeof_priv; - - rdev = kzalloc(alloc_size, GFP_KERNEL); - if (!rdev) - return NULL; - - rdev->ops = ops; - - mutex_lock(&cfg80211_mutex); - - rdev->wiphy_idx = wiphy_counter++; - - if (unlikely(!wiphy_idx_valid(rdev->wiphy_idx))) { - wiphy_counter--; - mutex_unlock(&cfg80211_mutex); - /* ugh, wrapped! */ - kfree(rdev); - return NULL; - } - - mutex_unlock(&cfg80211_mutex); - - /* give it a proper name */ - dev_set_name(&rdev->wiphy.dev, PHY_NAME "%d", rdev->wiphy_idx); - - mutex_init(&rdev->mtx); - mutex_init(&rdev->devlist_mtx); - mutex_init(&rdev->sched_scan_mtx); - INIT_LIST_HEAD(&rdev->netdev_list); - spin_lock_init(&rdev->bss_lock); - INIT_LIST_HEAD(&rdev->bss_list); - INIT_WORK(&rdev->scan_done_wk, __cfg80211_scan_done); - INIT_WORK(&rdev->sched_scan_results_wk, __cfg80211_sched_scan_results); - device_initialize(&rdev->wiphy.dev); - rdev->wiphy.dev.class = &ieee80211_class; - rdev->wiphy.dev.platform_data = rdev; - -#ifdef CONFIG_CFG80211_DEFAULT_PS - rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; -#endif - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) - wiphy_net_set(&rdev->wiphy, &init_net); -#endif - - rdev->rfkill_ops.set_block = cfg80211_rfkill_set_block; - rdev->rfkill = rfkill_alloc(dev_name(&rdev->wiphy.dev), - &rdev->wiphy.dev, RFKILL_TYPE_WLAN, - &rdev->rfkill_ops, rdev); - - if (!rdev->rfkill) { - kfree(rdev); - return NULL; - } - - INIT_WORK(&rdev->rfkill_sync, cfg80211_rfkill_sync_work); - INIT_WORK(&rdev->conn_work, cfg80211_conn_work); - INIT_WORK(&rdev->event_work, cfg80211_event_work); - - init_waitqueue_head(&rdev->dev_wait); - - /* - * Initialize wiphy parameters to IEEE 802.11 MIB default values. - * Fragmentation and RTS threshold are disabled by default with the - * special -1 value. - */ - rdev->wiphy.retry_short = 7; - rdev->wiphy.retry_long = 4; - rdev->wiphy.frag_threshold = (u32) -1; - rdev->wiphy.rts_threshold = (u32) -1; - rdev->wiphy.coverage_class = 0; - - return &rdev->wiphy; -} -EXPORT_SYMBOL(wiphy_new); - -static int wiphy_verify_combinations(struct wiphy *wiphy) -{ - const struct ieee80211_iface_combination *c; - int i, j; - - /* If we have combinations enforce them */ - if (wiphy->n_iface_combinations) - wiphy->flags |= WIPHY_FLAG_ENFORCE_COMBINATIONS; - - for (i = 0; i < wiphy->n_iface_combinations; i++) { - u32 cnt = 0; - u16 all_iftypes = 0; - - c = &wiphy->iface_combinations[i]; - - /* Combinations with just one interface aren't real */ - if (WARN_ON(c->max_interfaces < 2)) - return -EINVAL; - - /* Need at least one channel */ - if (WARN_ON(!c->num_different_channels)) - return -EINVAL; - - if (WARN_ON(!c->n_limits)) - return -EINVAL; - - for (j = 0; j < c->n_limits; j++) { - u16 types = c->limits[j].types; - - /* - * interface types shouldn't overlap, this is - * used in cfg80211_can_change_interface() - */ - if (WARN_ON(types & all_iftypes)) - return -EINVAL; - all_iftypes |= types; - - if (WARN_ON(!c->limits[j].max)) - return -EINVAL; - - /* Shouldn't list software iftypes in combinations! */ - if (WARN_ON(wiphy->software_iftypes & types)) - return -EINVAL; - - cnt += c->limits[j].max; - /* - * Don't advertise an unsupported type - * in a combination. - */ - if (WARN_ON((wiphy->interface_modes & types) != types)) - return -EINVAL; - } - - /* You can't even choose that many! */ - if (WARN_ON(cnt < c->max_interfaces)) - return -EINVAL; - } - - return 0; -} - -int wiphy_register(struct wiphy *wiphy) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - int res; - enum ieee80211_band band; - struct ieee80211_supported_band *sband; - bool have_band = false; - int i; - u16 ifmodes = wiphy->interface_modes; - - if (WARN_ON((wiphy->wowlan.flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && - !(wiphy->wowlan.flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY))) - return -EINVAL; - - if (WARN_ON(wiphy->ap_sme_capa && - !(wiphy->flags & WIPHY_FLAG_HAVE_AP_SME))) - return -EINVAL; - - if (WARN_ON(wiphy->addresses && !wiphy->n_addresses)) - return -EINVAL; - - if (WARN_ON(wiphy->addresses && - !is_zero_ether_addr(wiphy->perm_addr) && - memcmp(wiphy->perm_addr, wiphy->addresses[0].addr, - ETH_ALEN))) - return -EINVAL; - - if (wiphy->addresses) - memcpy(wiphy->perm_addr, wiphy->addresses[0].addr, ETH_ALEN); - - /* sanity check ifmodes */ - WARN_ON(!ifmodes); - ifmodes &= ((1 << NUM_NL80211_IFTYPES) - 1) & ~1; - if (WARN_ON(ifmodes != wiphy->interface_modes)) - wiphy->interface_modes = ifmodes; - - res = wiphy_verify_combinations(wiphy); - if (res) - return res; - - /* sanity check supported bands/channels */ - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - sband = wiphy->bands[band]; - if (!sband) - continue; - - sband->band = band; - - if (WARN_ON(!sband->n_channels || !sband->n_bitrates)) - return -EINVAL; - - /* - * Since cfg80211_disable_40mhz_24ghz is global, we can - * modify the sband's ht data even if the driver uses a - * global structure for that. - */ - if (cfg80211_disable_40mhz_24ghz && - band == IEEE80211_BAND_2GHZ && - sband->ht_cap.ht_supported) { - sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; - sband->ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; - } - - /* - * Since we use a u32 for rate bitmaps in - * ieee80211_get_response_rate, we cannot - * have more than 32 legacy rates. - */ - if (WARN_ON(sband->n_bitrates > 32)) - return -EINVAL; - - for (i = 0; i < sband->n_channels; i++) { - sband->channels[i].orig_flags = - sband->channels[i].flags; - sband->channels[i].orig_mag = - sband->channels[i].max_antenna_gain; - sband->channels[i].orig_mpwr = - sband->channels[i].max_power; - sband->channels[i].band = band; - } - - have_band = true; - } - - if (!have_band) { - WARN_ON(1); - return -EINVAL; - } - - if (rdev->wiphy.wowlan.n_patterns) { - if (WARN_ON(!rdev->wiphy.wowlan.pattern_min_len || - rdev->wiphy.wowlan.pattern_min_len > - rdev->wiphy.wowlan.pattern_max_len)) - return -EINVAL; - } - - /* check and set up bitrates */ - ieee80211_set_bitrate_flags(wiphy); - - mutex_lock(&cfg80211_mutex); - - res = device_add(&rdev->wiphy.dev); - if (res) { - mutex_unlock(&cfg80211_mutex); - return res; - } - - /* set up regulatory info */ - regulatory_update(wiphy, NL80211_REGDOM_SET_BY_CORE); - - list_add_rcu(&rdev->list, &cfg80211_rdev_list); - cfg80211_rdev_list_generation++; - - /* add to debugfs */ - rdev->wiphy.debugfsdir = - debugfs_create_dir(wiphy_name(&rdev->wiphy), - ieee80211_debugfs_dir); - if (IS_ERR(rdev->wiphy.debugfsdir)) - rdev->wiphy.debugfsdir = NULL; - - if (wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) { - struct regulatory_request request; - - request.wiphy_idx = get_wiphy_idx(wiphy); - request.initiator = NL80211_REGDOM_SET_BY_DRIVER; - request.alpha2[0] = '9'; - request.alpha2[1] = '9'; - - nl80211_send_reg_change_event(&request); - } - - cfg80211_debugfs_rdev_add(rdev); - mutex_unlock(&cfg80211_mutex); - - /* - * due to a locking dependency this has to be outside of the - * cfg80211_mutex lock - */ - res = rfkill_register(rdev->rfkill); - if (res) - goto out_rm_dev; - - rtnl_lock(); - rdev->wiphy.registered = true; - rtnl_unlock(); - return 0; - -out_rm_dev: - device_del(&rdev->wiphy.dev); - return res; -} -EXPORT_SYMBOL(wiphy_register); - -void wiphy_rfkill_start_polling(struct wiphy *wiphy) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - if (!rdev->ops->rfkill_poll) - return; - rdev->rfkill_ops.poll = cfg80211_rfkill_poll; - rfkill_resume_polling(rdev->rfkill); -} -EXPORT_SYMBOL(wiphy_rfkill_start_polling); - -void wiphy_rfkill_stop_polling(struct wiphy *wiphy) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - rfkill_pause_polling(rdev->rfkill); -} -EXPORT_SYMBOL(wiphy_rfkill_stop_polling); - -void wiphy_unregister(struct wiphy *wiphy) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - rtnl_lock(); - rdev->wiphy.registered = false; - rtnl_unlock(); - - rfkill_unregister(rdev->rfkill); - - /* protect the device list */ - mutex_lock(&cfg80211_mutex); - - wait_event(rdev->dev_wait, ({ - int __count; - mutex_lock(&rdev->devlist_mtx); - __count = rdev->opencount; - mutex_unlock(&rdev->devlist_mtx); - __count == 0;})); - - mutex_lock(&rdev->devlist_mtx); - BUG_ON(!list_empty(&rdev->netdev_list)); - mutex_unlock(&rdev->devlist_mtx); - - /* - * First remove the hardware from everywhere, this makes - * it impossible to find from userspace. - */ - debugfs_remove_recursive(rdev->wiphy.debugfsdir); - list_del_rcu(&rdev->list); - synchronize_rcu(); - - /* - * Try to grab rdev->mtx. If a command is still in progress, - * hopefully the driver will refuse it since it's tearing - * down the device already. We wait for this command to complete - * before unlinking the item from the list. - * Note: as codified by the BUG_ON above we cannot get here if - * a virtual interface is still present. Hence, we can only get - * to lock contention here if userspace issues a command that - * identified the hardware by wiphy index. - */ - cfg80211_lock_rdev(rdev); - /* nothing */ - cfg80211_unlock_rdev(rdev); - - /* If this device got a regulatory hint tell core its - * free to listen now to a new shiny device regulatory hint */ - reg_device_remove(wiphy); - - cfg80211_rdev_list_generation++; - device_del(&rdev->wiphy.dev); - - mutex_unlock(&cfg80211_mutex); - - flush_work(&rdev->scan_done_wk); - cancel_work_sync(&rdev->conn_work); - flush_work(&rdev->event_work); -} -EXPORT_SYMBOL(wiphy_unregister); - -void cfg80211_dev_free(struct cfg80211_registered_device *rdev) -{ - struct cfg80211_internal_bss *scan, *tmp; - rfkill_destroy(rdev->rfkill); - mutex_destroy(&rdev->mtx); - mutex_destroy(&rdev->devlist_mtx); - mutex_destroy(&rdev->sched_scan_mtx); - list_for_each_entry_safe(scan, tmp, &rdev->bss_list, list) - cfg80211_put_bss(&scan->pub); - cfg80211_rdev_free_wowlan(rdev); - kfree(rdev); -} - -void wiphy_free(struct wiphy *wiphy) -{ - put_device(&wiphy->dev); -} -EXPORT_SYMBOL(wiphy_free); - -void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - if (rfkill_set_hw_state(rdev->rfkill, blocked)) - schedule_work(&rdev->rfkill_sync); -} -EXPORT_SYMBOL(wiphy_rfkill_set_hw_state); - -static void wdev_cleanup_work(struct work_struct *work) -{ - struct wireless_dev *wdev; - struct cfg80211_registered_device *rdev; - - wdev = container_of(work, struct wireless_dev, cleanup_work); - rdev = wiphy_to_dev(wdev->wiphy); - - cfg80211_lock_rdev(rdev); - - if (WARN_ON(rdev->scan_req && rdev->scan_req->dev == wdev->netdev)) { - rdev->scan_req->aborted = true; - ___cfg80211_scan_done(rdev, true); - } - - cfg80211_unlock_rdev(rdev); - - mutex_lock(&rdev->sched_scan_mtx); - - if (WARN_ON(rdev->sched_scan_req && - rdev->sched_scan_req->dev == wdev->netdev)) { - __cfg80211_stop_sched_scan(rdev, false); - } - - mutex_unlock(&rdev->sched_scan_mtx); - - mutex_lock(&rdev->devlist_mtx); - rdev->opencount--; - mutex_unlock(&rdev->devlist_mtx); - wake_up(&rdev->dev_wait); - - dev_put(wdev->netdev); -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) -static struct device_type wiphy_type = { - .name = "wlan", -}; -#endif - -static int cfg80211_netdev_notifier_call(struct notifier_block * nb, - unsigned long state, - void *ndev) -{ - struct net_device *dev = ndev; - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev; - int ret; - - if (!wdev) - return NOTIFY_DONE; - - rdev = wiphy_to_dev(wdev->wiphy); - - WARN_ON(wdev->iftype == NL80211_IFTYPE_UNSPECIFIED); - - switch (state) { - case NETDEV_POST_INIT: - SET_NETDEV_DEVTYPE(dev, &wiphy_type); - break; - case NETDEV_REGISTER: - /* - * NB: cannot take rdev->mtx here because this may be - * called within code protected by it when interfaces - * are added with nl80211. - */ - mutex_init(&wdev->mtx); - INIT_WORK(&wdev->cleanup_work, wdev_cleanup_work); - INIT_LIST_HEAD(&wdev->event_list); - spin_lock_init(&wdev->event_lock); - INIT_LIST_HEAD(&wdev->mgmt_registrations); - spin_lock_init(&wdev->mgmt_registrations_lock); - - mutex_lock(&rdev->devlist_mtx); - list_add_rcu(&wdev->list, &rdev->netdev_list); - rdev->devlist_generation++; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) - /* can only change netns with wiphy */ - dev->features |= NETIF_F_NETNS_LOCAL; -#endif - - if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj, - "phy80211")) { - pr_err("failed to add phy80211 symlink to netdev!\n"); - } - wdev->netdev = dev; - wdev->sme_state = CFG80211_SME_IDLE; - mutex_unlock(&rdev->devlist_mtx); -#ifdef CONFIG_CFG80211_WEXT -#ifdef CONFIG_WIRELESS_EXT - if (!dev->wireless_handlers) - dev->wireless_handlers = &cfg80211_wext_handler; -#else - printk_once(KERN_WARNING "cfg80211: wext will not work because " - "kernel was compiled with CONFIG_WIRELESS_EXT=n. " - "Tools using wext interface, like iwconfig will " - "not work.\n"); -#endif - wdev->wext.default_key = -1; - wdev->wext.default_mgmt_key = -1; - wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; -#endif - - if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT) - wdev->ps = true; - else - wdev->ps = false; - /* allow mac80211 to determine the timeout */ - wdev->ps_timeout = -1; - - if (!dev->ethtool_ops) - dev->ethtool_ops = &cfg80211_ethtool_ops; - - if ((wdev->iftype == NL80211_IFTYPE_STATION || - wdev->iftype == NL80211_IFTYPE_P2P_CLIENT || - wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr) - dev->priv_flags |= IFF_DONT_BRIDGE; - break; - case NETDEV_GOING_DOWN: - switch (wdev->iftype) { - case NL80211_IFTYPE_ADHOC: - cfg80211_leave_ibss(rdev, dev, true); - break; - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_STATION: - mutex_lock(&rdev->sched_scan_mtx); - __cfg80211_stop_sched_scan(rdev, false); - mutex_unlock(&rdev->sched_scan_mtx); - - wdev_lock(wdev); -#ifdef CONFIG_CFG80211_WEXT - kfree(wdev->wext.ie); - wdev->wext.ie = NULL; - wdev->wext.ie_len = 0; - wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; -#endif - __cfg80211_disconnect(rdev, dev, - WLAN_REASON_DEAUTH_LEAVING, true); - cfg80211_mlme_down(rdev, dev); - wdev_unlock(wdev); - break; - case NL80211_IFTYPE_MESH_POINT: - cfg80211_leave_mesh(rdev, dev); - break; - default: - break; - } - wdev->beacon_interval = 0; - break; - case NETDEV_DOWN: - dev_hold(dev); - queue_work(cfg80211_wq, &wdev->cleanup_work); - break; - case NETDEV_UP: - /* - * If we have a really quick DOWN/UP succession we may - * have this work still pending ... cancel it and see - * if it was pending, in which case we need to account - * for some of the work it would have done. - */ - if (cancel_work_sync(&wdev->cleanup_work)) { - mutex_lock(&rdev->devlist_mtx); - rdev->opencount--; - mutex_unlock(&rdev->devlist_mtx); - dev_put(dev); - } - cfg80211_lock_rdev(rdev); - mutex_lock(&rdev->devlist_mtx); - wdev_lock(wdev); - switch (wdev->iftype) { -#ifdef CONFIG_CFG80211_WEXT - case NL80211_IFTYPE_ADHOC: - cfg80211_ibss_wext_join(rdev, wdev); - break; - case NL80211_IFTYPE_STATION: - cfg80211_mgd_wext_connect(rdev, wdev); - break; -#endif -#ifdef CONFIG_MAC80211_MESH - case NL80211_IFTYPE_MESH_POINT: - { - /* backward compat code... */ - struct mesh_setup setup; - memcpy(&setup, &default_mesh_setup, - sizeof(setup)); - /* back compat only needed for mesh_id */ - setup.mesh_id = wdev->ssid; - setup.mesh_id_len = wdev->mesh_id_up_len; - if (wdev->mesh_id_up_len) - __cfg80211_join_mesh(rdev, dev, - &setup, - &default_mesh_config); - break; - } -#endif - default: - break; - } - wdev_unlock(wdev); - rdev->opencount++; - mutex_unlock(&rdev->devlist_mtx); - cfg80211_unlock_rdev(rdev); - - /* - * Configure power management to the driver here so that its - * correctly set also after interface type changes etc. - */ - if ((wdev->iftype == NL80211_IFTYPE_STATION || - wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) && - rdev->ops->set_power_mgmt) - if (rdev->ops->set_power_mgmt(wdev->wiphy, dev, - wdev->ps, - wdev->ps_timeout)) { - /* assume this means it's off */ - wdev->ps = false; - } - break; - case NETDEV_UNREGISTER: - /* - * NB: cannot take rdev->mtx here because this may be - * called within code protected by it when interfaces - * are removed with nl80211. - */ - mutex_lock(&rdev->devlist_mtx); - /* - * It is possible to get NETDEV_UNREGISTER - * multiple times. To detect that, check - * that the interface is still on the list - * of registered interfaces, and only then - * remove and clean it up. - */ - if (!list_empty(&wdev->list)) { - sysfs_remove_link(&dev->dev.kobj, "phy80211"); - list_del_rcu(&wdev->list); - rdev->devlist_generation++; - cfg80211_mlme_purge_registrations(wdev); -#ifdef CONFIG_CFG80211_WEXT - kfree(wdev->wext.keys); -#endif - } - mutex_unlock(&rdev->devlist_mtx); - /* - * synchronise (so that we won't find this netdev - * from other code any more) and then clear the list - * head so that the above code can safely check for - * !list_empty() to avoid double-cleanup. - */ - synchronize_rcu(); - INIT_LIST_HEAD(&wdev->list); - break; - case NETDEV_PRE_UP: - if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) - return notifier_from_errno(-EOPNOTSUPP); - if (rfkill_blocked(rdev->rfkill)) - return notifier_from_errno(-ERFKILL); - ret = cfg80211_can_add_interface(rdev, wdev->iftype); - if (ret) - return notifier_from_errno(ret); - break; - } - - return NOTIFY_DONE; -} - -static struct notifier_block cfg80211_netdev_notifier = { - .notifier_call = cfg80211_netdev_notifier_call, -}; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) -static void __net_exit cfg80211_pernet_exit(struct net *net) -{ - struct cfg80211_registered_device *rdev; - - rtnl_lock(); - mutex_lock(&cfg80211_mutex); - list_for_each_entry(rdev, &cfg80211_rdev_list, list) { - if (net_eq(wiphy_net(&rdev->wiphy), net)) - WARN_ON(cfg80211_switch_netns(rdev, &init_net)); - } - mutex_unlock(&cfg80211_mutex); - rtnl_unlock(); -} - -static struct pernet_operations cfg80211_pernet_ops = { - .exit = cfg80211_pernet_exit, -}; -#endif - -static int __init cfg80211_init(void) -{ - int err; - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) - err = register_pernet_device(&cfg80211_pernet_ops); - if (err) - goto out_fail_pernet; -#endif - - err = wiphy_sysfs_init(); - if (err) - goto out_fail_sysfs; - - err = register_netdevice_notifier(&cfg80211_netdev_notifier); - if (err) - goto out_fail_notifier; - - err = nl80211_init(); - if (err) - goto out_fail_nl80211; - - ieee80211_debugfs_dir = debugfs_create_dir("ieee80211", NULL); - - err = regulatory_init(); - if (err) - goto out_fail_reg; - - cfg80211_wq = create_singlethread_workqueue("cfg80211"); - if (!cfg80211_wq) - goto out_fail_wq; - - return 0; - -out_fail_wq: - regulatory_exit(); -out_fail_reg: - debugfs_remove(ieee80211_debugfs_dir); -out_fail_nl80211: - unregister_netdevice_notifier(&cfg80211_netdev_notifier); -out_fail_notifier: - wiphy_sysfs_exit(); -out_fail_sysfs: -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) - unregister_pernet_device(&cfg80211_pernet_ops); -out_fail_pernet: -#endif - return err; -} -subsys_initcall(cfg80211_init); - -static void __exit cfg80211_exit(void) -{ - debugfs_remove(ieee80211_debugfs_dir); - nl80211_exit(); - unregister_netdevice_notifier(&cfg80211_netdev_notifier); - wiphy_sysfs_exit(); - regulatory_exit(); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) - unregister_pernet_device(&cfg80211_pernet_ops); -#endif - destroy_workqueue(cfg80211_wq); -} -module_exit(cfg80211_exit); diff --git a/openairITS/mac/DOT11/net/wireless/core.h b/openairITS/mac/DOT11/net/wireless/core.h deleted file mode 100644 index 3ac2dd00d71..00000000000 --- a/openairITS/mac/DOT11/net/wireless/core.h +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Wireless configuration interface internals. - * - * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> - */ -#ifndef __NET_WIRELESS_CORE_H -#define __NET_WIRELESS_CORE_H -#include <linux/mutex.h> -#include <linux/list.h> -#include <linux/netdevice.h> -#include <linux/kref.h> -#include <linux/rbtree.h> -#include <linux/debugfs.h> -#include <linux/rfkill.h> -#include <linux/workqueue.h> -#include <net/genetlink.h> -#include <net/cfg80211.h> -#include "reg.h" - -struct cfg80211_registered_device { - const struct cfg80211_ops *ops; - struct list_head list; - /* we hold this mutex during any call so that - * we cannot do multiple calls at once, and also - * to avoid the deregister call to proceed while - * any call is in progress */ - struct mutex mtx; - - /* rfkill support */ - struct rfkill_ops rfkill_ops; - struct rfkill *rfkill; - struct work_struct rfkill_sync; - - /* ISO / IEC 3166 alpha2 for which this device is receiving - * country IEs on, this can help disregard country IEs from APs - * on the same alpha2 quickly. The alpha2 may differ from - * cfg80211_regdomain's alpha2 when an intersection has occurred. - * If the AP is reconfigured this can also be used to tell us if - * the country on the country IE changed. */ - char country_ie_alpha2[2]; - - /* If a Country IE has been received this tells us the environment - * which its telling us its in. This defaults to ENVIRON_ANY */ - enum environment_cap env; - - /* wiphy index, internal only */ - int wiphy_idx; - - /* associate netdev list */ - struct mutex devlist_mtx; - /* protected by devlist_mtx or RCU */ - struct list_head netdev_list; - int devlist_generation; - int opencount; /* also protected by devlist_mtx */ - wait_queue_head_t dev_wait; - - u32 ap_beacons_nlpid; - - /* BSSes/scanning */ - spinlock_t bss_lock; - struct list_head bss_list; - struct rb_root bss_tree; - u32 bss_generation; - struct cfg80211_scan_request *scan_req; /* protected by RTNL */ - struct cfg80211_sched_scan_request *sched_scan_req; - unsigned long suspend_at; - struct work_struct scan_done_wk; - struct work_struct sched_scan_results_wk; - - struct mutex sched_scan_mtx; - -#ifdef CONFIG_NL80211_TESTMODE - struct genl_info *testmode_info; -#endif - - struct work_struct conn_work; - struct work_struct event_work; - - struct cfg80211_wowlan *wowlan; - - /* must be last because of the way we do wiphy_priv(), - * and it should at least be aligned to NETDEV_ALIGN */ - struct wiphy wiphy __attribute__((__aligned__(NETDEV_ALIGN))); -}; - -static inline -struct cfg80211_registered_device *wiphy_to_dev(struct wiphy *wiphy) -{ - BUG_ON(!wiphy); - return container_of(wiphy, struct cfg80211_registered_device, wiphy); -} - -/* Note 0 is valid, hence phy0 */ -static inline -bool wiphy_idx_valid(int wiphy_idx) -{ - return wiphy_idx >= 0; -} - -static inline void -cfg80211_rdev_free_wowlan(struct cfg80211_registered_device *rdev) -{ - int i; - - if (!rdev->wowlan) - return; - for (i = 0; i < rdev->wowlan->n_patterns; i++) - kfree(rdev->wowlan->patterns[i].mask); - kfree(rdev->wowlan->patterns); - kfree(rdev->wowlan); -} - -extern struct workqueue_struct *cfg80211_wq; -extern struct mutex cfg80211_mutex; -extern struct list_head cfg80211_rdev_list; -extern int cfg80211_rdev_list_generation; - -static inline void assert_cfg80211_lock(void) -{ - lockdep_assert_held(&cfg80211_mutex); -} - -/* - * You can use this to mark a wiphy_idx as not having an associated wiphy. - * It guarantees cfg80211_rdev_by_wiphy_idx(wiphy_idx) will return NULL - */ -#define WIPHY_IDX_STALE -1 - -struct cfg80211_internal_bss { - struct list_head list; - struct rb_node rbn; - unsigned long ts; - struct kref ref; - atomic_t hold; - bool beacon_ies_allocated; - bool proberesp_ies_allocated; - - /* must be last because of priv member */ - struct cfg80211_bss pub; -}; - -static inline struct cfg80211_internal_bss *bss_from_pub(struct cfg80211_bss *pub) -{ - return container_of(pub, struct cfg80211_internal_bss, pub); -} - -static inline void cfg80211_hold_bss(struct cfg80211_internal_bss *bss) -{ - atomic_inc(&bss->hold); -} - -static inline void cfg80211_unhold_bss(struct cfg80211_internal_bss *bss) -{ - int r = atomic_dec_return(&bss->hold); - WARN_ON(r < 0); -} - - -struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx); -int get_wiphy_idx(struct wiphy *wiphy); - -struct cfg80211_registered_device * -__cfg80211_rdev_from_info(struct genl_info *info); - -/* - * This function returns a pointer to the driver - * that the genl_info item that is passed refers to. - * If successful, it returns non-NULL and also locks - * the driver's mutex! - * - * This means that you need to call cfg80211_unlock_rdev() - * before being allowed to acquire &cfg80211_mutex! - * - * This is necessary because we need to lock the global - * mutex to get an item off the list safely, and then - * we lock the rdev mutex so it doesn't go away under us. - * - * We don't want to keep cfg80211_mutex locked - * for all the time in order to allow requests on - * other interfaces to go through at the same time. - * - * The result of this can be a PTR_ERR and hence must - * be checked with IS_ERR() for errors. - */ -extern struct cfg80211_registered_device * -cfg80211_get_dev_from_info(struct genl_info *info); - -/* requires cfg80211_rdev_mutex to be held! */ -struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx); - -/* identical to cfg80211_get_dev_from_info but only operate on ifindex */ -extern struct cfg80211_registered_device * -cfg80211_get_dev_from_ifindex(struct net *net, int ifindex); - -int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, - struct net *net); - -static inline void cfg80211_lock_rdev(struct cfg80211_registered_device *rdev) -{ - mutex_lock(&rdev->mtx); -} - -static inline void cfg80211_unlock_rdev(struct cfg80211_registered_device *rdev) -{ - BUG_ON(IS_ERR(rdev) || !rdev); - mutex_unlock(&rdev->mtx); -} - -static inline void wdev_lock(struct wireless_dev *wdev) - __acquires(wdev) -{ - mutex_lock(&wdev->mtx); - __acquire(wdev->mtx); -} - -static inline void wdev_unlock(struct wireless_dev *wdev) - __releases(wdev) -{ - __release(wdev->mtx); - mutex_unlock(&wdev->mtx); -} - -#define ASSERT_RDEV_LOCK(rdev) lockdep_assert_held(&(rdev)->mtx) -#define ASSERT_WDEV_LOCK(wdev) lockdep_assert_held(&(wdev)->mtx) - -enum cfg80211_event_type { - EVENT_CONNECT_RESULT, - EVENT_ROAMED, - EVENT_DISCONNECTED, - EVENT_IBSS_JOINED, -}; - -struct cfg80211_event { - struct list_head list; - enum cfg80211_event_type type; - - union { - struct { - u8 bssid[ETH_ALEN]; - const u8 *req_ie; - const u8 *resp_ie; - size_t req_ie_len; - size_t resp_ie_len; - u16 status; - } cr; - struct { - const u8 *req_ie; - const u8 *resp_ie; - size_t req_ie_len; - size_t resp_ie_len; - struct cfg80211_bss *bss; - } rm; - struct { - const u8 *ie; - size_t ie_len; - u16 reason; - } dc; - struct { - u8 bssid[ETH_ALEN]; - } ij; - }; -}; - -struct cfg80211_cached_keys { - struct key_params params[6]; - u8 data[6][WLAN_MAX_KEY_LEN]; - int def, defmgmt; -}; - - -/* free object */ -extern void cfg80211_dev_free(struct cfg80211_registered_device *rdev); - -extern int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, - char *newname); - -void ieee80211_set_bitrate_flags(struct wiphy *wiphy); - -void cfg80211_bss_expire(struct cfg80211_registered_device *dev); -void cfg80211_bss_age(struct cfg80211_registered_device *dev, - unsigned long age_secs); - -/* IBSS */ -int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct cfg80211_ibss_params *params, - struct cfg80211_cached_keys *connkeys); -int cfg80211_join_ibss(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct cfg80211_ibss_params *params, - struct cfg80211_cached_keys *connkeys); -void cfg80211_clear_ibss(struct net_device *dev, bool nowext); -int __cfg80211_leave_ibss(struct cfg80211_registered_device *rdev, - struct net_device *dev, bool nowext); -int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev, - struct net_device *dev, bool nowext); -void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid); -int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev); - -/* mesh */ -extern const struct mesh_config default_mesh_config; -extern const struct mesh_setup default_mesh_setup; -int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, - struct net_device *dev, - const struct mesh_setup *setup, - const struct mesh_config *conf); -int cfg80211_join_mesh(struct cfg80211_registered_device *rdev, - struct net_device *dev, - const struct mesh_setup *setup, - const struct mesh_config *conf); -int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, - struct net_device *dev); - -/* MLME */ -int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct ieee80211_channel *chan, - enum nl80211_auth_type auth_type, - const u8 *bssid, - const u8 *ssid, int ssid_len, - const u8 *ie, int ie_len, - const u8 *key, int key_len, int key_idx); -int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, - struct net_device *dev, struct ieee80211_channel *chan, - enum nl80211_auth_type auth_type, const u8 *bssid, - const u8 *ssid, int ssid_len, - const u8 *ie, int ie_len, - const u8 *key, int key_len, int key_idx); -int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct ieee80211_channel *chan, - const u8 *bssid, const u8 *prev_bssid, - const u8 *ssid, int ssid_len, - const u8 *ie, int ie_len, bool use_mfp, - struct cfg80211_crypto_settings *crypt, - u32 assoc_flags, struct ieee80211_ht_cap *ht_capa, - struct ieee80211_ht_cap *ht_capa_mask); -int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev, - struct net_device *dev, struct ieee80211_channel *chan, - const u8 *bssid, const u8 *prev_bssid, - const u8 *ssid, int ssid_len, - const u8 *ie, int ie_len, bool use_mfp, - struct cfg80211_crypto_settings *crypt, - u32 assoc_flags, struct ieee80211_ht_cap *ht_capa, - struct ieee80211_ht_cap *ht_capa_mask); -int __cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev, - struct net_device *dev, const u8 *bssid, - const u8 *ie, int ie_len, u16 reason, - bool local_state_change); -int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev, - struct net_device *dev, const u8 *bssid, - const u8 *ie, int ie_len, u16 reason, - bool local_state_change); -int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev, - struct net_device *dev, const u8 *bssid, - const u8 *ie, int ie_len, u16 reason, - bool local_state_change); -void cfg80211_mlme_down(struct cfg80211_registered_device *rdev, - struct net_device *dev); -void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len, - u16 status, bool wextev, - struct cfg80211_bss *bss); -int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid, - u16 frame_type, const u8 *match_data, - int match_len); -void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid); -void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev); -int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct ieee80211_channel *chan, bool offchan, - enum nl80211_channel_type channel_type, - bool channel_type_valid, unsigned int wait, - const u8 *buf, size_t len, bool no_cck, - bool dont_wait_for_ack, u64 *cookie); -void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa, - const struct ieee80211_ht_cap *ht_capa_mask); - -/* SME */ -int __cfg80211_connect(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct cfg80211_connect_params *connect, - struct cfg80211_cached_keys *connkeys, - const u8 *prev_bssid); -int cfg80211_connect(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct cfg80211_connect_params *connect, - struct cfg80211_cached_keys *connkeys); -int __cfg80211_disconnect(struct cfg80211_registered_device *rdev, - struct net_device *dev, u16 reason, - bool wextev); -int cfg80211_disconnect(struct cfg80211_registered_device *rdev, - struct net_device *dev, u16 reason, - bool wextev); -void __cfg80211_roamed(struct wireless_dev *wdev, - struct cfg80211_bss *bss, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len); -int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev); - -void cfg80211_conn_work(struct work_struct *work); -void cfg80211_sme_failed_assoc(struct wireless_dev *wdev); -bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev); - -/* internal helpers */ -bool cfg80211_supported_cipher_suite(struct wiphy *wiphy, u32 cipher); -int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev, - struct key_params *params, int key_idx, - bool pairwise, const u8 *mac_addr); -void __cfg80211_disconnected(struct net_device *dev, const u8 *ie, - size_t ie_len, u16 reason, bool from_ap); -void cfg80211_sme_scan_done(struct net_device *dev); -void cfg80211_sme_rx_auth(struct net_device *dev, const u8 *buf, size_t len); -void cfg80211_sme_disassoc(struct net_device *dev, - struct cfg80211_internal_bss *bss); -void __cfg80211_scan_done(struct work_struct *wk); -void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak); -void __cfg80211_sched_scan_results(struct work_struct *wk); -int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev, - bool driver_initiated); -void cfg80211_upload_connect_keys(struct wireless_dev *wdev); -int cfg80211_change_iface(struct cfg80211_registered_device *rdev, - struct net_device *dev, enum nl80211_iftype ntype, - u32 *flags, struct vif_params *params); -void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev); - -int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev, - enum nl80211_iftype iftype); - -static inline int -cfg80211_can_add_interface(struct cfg80211_registered_device *rdev, - enum nl80211_iftype iftype) -{ - return cfg80211_can_change_interface(rdev, NULL, iftype); -} - -struct ieee80211_channel * -rdev_freq_to_chan(struct cfg80211_registered_device *rdev, - int freq, enum nl80211_channel_type channel_type); -int cfg80211_set_freq(struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev, int freq, - enum nl80211_channel_type channel_type); - -u16 cfg80211_calculate_bitrate(struct rate_info *rate); - -int ieee80211_get_ratemask(struct ieee80211_supported_band *sband, - const u8 *rates, unsigned int n_rates, - u32 *mask); - -int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev, - u32 beacon_int); - -#ifdef CONFIG_CFG80211_DEVELOPER_WARNINGS -#define CFG80211_DEV_WARN_ON(cond) WARN_ON(cond) -#else -/* - * Trick to enable using it as a condition, - * and also not give a warning when it's - * not used that way. - */ -#define CFG80211_DEV_WARN_ON(cond) ({bool __r = (cond); __r; }) -#endif - -#endif /* __NET_WIRELESS_CORE_H */ diff --git a/openairITS/mac/DOT11/net/wireless/db.txt b/openairITS/mac/DOT11/net/wireless/db.txt deleted file mode 100644 index a2fc3a09ccd..00000000000 --- a/openairITS/mac/DOT11/net/wireless/db.txt +++ /dev/null @@ -1,17 +0,0 @@ -# -# This file is a placeholder to prevent accidental build breakage if someone -# enables CONFIG_CFG80211_INTERNAL_REGDB. Almost no one actually needs to -# enable that build option. -# -# You should be using CRDA instead. It is even better if you use the CRDA -# package provided by your distribution, since they will probably keep it -# up-to-date on your behalf. -# -# If you _really_ intend to use CONFIG_CFG80211_INTERNAL_REGDB then you will -# need to replace this file with one containing appropriately formatted -# regulatory rules that cover the regulatory domains you will be using. Your -# best option is to extract the db.txt file from the wireless-regdb git -# repository: -# -# git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-regdb.git -# diff --git a/openairITS/mac/DOT11/net/wireless/debugfs.c b/openairITS/mac/DOT11/net/wireless/debugfs.c deleted file mode 100644 index 920cabe0461..00000000000 --- a/openairITS/mac/DOT11/net/wireless/debugfs.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * cfg80211 debugfs - * - * Copyright 2009 Luis R. Rodriguez <lrodriguez@atheros.com> - * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/slab.h> -#include "core.h" -#include "debugfs.h" - -#define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...) \ -static ssize_t name## _read(struct file *file, char __user *userbuf, \ - size_t count, loff_t *ppos) \ -{ \ - struct wiphy *wiphy= file->private_data; \ - char buf[buflen]; \ - int res; \ - \ - res = scnprintf(buf, buflen, fmt "\n", ##value); \ - return simple_read_from_buffer(userbuf, count, ppos, buf, res); \ -} \ - \ -static const struct file_operations name## _ops = { \ - .read = name## _read, \ - .open = simple_open, \ - .llseek = generic_file_llseek, \ -}; - -DEBUGFS_READONLY_FILE(rts_threshold, 20, "%d", - wiphy->rts_threshold) -DEBUGFS_READONLY_FILE(fragmentation_threshold, 20, "%d", - wiphy->frag_threshold); -DEBUGFS_READONLY_FILE(short_retry_limit, 20, "%d", - wiphy->retry_short) -DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d", - wiphy->retry_long); - -static int ht_print_chan(struct ieee80211_channel *chan, - char *buf, int buf_size, int offset) -{ - if (WARN_ON(offset > buf_size)) - return 0; - - if (chan->flags & IEEE80211_CHAN_DISABLED) - return snprintf(buf + offset, - buf_size - offset, - "%d Disabled\n", - chan->center_freq); - - return snprintf(buf + offset, - buf_size - offset, - "%d HT40 %c%c\n", - chan->center_freq, - (chan->flags & IEEE80211_CHAN_NO_HT40MINUS) ? ' ' : '-', - (chan->flags & IEEE80211_CHAN_NO_HT40PLUS) ? ' ' : '+'); -} - -static ssize_t ht40allow_map_read(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) -{ - struct wiphy *wiphy = file->private_data; - char *buf; - unsigned int offset = 0, buf_size = PAGE_SIZE, i, r; - enum ieee80211_band band; - struct ieee80211_supported_band *sband; - - buf = kzalloc(buf_size, GFP_KERNEL); - if (!buf) - return -ENOMEM; - - mutex_lock(&cfg80211_mutex); - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - sband = wiphy->bands[band]; - if (!sband) - continue; - for (i = 0; i < sband->n_channels; i++) - offset += ht_print_chan(&sband->channels[i], - buf, buf_size, offset); - } - - mutex_unlock(&cfg80211_mutex); - - r = simple_read_from_buffer(user_buf, count, ppos, buf, offset); - - kfree(buf); - - return r; -} - -static const struct file_operations ht40allow_map_ops = { - .read = ht40allow_map_read, - .open = simple_open, - .llseek = default_llseek, -}; - -#define DEBUGFS_ADD(name) \ - debugfs_create_file(#name, S_IRUGO, phyd, &rdev->wiphy, &name## _ops); - -void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev) -{ - struct dentry *phyd = rdev->wiphy.debugfsdir; - - DEBUGFS_ADD(rts_threshold); - DEBUGFS_ADD(fragmentation_threshold); - DEBUGFS_ADD(short_retry_limit); - DEBUGFS_ADD(long_retry_limit); - DEBUGFS_ADD(ht40allow_map); -} diff --git a/openairITS/mac/DOT11/net/wireless/debugfs.h b/openairITS/mac/DOT11/net/wireless/debugfs.h deleted file mode 100644 index 74fdd381142..00000000000 --- a/openairITS/mac/DOT11/net/wireless/debugfs.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __CFG80211_DEBUGFS_H -#define __CFG80211_DEBUGFS_H - -#ifdef CONFIG_CFG80211_DEBUGFS -void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev); -#else -static inline -void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev) {} -#endif - -#endif /* __CFG80211_DEBUGFS_H */ diff --git a/openairITS/mac/DOT11/net/wireless/ethtool.c b/openairITS/mac/DOT11/net/wireless/ethtool.c deleted file mode 100644 index 9bde4d1d3e9..00000000000 --- a/openairITS/mac/DOT11/net/wireless/ethtool.c +++ /dev/null @@ -1,78 +0,0 @@ -#include <linux/utsname.h> -#include <net/cfg80211.h> -#include "core.h" -#include "ethtool.h" - -static void cfg80211_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - strlcpy(info->driver, wiphy_dev(wdev->wiphy)->driver->name, - sizeof(info->driver)); - - strlcpy(info->version, init_utsname()->release, sizeof(info->version)); - - if (wdev->wiphy->fw_version[0]) - strncpy(info->fw_version, wdev->wiphy->fw_version, - sizeof(info->fw_version)); - else - strncpy(info->fw_version, "N/A", sizeof(info->fw_version)); - - strlcpy(info->bus_info, dev_name(wiphy_dev(wdev->wiphy)), - sizeof(info->bus_info)); -} - -static int cfg80211_get_regs_len(struct net_device *dev) -{ - /* For now, return 0... */ - return 0; -} - -static void cfg80211_get_regs(struct net_device *dev, struct ethtool_regs *regs, - void *data) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - regs->version = wdev->wiphy->hw_version; - regs->len = 0; -} - -static void cfg80211_get_ringparam(struct net_device *dev, - struct ethtool_ringparam *rp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - - memset(rp, 0, sizeof(*rp)); - - if (rdev->ops->get_ringparam) - rdev->ops->get_ringparam(wdev->wiphy, - &rp->tx_pending, &rp->tx_max_pending, - &rp->rx_pending, &rp->rx_max_pending); -} - -static int cfg80211_set_ringparam(struct net_device *dev, - struct ethtool_ringparam *rp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - - if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0) - return -EINVAL; - - if (rdev->ops->set_ringparam) - return rdev->ops->set_ringparam(wdev->wiphy, - rp->tx_pending, rp->rx_pending); - - return -ENOTSUPP; -} - -const struct ethtool_ops cfg80211_ethtool_ops = { - .get_drvinfo = cfg80211_get_drvinfo, - .get_regs_len = cfg80211_get_regs_len, - .get_regs = cfg80211_get_regs, - .get_link = ethtool_op_get_link, - .get_ringparam = cfg80211_get_ringparam, - .set_ringparam = cfg80211_set_ringparam, -}; diff --git a/openairITS/mac/DOT11/net/wireless/ethtool.h b/openairITS/mac/DOT11/net/wireless/ethtool.h deleted file mode 100644 index 695ecad20bd..00000000000 --- a/openairITS/mac/DOT11/net/wireless/ethtool.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __CFG80211_ETHTOOL__ -#define __CFG80211_ETHTOOL__ - -extern const struct ethtool_ops cfg80211_ethtool_ops; - -#endif /* __CFG80211_ETHTOOL__ */ diff --git a/openairITS/mac/DOT11/net/wireless/genregdb.awk b/openairITS/mac/DOT11/net/wireless/genregdb.awk deleted file mode 100644 index 9392f8cbb90..00000000000 --- a/openairITS/mac/DOT11/net/wireless/genregdb.awk +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/awk -f -# -# genregdb.awk -- generate regdb.c from db.txt -# -# Actually, it reads from stdin (presumed to be db.txt) and writes -# to stdout (presumed to be regdb.c), but close enough... -# -# Copyright 2009 John W. Linville <linville@tuxdriver.com> -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -BEGIN { - active = 0 - rules = 0; - print "/*" - print " * DO NOT EDIT -- file generated from data in db.txt" - print " */" - print "" - print "#include <linux/nl80211.h>" - print "#include <net/cfg80211.h>" - print "#include \"regdb.h\"" - print "" - regdb = "const struct ieee80211_regdomain *reg_regdb[] = {\n" -} - -/^[ \t]*#/ { - # Ignore -} - -!active && /^[ \t]*$/ { - # Ignore -} - -!active && /country/ { - country=$2 - sub(/:/, "", country) - printf "static const struct ieee80211_regdomain regdom_%s = {\n", country - printf "\t.alpha2 = \"%s\",\n", country - printf "\t.reg_rules = {\n" - active = 1 - regdb = regdb "\t®dom_" country ",\n" -} - -active && /^[ \t]*\(/ { - start = $1 - sub(/\(/, "", start) - end = $3 - bw = $5 - sub(/\),/, "", bw) - gain = $6 - sub(/\(/, "", gain) - sub(/,/, "", gain) - power = $7 - sub(/\)/, "", power) - sub(/,/, "", power) - # power might be in mW... - units = $8 - sub(/\)/, "", units) - sub(/,/, "", units) - if (units == "mW") { - if (power == 100) { - power = 20 - } else if (power == 200) { - power = 23 - } else if (power == 500) { - power = 27 - } else if (power == 1000) { - power = 30 - } else { - print "Unknown power value in database!" - } - } - flagstr = "" - for (i=8; i<=NF; i++) - flagstr = flagstr $i - split(flagstr, flagarray, ",") - flags = "" - for (arg in flagarray) { - if (flagarray[arg] == "NO-OFDM") { - flags = flags "\n\t\t\tNL80211_RRF_NO_OFDM | " - } else if (flagarray[arg] == "NO-CCK") { - flags = flags "\n\t\t\tNL80211_RRF_NO_CCK | " - } else if (flagarray[arg] == "NO-INDOOR") { - flags = flags "\n\t\t\tNL80211_RRF_NO_INDOOR | " - } else if (flagarray[arg] == "NO-OUTDOOR") { - flags = flags "\n\t\t\tNL80211_RRF_NO_OUTDOOR | " - } else if (flagarray[arg] == "DFS") { - flags = flags "\n\t\t\tNL80211_RRF_DFS | " - } else if (flagarray[arg] == "PTP-ONLY") { - flags = flags "\n\t\t\tNL80211_RRF_PTP_ONLY | " - } else if (flagarray[arg] == "PTMP-ONLY") { - flags = flags "\n\t\t\tNL80211_RRF_PTMP_ONLY | " - } else if (flagarray[arg] == "PASSIVE-SCAN") { - flags = flags "\n\t\t\tNL80211_RRF_PASSIVE_SCAN | " - } else if (flagarray[arg] == "NO-IBSS") { - flags = flags "\n\t\t\tNL80211_RRF_NO_IBSS | " - } - } - flags = flags "0" - printf "\t\tREG_RULE(%d, %d, %d, %d, %d, %s),\n", start, end, bw, gain, power, flags - rules++ -} - -active && /^[ \t]*$/ { - active = 0 - printf "\t},\n" - printf "\t.n_reg_rules = %d\n", rules - printf "};\n\n" - rules = 0; -} - -END { - print regdb "};" - print "" - print "int reg_regdb_size = ARRAY_SIZE(reg_regdb);" -} diff --git a/openairITS/mac/DOT11/net/wireless/ibss.c b/openairITS/mac/DOT11/net/wireless/ibss.c deleted file mode 100644 index 30f20fe4a5f..00000000000 --- a/openairITS/mac/DOT11/net/wireless/ibss.c +++ /dev/null @@ -1,527 +0,0 @@ -/* - * Some IBSS support code for cfg80211. - * - * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> - */ - -#include <linux/etherdevice.h> -#include <linux/if_arp.h> -#include <linux/slab.h> -#include <linux/export.h> -#include <net/cfg80211.h> -#include "wext-compat.h" -#include "nl80211.h" - - -void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_bss *bss; -#ifdef CONFIG_CFG80211_WEXT - union iwreq_data wrqu; -#endif - - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_ADHOC)) - return; - - if (!wdev->ssid_len) - return; - - bss = cfg80211_get_bss(wdev->wiphy, NULL, bssid, - wdev->ssid, wdev->ssid_len, - WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS); - - if (WARN_ON(!bss)) - return; - - if (wdev->current_bss) { - cfg80211_unhold_bss(wdev->current_bss); - cfg80211_put_bss(&wdev->current_bss->pub); - } - - cfg80211_hold_bss(bss_from_pub(bss)); - wdev->current_bss = bss_from_pub(bss); - - cfg80211_upload_connect_keys(wdev); - - nl80211_send_ibss_bssid(wiphy_to_dev(wdev->wiphy), dev, bssid, - GFP_KERNEL); -#ifdef CONFIG_CFG80211_WEXT - memset(&wrqu, 0, sizeof(wrqu)); - memcpy(wrqu.ap_addr.sa_data, bssid, ETH_ALEN); - wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); -#endif -} - -void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct cfg80211_event *ev; - unsigned long flags; - - CFG80211_DEV_WARN_ON(!wdev->ssid_len); - - ev = kzalloc(sizeof(*ev), gfp); - if (!ev) - return; - - ev->type = EVENT_IBSS_JOINED; - memcpy(ev->cr.bssid, bssid, ETH_ALEN); - - spin_lock_irqsave(&wdev->event_lock, flags); - list_add_tail(&ev->list, &wdev->event_list); - spin_unlock_irqrestore(&wdev->event_lock, flags); - queue_work(cfg80211_wq, &rdev->event_work); -} -EXPORT_SYMBOL(cfg80211_ibss_joined); - -int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct cfg80211_ibss_params *params, - struct cfg80211_cached_keys *connkeys) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - ASSERT_WDEV_LOCK(wdev); - - if (wdev->ssid_len) - return -EALREADY; - - if (!params->basic_rates) { - /* - * If no rates were explicitly configured, - * use the mandatory rate set for 11b or - * 11a for maximum compatibility. - */ - struct ieee80211_supported_band *sband = - rdev->wiphy.bands[params->channel->band]; - int j; - u32 flag = params->channel->band == IEEE80211_BAND_5GHZ ? - IEEE80211_RATE_MANDATORY_A : - IEEE80211_RATE_MANDATORY_B; - - for (j = 0; j < sband->n_bitrates; j++) { - if (sband->bitrates[j].flags & flag) - params->basic_rates |= BIT(j); - } - } - - if (WARN_ON(wdev->connect_keys)) - kfree(wdev->connect_keys); - wdev->connect_keys = connkeys; - -#ifdef CONFIG_CFG80211_WEXT - wdev->wext.ibss.channel = params->channel; -#endif - err = rdev->ops->join_ibss(&rdev->wiphy, dev, params); - if (err) { - wdev->connect_keys = NULL; - return err; - } - - memcpy(wdev->ssid, params->ssid, params->ssid_len); - wdev->ssid_len = params->ssid_len; - - return 0; -} - -int cfg80211_join_ibss(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct cfg80211_ibss_params *params, - struct cfg80211_cached_keys *connkeys) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - mutex_lock(&rdev->devlist_mtx); - wdev_lock(wdev); - err = __cfg80211_join_ibss(rdev, dev, params, connkeys); - wdev_unlock(wdev); - mutex_unlock(&rdev->devlist_mtx); - - return err; -} - -static void __cfg80211_clear_ibss(struct net_device *dev, bool nowext) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - int i; - - ASSERT_WDEV_LOCK(wdev); - - kfree(wdev->connect_keys); - wdev->connect_keys = NULL; - - /* - * Delete all the keys ... pairwise keys can't really - * exist any more anyway, but default keys might. - */ - if (rdev->ops->del_key) - for (i = 0; i < 6; i++) - rdev->ops->del_key(wdev->wiphy, dev, i, false, NULL); - - if (wdev->current_bss) { - cfg80211_unhold_bss(wdev->current_bss); - cfg80211_put_bss(&wdev->current_bss->pub); - } - - wdev->current_bss = NULL; - wdev->ssid_len = 0; -#ifdef CONFIG_CFG80211_WEXT - if (!nowext) - wdev->wext.ibss.ssid_len = 0; -#endif -} - -void cfg80211_clear_ibss(struct net_device *dev, bool nowext) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - wdev_lock(wdev); - __cfg80211_clear_ibss(dev, nowext); - wdev_unlock(wdev); -} - -int __cfg80211_leave_ibss(struct cfg80211_registered_device *rdev, - struct net_device *dev, bool nowext) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - ASSERT_WDEV_LOCK(wdev); - - if (!wdev->ssid_len) - return -ENOLINK; - - err = rdev->ops->leave_ibss(&rdev->wiphy, dev); - - if (err) - return err; - - __cfg80211_clear_ibss(dev, nowext); - - return 0; -} - -int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev, - struct net_device *dev, bool nowext) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - wdev_lock(wdev); - err = __cfg80211_leave_ibss(rdev, dev, nowext); - wdev_unlock(wdev); - - return err; -} - -#ifdef CONFIG_CFG80211_WEXT -int cfg80211_ibss_wext_join(struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev) -{ - struct cfg80211_cached_keys *ck = NULL; - enum ieee80211_band band; - int i, err; - - ASSERT_WDEV_LOCK(wdev); - - if (!wdev->wext.ibss.beacon_interval) - wdev->wext.ibss.beacon_interval = 100; - - /* try to find an IBSS channel if none requested ... */ - if (!wdev->wext.ibss.channel) { - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - struct ieee80211_supported_band *sband; - struct ieee80211_channel *chan; - - sband = rdev->wiphy.bands[band]; - if (!sband) - continue; - - for (i = 0; i < sband->n_channels; i++) { - chan = &sband->channels[i]; - if (chan->flags & IEEE80211_CHAN_NO_IBSS) - continue; - if (chan->flags & IEEE80211_CHAN_DISABLED) - continue; - wdev->wext.ibss.channel = chan; - break; - } - - if (wdev->wext.ibss.channel) - break; - } - - if (!wdev->wext.ibss.channel) - return -EINVAL; - } - - /* don't join -- SSID is not there */ - if (!wdev->wext.ibss.ssid_len) - return 0; - - if (!netif_running(wdev->netdev)) - return 0; - - if (wdev->wext.keys) { - wdev->wext.keys->def = wdev->wext.default_key; - wdev->wext.keys->defmgmt = wdev->wext.default_mgmt_key; - } - - wdev->wext.ibss.privacy = wdev->wext.default_key != -1; - - if (wdev->wext.keys) { - ck = kmemdup(wdev->wext.keys, sizeof(*ck), GFP_KERNEL); - if (!ck) - return -ENOMEM; - for (i = 0; i < 6; i++) - ck->params[i].key = ck->data[i]; - } - err = __cfg80211_join_ibss(rdev, wdev->netdev, - &wdev->wext.ibss, ck); - if (err) - kfree(ck); - - return err; -} - -int cfg80211_ibss_wext_siwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *wextfreq, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct ieee80211_channel *chan = NULL; - int err, freq; - - /* call only for ibss! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_ADHOC)) - return -EINVAL; - - if (!rdev->ops->join_ibss) - return -EOPNOTSUPP; - - freq = cfg80211_wext_freq(wdev->wiphy, wextfreq); - if (freq < 0) - return freq; - - if (freq) { - chan = ieee80211_get_channel(wdev->wiphy, freq); - if (!chan) - return -EINVAL; - if (chan->flags & IEEE80211_CHAN_NO_IBSS || - chan->flags & IEEE80211_CHAN_DISABLED) - return -EINVAL; - } - - if (wdev->wext.ibss.channel == chan) - return 0; - - wdev_lock(wdev); - err = 0; - if (wdev->ssid_len) - err = __cfg80211_leave_ibss(rdev, dev, true); - wdev_unlock(wdev); - - if (err) - return err; - - if (chan) { - wdev->wext.ibss.channel = chan; - wdev->wext.ibss.channel_fixed = true; - } else { - /* cfg80211_ibss_wext_join will pick one if needed */ - wdev->wext.ibss.channel_fixed = false; - } - - mutex_lock(&rdev->devlist_mtx); - wdev_lock(wdev); - err = cfg80211_ibss_wext_join(rdev, wdev); - wdev_unlock(wdev); - mutex_unlock(&rdev->devlist_mtx); - - return err; -} - -int cfg80211_ibss_wext_giwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct ieee80211_channel *chan = NULL; - - /* call only for ibss! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_ADHOC)) - return -EINVAL; - - wdev_lock(wdev); - if (wdev->current_bss) - chan = wdev->current_bss->pub.channel; - else if (wdev->wext.ibss.channel) - chan = wdev->wext.ibss.channel; - wdev_unlock(wdev); - - if (chan) { - freq->m = chan->center_freq; - freq->e = 6; - return 0; - } - - /* no channel if not joining */ - return -EINVAL; -} - -int cfg80211_ibss_wext_siwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - size_t len = data->length; - int err; - - /* call only for ibss! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_ADHOC)) - return -EINVAL; - - if (!rdev->ops->join_ibss) - return -EOPNOTSUPP; - - wdev_lock(wdev); - err = 0; - if (wdev->ssid_len) - err = __cfg80211_leave_ibss(rdev, dev, true); - wdev_unlock(wdev); - - if (err) - return err; - - /* iwconfig uses nul termination in SSID.. */ - if (len > 0 && ssid[len - 1] == '\0') - len--; - - wdev->wext.ibss.ssid = wdev->ssid; - memcpy(wdev->wext.ibss.ssid, ssid, len); - wdev->wext.ibss.ssid_len = len; - - mutex_lock(&rdev->devlist_mtx); - wdev_lock(wdev); - err = cfg80211_ibss_wext_join(rdev, wdev); - wdev_unlock(wdev); - mutex_unlock(&rdev->devlist_mtx); - - return err; -} - -int cfg80211_ibss_wext_giwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - /* call only for ibss! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_ADHOC)) - return -EINVAL; - - data->flags = 0; - - wdev_lock(wdev); - if (wdev->ssid_len) { - data->flags = 1; - data->length = wdev->ssid_len; - memcpy(ssid, wdev->ssid, data->length); - } else if (wdev->wext.ibss.ssid && wdev->wext.ibss.ssid_len) { - data->flags = 1; - data->length = wdev->wext.ibss.ssid_len; - memcpy(ssid, wdev->wext.ibss.ssid, data->length); - } - wdev_unlock(wdev); - - return 0; -} - -int cfg80211_ibss_wext_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - u8 *bssid = ap_addr->sa_data; - int err; - - /* call only for ibss! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_ADHOC)) - return -EINVAL; - - if (!rdev->ops->join_ibss) - return -EOPNOTSUPP; - - if (ap_addr->sa_family != ARPHRD_ETHER) - return -EINVAL; - - /* automatic mode */ - if (is_zero_ether_addr(bssid) || is_broadcast_ether_addr(bssid)) - bssid = NULL; - - /* both automatic */ - if (!bssid && !wdev->wext.ibss.bssid) - return 0; - - /* fixed already - and no change */ - if (wdev->wext.ibss.bssid && bssid && - compare_ether_addr(bssid, wdev->wext.ibss.bssid) == 0) - return 0; - - wdev_lock(wdev); - err = 0; - if (wdev->ssid_len) - err = __cfg80211_leave_ibss(rdev, dev, true); - wdev_unlock(wdev); - - if (err) - return err; - - if (bssid) { - memcpy(wdev->wext.bssid, bssid, ETH_ALEN); - wdev->wext.ibss.bssid = wdev->wext.bssid; - } else - wdev->wext.ibss.bssid = NULL; - - mutex_lock(&rdev->devlist_mtx); - wdev_lock(wdev); - err = cfg80211_ibss_wext_join(rdev, wdev); - wdev_unlock(wdev); - mutex_unlock(&rdev->devlist_mtx); - - return err; -} - -int cfg80211_ibss_wext_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - /* call only for ibss! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_ADHOC)) - return -EINVAL; - - ap_addr->sa_family = ARPHRD_ETHER; - - wdev_lock(wdev); - if (wdev->current_bss) - memcpy(ap_addr->sa_data, wdev->current_bss->pub.bssid, ETH_ALEN); - else if (wdev->wext.ibss.bssid) - memcpy(ap_addr->sa_data, wdev->wext.ibss.bssid, ETH_ALEN); - else - memset(ap_addr->sa_data, 0, ETH_ALEN); - - wdev_unlock(wdev); - - return 0; -} -#endif diff --git a/openairITS/mac/DOT11/net/wireless/lib80211.c b/openairITS/mac/DOT11/net/wireless/lib80211.c deleted file mode 100644 index 5451fa4e904..00000000000 --- a/openairITS/mac/DOT11/net/wireless/lib80211.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * lib80211 -- common bits for IEEE802.11 drivers - * - * Copyright(c) 2008 John W. Linville <linville@tuxdriver.com> - * - * Portions copied from old ieee80211 component, w/ original copyright - * notices below: - * - * Host AP crypto routines - * - * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi> - * Portions Copyright (C) 2004, Intel Corporation <jketreno@linux.intel.com> - * - */ - -#undef pr_fmt -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include <linux/kernel.h> -#include <linux/printk.h> -#include <linux/module.h> -#include <linux/ctype.h> -#include <linux/ieee80211.h> -#include <linux/errno.h> -#include <linux/init.h> -#include <linux/slab.h> -#include <linux/string.h> - -#include <net/lib80211.h> - -#define DRV_NAME "lib80211" - -#define DRV_DESCRIPTION "common routines for IEEE802.11 drivers" - -MODULE_DESCRIPTION(DRV_DESCRIPTION); -MODULE_AUTHOR("John W. Linville <linville@tuxdriver.com>"); -MODULE_LICENSE("GPL"); - -struct lib80211_crypto_alg { - struct list_head list; - struct lib80211_crypto_ops *ops; -}; - -static LIST_HEAD(lib80211_crypto_algs); -static DEFINE_SPINLOCK(lib80211_crypto_lock); - -static void lib80211_crypt_deinit_entries(struct lib80211_crypt_info *info, - int force); -static void lib80211_crypt_quiescing(struct lib80211_crypt_info *info); -static void lib80211_crypt_deinit_handler(unsigned long data); - -const char *print_ssid(char *buf, const char *ssid, u8 ssid_len) -{ - const char *s = ssid; - char *d = buf; - - ssid_len = min_t(u8, ssid_len, IEEE80211_MAX_SSID_LEN); - while (ssid_len--) { - if (isprint(*s)) { - *d++ = *s++; - continue; - } - - *d++ = '\\'; - if (*s == '\0') - *d++ = '0'; - else if (*s == '\n') - *d++ = 'n'; - else if (*s == '\r') - *d++ = 'r'; - else if (*s == '\t') - *d++ = 't'; - else if (*s == '\\') - *d++ = '\\'; - else - d += snprintf(d, 3, "%03o", *s); - s++; - } - *d = '\0'; - return buf; -} -EXPORT_SYMBOL(print_ssid); - -int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name, - spinlock_t *lock) -{ - memset(info, 0, sizeof(*info)); - - info->name = name; - info->lock = lock; - - INIT_LIST_HEAD(&info->crypt_deinit_list); - setup_timer(&info->crypt_deinit_timer, lib80211_crypt_deinit_handler, - (unsigned long)info); - - return 0; -} -EXPORT_SYMBOL(lib80211_crypt_info_init); - -void lib80211_crypt_info_free(struct lib80211_crypt_info *info) -{ - int i; - - lib80211_crypt_quiescing(info); - del_timer_sync(&info->crypt_deinit_timer); - lib80211_crypt_deinit_entries(info, 1); - - for (i = 0; i < NUM_WEP_KEYS; i++) { - struct lib80211_crypt_data *crypt = info->crypt[i]; - if (crypt) { - if (crypt->ops) { - crypt->ops->deinit(crypt->priv); - module_put(crypt->ops->owner); - } - kfree(crypt); - info->crypt[i] = NULL; - } - } -} -EXPORT_SYMBOL(lib80211_crypt_info_free); - -static void lib80211_crypt_deinit_entries(struct lib80211_crypt_info *info, - int force) -{ - struct lib80211_crypt_data *entry, *next; - unsigned long flags; - - spin_lock_irqsave(info->lock, flags); - list_for_each_entry_safe(entry, next, &info->crypt_deinit_list, list) { - if (atomic_read(&entry->refcnt) != 0 && !force) - continue; - - list_del(&entry->list); - - if (entry->ops) { - entry->ops->deinit(entry->priv); - module_put(entry->ops->owner); - } - kfree(entry); - } - spin_unlock_irqrestore(info->lock, flags); -} - -/* After this, crypt_deinit_list won't accept new members */ -static void lib80211_crypt_quiescing(struct lib80211_crypt_info *info) -{ - unsigned long flags; - - spin_lock_irqsave(info->lock, flags); - info->crypt_quiesced = 1; - spin_unlock_irqrestore(info->lock, flags); -} - -static void lib80211_crypt_deinit_handler(unsigned long data) -{ - struct lib80211_crypt_info *info = (struct lib80211_crypt_info *)data; - unsigned long flags; - - lib80211_crypt_deinit_entries(info, 0); - - spin_lock_irqsave(info->lock, flags); - if (!list_empty(&info->crypt_deinit_list) && !info->crypt_quiesced) { - printk(KERN_DEBUG "%s: entries remaining in delayed crypt " - "deletion list\n", info->name); - info->crypt_deinit_timer.expires = jiffies + HZ; - add_timer(&info->crypt_deinit_timer); - } - spin_unlock_irqrestore(info->lock, flags); -} - -void lib80211_crypt_delayed_deinit(struct lib80211_crypt_info *info, - struct lib80211_crypt_data **crypt) -{ - struct lib80211_crypt_data *tmp; - unsigned long flags; - - if (*crypt == NULL) - return; - - tmp = *crypt; - *crypt = NULL; - - /* must not run ops->deinit() while there may be pending encrypt or - * decrypt operations. Use a list of delayed deinits to avoid needing - * locking. */ - - spin_lock_irqsave(info->lock, flags); - if (!info->crypt_quiesced) { - list_add(&tmp->list, &info->crypt_deinit_list); - if (!timer_pending(&info->crypt_deinit_timer)) { - info->crypt_deinit_timer.expires = jiffies + HZ; - add_timer(&info->crypt_deinit_timer); - } - } - spin_unlock_irqrestore(info->lock, flags); -} -EXPORT_SYMBOL(lib80211_crypt_delayed_deinit); - -int lib80211_register_crypto_ops(struct lib80211_crypto_ops *ops) -{ - unsigned long flags; - struct lib80211_crypto_alg *alg; - - alg = kzalloc(sizeof(*alg), GFP_KERNEL); - if (alg == NULL) - return -ENOMEM; - - alg->ops = ops; - - spin_lock_irqsave(&lib80211_crypto_lock, flags); - list_add(&alg->list, &lib80211_crypto_algs); - spin_unlock_irqrestore(&lib80211_crypto_lock, flags); - - printk(KERN_DEBUG "lib80211_crypt: registered algorithm '%s'\n", - ops->name); - - return 0; -} -EXPORT_SYMBOL(lib80211_register_crypto_ops); - -int lib80211_unregister_crypto_ops(struct lib80211_crypto_ops *ops) -{ - struct lib80211_crypto_alg *alg; - unsigned long flags; - - spin_lock_irqsave(&lib80211_crypto_lock, flags); - list_for_each_entry(alg, &lib80211_crypto_algs, list) { - if (alg->ops == ops) - goto found; - } - spin_unlock_irqrestore(&lib80211_crypto_lock, flags); - return -EINVAL; - - found: - printk(KERN_DEBUG "lib80211_crypt: unregistered algorithm '%s'\n", - ops->name); - list_del(&alg->list); - spin_unlock_irqrestore(&lib80211_crypto_lock, flags); - kfree(alg); - return 0; -} -EXPORT_SYMBOL(lib80211_unregister_crypto_ops); - -struct lib80211_crypto_ops *lib80211_get_crypto_ops(const char *name) -{ - struct lib80211_crypto_alg *alg; - unsigned long flags; - - spin_lock_irqsave(&lib80211_crypto_lock, flags); - list_for_each_entry(alg, &lib80211_crypto_algs, list) { - if (strcmp(alg->ops->name, name) == 0) - goto found; - } - spin_unlock_irqrestore(&lib80211_crypto_lock, flags); - return NULL; - - found: - spin_unlock_irqrestore(&lib80211_crypto_lock, flags); - return alg->ops; -} -EXPORT_SYMBOL(lib80211_get_crypto_ops); - -static void *lib80211_crypt_null_init(int keyidx) -{ - return (void *)1; -} - -static void lib80211_crypt_null_deinit(void *priv) -{ -} - -static struct lib80211_crypto_ops lib80211_crypt_null = { - .name = "NULL", - .init = lib80211_crypt_null_init, - .deinit = lib80211_crypt_null_deinit, - .owner = THIS_MODULE, -}; - -static int __init lib80211_init(void) -{ - pr_info(DRV_DESCRIPTION "\n"); - return lib80211_register_crypto_ops(&lib80211_crypt_null); -} - -static void __exit lib80211_exit(void) -{ - lib80211_unregister_crypto_ops(&lib80211_crypt_null); - BUG_ON(!list_empty(&lib80211_crypto_algs)); -} - -module_init(lib80211_init); -module_exit(lib80211_exit); diff --git a/openairITS/mac/DOT11/net/wireless/lib80211_crypt_ccmp.c b/openairITS/mac/DOT11/net/wireless/lib80211_crypt_ccmp.c deleted file mode 100644 index 755738d26bb..00000000000 --- a/openairITS/mac/DOT11/net/wireless/lib80211_crypt_ccmp.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - * lib80211 crypt: host-based CCMP encryption implementation for lib80211 - * - * Copyright (c) 2003-2004, Jouni Malinen <j@w1.fi> - * Copyright (c) 2008, John W. Linville <linville@tuxdriver.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. - */ - -#include <linux/kernel.h> -#include <linux/err.h> -#include <linux/module.h> -#include <linux/init.h> -#include <linux/slab.h> -#include <linux/random.h> -#include <linux/skbuff.h> -#include <linux/netdevice.h> -#include <linux/if_ether.h> -#include <linux/if_arp.h> -#include <asm/string.h> -#include <linux/wireless.h> - -#include <linux/ieee80211.h> - -#include <linux/crypto.h> - -#include <net/lib80211.h> - -MODULE_AUTHOR("Jouni Malinen"); -MODULE_DESCRIPTION("Host AP crypt: CCMP"); -MODULE_LICENSE("GPL"); - -#define AES_BLOCK_LEN 16 -#define CCMP_HDR_LEN 8 -#define CCMP_MIC_LEN 8 -#define CCMP_TK_LEN 16 -#define CCMP_PN_LEN 6 - -struct lib80211_ccmp_data { - u8 key[CCMP_TK_LEN]; - int key_set; - - u8 tx_pn[CCMP_PN_LEN]; - u8 rx_pn[CCMP_PN_LEN]; - - u32 dot11RSNAStatsCCMPFormatErrors; - u32 dot11RSNAStatsCCMPReplays; - u32 dot11RSNAStatsCCMPDecryptErrors; - - int key_idx; - - struct crypto_cipher *tfm; - - /* scratch buffers for virt_to_page() (crypto API) */ - u8 tx_b0[AES_BLOCK_LEN], tx_b[AES_BLOCK_LEN], - tx_e[AES_BLOCK_LEN], tx_s0[AES_BLOCK_LEN]; - u8 rx_b0[AES_BLOCK_LEN], rx_b[AES_BLOCK_LEN], rx_a[AES_BLOCK_LEN]; -}; - -static inline void lib80211_ccmp_aes_encrypt(struct crypto_cipher *tfm, - const u8 pt[16], u8 ct[16]) -{ - crypto_cipher_encrypt_one(tfm, ct, pt); -} - -static void *lib80211_ccmp_init(int key_idx) -{ - struct lib80211_ccmp_data *priv; - - priv = kzalloc(sizeof(*priv), GFP_ATOMIC); - if (priv == NULL) - goto fail; - priv->key_idx = key_idx; - - priv->tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->tfm)) { - priv->tfm = NULL; - goto fail; - } - - return priv; - - fail: - if (priv) { - if (priv->tfm) - crypto_free_cipher(priv->tfm); - kfree(priv); - } - - return NULL; -} - -static void lib80211_ccmp_deinit(void *priv) -{ - struct lib80211_ccmp_data *_priv = priv; - if (_priv && _priv->tfm) - crypto_free_cipher(_priv->tfm); - kfree(priv); -} - -static inline void xor_block(u8 * b, u8 * a, size_t len) -{ - int i; - for (i = 0; i < len; i++) - b[i] ^= a[i]; -} - -static void ccmp_init_blocks(struct crypto_cipher *tfm, - struct ieee80211_hdr *hdr, - u8 * pn, size_t dlen, u8 * b0, u8 * auth, u8 * s0) -{ - u8 *pos, qc = 0; - size_t aad_len; - int a4_included, qc_included; - u8 aad[2 * AES_BLOCK_LEN]; - - a4_included = ieee80211_has_a4(hdr->frame_control); - qc_included = ieee80211_is_data_qos(hdr->frame_control); - - aad_len = 22; - if (a4_included) - aad_len += 6; - if (qc_included) { - pos = (u8 *) & hdr->addr4; - if (a4_included) - pos += 6; - qc = *pos & 0x0f; - aad_len += 2; - } - - /* CCM Initial Block: - * Flag (Include authentication header, M=3 (8-octet MIC), - * L=1 (2-octet Dlen)) - * Nonce: 0x00 | A2 | PN - * Dlen */ - b0[0] = 0x59; - b0[1] = qc; - memcpy(b0 + 2, hdr->addr2, ETH_ALEN); - memcpy(b0 + 8, pn, CCMP_PN_LEN); - b0[14] = (dlen >> 8) & 0xff; - b0[15] = dlen & 0xff; - - /* AAD: - * FC with bits 4..6 and 11..13 masked to zero; 14 is always one - * A1 | A2 | A3 - * SC with bits 4..15 (seq#) masked to zero - * A4 (if present) - * QC (if present) - */ - pos = (u8 *) hdr; - aad[0] = 0; /* aad_len >> 8 */ - aad[1] = aad_len & 0xff; - aad[2] = pos[0] & 0x8f; - aad[3] = pos[1] & 0xc7; - memcpy(aad + 4, hdr->addr1, 3 * ETH_ALEN); - pos = (u8 *) & hdr->seq_ctrl; - aad[22] = pos[0] & 0x0f; - aad[23] = 0; /* all bits masked */ - memset(aad + 24, 0, 8); - if (a4_included) - memcpy(aad + 24, hdr->addr4, ETH_ALEN); - if (qc_included) { - aad[a4_included ? 30 : 24] = qc; - /* rest of QC masked */ - } - - /* Start with the first block and AAD */ - lib80211_ccmp_aes_encrypt(tfm, b0, auth); - xor_block(auth, aad, AES_BLOCK_LEN); - lib80211_ccmp_aes_encrypt(tfm, auth, auth); - xor_block(auth, &aad[AES_BLOCK_LEN], AES_BLOCK_LEN); - lib80211_ccmp_aes_encrypt(tfm, auth, auth); - b0[0] &= 0x07; - b0[14] = b0[15] = 0; - lib80211_ccmp_aes_encrypt(tfm, b0, s0); -} - -static int lib80211_ccmp_hdr(struct sk_buff *skb, int hdr_len, - u8 *aeskey, int keylen, void *priv) -{ - struct lib80211_ccmp_data *key = priv; - int i; - u8 *pos; - - if (skb_headroom(skb) < CCMP_HDR_LEN || skb->len < hdr_len) - return -1; - - if (aeskey != NULL && keylen >= CCMP_TK_LEN) - memcpy(aeskey, key->key, CCMP_TK_LEN); - - pos = skb_push(skb, CCMP_HDR_LEN); - memmove(pos, pos + CCMP_HDR_LEN, hdr_len); - pos += hdr_len; - - i = CCMP_PN_LEN - 1; - while (i >= 0) { - key->tx_pn[i]++; - if (key->tx_pn[i] != 0) - break; - i--; - } - - *pos++ = key->tx_pn[5]; - *pos++ = key->tx_pn[4]; - *pos++ = 0; - *pos++ = (key->key_idx << 6) | (1 << 5) /* Ext IV included */ ; - *pos++ = key->tx_pn[3]; - *pos++ = key->tx_pn[2]; - *pos++ = key->tx_pn[1]; - *pos++ = key->tx_pn[0]; - - return CCMP_HDR_LEN; -} - -static int lib80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) -{ - struct lib80211_ccmp_data *key = priv; - int data_len, i, blocks, last, len; - u8 *pos, *mic; - struct ieee80211_hdr *hdr; - u8 *b0 = key->tx_b0; - u8 *b = key->tx_b; - u8 *e = key->tx_e; - u8 *s0 = key->tx_s0; - - if (skb_tailroom(skb) < CCMP_MIC_LEN || skb->len < hdr_len) - return -1; - - data_len = skb->len - hdr_len; - len = lib80211_ccmp_hdr(skb, hdr_len, NULL, 0, priv); - if (len < 0) - return -1; - - pos = skb->data + hdr_len + CCMP_HDR_LEN; - hdr = (struct ieee80211_hdr *)skb->data; - ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); - - blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); - last = data_len % AES_BLOCK_LEN; - - for (i = 1; i <= blocks; i++) { - len = (i == blocks && last) ? last : AES_BLOCK_LEN; - /* Authentication */ - xor_block(b, pos, len); - lib80211_ccmp_aes_encrypt(key->tfm, b, b); - /* Encryption, with counter */ - b0[14] = (i >> 8) & 0xff; - b0[15] = i & 0xff; - lib80211_ccmp_aes_encrypt(key->tfm, b0, e); - xor_block(pos, e, len); - pos += len; - } - - mic = skb_put(skb, CCMP_MIC_LEN); - for (i = 0; i < CCMP_MIC_LEN; i++) - mic[i] = b[i] ^ s0[i]; - - return 0; -} - -/* - * deal with seq counter wrapping correctly. - * refer to timer_after() for jiffies wrapping handling - */ -static inline int ccmp_replay_check(u8 *pn_n, u8 *pn_o) -{ - u32 iv32_n, iv16_n; - u32 iv32_o, iv16_o; - - iv32_n = (pn_n[0] << 24) | (pn_n[1] << 16) | (pn_n[2] << 8) | pn_n[3]; - iv16_n = (pn_n[4] << 8) | pn_n[5]; - - iv32_o = (pn_o[0] << 24) | (pn_o[1] << 16) | (pn_o[2] << 8) | pn_o[3]; - iv16_o = (pn_o[4] << 8) | pn_o[5]; - - if ((s32)iv32_n - (s32)iv32_o < 0 || - (iv32_n == iv32_o && iv16_n <= iv16_o)) - return 1; - return 0; -} - -static int lib80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) -{ - struct lib80211_ccmp_data *key = priv; - u8 keyidx, *pos; - struct ieee80211_hdr *hdr; - u8 *b0 = key->rx_b0; - u8 *b = key->rx_b; - u8 *a = key->rx_a; - u8 pn[6]; - int i, blocks, last, len; - size_t data_len = skb->len - hdr_len - CCMP_HDR_LEN - CCMP_MIC_LEN; - u8 *mic = skb->data + skb->len - CCMP_MIC_LEN; - - if (skb->len < hdr_len + CCMP_HDR_LEN + CCMP_MIC_LEN) { - key->dot11RSNAStatsCCMPFormatErrors++; - return -1; - } - - hdr = (struct ieee80211_hdr *)skb->data; - pos = skb->data + hdr_len; - keyidx = pos[3]; - if (!(keyidx & (1 << 5))) { - if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: received packet without ExtIV" - " flag from %pM\n", hdr->addr2); - } - key->dot11RSNAStatsCCMPFormatErrors++; - return -2; - } - keyidx >>= 6; - if (key->key_idx != keyidx) { - printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame " - "keyidx=%d priv=%p\n", key->key_idx, keyidx, priv); - return -6; - } - if (!key->key_set) { - if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: received packet from %pM" - " with keyid=%d that does not have a configured" - " key\n", hdr->addr2, keyidx); - } - return -3; - } - - pn[0] = pos[7]; - pn[1] = pos[6]; - pn[2] = pos[5]; - pn[3] = pos[4]; - pn[4] = pos[1]; - pn[5] = pos[0]; - pos += 8; - - if (ccmp_replay_check(pn, key->rx_pn)) { -#ifdef CONFIG_LIB80211_DEBUG - if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: replay detected: STA=%pM " - "previous PN %02x%02x%02x%02x%02x%02x " - "received PN %02x%02x%02x%02x%02x%02x\n", - hdr->addr2, - key->rx_pn[0], key->rx_pn[1], key->rx_pn[2], - key->rx_pn[3], key->rx_pn[4], key->rx_pn[5], - pn[0], pn[1], pn[2], pn[3], pn[4], pn[5]); - } -#endif - key->dot11RSNAStatsCCMPReplays++; - return -4; - } - - ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); - xor_block(mic, b, CCMP_MIC_LEN); - - blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); - last = data_len % AES_BLOCK_LEN; - - for (i = 1; i <= blocks; i++) { - len = (i == blocks && last) ? last : AES_BLOCK_LEN; - /* Decrypt, with counter */ - b0[14] = (i >> 8) & 0xff; - b0[15] = i & 0xff; - lib80211_ccmp_aes_encrypt(key->tfm, b0, b); - xor_block(pos, b, len); - /* Authentication */ - xor_block(a, pos, len); - lib80211_ccmp_aes_encrypt(key->tfm, a, a); - pos += len; - } - - if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { - if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: decrypt failed: STA=" - "%pM\n", hdr->addr2); - } - key->dot11RSNAStatsCCMPDecryptErrors++; - return -5; - } - - memcpy(key->rx_pn, pn, CCMP_PN_LEN); - - /* Remove hdr and MIC */ - memmove(skb->data + CCMP_HDR_LEN, skb->data, hdr_len); - skb_pull(skb, CCMP_HDR_LEN); - skb_trim(skb, skb->len - CCMP_MIC_LEN); - - return keyidx; -} - -static int lib80211_ccmp_set_key(void *key, int len, u8 * seq, void *priv) -{ - struct lib80211_ccmp_data *data = priv; - int keyidx; - struct crypto_cipher *tfm = data->tfm; - - keyidx = data->key_idx; - memset(data, 0, sizeof(*data)); - data->key_idx = keyidx; - data->tfm = tfm; - if (len == CCMP_TK_LEN) { - memcpy(data->key, key, CCMP_TK_LEN); - data->key_set = 1; - if (seq) { - data->rx_pn[0] = seq[5]; - data->rx_pn[1] = seq[4]; - data->rx_pn[2] = seq[3]; - data->rx_pn[3] = seq[2]; - data->rx_pn[4] = seq[1]; - data->rx_pn[5] = seq[0]; - } - crypto_cipher_setkey(data->tfm, data->key, CCMP_TK_LEN); - } else if (len == 0) - data->key_set = 0; - else - return -1; - - return 0; -} - -static int lib80211_ccmp_get_key(void *key, int len, u8 * seq, void *priv) -{ - struct lib80211_ccmp_data *data = priv; - - if (len < CCMP_TK_LEN) - return -1; - - if (!data->key_set) - return 0; - memcpy(key, data->key, CCMP_TK_LEN); - - if (seq) { - seq[0] = data->tx_pn[5]; - seq[1] = data->tx_pn[4]; - seq[2] = data->tx_pn[3]; - seq[3] = data->tx_pn[2]; - seq[4] = data->tx_pn[1]; - seq[5] = data->tx_pn[0]; - } - - return CCMP_TK_LEN; -} - -static char *lib80211_ccmp_print_stats(char *p, void *priv) -{ - struct lib80211_ccmp_data *ccmp = priv; - - p += sprintf(p, "key[%d] alg=CCMP key_set=%d " - "tx_pn=%02x%02x%02x%02x%02x%02x " - "rx_pn=%02x%02x%02x%02x%02x%02x " - "format_errors=%d replays=%d decrypt_errors=%d\n", - ccmp->key_idx, ccmp->key_set, - ccmp->tx_pn[0], ccmp->tx_pn[1], ccmp->tx_pn[2], - ccmp->tx_pn[3], ccmp->tx_pn[4], ccmp->tx_pn[5], - ccmp->rx_pn[0], ccmp->rx_pn[1], ccmp->rx_pn[2], - ccmp->rx_pn[3], ccmp->rx_pn[4], ccmp->rx_pn[5], - ccmp->dot11RSNAStatsCCMPFormatErrors, - ccmp->dot11RSNAStatsCCMPReplays, - ccmp->dot11RSNAStatsCCMPDecryptErrors); - - return p; -} - -static struct lib80211_crypto_ops lib80211_crypt_ccmp = { - .name = "CCMP", - .init = lib80211_ccmp_init, - .deinit = lib80211_ccmp_deinit, - .encrypt_mpdu = lib80211_ccmp_encrypt, - .decrypt_mpdu = lib80211_ccmp_decrypt, - .encrypt_msdu = NULL, - .decrypt_msdu = NULL, - .set_key = lib80211_ccmp_set_key, - .get_key = lib80211_ccmp_get_key, - .print_stats = lib80211_ccmp_print_stats, - .extra_mpdu_prefix_len = CCMP_HDR_LEN, - .extra_mpdu_postfix_len = CCMP_MIC_LEN, - .owner = THIS_MODULE, -}; - -static int __init lib80211_crypto_ccmp_init(void) -{ - return lib80211_register_crypto_ops(&lib80211_crypt_ccmp); -} - -static void __exit lib80211_crypto_ccmp_exit(void) -{ - lib80211_unregister_crypto_ops(&lib80211_crypt_ccmp); -} - -module_init(lib80211_crypto_ccmp_init); -module_exit(lib80211_crypto_ccmp_exit); diff --git a/openairITS/mac/DOT11/net/wireless/lib80211_crypt_tkip.c b/openairITS/mac/DOT11/net/wireless/lib80211_crypt_tkip.c deleted file mode 100644 index 0b5be8c660b..00000000000 --- a/openairITS/mac/DOT11/net/wireless/lib80211_crypt_tkip.c +++ /dev/null @@ -1,783 +0,0 @@ -/* - * lib80211 crypt: host-based TKIP encryption implementation for lib80211 - * - * Copyright (c) 2003-2004, Jouni Malinen <j@w1.fi> - * Copyright (c) 2008, John W. Linville <linville@tuxdriver.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. - */ - -#undef pr_fmt -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include <linux/kernel.h> -#include <linux/printk.h> -#include <linux/err.h> -#include <linux/module.h> -#include <linux/init.h> -#include <linux/slab.h> -#include <linux/random.h> -#include <linux/scatterlist.h> -#include <linux/skbuff.h> -#include <linux/netdevice.h> -#include <linux/mm.h> -#include <linux/if_ether.h> -#include <linux/if_arp.h> -#include <asm/string.h> - -#include <linux/wireless.h> -#include <linux/ieee80211.h> -#include <net/iw_handler.h> - -#include <linux/crypto.h> -#include <linux/crc32.h> - -#include <net/lib80211.h> - -MODULE_AUTHOR("Jouni Malinen"); -MODULE_DESCRIPTION("lib80211 crypt: TKIP"); -MODULE_LICENSE("GPL"); - -#define TKIP_HDR_LEN 8 - -struct lib80211_tkip_data { -#define TKIP_KEY_LEN 32 - u8 key[TKIP_KEY_LEN]; - int key_set; - - u32 tx_iv32; - u16 tx_iv16; - u16 tx_ttak[5]; - int tx_phase1_done; - - u32 rx_iv32; - u16 rx_iv16; - u16 rx_ttak[5]; - int rx_phase1_done; - u32 rx_iv32_new; - u16 rx_iv16_new; - - u32 dot11RSNAStatsTKIPReplays; - u32 dot11RSNAStatsTKIPICVErrors; - u32 dot11RSNAStatsTKIPLocalMICFailures; - - int key_idx; - - struct crypto_blkcipher *rx_tfm_arc4; - struct crypto_hash *rx_tfm_michael; - struct crypto_blkcipher *tx_tfm_arc4; - struct crypto_hash *tx_tfm_michael; - - /* scratch buffers for virt_to_page() (crypto API) */ - u8 rx_hdr[16], tx_hdr[16]; - - unsigned long flags; -}; - -static unsigned long lib80211_tkip_set_flags(unsigned long flags, void *priv) -{ - struct lib80211_tkip_data *_priv = priv; - unsigned long old_flags = _priv->flags; - _priv->flags = flags; - return old_flags; -} - -static unsigned long lib80211_tkip_get_flags(void *priv) -{ - struct lib80211_tkip_data *_priv = priv; - return _priv->flags; -} - -static void *lib80211_tkip_init(int key_idx) -{ - struct lib80211_tkip_data *priv; - - priv = kzalloc(sizeof(*priv), GFP_ATOMIC); - if (priv == NULL) - goto fail; - - priv->key_idx = key_idx; - - priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, - CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->tx_tfm_arc4)) { - priv->tx_tfm_arc4 = NULL; - goto fail; - } - - priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, - CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->tx_tfm_michael)) { - priv->tx_tfm_michael = NULL; - goto fail; - } - - priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, - CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->rx_tfm_arc4)) { - priv->rx_tfm_arc4 = NULL; - goto fail; - } - - priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, - CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->rx_tfm_michael)) { - priv->rx_tfm_michael = NULL; - goto fail; - } - - return priv; - - fail: - if (priv) { - if (priv->tx_tfm_michael) - crypto_free_hash(priv->tx_tfm_michael); - if (priv->tx_tfm_arc4) - crypto_free_blkcipher(priv->tx_tfm_arc4); - if (priv->rx_tfm_michael) - crypto_free_hash(priv->rx_tfm_michael); - if (priv->rx_tfm_arc4) - crypto_free_blkcipher(priv->rx_tfm_arc4); - kfree(priv); - } - - return NULL; -} - -static void lib80211_tkip_deinit(void *priv) -{ - struct lib80211_tkip_data *_priv = priv; - if (_priv) { - if (_priv->tx_tfm_michael) - crypto_free_hash(_priv->tx_tfm_michael); - if (_priv->tx_tfm_arc4) - crypto_free_blkcipher(_priv->tx_tfm_arc4); - if (_priv->rx_tfm_michael) - crypto_free_hash(_priv->rx_tfm_michael); - if (_priv->rx_tfm_arc4) - crypto_free_blkcipher(_priv->rx_tfm_arc4); - } - kfree(priv); -} - -static inline u16 RotR1(u16 val) -{ - return (val >> 1) | (val << 15); -} - -static inline u8 Lo8(u16 val) -{ - return val & 0xff; -} - -static inline u8 Hi8(u16 val) -{ - return val >> 8; -} - -static inline u16 Lo16(u32 val) -{ - return val & 0xffff; -} - -static inline u16 Hi16(u32 val) -{ - return val >> 16; -} - -static inline u16 Mk16(u8 hi, u8 lo) -{ - return lo | (((u16) hi) << 8); -} - -static inline u16 Mk16_le(__le16 * v) -{ - return le16_to_cpu(*v); -} - -static const u16 Sbox[256] = { - 0xC6A5, 0xF884, 0xEE99, 0xF68D, 0xFF0D, 0xD6BD, 0xDEB1, 0x9154, - 0x6050, 0x0203, 0xCEA9, 0x567D, 0xE719, 0xB562, 0x4DE6, 0xEC9A, - 0x8F45, 0x1F9D, 0x8940, 0xFA87, 0xEF15, 0xB2EB, 0x8EC9, 0xFB0B, - 0x41EC, 0xB367, 0x5FFD, 0x45EA, 0x23BF, 0x53F7, 0xE496, 0x9B5B, - 0x75C2, 0xE11C, 0x3DAE, 0x4C6A, 0x6C5A, 0x7E41, 0xF502, 0x834F, - 0x685C, 0x51F4, 0xD134, 0xF908, 0xE293, 0xAB73, 0x6253, 0x2A3F, - 0x080C, 0x9552, 0x4665, 0x9D5E, 0x3028, 0x37A1, 0x0A0F, 0x2FB5, - 0x0E09, 0x2436, 0x1B9B, 0xDF3D, 0xCD26, 0x4E69, 0x7FCD, 0xEA9F, - 0x121B, 0x1D9E, 0x5874, 0x342E, 0x362D, 0xDCB2, 0xB4EE, 0x5BFB, - 0xA4F6, 0x764D, 0xB761, 0x7DCE, 0x527B, 0xDD3E, 0x5E71, 0x1397, - 0xA6F5, 0xB968, 0x0000, 0xC12C, 0x4060, 0xE31F, 0x79C8, 0xB6ED, - 0xD4BE, 0x8D46, 0x67D9, 0x724B, 0x94DE, 0x98D4, 0xB0E8, 0x854A, - 0xBB6B, 0xC52A, 0x4FE5, 0xED16, 0x86C5, 0x9AD7, 0x6655, 0x1194, - 0x8ACF, 0xE910, 0x0406, 0xFE81, 0xA0F0, 0x7844, 0x25BA, 0x4BE3, - 0xA2F3, 0x5DFE, 0x80C0, 0x058A, 0x3FAD, 0x21BC, 0x7048, 0xF104, - 0x63DF, 0x77C1, 0xAF75, 0x4263, 0x2030, 0xE51A, 0xFD0E, 0xBF6D, - 0x814C, 0x1814, 0x2635, 0xC32F, 0xBEE1, 0x35A2, 0x88CC, 0x2E39, - 0x9357, 0x55F2, 0xFC82, 0x7A47, 0xC8AC, 0xBAE7, 0x322B, 0xE695, - 0xC0A0, 0x1998, 0x9ED1, 0xA37F, 0x4466, 0x547E, 0x3BAB, 0x0B83, - 0x8CCA, 0xC729, 0x6BD3, 0x283C, 0xA779, 0xBCE2, 0x161D, 0xAD76, - 0xDB3B, 0x6456, 0x744E, 0x141E, 0x92DB, 0x0C0A, 0x486C, 0xB8E4, - 0x9F5D, 0xBD6E, 0x43EF, 0xC4A6, 0x39A8, 0x31A4, 0xD337, 0xF28B, - 0xD532, 0x8B43, 0x6E59, 0xDAB7, 0x018C, 0xB164, 0x9CD2, 0x49E0, - 0xD8B4, 0xACFA, 0xF307, 0xCF25, 0xCAAF, 0xF48E, 0x47E9, 0x1018, - 0x6FD5, 0xF088, 0x4A6F, 0x5C72, 0x3824, 0x57F1, 0x73C7, 0x9751, - 0xCB23, 0xA17C, 0xE89C, 0x3E21, 0x96DD, 0x61DC, 0x0D86, 0x0F85, - 0xE090, 0x7C42, 0x71C4, 0xCCAA, 0x90D8, 0x0605, 0xF701, 0x1C12, - 0xC2A3, 0x6A5F, 0xAEF9, 0x69D0, 0x1791, 0x9958, 0x3A27, 0x27B9, - 0xD938, 0xEB13, 0x2BB3, 0x2233, 0xD2BB, 0xA970, 0x0789, 0x33A7, - 0x2DB6, 0x3C22, 0x1592, 0xC920, 0x8749, 0xAAFF, 0x5078, 0xA57A, - 0x038F, 0x59F8, 0x0980, 0x1A17, 0x65DA, 0xD731, 0x84C6, 0xD0B8, - 0x82C3, 0x29B0, 0x5A77, 0x1E11, 0x7BCB, 0xA8FC, 0x6DD6, 0x2C3A, -}; - -static inline u16 _S_(u16 v) -{ - u16 t = Sbox[Hi8(v)]; - return Sbox[Lo8(v)] ^ ((t << 8) | (t >> 8)); -} - -#define PHASE1_LOOP_COUNT 8 - -static void tkip_mixing_phase1(u16 * TTAK, const u8 * TK, const u8 * TA, - u32 IV32) -{ - int i, j; - - /* Initialize the 80-bit TTAK from TSC (IV32) and TA[0..5] */ - TTAK[0] = Lo16(IV32); - TTAK[1] = Hi16(IV32); - TTAK[2] = Mk16(TA[1], TA[0]); - TTAK[3] = Mk16(TA[3], TA[2]); - TTAK[4] = Mk16(TA[5], TA[4]); - - for (i = 0; i < PHASE1_LOOP_COUNT; i++) { - j = 2 * (i & 1); - TTAK[0] += _S_(TTAK[4] ^ Mk16(TK[1 + j], TK[0 + j])); - TTAK[1] += _S_(TTAK[0] ^ Mk16(TK[5 + j], TK[4 + j])); - TTAK[2] += _S_(TTAK[1] ^ Mk16(TK[9 + j], TK[8 + j])); - TTAK[3] += _S_(TTAK[2] ^ Mk16(TK[13 + j], TK[12 + j])); - TTAK[4] += _S_(TTAK[3] ^ Mk16(TK[1 + j], TK[0 + j])) + i; - } -} - -static void tkip_mixing_phase2(u8 * WEPSeed, const u8 * TK, const u16 * TTAK, - u16 IV16) -{ - /* Make temporary area overlap WEP seed so that the final copy can be - * avoided on little endian hosts. */ - u16 *PPK = (u16 *) & WEPSeed[4]; - - /* Step 1 - make copy of TTAK and bring in TSC */ - PPK[0] = TTAK[0]; - PPK[1] = TTAK[1]; - PPK[2] = TTAK[2]; - PPK[3] = TTAK[3]; - PPK[4] = TTAK[4]; - PPK[5] = TTAK[4] + IV16; - - /* Step 2 - 96-bit bijective mixing using S-box */ - PPK[0] += _S_(PPK[5] ^ Mk16_le((__le16 *) & TK[0])); - PPK[1] += _S_(PPK[0] ^ Mk16_le((__le16 *) & TK[2])); - PPK[2] += _S_(PPK[1] ^ Mk16_le((__le16 *) & TK[4])); - PPK[3] += _S_(PPK[2] ^ Mk16_le((__le16 *) & TK[6])); - PPK[4] += _S_(PPK[3] ^ Mk16_le((__le16 *) & TK[8])); - PPK[5] += _S_(PPK[4] ^ Mk16_le((__le16 *) & TK[10])); - - PPK[0] += RotR1(PPK[5] ^ Mk16_le((__le16 *) & TK[12])); - PPK[1] += RotR1(PPK[0] ^ Mk16_le((__le16 *) & TK[14])); - PPK[2] += RotR1(PPK[1]); - PPK[3] += RotR1(PPK[2]); - PPK[4] += RotR1(PPK[3]); - PPK[5] += RotR1(PPK[4]); - - /* Step 3 - bring in last of TK bits, assign 24-bit WEP IV value - * WEPSeed[0..2] is transmitted as WEP IV */ - WEPSeed[0] = Hi8(IV16); - WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; - WEPSeed[2] = Lo8(IV16); - WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((__le16 *) & TK[0])) >> 1); - -#ifdef __BIG_ENDIAN - { - int i; - for (i = 0; i < 6; i++) - PPK[i] = (PPK[i] << 8) | (PPK[i] >> 8); - } -#endif -} - -static int lib80211_tkip_hdr(struct sk_buff *skb, int hdr_len, - u8 * rc4key, int keylen, void *priv) -{ - struct lib80211_tkip_data *tkey = priv; - u8 *pos; - struct ieee80211_hdr *hdr; - - hdr = (struct ieee80211_hdr *)skb->data; - - if (skb_headroom(skb) < TKIP_HDR_LEN || skb->len < hdr_len) - return -1; - - if (rc4key == NULL || keylen < 16) - return -1; - - if (!tkey->tx_phase1_done) { - tkip_mixing_phase1(tkey->tx_ttak, tkey->key, hdr->addr2, - tkey->tx_iv32); - tkey->tx_phase1_done = 1; - } - tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak, tkey->tx_iv16); - - pos = skb_push(skb, TKIP_HDR_LEN); - memmove(pos, pos + TKIP_HDR_LEN, hdr_len); - pos += hdr_len; - - *pos++ = *rc4key; - *pos++ = *(rc4key + 1); - *pos++ = *(rc4key + 2); - *pos++ = (tkey->key_idx << 6) | (1 << 5) /* Ext IV included */ ; - *pos++ = tkey->tx_iv32 & 0xff; - *pos++ = (tkey->tx_iv32 >> 8) & 0xff; - *pos++ = (tkey->tx_iv32 >> 16) & 0xff; - *pos++ = (tkey->tx_iv32 >> 24) & 0xff; - - tkey->tx_iv16++; - if (tkey->tx_iv16 == 0) { - tkey->tx_phase1_done = 0; - tkey->tx_iv32++; - } - - return TKIP_HDR_LEN; -} - -static int lib80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) -{ - struct lib80211_tkip_data *tkey = priv; - struct blkcipher_desc desc = { .tfm = tkey->tx_tfm_arc4 }; - int len; - u8 rc4key[16], *pos, *icv; - u32 crc; - struct scatterlist sg; - - if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { - if (net_ratelimit()) { - struct ieee80211_hdr *hdr = - (struct ieee80211_hdr *)skb->data; - printk(KERN_DEBUG ": TKIP countermeasures: dropped " - "TX packet to %pM\n", hdr->addr1); - } - return -1; - } - - if (skb_tailroom(skb) < 4 || skb->len < hdr_len) - return -1; - - len = skb->len - hdr_len; - pos = skb->data + hdr_len; - - if ((lib80211_tkip_hdr(skb, hdr_len, rc4key, 16, priv)) < 0) - return -1; - - crc = ~crc32_le(~0, pos, len); - icv = skb_put(skb, 4); - icv[0] = crc; - icv[1] = crc >> 8; - icv[2] = crc >> 16; - icv[3] = crc >> 24; - - crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); - sg_init_one(&sg, pos, len + 4); - return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); -} - -/* - * deal with seq counter wrapping correctly. - * refer to timer_after() for jiffies wrapping handling - */ -static inline int tkip_replay_check(u32 iv32_n, u16 iv16_n, - u32 iv32_o, u16 iv16_o) -{ - if ((s32)iv32_n - (s32)iv32_o < 0 || - (iv32_n == iv32_o && iv16_n <= iv16_o)) - return 1; - return 0; -} - -static int lib80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) -{ - struct lib80211_tkip_data *tkey = priv; - struct blkcipher_desc desc = { .tfm = tkey->rx_tfm_arc4 }; - u8 rc4key[16]; - u8 keyidx, *pos; - u32 iv32; - u16 iv16; - struct ieee80211_hdr *hdr; - u8 icv[4]; - u32 crc; - struct scatterlist sg; - int plen; - - hdr = (struct ieee80211_hdr *)skb->data; - - if (tkey->flags & IEEE80211_CRYPTO_TKIP_COUNTERMEASURES) { - if (net_ratelimit()) { - printk(KERN_DEBUG ": TKIP countermeasures: dropped " - "received packet from %pM\n", hdr->addr2); - } - return -1; - } - - if (skb->len < hdr_len + TKIP_HDR_LEN + 4) - return -1; - - pos = skb->data + hdr_len; - keyidx = pos[3]; - if (!(keyidx & (1 << 5))) { - if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: received packet without ExtIV" - " flag from %pM\n", hdr->addr2); - } - return -2; - } - keyidx >>= 6; - if (tkey->key_idx != keyidx) { - printk(KERN_DEBUG "TKIP: RX tkey->key_idx=%d frame " - "keyidx=%d priv=%p\n", tkey->key_idx, keyidx, priv); - return -6; - } - if (!tkey->key_set) { - if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: received packet from %pM" - " with keyid=%d that does not have a configured" - " key\n", hdr->addr2, keyidx); - } - return -3; - } - iv16 = (pos[0] << 8) | pos[2]; - iv32 = pos[4] | (pos[5] << 8) | (pos[6] << 16) | (pos[7] << 24); - pos += TKIP_HDR_LEN; - - if (tkip_replay_check(iv32, iv16, tkey->rx_iv32, tkey->rx_iv16)) { -#ifdef CONFIG_LIB80211_DEBUG - if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: replay detected: STA=%pM" - " previous TSC %08x%04x received TSC " - "%08x%04x\n", hdr->addr2, - tkey->rx_iv32, tkey->rx_iv16, iv32, iv16); - } -#endif - tkey->dot11RSNAStatsTKIPReplays++; - return -4; - } - - if (iv32 != tkey->rx_iv32 || !tkey->rx_phase1_done) { - tkip_mixing_phase1(tkey->rx_ttak, tkey->key, hdr->addr2, iv32); - tkey->rx_phase1_done = 1; - } - tkip_mixing_phase2(rc4key, tkey->key, tkey->rx_ttak, iv16); - - plen = skb->len - hdr_len - 12; - - crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); - sg_init_one(&sg, pos, plen + 4); - if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { - if (net_ratelimit()) { - printk(KERN_DEBUG ": TKIP: failed to decrypt " - "received packet from %pM\n", - hdr->addr2); - } - return -7; - } - - crc = ~crc32_le(~0, pos, plen); - icv[0] = crc; - icv[1] = crc >> 8; - icv[2] = crc >> 16; - icv[3] = crc >> 24; - if (memcmp(icv, pos + plen, 4) != 0) { - if (iv32 != tkey->rx_iv32) { - /* Previously cached Phase1 result was already lost, so - * it needs to be recalculated for the next packet. */ - tkey->rx_phase1_done = 0; - } -#ifdef CONFIG_LIB80211_DEBUG - if (net_ratelimit()) { - printk(KERN_DEBUG "TKIP: ICV error detected: STA=" - "%pM\n", hdr->addr2); - } -#endif - tkey->dot11RSNAStatsTKIPICVErrors++; - return -5; - } - - /* Update real counters only after Michael MIC verification has - * completed */ - tkey->rx_iv32_new = iv32; - tkey->rx_iv16_new = iv16; - - /* Remove IV and ICV */ - memmove(skb->data + TKIP_HDR_LEN, skb->data, hdr_len); - skb_pull(skb, TKIP_HDR_LEN); - skb_trim(skb, skb->len - 4); - - return keyidx; -} - -static int michael_mic(struct crypto_hash *tfm_michael, u8 * key, u8 * hdr, - u8 * data, size_t data_len, u8 * mic) -{ - struct hash_desc desc; - struct scatterlist sg[2]; - - if (tfm_michael == NULL) { - pr_warn("%s(): tfm_michael == NULL\n", __func__); - return -1; - } - sg_init_table(sg, 2); - sg_set_buf(&sg[0], hdr, 16); - sg_set_buf(&sg[1], data, data_len); - - if (crypto_hash_setkey(tfm_michael, key, 8)) - return -1; - - desc.tfm = tfm_michael; - desc.flags = 0; - return crypto_hash_digest(&desc, sg, data_len + 16, mic); -} - -static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr) -{ - struct ieee80211_hdr *hdr11; - - hdr11 = (struct ieee80211_hdr *)skb->data; - - switch (le16_to_cpu(hdr11->frame_control) & - (IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS)) { - case IEEE80211_FCTL_TODS: - memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ - break; - case IEEE80211_FCTL_FROMDS: - memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr3, ETH_ALEN); /* SA */ - break; - case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: - memcpy(hdr, hdr11->addr3, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr4, ETH_ALEN); /* SA */ - break; - case 0: - memcpy(hdr, hdr11->addr1, ETH_ALEN); /* DA */ - memcpy(hdr + ETH_ALEN, hdr11->addr2, ETH_ALEN); /* SA */ - break; - } - - if (ieee80211_is_data_qos(hdr11->frame_control)) { - hdr[12] = le16_to_cpu(*((__le16 *)ieee80211_get_qos_ctl(hdr11))) - & IEEE80211_QOS_CTL_TID_MASK; - } else - hdr[12] = 0; /* priority */ - - hdr[13] = hdr[14] = hdr[15] = 0; /* reserved */ -} - -static int lib80211_michael_mic_add(struct sk_buff *skb, int hdr_len, - void *priv) -{ - struct lib80211_tkip_data *tkey = priv; - u8 *pos; - - if (skb_tailroom(skb) < 8 || skb->len < hdr_len) { - printk(KERN_DEBUG "Invalid packet for Michael MIC add " - "(tailroom=%d hdr_len=%d skb->len=%d)\n", - skb_tailroom(skb), hdr_len, skb->len); - return -1; - } - - michael_mic_hdr(skb, tkey->tx_hdr); - pos = skb_put(skb, 8); - if (michael_mic(tkey->tx_tfm_michael, &tkey->key[16], tkey->tx_hdr, - skb->data + hdr_len, skb->len - 8 - hdr_len, pos)) - return -1; - - return 0; -} - -static void lib80211_michael_mic_failure(struct net_device *dev, - struct ieee80211_hdr *hdr, - int keyidx) -{ - union iwreq_data wrqu; - struct iw_michaelmicfailure ev; - - /* TODO: needed parameters: count, keyid, key type, TSC */ - memset(&ev, 0, sizeof(ev)); - ev.flags = keyidx & IW_MICFAILURE_KEY_ID; - if (hdr->addr1[0] & 0x01) - ev.flags |= IW_MICFAILURE_GROUP; - else - ev.flags |= IW_MICFAILURE_PAIRWISE; - ev.src_addr.sa_family = ARPHRD_ETHER; - memcpy(ev.src_addr.sa_data, hdr->addr2, ETH_ALEN); - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = sizeof(ev); - wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&ev); -} - -static int lib80211_michael_mic_verify(struct sk_buff *skb, int keyidx, - int hdr_len, void *priv) -{ - struct lib80211_tkip_data *tkey = priv; - u8 mic[8]; - - if (!tkey->key_set) - return -1; - - michael_mic_hdr(skb, tkey->rx_hdr); - if (michael_mic(tkey->rx_tfm_michael, &tkey->key[24], tkey->rx_hdr, - skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) - return -1; - if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { - struct ieee80211_hdr *hdr; - hdr = (struct ieee80211_hdr *)skb->data; - printk(KERN_DEBUG "%s: Michael MIC verification failed for " - "MSDU from %pM keyidx=%d\n", - skb->dev ? skb->dev->name : "N/A", hdr->addr2, - keyidx); - if (skb->dev) - lib80211_michael_mic_failure(skb->dev, hdr, keyidx); - tkey->dot11RSNAStatsTKIPLocalMICFailures++; - return -1; - } - - /* Update TSC counters for RX now that the packet verification has - * completed. */ - tkey->rx_iv32 = tkey->rx_iv32_new; - tkey->rx_iv16 = tkey->rx_iv16_new; - - skb_trim(skb, skb->len - 8); - - return 0; -} - -static int lib80211_tkip_set_key(void *key, int len, u8 * seq, void *priv) -{ - struct lib80211_tkip_data *tkey = priv; - int keyidx; - struct crypto_hash *tfm = tkey->tx_tfm_michael; - struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; - struct crypto_hash *tfm3 = tkey->rx_tfm_michael; - struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; - - keyidx = tkey->key_idx; - memset(tkey, 0, sizeof(*tkey)); - tkey->key_idx = keyidx; - tkey->tx_tfm_michael = tfm; - tkey->tx_tfm_arc4 = tfm2; - tkey->rx_tfm_michael = tfm3; - tkey->rx_tfm_arc4 = tfm4; - if (len == TKIP_KEY_LEN) { - memcpy(tkey->key, key, TKIP_KEY_LEN); - tkey->key_set = 1; - tkey->tx_iv16 = 1; /* TSC is initialized to 1 */ - if (seq) { - tkey->rx_iv32 = (seq[5] << 24) | (seq[4] << 16) | - (seq[3] << 8) | seq[2]; - tkey->rx_iv16 = (seq[1] << 8) | seq[0]; - } - } else if (len == 0) - tkey->key_set = 0; - else - return -1; - - return 0; -} - -static int lib80211_tkip_get_key(void *key, int len, u8 * seq, void *priv) -{ - struct lib80211_tkip_data *tkey = priv; - - if (len < TKIP_KEY_LEN) - return -1; - - if (!tkey->key_set) - return 0; - memcpy(key, tkey->key, TKIP_KEY_LEN); - - if (seq) { - /* Return the sequence number of the last transmitted frame. */ - u16 iv16 = tkey->tx_iv16; - u32 iv32 = tkey->tx_iv32; - if (iv16 == 0) - iv32--; - iv16--; - seq[0] = tkey->tx_iv16; - seq[1] = tkey->tx_iv16 >> 8; - seq[2] = tkey->tx_iv32; - seq[3] = tkey->tx_iv32 >> 8; - seq[4] = tkey->tx_iv32 >> 16; - seq[5] = tkey->tx_iv32 >> 24; - } - - return TKIP_KEY_LEN; -} - -static char *lib80211_tkip_print_stats(char *p, void *priv) -{ - struct lib80211_tkip_data *tkip = priv; - p += sprintf(p, "key[%d] alg=TKIP key_set=%d " - "tx_pn=%02x%02x%02x%02x%02x%02x " - "rx_pn=%02x%02x%02x%02x%02x%02x " - "replays=%d icv_errors=%d local_mic_failures=%d\n", - tkip->key_idx, tkip->key_set, - (tkip->tx_iv32 >> 24) & 0xff, - (tkip->tx_iv32 >> 16) & 0xff, - (tkip->tx_iv32 >> 8) & 0xff, - tkip->tx_iv32 & 0xff, - (tkip->tx_iv16 >> 8) & 0xff, - tkip->tx_iv16 & 0xff, - (tkip->rx_iv32 >> 24) & 0xff, - (tkip->rx_iv32 >> 16) & 0xff, - (tkip->rx_iv32 >> 8) & 0xff, - tkip->rx_iv32 & 0xff, - (tkip->rx_iv16 >> 8) & 0xff, - tkip->rx_iv16 & 0xff, - tkip->dot11RSNAStatsTKIPReplays, - tkip->dot11RSNAStatsTKIPICVErrors, - tkip->dot11RSNAStatsTKIPLocalMICFailures); - return p; -} - -static struct lib80211_crypto_ops lib80211_crypt_tkip = { - .name = "TKIP", - .init = lib80211_tkip_init, - .deinit = lib80211_tkip_deinit, - .encrypt_mpdu = lib80211_tkip_encrypt, - .decrypt_mpdu = lib80211_tkip_decrypt, - .encrypt_msdu = lib80211_michael_mic_add, - .decrypt_msdu = lib80211_michael_mic_verify, - .set_key = lib80211_tkip_set_key, - .get_key = lib80211_tkip_get_key, - .print_stats = lib80211_tkip_print_stats, - .extra_mpdu_prefix_len = 4 + 4, /* IV + ExtIV */ - .extra_mpdu_postfix_len = 4, /* ICV */ - .extra_msdu_postfix_len = 8, /* MIC */ - .get_flags = lib80211_tkip_get_flags, - .set_flags = lib80211_tkip_set_flags, - .owner = THIS_MODULE, -}; - -static int __init lib80211_crypto_tkip_init(void) -{ - return lib80211_register_crypto_ops(&lib80211_crypt_tkip); -} - -static void __exit lib80211_crypto_tkip_exit(void) -{ - lib80211_unregister_crypto_ops(&lib80211_crypt_tkip); -} - -module_init(lib80211_crypto_tkip_init); -module_exit(lib80211_crypto_tkip_exit); diff --git a/openairITS/mac/DOT11/net/wireless/lib80211_crypt_wep.c b/openairITS/mac/DOT11/net/wireless/lib80211_crypt_wep.c deleted file mode 100644 index c1304018fc1..00000000000 --- a/openairITS/mac/DOT11/net/wireless/lib80211_crypt_wep.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * lib80211 crypt: host-based WEP encryption implementation for lib80211 - * - * Copyright (c) 2002-2004, Jouni Malinen <j@w1.fi> - * Copyright (c) 2008, John W. Linville <linville@tuxdriver.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. See README and COPYING for - * more details. - */ - -#include <linux/err.h> -#include <linux/module.h> -#include <linux/init.h> -#include <linux/slab.h> -#include <linux/random.h> -#include <linux/scatterlist.h> -#include <linux/skbuff.h> -#include <linux/mm.h> -#include <asm/string.h> - -#include <net/lib80211.h> - -#include <linux/crypto.h> -#include <linux/crc32.h> - -MODULE_AUTHOR("Jouni Malinen"); -MODULE_DESCRIPTION("lib80211 crypt: WEP"); -MODULE_LICENSE("GPL"); - -struct lib80211_wep_data { - u32 iv; -#define WEP_KEY_LEN 13 - u8 key[WEP_KEY_LEN + 1]; - u8 key_len; - u8 key_idx; - struct crypto_blkcipher *tx_tfm; - struct crypto_blkcipher *rx_tfm; -}; - -static void *lib80211_wep_init(int keyidx) -{ - struct lib80211_wep_data *priv; - - priv = kzalloc(sizeof(*priv), GFP_ATOMIC); - if (priv == NULL) - goto fail; - priv->key_idx = keyidx; - - priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->tx_tfm)) { - priv->tx_tfm = NULL; - goto fail; - } - - priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); - if (IS_ERR(priv->rx_tfm)) { - priv->rx_tfm = NULL; - goto fail; - } - /* start WEP IV from a random value */ - get_random_bytes(&priv->iv, 4); - - return priv; - - fail: - if (priv) { - if (priv->tx_tfm) - crypto_free_blkcipher(priv->tx_tfm); - if (priv->rx_tfm) - crypto_free_blkcipher(priv->rx_tfm); - kfree(priv); - } - return NULL; -} - -static void lib80211_wep_deinit(void *priv) -{ - struct lib80211_wep_data *_priv = priv; - if (_priv) { - if (_priv->tx_tfm) - crypto_free_blkcipher(_priv->tx_tfm); - if (_priv->rx_tfm) - crypto_free_blkcipher(_priv->rx_tfm); - } - kfree(priv); -} - -/* Add WEP IV/key info to a frame that has at least 4 bytes of headroom */ -static int lib80211_wep_build_iv(struct sk_buff *skb, int hdr_len, - u8 *key, int keylen, void *priv) -{ - struct lib80211_wep_data *wep = priv; - u32 klen; - u8 *pos; - - if (skb_headroom(skb) < 4 || skb->len < hdr_len) - return -1; - - pos = skb_push(skb, 4); - memmove(pos, pos + 4, hdr_len); - pos += hdr_len; - - klen = 3 + wep->key_len; - - wep->iv++; - - /* Fluhrer, Mantin, and Shamir have reported weaknesses in the key - * scheduling algorithm of RC4. At least IVs (KeyByte + 3, 0xff, N) - * can be used to speedup attacks, so avoid using them. */ - if ((wep->iv & 0xff00) == 0xff00) { - u8 B = (wep->iv >> 16) & 0xff; - if (B >= 3 && B < klen) - wep->iv += 0x0100; - } - - /* Prepend 24-bit IV to RC4 key and TX frame */ - *pos++ = (wep->iv >> 16) & 0xff; - *pos++ = (wep->iv >> 8) & 0xff; - *pos++ = wep->iv & 0xff; - *pos++ = wep->key_idx << 6; - - return 0; -} - -/* Perform WEP encryption on given skb that has at least 4 bytes of headroom - * for IV and 4 bytes of tailroom for ICV. Both IV and ICV will be transmitted, - * so the payload length increases with 8 bytes. - * - * WEP frame payload: IV + TX key idx, RC4(data), ICV = RC4(CRC32(data)) - */ -static int lib80211_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) -{ - struct lib80211_wep_data *wep = priv; - struct blkcipher_desc desc = { .tfm = wep->tx_tfm }; - u32 crc, klen, len; - u8 *pos, *icv; - struct scatterlist sg; - u8 key[WEP_KEY_LEN + 3]; - - /* other checks are in lib80211_wep_build_iv */ - if (skb_tailroom(skb) < 4) - return -1; - - /* add the IV to the frame */ - if (lib80211_wep_build_iv(skb, hdr_len, NULL, 0, priv)) - return -1; - - /* Copy the IV into the first 3 bytes of the key */ - skb_copy_from_linear_data_offset(skb, hdr_len, key, 3); - - /* Copy rest of the WEP key (the secret part) */ - memcpy(key + 3, wep->key, wep->key_len); - - len = skb->len - hdr_len - 4; - pos = skb->data + hdr_len + 4; - klen = 3 + wep->key_len; - - /* Append little-endian CRC32 over only the data and encrypt it to produce ICV */ - crc = ~crc32_le(~0, pos, len); - icv = skb_put(skb, 4); - icv[0] = crc; - icv[1] = crc >> 8; - icv[2] = crc >> 16; - icv[3] = crc >> 24; - - crypto_blkcipher_setkey(wep->tx_tfm, key, klen); - sg_init_one(&sg, pos, len + 4); - return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); -} - -/* Perform WEP decryption on given buffer. Buffer includes whole WEP part of - * the frame: IV (4 bytes), encrypted payload (including SNAP header), - * ICV (4 bytes). len includes both IV and ICV. - * - * Returns 0 if frame was decrypted successfully and ICV was correct and -1 on - * failure. If frame is OK, IV and ICV will be removed. - */ -static int lib80211_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) -{ - struct lib80211_wep_data *wep = priv; - struct blkcipher_desc desc = { .tfm = wep->rx_tfm }; - u32 crc, klen, plen; - u8 key[WEP_KEY_LEN + 3]; - u8 keyidx, *pos, icv[4]; - struct scatterlist sg; - - if (skb->len < hdr_len + 8) - return -1; - - pos = skb->data + hdr_len; - key[0] = *pos++; - key[1] = *pos++; - key[2] = *pos++; - keyidx = *pos++ >> 6; - if (keyidx != wep->key_idx) - return -1; - - klen = 3 + wep->key_len; - - /* Copy rest of the WEP key (the secret part) */ - memcpy(key + 3, wep->key, wep->key_len); - - /* Apply RC4 to data and compute CRC32 over decrypted data */ - plen = skb->len - hdr_len - 8; - - crypto_blkcipher_setkey(wep->rx_tfm, key, klen); - sg_init_one(&sg, pos, plen + 4); - if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) - return -7; - - crc = ~crc32_le(~0, pos, plen); - icv[0] = crc; - icv[1] = crc >> 8; - icv[2] = crc >> 16; - icv[3] = crc >> 24; - if (memcmp(icv, pos + plen, 4) != 0) { - /* ICV mismatch - drop frame */ - return -2; - } - - /* Remove IV and ICV */ - memmove(skb->data + 4, skb->data, hdr_len); - skb_pull(skb, 4); - skb_trim(skb, skb->len - 4); - - return 0; -} - -static int lib80211_wep_set_key(void *key, int len, u8 * seq, void *priv) -{ - struct lib80211_wep_data *wep = priv; - - if (len < 0 || len > WEP_KEY_LEN) - return -1; - - memcpy(wep->key, key, len); - wep->key_len = len; - - return 0; -} - -static int lib80211_wep_get_key(void *key, int len, u8 * seq, void *priv) -{ - struct lib80211_wep_data *wep = priv; - - if (len < wep->key_len) - return -1; - - memcpy(key, wep->key, wep->key_len); - - return wep->key_len; -} - -static char *lib80211_wep_print_stats(char *p, void *priv) -{ - struct lib80211_wep_data *wep = priv; - p += sprintf(p, "key[%d] alg=WEP len=%d\n", wep->key_idx, wep->key_len); - return p; -} - -static struct lib80211_crypto_ops lib80211_crypt_wep = { - .name = "WEP", - .init = lib80211_wep_init, - .deinit = lib80211_wep_deinit, - .encrypt_mpdu = lib80211_wep_encrypt, - .decrypt_mpdu = lib80211_wep_decrypt, - .encrypt_msdu = NULL, - .decrypt_msdu = NULL, - .set_key = lib80211_wep_set_key, - .get_key = lib80211_wep_get_key, - .print_stats = lib80211_wep_print_stats, - .extra_mpdu_prefix_len = 4, /* IV */ - .extra_mpdu_postfix_len = 4, /* ICV */ - .owner = THIS_MODULE, -}; - -static int __init lib80211_crypto_wep_init(void) -{ - return lib80211_register_crypto_ops(&lib80211_crypt_wep); -} - -static void __exit lib80211_crypto_wep_exit(void) -{ - lib80211_unregister_crypto_ops(&lib80211_crypt_wep); -} - -module_init(lib80211_crypto_wep_init); -module_exit(lib80211_crypto_wep_exit); diff --git a/openairITS/mac/DOT11/net/wireless/mesh.c b/openairITS/mac/DOT11/net/wireless/mesh.c deleted file mode 100644 index ba21ab22187..00000000000 --- a/openairITS/mac/DOT11/net/wireless/mesh.c +++ /dev/null @@ -1,171 +0,0 @@ -#include <linux/ieee80211.h> -#include <linux/export.h> -#include <net/cfg80211.h> -#include "nl80211.h" -#include "core.h" - -/* Default values, timeouts in ms */ -#define MESH_TTL 31 -#define MESH_DEFAULT_ELEMENT_TTL 31 -#define MESH_MAX_RETR 3 -#define MESH_RET_T 100 -#define MESH_CONF_T 100 -#define MESH_HOLD_T 100 - -#define MESH_PATH_TIMEOUT 5000 -#define MESH_RANN_INTERVAL 5000 - -/* - * Minimum interval between two consecutive PREQs originated by the same - * interface - */ -#define MESH_PREQ_MIN_INT 10 -#define MESH_PERR_MIN_INT 100 -#define MESH_DIAM_TRAVERSAL_TIME 50 - -#define MESH_RSSI_THRESHOLD 0 - -/* - * A path will be refreshed if it is used PATH_REFRESH_TIME milliseconds - * before timing out. This way it will remain ACTIVE and no data frames - * will be unnecessarily held in the pending queue. - */ -#define MESH_PATH_REFRESH_TIME 1000 -#define MESH_MIN_DISCOVERY_TIMEOUT (2 * MESH_DIAM_TRAVERSAL_TIME) - -/* Default maximum number of established plinks per interface */ -#define MESH_MAX_ESTAB_PLINKS 32 - -#define MESH_MAX_PREQ_RETRIES 4 - - -const struct mesh_config default_mesh_config = { - .dot11MeshRetryTimeout = MESH_RET_T, - .dot11MeshConfirmTimeout = MESH_CONF_T, - .dot11MeshHoldingTimeout = MESH_HOLD_T, - .dot11MeshMaxRetries = MESH_MAX_RETR, - .dot11MeshTTL = MESH_TTL, - .element_ttl = MESH_DEFAULT_ELEMENT_TTL, - .auto_open_plinks = true, - .dot11MeshMaxPeerLinks = MESH_MAX_ESTAB_PLINKS, - .dot11MeshHWMPactivePathTimeout = MESH_PATH_TIMEOUT, - .dot11MeshHWMPpreqMinInterval = MESH_PREQ_MIN_INT, - .dot11MeshHWMPperrMinInterval = MESH_PERR_MIN_INT, - .dot11MeshHWMPnetDiameterTraversalTime = MESH_DIAM_TRAVERSAL_TIME, - .dot11MeshHWMPmaxPREQretries = MESH_MAX_PREQ_RETRIES, - .path_refresh_time = MESH_PATH_REFRESH_TIME, - .min_discovery_timeout = MESH_MIN_DISCOVERY_TIMEOUT, - .dot11MeshHWMPRannInterval = MESH_RANN_INTERVAL, - .dot11MeshGateAnnouncementProtocol = false, - .dot11MeshForwarding = true, - .rssi_threshold = MESH_RSSI_THRESHOLD, -}; - -const struct mesh_setup default_mesh_setup = { - .path_sel_proto = IEEE80211_PATH_PROTOCOL_HWMP, - .path_metric = IEEE80211_PATH_METRIC_AIRTIME, - .ie = NULL, - .ie_len = 0, - .is_secure = false, -}; - -int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev, - struct net_device *dev, - const struct mesh_setup *setup, - const struct mesh_config *conf) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != IEEE80211_MAX_MESH_ID_LEN); - - ASSERT_WDEV_LOCK(wdev); - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) - return -EOPNOTSUPP; - - if (!(rdev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) && - setup->is_secure) - return -EOPNOTSUPP; - - if (wdev->mesh_id_len) - return -EALREADY; - - if (!setup->mesh_id_len) - return -EINVAL; - - if (!rdev->ops->join_mesh) - return -EOPNOTSUPP; - - err = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup); - if (!err) { - memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len); - wdev->mesh_id_len = setup->mesh_id_len; - } - - return err; -} - -int cfg80211_join_mesh(struct cfg80211_registered_device *rdev, - struct net_device *dev, - const struct mesh_setup *setup, - const struct mesh_config *conf) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - wdev_lock(wdev); - err = __cfg80211_join_mesh(rdev, dev, setup, conf); - wdev_unlock(wdev); - - return err; -} - -void cfg80211_notify_new_peer_candidate(struct net_device *dev, - const u8 *macaddr, const u8* ie, u8 ie_len, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_MESH_POINT)) - return; - - nl80211_send_new_peer_candidate(wiphy_to_dev(wdev->wiphy), dev, - macaddr, ie, ie_len, gfp); -} -EXPORT_SYMBOL(cfg80211_notify_new_peer_candidate); - -static int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, - struct net_device *dev) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - ASSERT_WDEV_LOCK(wdev); - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) - return -EOPNOTSUPP; - - if (!rdev->ops->leave_mesh) - return -EOPNOTSUPP; - - if (!wdev->mesh_id_len) - return -ENOTCONN; - - err = rdev->ops->leave_mesh(&rdev->wiphy, dev); - if (!err) - wdev->mesh_id_len = 0; - return err; -} - -int cfg80211_leave_mesh(struct cfg80211_registered_device *rdev, - struct net_device *dev) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - wdev_lock(wdev); - err = __cfg80211_leave_mesh(rdev, dev); - wdev_unlock(wdev); - - return err; -} diff --git a/openairITS/mac/DOT11/net/wireless/mlme.c b/openairITS/mac/DOT11/net/wireless/mlme.c deleted file mode 100644 index f5a7ac3a093..00000000000 --- a/openairITS/mac/DOT11/net/wireless/mlme.c +++ /dev/null @@ -1,956 +0,0 @@ -/* - * cfg80211 MLME SAP interface - * - * Copyright (c) 2009, Jouni Malinen <j@w1.fi> - */ - -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/netdevice.h> -#include <linux/nl80211.h> -#include <linux/slab.h> -#include <linux/wireless.h> -#include <net/cfg80211.h> -#include <net/iw_handler.h> -#include "core.h" -#include "nl80211.h" - -void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - wdev_lock(wdev); - - nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL); - cfg80211_sme_rx_auth(dev, buf, len); - - wdev_unlock(wdev); -} -EXPORT_SYMBOL(cfg80211_send_rx_auth); - -void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss, - const u8 *buf, size_t len) -{ - u16 status_code; - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; - u8 *ie = mgmt->u.assoc_resp.variable; - int ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); - - wdev_lock(wdev); - - status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); - - /* - * This is a bit of a hack, we don't notify userspace of - * a (re-)association reply if we tried to send a reassoc - * and got a reject -- we only try again with an assoc - * frame instead of reassoc. - */ - if (status_code != WLAN_STATUS_SUCCESS && wdev->conn && - cfg80211_sme_failed_reassoc(wdev)) { - cfg80211_put_bss(bss); - goto out; - } - - nl80211_send_rx_assoc(rdev, dev, buf, len, GFP_KERNEL); - - if (status_code != WLAN_STATUS_SUCCESS && wdev->conn) { - cfg80211_sme_failed_assoc(wdev); - /* - * do not call connect_result() now because the - * sme will schedule work that does it later. - */ - cfg80211_put_bss(bss); - goto out; - } - - if (!wdev->conn && wdev->sme_state == CFG80211_SME_IDLE) { - /* - * This is for the userspace SME, the CONNECTING - * state will be changed to CONNECTED by - * __cfg80211_connect_result() below. - */ - wdev->sme_state = CFG80211_SME_CONNECTING; - } - - /* this consumes the bss reference */ - __cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, ie, len - ieoffs, - status_code, - status_code == WLAN_STATUS_SUCCESS, bss); - out: - wdev_unlock(wdev); -} -EXPORT_SYMBOL(cfg80211_send_rx_assoc); - -void __cfg80211_send_deauth(struct net_device *dev, - const u8 *buf, size_t len) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; - const u8 *bssid = mgmt->bssid; - bool was_current = false; - - ASSERT_WDEV_LOCK(wdev); - - if (wdev->current_bss && - memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) { - cfg80211_unhold_bss(wdev->current_bss); - cfg80211_put_bss(&wdev->current_bss->pub); - wdev->current_bss = NULL; - was_current = true; - } - - nl80211_send_deauth(rdev, dev, buf, len, GFP_KERNEL); - - if (wdev->sme_state == CFG80211_SME_CONNECTED && was_current) { - u16 reason_code; - bool from_ap; - - reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); - - from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0; - __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap); - } else if (wdev->sme_state == CFG80211_SME_CONNECTING) { - __cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - false, NULL); - } -} -EXPORT_SYMBOL(__cfg80211_send_deauth); - -void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - wdev_lock(wdev); - __cfg80211_send_deauth(dev, buf, len); - wdev_unlock(wdev); -} -EXPORT_SYMBOL(cfg80211_send_deauth); - -void __cfg80211_send_disassoc(struct net_device *dev, - const u8 *buf, size_t len) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; - const u8 *bssid = mgmt->bssid; - u16 reason_code; - bool from_ap; - - ASSERT_WDEV_LOCK(wdev); - - nl80211_send_disassoc(rdev, dev, buf, len, GFP_KERNEL); - - if (wdev->sme_state != CFG80211_SME_CONNECTED) - return; - - if (wdev->current_bss && - memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) { - cfg80211_sme_disassoc(dev, wdev->current_bss); - cfg80211_unhold_bss(wdev->current_bss); - cfg80211_put_bss(&wdev->current_bss->pub); - wdev->current_bss = NULL; - } else - WARN_ON(1); - - - reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); - - from_ap = memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0; - __cfg80211_disconnected(dev, NULL, 0, reason_code, from_ap); -} -EXPORT_SYMBOL(__cfg80211_send_disassoc); - -void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - wdev_lock(wdev); - __cfg80211_send_disassoc(dev, buf, len); - wdev_unlock(wdev); -} -EXPORT_SYMBOL(cfg80211_send_disassoc); - -void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf, - size_t len) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - nl80211_send_unprot_deauth(rdev, dev, buf, len, GFP_ATOMIC); -} -EXPORT_SYMBOL(cfg80211_send_unprot_deauth); - -void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf, - size_t len) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - nl80211_send_unprot_disassoc(rdev, dev, buf, len, GFP_ATOMIC); -} -EXPORT_SYMBOL(cfg80211_send_unprot_disassoc); - -void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - wdev_lock(wdev); - - nl80211_send_auth_timeout(rdev, dev, addr, GFP_KERNEL); - if (wdev->sme_state == CFG80211_SME_CONNECTING) - __cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - false, NULL); - - wdev_unlock(wdev); -} -EXPORT_SYMBOL(cfg80211_send_auth_timeout); - -void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - wdev_lock(wdev); - - nl80211_send_assoc_timeout(rdev, dev, addr, GFP_KERNEL); - if (wdev->sme_state == CFG80211_SME_CONNECTING) - __cfg80211_connect_result(dev, addr, NULL, 0, NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - false, NULL); - - wdev_unlock(wdev); -} -EXPORT_SYMBOL(cfg80211_send_assoc_timeout); - -void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, - enum nl80211_key_type key_type, int key_id, - const u8 *tsc, gfp_t gfp) -{ - struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); -#ifdef CONFIG_CFG80211_WEXT - union iwreq_data wrqu; - char *buf = kmalloc(128, gfp); - - if (buf) { - sprintf(buf, "MLME-MICHAELMICFAILURE.indication(" - "keyid=%d %scast addr=%pM)", key_id, - key_type == NL80211_KEYTYPE_GROUP ? "broad" : "uni", - addr); - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = strlen(buf); - wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); - kfree(buf); - } -#endif - - nl80211_michael_mic_failure(rdev, dev, addr, key_type, key_id, tsc, gfp); -} -EXPORT_SYMBOL(cfg80211_michael_mic_failure); - -/* some MLME handling for userspace SME */ -int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct ieee80211_channel *chan, - enum nl80211_auth_type auth_type, - const u8 *bssid, - const u8 *ssid, int ssid_len, - const u8 *ie, int ie_len, - const u8 *key, int key_len, int key_idx) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_auth_request req; - int err; - - ASSERT_WDEV_LOCK(wdev); - - if (auth_type == NL80211_AUTHTYPE_SHARED_KEY) - if (!key || !key_len || key_idx < 0 || key_idx > 4) - return -EINVAL; - - if (wdev->current_bss && - memcmp(bssid, wdev->current_bss->pub.bssid, ETH_ALEN) == 0) - return -EALREADY; - - memset(&req, 0, sizeof(req)); - - req.ie = ie; - req.ie_len = ie_len; - req.auth_type = auth_type; - req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len, - WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); - req.key = key; - req.key_len = key_len; - req.key_idx = key_idx; - if (!req.bss) - return -ENOENT; - - err = rdev->ops->auth(&rdev->wiphy, dev, &req); - - cfg80211_put_bss(req.bss); - return err; -} - -int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, - struct net_device *dev, struct ieee80211_channel *chan, - enum nl80211_auth_type auth_type, const u8 *bssid, - const u8 *ssid, int ssid_len, - const u8 *ie, int ie_len, - const u8 *key, int key_len, int key_idx) -{ - int err; - - wdev_lock(dev->ieee80211_ptr); - err = __cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid, - ssid, ssid_len, ie, ie_len, - key, key_len, key_idx); - wdev_unlock(dev->ieee80211_ptr); - - return err; -} - -/* Do a logical ht_capa &= ht_capa_mask. */ -void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa, - const struct ieee80211_ht_cap *ht_capa_mask) -{ - int i; - u8 *p1, *p2; - if (!ht_capa_mask) { - memset(ht_capa, 0, sizeof(*ht_capa)); - return; - } - - p1 = (u8*)(ht_capa); - p2 = (u8*)(ht_capa_mask); - for (i = 0; i<sizeof(*ht_capa); i++) - p1[i] &= p2[i]; -} - -int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct ieee80211_channel *chan, - const u8 *bssid, const u8 *prev_bssid, - const u8 *ssid, int ssid_len, - const u8 *ie, int ie_len, bool use_mfp, - struct cfg80211_crypto_settings *crypt, - u32 assoc_flags, struct ieee80211_ht_cap *ht_capa, - struct ieee80211_ht_cap *ht_capa_mask) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_assoc_request req; - int err; - bool was_connected = false; - - ASSERT_WDEV_LOCK(wdev); - - memset(&req, 0, sizeof(req)); - - if (wdev->current_bss && prev_bssid && - memcmp(wdev->current_bss->pub.bssid, prev_bssid, ETH_ALEN) == 0) { - /* - * Trying to reassociate: Allow this to proceed and let the old - * association to be dropped when the new one is completed. - */ - if (wdev->sme_state == CFG80211_SME_CONNECTED) { - was_connected = true; - wdev->sme_state = CFG80211_SME_CONNECTING; - } - } else if (wdev->current_bss) - return -EALREADY; - - req.ie = ie; - req.ie_len = ie_len; - memcpy(&req.crypto, crypt, sizeof(req.crypto)); - req.use_mfp = use_mfp; - req.prev_bssid = prev_bssid; - req.flags = assoc_flags; - if (ht_capa) - memcpy(&req.ht_capa, ht_capa, sizeof(req.ht_capa)); - if (ht_capa_mask) - memcpy(&req.ht_capa_mask, ht_capa_mask, - sizeof(req.ht_capa_mask)); - cfg80211_oper_and_ht_capa(&req.ht_capa_mask, - rdev->wiphy.ht_capa_mod_mask); - - req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len, - WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); - if (!req.bss) { - if (was_connected) - wdev->sme_state = CFG80211_SME_CONNECTED; - return -ENOENT; - } - - err = rdev->ops->assoc(&rdev->wiphy, dev, &req); - - if (err) { - if (was_connected) - wdev->sme_state = CFG80211_SME_CONNECTED; - cfg80211_put_bss(req.bss); - } - - return err; -} - -int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct ieee80211_channel *chan, - const u8 *bssid, const u8 *prev_bssid, - const u8 *ssid, int ssid_len, - const u8 *ie, int ie_len, bool use_mfp, - struct cfg80211_crypto_settings *crypt, - u32 assoc_flags, struct ieee80211_ht_cap *ht_capa, - struct ieee80211_ht_cap *ht_capa_mask) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - wdev_lock(wdev); - err = __cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid, - ssid, ssid_len, ie, ie_len, use_mfp, crypt, - assoc_flags, ht_capa, ht_capa_mask); - wdev_unlock(wdev); - - return err; -} - -int __cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev, - struct net_device *dev, const u8 *bssid, - const u8 *ie, int ie_len, u16 reason, - bool local_state_change) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_deauth_request req = { - .bssid = bssid, - .reason_code = reason, - .ie = ie, - .ie_len = ie_len, - }; - - ASSERT_WDEV_LOCK(wdev); - - if (local_state_change) { - if (wdev->current_bss && - memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) { - cfg80211_unhold_bss(wdev->current_bss); - cfg80211_put_bss(&wdev->current_bss->pub); - wdev->current_bss = NULL; - } - - return 0; - } - - return rdev->ops->deauth(&rdev->wiphy, dev, &req); -} - -int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev, - struct net_device *dev, const u8 *bssid, - const u8 *ie, int ie_len, u16 reason, - bool local_state_change) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - wdev_lock(wdev); - err = __cfg80211_mlme_deauth(rdev, dev, bssid, ie, ie_len, reason, - local_state_change); - wdev_unlock(wdev); - - return err; -} - -static int __cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev, - struct net_device *dev, const u8 *bssid, - const u8 *ie, int ie_len, u16 reason, - bool local_state_change) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_disassoc_request req; - - ASSERT_WDEV_LOCK(wdev); - - if (wdev->sme_state != CFG80211_SME_CONNECTED) - return -ENOTCONN; - - if (WARN_ON(!wdev->current_bss)) - return -ENOTCONN; - - memset(&req, 0, sizeof(req)); - req.reason_code = reason; - req.local_state_change = local_state_change; - req.ie = ie; - req.ie_len = ie_len; - if (memcmp(wdev->current_bss->pub.bssid, bssid, ETH_ALEN) == 0) - req.bss = &wdev->current_bss->pub; - else - return -ENOTCONN; - - return rdev->ops->disassoc(&rdev->wiphy, dev, &req); -} - -int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev, - struct net_device *dev, const u8 *bssid, - const u8 *ie, int ie_len, u16 reason, - bool local_state_change) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - wdev_lock(wdev); - err = __cfg80211_mlme_disassoc(rdev, dev, bssid, ie, ie_len, reason, - local_state_change); - wdev_unlock(wdev); - - return err; -} - -void cfg80211_mlme_down(struct cfg80211_registered_device *rdev, - struct net_device *dev) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_deauth_request req; - u8 bssid[ETH_ALEN]; - - ASSERT_WDEV_LOCK(wdev); - - if (!rdev->ops->deauth) - return; - - memset(&req, 0, sizeof(req)); - req.reason_code = WLAN_REASON_DEAUTH_LEAVING; - req.ie = NULL; - req.ie_len = 0; - - if (!wdev->current_bss) - return; - - memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN); - req.bssid = bssid; - rdev->ops->deauth(&rdev->wiphy, dev, &req); - - if (wdev->current_bss) { - cfg80211_unhold_bss(wdev->current_bss); - cfg80211_put_bss(&wdev->current_bss->pub); - wdev->current_bss = NULL; - } -} - -void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, gfp_t gfp) -{ - struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - nl80211_send_remain_on_channel(rdev, dev, cookie, chan, channel_type, - duration, gfp); -} -EXPORT_SYMBOL(cfg80211_ready_on_channel); - -void cfg80211_remain_on_channel_expired(struct net_device *dev, - u64 cookie, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - gfp_t gfp) -{ - struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - nl80211_send_remain_on_channel_cancel(rdev, dev, cookie, chan, - channel_type, gfp); -} -EXPORT_SYMBOL(cfg80211_remain_on_channel_expired); - -void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, - struct station_info *sinfo, gfp_t gfp) -{ - struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - nl80211_send_sta_event(rdev, dev, mac_addr, sinfo, gfp); -} -EXPORT_SYMBOL(cfg80211_new_sta); - -void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp) -{ - struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - nl80211_send_sta_del_event(rdev, dev, mac_addr, gfp); -} -EXPORT_SYMBOL(cfg80211_del_sta); - -struct cfg80211_mgmt_registration { - struct list_head list; - - u32 nlpid; - - int match_len; - - __le16 frame_type; - - u8 match[]; -}; - -int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid, - u16 frame_type, const u8 *match_data, - int match_len) -{ - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - struct cfg80211_mgmt_registration *reg, *nreg; - int err = 0; - u16 mgmt_type; - - if (!wdev->wiphy->mgmt_stypes) - return -EOPNOTSUPP; - - if ((frame_type & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT) - return -EINVAL; - - if (frame_type & ~(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) - return -EINVAL; - - mgmt_type = (frame_type & IEEE80211_FCTL_STYPE) >> 4; - if (!(wdev->wiphy->mgmt_stypes[wdev->iftype].rx & BIT(mgmt_type))) - return -EINVAL; - - nreg = kzalloc(sizeof(*reg) + match_len, GFP_KERNEL); - if (!nreg) - return -ENOMEM; - - spin_lock_bh(&wdev->mgmt_registrations_lock); - - list_for_each_entry(reg, &wdev->mgmt_registrations, list) { - int mlen = min(match_len, reg->match_len); - - if (frame_type != le16_to_cpu(reg->frame_type)) - continue; - - if (memcmp(reg->match, match_data, mlen) == 0) { - err = -EALREADY; - break; - } - } - - if (err) { - kfree(nreg); - goto out; - } - - memcpy(nreg->match, match_data, match_len); - nreg->match_len = match_len; - nreg->nlpid = snd_pid; - nreg->frame_type = cpu_to_le16(frame_type); - list_add(&nreg->list, &wdev->mgmt_registrations); - - if (rdev->ops->mgmt_frame_register) - rdev->ops->mgmt_frame_register(wiphy, wdev->netdev, - frame_type, true); - - out: - spin_unlock_bh(&wdev->mgmt_registrations_lock); - - return err; -} - -void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid) -{ - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - struct cfg80211_mgmt_registration *reg, *tmp; - - spin_lock_bh(&wdev->mgmt_registrations_lock); - - list_for_each_entry_safe(reg, tmp, &wdev->mgmt_registrations, list) { - if (reg->nlpid != nlpid) - continue; - - if (rdev->ops->mgmt_frame_register) { - u16 frame_type = le16_to_cpu(reg->frame_type); - - rdev->ops->mgmt_frame_register(wiphy, wdev->netdev, - frame_type, false); - } - - list_del(®->list); - kfree(reg); - } - - spin_unlock_bh(&wdev->mgmt_registrations_lock); - - if (nlpid == wdev->ap_unexpected_nlpid) - wdev->ap_unexpected_nlpid = 0; -} - -void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev) -{ - struct cfg80211_mgmt_registration *reg, *tmp; - - spin_lock_bh(&wdev->mgmt_registrations_lock); - - list_for_each_entry_safe(reg, tmp, &wdev->mgmt_registrations, list) { - list_del(®->list); - kfree(reg); - } - - spin_unlock_bh(&wdev->mgmt_registrations_lock); -} - -int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct ieee80211_channel *chan, bool offchan, - enum nl80211_channel_type channel_type, - bool channel_type_valid, unsigned int wait, - const u8 *buf, size_t len, bool no_cck, - bool dont_wait_for_ack, u64 *cookie) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - const struct ieee80211_mgmt *mgmt; - u16 stype; - - if (!wdev->wiphy->mgmt_stypes) - return -EOPNOTSUPP; - - if (!rdev->ops->mgmt_tx) - return -EOPNOTSUPP; - - if (len < 24 + 1) - return -EINVAL; - - mgmt = (const struct ieee80211_mgmt *) buf; - - if (!ieee80211_is_mgmt(mgmt->frame_control)) - return -EINVAL; - - stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE; - if (!(wdev->wiphy->mgmt_stypes[wdev->iftype].tx & BIT(stype >> 4))) - return -EINVAL; - - if (ieee80211_is_action(mgmt->frame_control) && - mgmt->u.action.category != WLAN_CATEGORY_PUBLIC) { - int err = 0; - - wdev_lock(wdev); - - switch (wdev->iftype) { - case NL80211_IFTYPE_ADHOC: - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_P2P_CLIENT: - if (!wdev->current_bss) { - err = -ENOTCONN; - break; - } - - if (memcmp(wdev->current_bss->pub.bssid, - mgmt->bssid, ETH_ALEN)) { - err = -ENOTCONN; - break; - } - - /* - * check for IBSS DA must be done by driver as - * cfg80211 doesn't track the stations - */ - if (wdev->iftype == NL80211_IFTYPE_ADHOC) - break; - - /* for station, check that DA is the AP */ - if (memcmp(wdev->current_bss->pub.bssid, - mgmt->da, ETH_ALEN)) { - err = -ENOTCONN; - break; - } - break; - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_P2P_GO: - case NL80211_IFTYPE_AP_VLAN: - if (memcmp(mgmt->bssid, dev->dev_addr, ETH_ALEN)) - err = -EINVAL; - break; - case NL80211_IFTYPE_MESH_POINT: - if (memcmp(mgmt->sa, mgmt->bssid, ETH_ALEN)) { - err = -EINVAL; - break; - } - /* - * check for mesh DA must be done by driver as - * cfg80211 doesn't track the stations - */ - break; - default: - err = -EOPNOTSUPP; - break; - } - wdev_unlock(wdev); - - if (err) - return err; - } - - if (memcmp(mgmt->sa, dev->dev_addr, ETH_ALEN) != 0) - return -EINVAL; - - /* Transmit the Action frame as requested by user space */ - return rdev->ops->mgmt_tx(&rdev->wiphy, dev, chan, offchan, - channel_type, channel_type_valid, - wait, buf, len, no_cck, dont_wait_for_ack, - cookie); -} - -bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_mbm, - const u8 *buf, size_t len, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - struct cfg80211_mgmt_registration *reg; - const struct ieee80211_txrx_stypes *stypes = - &wiphy->mgmt_stypes[wdev->iftype]; - struct ieee80211_mgmt *mgmt = (void *)buf; - const u8 *data; - int data_len; - bool result = false; - __le16 ftype = mgmt->frame_control & - cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE); - u16 stype; - - stype = (le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE) >> 4; - - if (!(stypes->rx & BIT(stype))) - return false; - - data = buf + ieee80211_hdrlen(mgmt->frame_control); - data_len = len - ieee80211_hdrlen(mgmt->frame_control); - - spin_lock_bh(&wdev->mgmt_registrations_lock); - - list_for_each_entry(reg, &wdev->mgmt_registrations, list) { - if (reg->frame_type != ftype) - continue; - - if (reg->match_len > data_len) - continue; - - if (memcmp(reg->match, data, reg->match_len)) - continue; - - /* found match! */ - - /* Indicate the received Action frame to user space */ - if (nl80211_send_mgmt(rdev, dev, reg->nlpid, - freq, sig_mbm, - buf, len, gfp)) - continue; - - result = true; - break; - } - - spin_unlock_bh(&wdev->mgmt_registrations_lock); - - return result; -} -EXPORT_SYMBOL(cfg80211_rx_mgmt); - -void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie, - const u8 *buf, size_t len, bool ack, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - /* Indicate TX status of the Action frame to user space */ - nl80211_send_mgmt_tx_status(rdev, dev, cookie, buf, len, ack, gfp); -} -EXPORT_SYMBOL(cfg80211_mgmt_tx_status); - -void cfg80211_cqm_rssi_notify(struct net_device *dev, - enum nl80211_cqm_rssi_threshold_event rssi_event, - gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - /* Indicate roaming trigger event to user space */ - nl80211_send_cqm_rssi_notify(rdev, dev, rssi_event, gfp); -} -EXPORT_SYMBOL(cfg80211_cqm_rssi_notify); - -void cfg80211_cqm_pktloss_notify(struct net_device *dev, - const u8 *peer, u32 num_packets, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - /* Indicate roaming trigger event to user space */ - nl80211_send_cqm_pktloss_notify(rdev, dev, peer, num_packets, gfp); -} -EXPORT_SYMBOL(cfg80211_cqm_pktloss_notify); - -void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid, - const u8 *replay_ctr, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - nl80211_gtk_rekey_notify(rdev, dev, bssid, replay_ctr, gfp); -} -EXPORT_SYMBOL(cfg80211_gtk_rekey_notify); - -void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index, - const u8 *bssid, bool preauth, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - nl80211_pmksa_candidate_notify(rdev, dev, index, bssid, preauth, gfp); -} -EXPORT_SYMBOL(cfg80211_pmksa_candidate_notify); - -bool cfg80211_rx_spurious_frame(struct net_device *dev, - const u8 *addr, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_AP && - wdev->iftype != NL80211_IFTYPE_P2P_GO)) - return false; - - return nl80211_unexpected_frame(dev, addr, gfp); -} -EXPORT_SYMBOL(cfg80211_rx_spurious_frame); - -bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, - const u8 *addr, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_AP && - wdev->iftype != NL80211_IFTYPE_P2P_GO && - wdev->iftype != NL80211_IFTYPE_AP_VLAN)) - return false; - - return nl80211_unexpected_4addr_frame(dev, addr, gfp); -} -EXPORT_SYMBOL(cfg80211_rx_unexpected_4addr_frame); diff --git a/openairITS/mac/DOT11/net/wireless/modules.order b/openairITS/mac/DOT11/net/wireless/modules.order deleted file mode 100644 index 213b6d0453a..00000000000 --- a/openairITS/mac/DOT11/net/wireless/modules.order +++ /dev/null @@ -1 +0,0 @@ -kernel//home/thales/openair4G/openairITS/mac/DOT11/net/wireless/cfg80211.ko diff --git a/openairITS/mac/DOT11/net/wireless/nl80211.c b/openairITS/mac/DOT11/net/wireless/nl80211.c deleted file mode 100644 index 0ea8f3256c9..00000000000 --- a/openairITS/mac/DOT11/net/wireless/nl80211.c +++ /dev/null @@ -1,8117 +0,0 @@ -/* - * This is the new netlink-based wireless configuration interface. - * - * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> - */ - -#include <linux/if.h> -#include <linux/module.h> -#include <linux/err.h> -#include <linux/slab.h> -#include <linux/list.h> -#include <linux/if_ether.h> -#include <linux/ieee80211.h> -#include <linux/nl80211.h> -#include <linux/rtnetlink.h> -#include <linux/netlink.h> -#include <linux/etherdevice.h> -#include <net/net_namespace.h> -#include <net/genetlink.h> -#include <net/cfg80211.h> -#include <net/sock.h> -#include "core.h" -#include "nl80211.h" -#include "reg.h" - -static bool nl80211_valid_auth_type(enum nl80211_auth_type auth_type); -static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, - struct genl_info *info, - struct cfg80211_crypto_settings *settings, - int cipher_limit); - -static int nl80211_pre_doit(struct genl_ops *ops, struct sk_buff *skb, - struct genl_info *info); -static void nl80211_post_doit(struct genl_ops *ops, struct sk_buff *skb, - struct genl_info *info); - -/* the netlink family */ -static struct genl_family nl80211_fam = { - .id = GENL_ID_GENERATE, /* don't bother with a hardcoded ID */ - .name = "nl80211", /* have users key off the name instead */ - .hdrsize = 0, /* no private header */ - .version = 1, /* no particular meaning now */ - .maxattr = NL80211_ATTR_MAX, - .netnsok = true, - .pre_doit = nl80211_pre_doit, - .post_doit = nl80211_post_doit, -}; - -/* internal helper: get rdev and dev */ -static int get_rdev_dev_by_ifindex(struct net *netns, struct nlattr **attrs, - struct cfg80211_registered_device **rdev, - struct net_device **dev) -{ - int ifindex; - - if (!attrs[NL80211_ATTR_IFINDEX]) - return -EINVAL; - - ifindex = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]); - *dev = dev_get_by_index(netns, ifindex); - if (!*dev) - return -ENODEV; - - *rdev = cfg80211_get_dev_from_ifindex(netns, ifindex); - if (IS_ERR(*rdev)) { - dev_put(*dev); - return PTR_ERR(*rdev); - } - - return 0; -} - -/* policy for the attributes */ -static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { - [NL80211_ATTR_WIPHY] = { .type = NLA_U32 }, - [NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING, - .len = 20-1 }, - [NL80211_ATTR_WIPHY_TXQ_PARAMS] = { .type = NLA_NESTED }, - [NL80211_ATTR_WIPHY_FREQ] = { .type = NLA_U32 }, - [NL80211_ATTR_WIPHY_CHANNEL_TYPE] = { .type = NLA_U32 }, - [NL80211_ATTR_WIPHY_RETRY_SHORT] = { .type = NLA_U8 }, - [NL80211_ATTR_WIPHY_RETRY_LONG] = { .type = NLA_U8 }, - [NL80211_ATTR_WIPHY_FRAG_THRESHOLD] = { .type = NLA_U32 }, - [NL80211_ATTR_WIPHY_RTS_THRESHOLD] = { .type = NLA_U32 }, - [NL80211_ATTR_WIPHY_COVERAGE_CLASS] = { .type = NLA_U8 }, - - [NL80211_ATTR_IFTYPE] = { .type = NLA_U32 }, - [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 }, - [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 }, - - [NL80211_ATTR_MAC] = { .len = ETH_ALEN }, - [NL80211_ATTR_PREV_BSSID] = { .len = ETH_ALEN }, - - [NL80211_ATTR_KEY] = { .type = NLA_NESTED, }, - [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY, - .len = WLAN_MAX_KEY_LEN }, - [NL80211_ATTR_KEY_IDX] = { .type = NLA_U8 }, - [NL80211_ATTR_KEY_CIPHER] = { .type = NLA_U32 }, - [NL80211_ATTR_KEY_DEFAULT] = { .type = NLA_FLAG }, - [NL80211_ATTR_KEY_SEQ] = { .type = NLA_BINARY, .len = 16 }, - [NL80211_ATTR_KEY_TYPE] = { .type = NLA_U32 }, - - [NL80211_ATTR_BEACON_INTERVAL] = { .type = NLA_U32 }, - [NL80211_ATTR_DTIM_PERIOD] = { .type = NLA_U32 }, - [NL80211_ATTR_BEACON_HEAD] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_DATA_LEN }, - [NL80211_ATTR_BEACON_TAIL] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_DATA_LEN }, - [NL80211_ATTR_STA_AID] = { .type = NLA_U16 }, - [NL80211_ATTR_STA_FLAGS] = { .type = NLA_NESTED }, - [NL80211_ATTR_STA_LISTEN_INTERVAL] = { .type = NLA_U16 }, - [NL80211_ATTR_STA_SUPPORTED_RATES] = { .type = NLA_BINARY, - .len = NL80211_MAX_SUPP_RATES }, - [NL80211_ATTR_STA_PLINK_ACTION] = { .type = NLA_U8 }, - [NL80211_ATTR_STA_VLAN] = { .type = NLA_U32 }, - [NL80211_ATTR_MNTR_FLAGS] = { /* NLA_NESTED can't be empty */ }, - [NL80211_ATTR_MESH_ID] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_MESH_ID_LEN }, - [NL80211_ATTR_MPATH_NEXT_HOP] = { .type = NLA_U32 }, - - [NL80211_ATTR_REG_ALPHA2] = { .type = NLA_STRING, .len = 2 }, - [NL80211_ATTR_REG_RULES] = { .type = NLA_NESTED }, - - [NL80211_ATTR_BSS_CTS_PROT] = { .type = NLA_U8 }, - [NL80211_ATTR_BSS_SHORT_PREAMBLE] = { .type = NLA_U8 }, - [NL80211_ATTR_BSS_SHORT_SLOT_TIME] = { .type = NLA_U8 }, - [NL80211_ATTR_BSS_BASIC_RATES] = { .type = NLA_BINARY, - .len = NL80211_MAX_SUPP_RATES }, - [NL80211_ATTR_BSS_HT_OPMODE] = { .type = NLA_U16 }, - - [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED }, - [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG }, - - [NL80211_ATTR_HT_CAPABILITY] = { .len = NL80211_HT_CAPABILITY_LEN }, - - [NL80211_ATTR_MGMT_SUBTYPE] = { .type = NLA_U8 }, - [NL80211_ATTR_IE] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_DATA_LEN }, - [NL80211_ATTR_SCAN_FREQUENCIES] = { .type = NLA_NESTED }, - [NL80211_ATTR_SCAN_SSIDS] = { .type = NLA_NESTED }, - - [NL80211_ATTR_SSID] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_SSID_LEN }, - [NL80211_ATTR_AUTH_TYPE] = { .type = NLA_U32 }, - [NL80211_ATTR_REASON_CODE] = { .type = NLA_U16 }, - [NL80211_ATTR_FREQ_FIXED] = { .type = NLA_FLAG }, - [NL80211_ATTR_TIMED_OUT] = { .type = NLA_FLAG }, - [NL80211_ATTR_USE_MFP] = { .type = NLA_U32 }, - [NL80211_ATTR_STA_FLAGS2] = { - .len = sizeof(struct nl80211_sta_flag_update), - }, - [NL80211_ATTR_CONTROL_PORT] = { .type = NLA_FLAG }, - [NL80211_ATTR_CONTROL_PORT_ETHERTYPE] = { .type = NLA_U16 }, - [NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT] = { .type = NLA_FLAG }, - [NL80211_ATTR_PRIVACY] = { .type = NLA_FLAG }, - [NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 }, - [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 }, - [NL80211_ATTR_PID] = { .type = NLA_U32 }, - [NL80211_ATTR_4ADDR] = { .type = NLA_U8 }, - [NL80211_ATTR_PMKID] = { .type = NLA_BINARY, - .len = WLAN_PMKID_LEN }, - [NL80211_ATTR_DURATION] = { .type = NLA_U32 }, - [NL80211_ATTR_COOKIE] = { .type = NLA_U64 }, - [NL80211_ATTR_TX_RATES] = { .type = NLA_NESTED }, - [NL80211_ATTR_FRAME] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_DATA_LEN }, - [NL80211_ATTR_FRAME_MATCH] = { .type = NLA_BINARY, }, - [NL80211_ATTR_PS_STATE] = { .type = NLA_U32 }, - [NL80211_ATTR_CQM] = { .type = NLA_NESTED, }, - [NL80211_ATTR_LOCAL_STATE_CHANGE] = { .type = NLA_FLAG }, - [NL80211_ATTR_AP_ISOLATE] = { .type = NLA_U8 }, - [NL80211_ATTR_WIPHY_TX_POWER_SETTING] = { .type = NLA_U32 }, - [NL80211_ATTR_WIPHY_TX_POWER_LEVEL] = { .type = NLA_U32 }, - [NL80211_ATTR_FRAME_TYPE] = { .type = NLA_U16 }, - [NL80211_ATTR_WIPHY_ANTENNA_TX] = { .type = NLA_U32 }, - [NL80211_ATTR_WIPHY_ANTENNA_RX] = { .type = NLA_U32 }, - [NL80211_ATTR_MCAST_RATE] = { .type = NLA_U32 }, - [NL80211_ATTR_OFFCHANNEL_TX_OK] = { .type = NLA_FLAG }, - [NL80211_ATTR_KEY_DEFAULT_TYPES] = { .type = NLA_NESTED }, - [NL80211_ATTR_WOWLAN_TRIGGERS] = { .type = NLA_NESTED }, - [NL80211_ATTR_STA_PLINK_STATE] = { .type = NLA_U8 }, - [NL80211_ATTR_SCHED_SCAN_INTERVAL] = { .type = NLA_U32 }, - [NL80211_ATTR_REKEY_DATA] = { .type = NLA_NESTED }, - [NL80211_ATTR_SCAN_SUPP_RATES] = { .type = NLA_NESTED }, - [NL80211_ATTR_HIDDEN_SSID] = { .type = NLA_U32 }, - [NL80211_ATTR_IE_PROBE_RESP] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_DATA_LEN }, - [NL80211_ATTR_IE_ASSOC_RESP] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_DATA_LEN }, - [NL80211_ATTR_ROAM_SUPPORT] = { .type = NLA_FLAG }, - [NL80211_ATTR_SCHED_SCAN_MATCH] = { .type = NLA_NESTED }, - [NL80211_ATTR_TX_NO_CCK_RATE] = { .type = NLA_FLAG }, - [NL80211_ATTR_TDLS_ACTION] = { .type = NLA_U8 }, - [NL80211_ATTR_TDLS_DIALOG_TOKEN] = { .type = NLA_U8 }, - [NL80211_ATTR_TDLS_OPERATION] = { .type = NLA_U8 }, - [NL80211_ATTR_TDLS_SUPPORT] = { .type = NLA_FLAG }, - [NL80211_ATTR_TDLS_EXTERNAL_SETUP] = { .type = NLA_FLAG }, - [NL80211_ATTR_DONT_WAIT_FOR_ACK] = { .type = NLA_FLAG }, - [NL80211_ATTR_PROBE_RESP] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_DATA_LEN }, - [NL80211_ATTR_DFS_REGION] = { .type = NLA_U8 }, - [NL80211_ATTR_DISABLE_HT] = { .type = NLA_FLAG }, - [NL80211_ATTR_HT_CAPABILITY_MASK] = { - .len = NL80211_HT_CAPABILITY_LEN - }, - [NL80211_ATTR_NOACK_MAP] = { .type = NLA_U16 }, - [NL80211_ATTR_INACTIVITY_TIMEOUT] = { .type = NLA_U16 }, - [NL80211_ATTR_BG_SCAN_PERIOD] = { .type = NLA_U16 }, -}; - -/* policy for the key attributes */ -static const struct nla_policy nl80211_key_policy[NL80211_KEY_MAX + 1] = { - [NL80211_KEY_DATA] = { .type = NLA_BINARY, .len = WLAN_MAX_KEY_LEN }, - [NL80211_KEY_IDX] = { .type = NLA_U8 }, - [NL80211_KEY_CIPHER] = { .type = NLA_U32 }, - [NL80211_KEY_SEQ] = { .type = NLA_BINARY, .len = 16 }, - [NL80211_KEY_DEFAULT] = { .type = NLA_FLAG }, - [NL80211_KEY_DEFAULT_MGMT] = { .type = NLA_FLAG }, - [NL80211_KEY_TYPE] = { .type = NLA_U32 }, - [NL80211_KEY_DEFAULT_TYPES] = { .type = NLA_NESTED }, -}; - -/* policy for the key default flags */ -static const struct nla_policy -nl80211_key_default_policy[NUM_NL80211_KEY_DEFAULT_TYPES] = { - [NL80211_KEY_DEFAULT_TYPE_UNICAST] = { .type = NLA_FLAG }, - [NL80211_KEY_DEFAULT_TYPE_MULTICAST] = { .type = NLA_FLAG }, -}; - -/* policy for WoWLAN attributes */ -static const struct nla_policy -nl80211_wowlan_policy[NUM_NL80211_WOWLAN_TRIG] = { - [NL80211_WOWLAN_TRIG_ANY] = { .type = NLA_FLAG }, - [NL80211_WOWLAN_TRIG_DISCONNECT] = { .type = NLA_FLAG }, - [NL80211_WOWLAN_TRIG_MAGIC_PKT] = { .type = NLA_FLAG }, - [NL80211_WOWLAN_TRIG_PKT_PATTERN] = { .type = NLA_NESTED }, - [NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE] = { .type = NLA_FLAG }, - [NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST] = { .type = NLA_FLAG }, - [NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE] = { .type = NLA_FLAG }, - [NL80211_WOWLAN_TRIG_RFKILL_RELEASE] = { .type = NLA_FLAG }, -}; - -/* policy for GTK rekey offload attributes */ -static const struct nla_policy -nl80211_rekey_policy[NUM_NL80211_REKEY_DATA] = { - [NL80211_REKEY_DATA_KEK] = { .len = NL80211_KEK_LEN }, - [NL80211_REKEY_DATA_KCK] = { .len = NL80211_KCK_LEN }, - [NL80211_REKEY_DATA_REPLAY_CTR] = { .len = NL80211_REPLAY_CTR_LEN }, -}; - -static const struct nla_policy -nl80211_match_policy[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1] = { - [NL80211_ATTR_SCHED_SCAN_MATCH_SSID] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_SSID_LEN }, -}; - -/* ifidx get helper */ -static int nl80211_get_ifidx(struct netlink_callback *cb) -{ - int res; - - res = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, - nl80211_fam.attrbuf, nl80211_fam.maxattr, - nl80211_policy); - if (res) - return res; - - if (!nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX]) - return -EINVAL; - - res = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX]); - if (!res) - return -EINVAL; - return res; -} - -static int nl80211_prepare_netdev_dump(struct sk_buff *skb, - struct netlink_callback *cb, - struct cfg80211_registered_device **rdev, - struct net_device **dev) -{ - int ifidx = cb->args[0]; - int err; - - if (!ifidx) - ifidx = nl80211_get_ifidx(cb); - if (ifidx < 0) - return ifidx; - - cb->args[0] = ifidx; - - rtnl_lock(); - - *dev = __dev_get_by_index(sock_net(skb->sk), ifidx); - if (!*dev) { - err = -ENODEV; - goto out_rtnl; - } - - *rdev = cfg80211_get_dev_from_ifindex(sock_net(skb->sk), ifidx); - if (IS_ERR(*rdev)) { - err = PTR_ERR(*rdev); - goto out_rtnl; - } - - return 0; - out_rtnl: - rtnl_unlock(); - return err; -} - -static void nl80211_finish_netdev_dump(struct cfg80211_registered_device *rdev) -{ - cfg80211_unlock_rdev(rdev); - rtnl_unlock(); -} - -/* IE validation */ -static bool is_valid_ie_attr(const struct nlattr *attr) -{ - const u8 *pos; - int len; - - if (!attr) - return true; - - pos = nla_data(attr); - len = nla_len(attr); - - while (len) { - u8 elemlen; - - if (len < 2) - return false; - len -= 2; - - elemlen = pos[1]; - if (elemlen > len) - return false; - - len -= elemlen; - pos += 2 + elemlen; - } - - return true; -} - -/* message building helper */ -static inline void *nl80211hdr_put(struct sk_buff *skb, u32 pid, u32 seq, - int flags, u8 cmd) -{ - /* since there is no private header just add the generic one */ - return genlmsg_put(skb, pid, seq, &nl80211_fam, flags, cmd); -} - -static int nl80211_msg_put_channel(struct sk_buff *msg, - struct ieee80211_channel *chan) -{ - NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_FREQ, - chan->center_freq); - - if (chan->flags & IEEE80211_CHAN_DISABLED) - NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_DISABLED); - if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) - NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_PASSIVE_SCAN); - if (chan->flags & IEEE80211_CHAN_NO_IBSS) - NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_IBSS); - if (chan->flags & IEEE80211_CHAN_RADAR) - NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_RADAR); - - NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, - DBM_TO_MBM(chan->max_power)); - - return 0; - - nla_put_failure: - return -ENOBUFS; -} - -/* netlink command implementations */ - -struct key_parse { - struct key_params p; - int idx; - int type; - bool def, defmgmt; - bool def_uni, def_multi; -}; - -static int nl80211_parse_key_new(struct nlattr *key, struct key_parse *k) -{ - struct nlattr *tb[NL80211_KEY_MAX + 1]; - int err = nla_parse_nested(tb, NL80211_KEY_MAX, key, - nl80211_key_policy); - if (err) - return err; - - k->def = !!tb[NL80211_KEY_DEFAULT]; - k->defmgmt = !!tb[NL80211_KEY_DEFAULT_MGMT]; - - if (k->def) { - k->def_uni = true; - k->def_multi = true; - } - if (k->defmgmt) - k->def_multi = true; - - if (tb[NL80211_KEY_IDX]) - k->idx = nla_get_u8(tb[NL80211_KEY_IDX]); - - if (tb[NL80211_KEY_DATA]) { - k->p.key = nla_data(tb[NL80211_KEY_DATA]); - k->p.key_len = nla_len(tb[NL80211_KEY_DATA]); - } - - if (tb[NL80211_KEY_SEQ]) { - k->p.seq = nla_data(tb[NL80211_KEY_SEQ]); - k->p.seq_len = nla_len(tb[NL80211_KEY_SEQ]); - } - - if (tb[NL80211_KEY_CIPHER]) - k->p.cipher = nla_get_u32(tb[NL80211_KEY_CIPHER]); - - if (tb[NL80211_KEY_TYPE]) { - k->type = nla_get_u32(tb[NL80211_KEY_TYPE]); - if (k->type < 0 || k->type >= NUM_NL80211_KEYTYPES) - return -EINVAL; - } - - if (tb[NL80211_KEY_DEFAULT_TYPES]) { - struct nlattr *kdt[NUM_NL80211_KEY_DEFAULT_TYPES]; - err = nla_parse_nested(kdt, NUM_NL80211_KEY_DEFAULT_TYPES - 1, - tb[NL80211_KEY_DEFAULT_TYPES], - nl80211_key_default_policy); - if (err) - return err; - - k->def_uni = kdt[NL80211_KEY_DEFAULT_TYPE_UNICAST]; - k->def_multi = kdt[NL80211_KEY_DEFAULT_TYPE_MULTICAST]; - } - - return 0; -} - -static int nl80211_parse_key_old(struct genl_info *info, struct key_parse *k) -{ - if (info->attrs[NL80211_ATTR_KEY_DATA]) { - k->p.key = nla_data(info->attrs[NL80211_ATTR_KEY_DATA]); - k->p.key_len = nla_len(info->attrs[NL80211_ATTR_KEY_DATA]); - } - - if (info->attrs[NL80211_ATTR_KEY_SEQ]) { - k->p.seq = nla_data(info->attrs[NL80211_ATTR_KEY_SEQ]); - k->p.seq_len = nla_len(info->attrs[NL80211_ATTR_KEY_SEQ]); - } - - if (info->attrs[NL80211_ATTR_KEY_IDX]) - k->idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]); - - if (info->attrs[NL80211_ATTR_KEY_CIPHER]) - k->p.cipher = nla_get_u32(info->attrs[NL80211_ATTR_KEY_CIPHER]); - - k->def = !!info->attrs[NL80211_ATTR_KEY_DEFAULT]; - k->defmgmt = !!info->attrs[NL80211_ATTR_KEY_DEFAULT_MGMT]; - - if (k->def) { - k->def_uni = true; - k->def_multi = true; - } - if (k->defmgmt) - k->def_multi = true; - - if (info->attrs[NL80211_ATTR_KEY_TYPE]) { - k->type = nla_get_u32(info->attrs[NL80211_ATTR_KEY_TYPE]); - if (k->type < 0 || k->type >= NUM_NL80211_KEYTYPES) - return -EINVAL; - } - - if (info->attrs[NL80211_ATTR_KEY_DEFAULT_TYPES]) { - struct nlattr *kdt[NUM_NL80211_KEY_DEFAULT_TYPES]; - int err = nla_parse_nested( - kdt, NUM_NL80211_KEY_DEFAULT_TYPES - 1, - info->attrs[NL80211_ATTR_KEY_DEFAULT_TYPES], - nl80211_key_default_policy); - if (err) - return err; - - k->def_uni = kdt[NL80211_KEY_DEFAULT_TYPE_UNICAST]; - k->def_multi = kdt[NL80211_KEY_DEFAULT_TYPE_MULTICAST]; - } - - return 0; -} - -static int nl80211_parse_key(struct genl_info *info, struct key_parse *k) -{ - int err; - - memset(k, 0, sizeof(*k)); - k->idx = -1; - k->type = -1; - - if (info->attrs[NL80211_ATTR_KEY]) - err = nl80211_parse_key_new(info->attrs[NL80211_ATTR_KEY], k); - else - err = nl80211_parse_key_old(info, k); - - if (err) - return err; - - if (k->def && k->defmgmt) - return -EINVAL; - - if (k->defmgmt) { - if (k->def_uni || !k->def_multi) - return -EINVAL; - } - - if (k->idx != -1) { - if (k->defmgmt) { - if (k->idx < 4 || k->idx > 5) - return -EINVAL; - } else if (k->def) { - if (k->idx < 0 || k->idx > 3) - return -EINVAL; - } else { - if (k->idx < 0 || k->idx > 5) - return -EINVAL; - } - } - - return 0; -} - -static struct cfg80211_cached_keys * -nl80211_parse_connkeys(struct cfg80211_registered_device *rdev, - struct nlattr *keys) -{ - struct key_parse parse; - struct nlattr *key; - struct cfg80211_cached_keys *result; - int rem, err, def = 0; - - result = kzalloc(sizeof(*result), GFP_KERNEL); - if (!result) - return ERR_PTR(-ENOMEM); - - result->def = -1; - result->defmgmt = -1; - - nla_for_each_nested(key, keys, rem) { - memset(&parse, 0, sizeof(parse)); - parse.idx = -1; - - err = nl80211_parse_key_new(key, &parse); - if (err) - goto error; - err = -EINVAL; - if (!parse.p.key) - goto error; - if (parse.idx < 0 || parse.idx > 4) - goto error; - if (parse.def) { - if (def) - goto error; - def = 1; - result->def = parse.idx; - if (!parse.def_uni || !parse.def_multi) - goto error; - } else if (parse.defmgmt) - goto error; - err = cfg80211_validate_key_settings(rdev, &parse.p, - parse.idx, false, NULL); - if (err) - goto error; - result->params[parse.idx].cipher = parse.p.cipher; - result->params[parse.idx].key_len = parse.p.key_len; - result->params[parse.idx].key = result->data[parse.idx]; - memcpy(result->data[parse.idx], parse.p.key, parse.p.key_len); - } - - return result; - error: - kfree(result); - return ERR_PTR(err); -} - -static int nl80211_key_allowed(struct wireless_dev *wdev) -{ - ASSERT_WDEV_LOCK(wdev); - - switch (wdev->iftype) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_P2P_GO: - case NL80211_IFTYPE_MESH_POINT: - break; - case NL80211_IFTYPE_ADHOC: - if (!wdev->current_bss) - return -ENOLINK; - break; - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_P2P_CLIENT: - if (wdev->sme_state != CFG80211_SME_CONNECTED) - return -ENOLINK; - break; - default: - return -EINVAL; - } - - return 0; -} - -static int nl80211_put_iftypes(struct sk_buff *msg, u32 attr, u16 ifmodes) -{ - struct nlattr *nl_modes = nla_nest_start(msg, attr); - int i; - - if (!nl_modes) - goto nla_put_failure; - - i = 0; - while (ifmodes) { - if (ifmodes & 1) - NLA_PUT_FLAG(msg, i); - ifmodes >>= 1; - i++; - } - - nla_nest_end(msg, nl_modes); - return 0; - -nla_put_failure: - return -ENOBUFS; -} - -static int nl80211_put_iface_combinations(struct wiphy *wiphy, - struct sk_buff *msg) -{ - struct nlattr *nl_combis; - int i, j; - - nl_combis = nla_nest_start(msg, - NL80211_ATTR_INTERFACE_COMBINATIONS); - if (!nl_combis) - goto nla_put_failure; - - for (i = 0; i < wiphy->n_iface_combinations; i++) { - const struct ieee80211_iface_combination *c; - struct nlattr *nl_combi, *nl_limits; - - c = &wiphy->iface_combinations[i]; - - nl_combi = nla_nest_start(msg, i + 1); - if (!nl_combi) - goto nla_put_failure; - - nl_limits = nla_nest_start(msg, NL80211_IFACE_COMB_LIMITS); - if (!nl_limits) - goto nla_put_failure; - - for (j = 0; j < c->n_limits; j++) { - struct nlattr *nl_limit; - - nl_limit = nla_nest_start(msg, j + 1); - if (!nl_limit) - goto nla_put_failure; - NLA_PUT_U32(msg, NL80211_IFACE_LIMIT_MAX, - c->limits[j].max); - if (nl80211_put_iftypes(msg, NL80211_IFACE_LIMIT_TYPES, - c->limits[j].types)) - goto nla_put_failure; - nla_nest_end(msg, nl_limit); - } - - nla_nest_end(msg, nl_limits); - - if (c->beacon_int_infra_match) - NLA_PUT_FLAG(msg, - NL80211_IFACE_COMB_STA_AP_BI_MATCH); - NLA_PUT_U32(msg, NL80211_IFACE_COMB_NUM_CHANNELS, - c->num_different_channels); - NLA_PUT_U32(msg, NL80211_IFACE_COMB_MAXNUM, - c->max_interfaces); - - nla_nest_end(msg, nl_combi); - } - - nla_nest_end(msg, nl_combis); - - return 0; -nla_put_failure: - return -ENOBUFS; -} - -static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags, - struct cfg80211_registered_device *dev) -{ - void *hdr; - struct nlattr *nl_bands, *nl_band; - struct nlattr *nl_freqs, *nl_freq; - struct nlattr *nl_rates, *nl_rate; - struct nlattr *nl_cmds; - enum ieee80211_band band; - struct ieee80211_channel *chan; - struct ieee80211_rate *rate; - int i; - const struct ieee80211_txrx_stypes *mgmt_stypes = - dev->wiphy.mgmt_stypes; - - hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_WIPHY); - if (!hdr) - return -1; - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, dev->wiphy_idx); - NLA_PUT_STRING(msg, NL80211_ATTR_WIPHY_NAME, wiphy_name(&dev->wiphy)); - - NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, - cfg80211_rdev_list_generation); - - NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT, - dev->wiphy.retry_short); - NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_RETRY_LONG, - dev->wiphy.retry_long); - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FRAG_THRESHOLD, - dev->wiphy.frag_threshold); - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, - dev->wiphy.rts_threshold); - NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, - dev->wiphy.coverage_class); - NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, - dev->wiphy.max_scan_ssids); - NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, - dev->wiphy.max_sched_scan_ssids); - NLA_PUT_U16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN, - dev->wiphy.max_scan_ie_len); - NLA_PUT_U16(msg, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, - dev->wiphy.max_sched_scan_ie_len); - NLA_PUT_U8(msg, NL80211_ATTR_MAX_MATCH_SETS, - dev->wiphy.max_match_sets); - - if (dev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) - NLA_PUT_FLAG(msg, NL80211_ATTR_SUPPORT_IBSS_RSN); - if (dev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) - NLA_PUT_FLAG(msg, NL80211_ATTR_SUPPORT_MESH_AUTH); - if (dev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) - NLA_PUT_FLAG(msg, NL80211_ATTR_SUPPORT_AP_UAPSD); - if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) - NLA_PUT_FLAG(msg, NL80211_ATTR_ROAM_SUPPORT); - if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) - NLA_PUT_FLAG(msg, NL80211_ATTR_TDLS_SUPPORT); - if (dev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP) - NLA_PUT_FLAG(msg, NL80211_ATTR_TDLS_EXTERNAL_SETUP); - - NLA_PUT(msg, NL80211_ATTR_CIPHER_SUITES, - sizeof(u32) * dev->wiphy.n_cipher_suites, - dev->wiphy.cipher_suites); - - NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_PMKIDS, - dev->wiphy.max_num_pmkids); - - if (dev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) - NLA_PUT_FLAG(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE); - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, - dev->wiphy.available_antennas_tx); - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, - dev->wiphy.available_antennas_rx); - - if (dev->wiphy.flags & WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD) - NLA_PUT_U32(msg, NL80211_ATTR_PROBE_RESP_OFFLOAD, - dev->wiphy.probe_resp_offload); - - if ((dev->wiphy.available_antennas_tx || - dev->wiphy.available_antennas_rx) && dev->ops->get_antenna) { - u32 tx_ant = 0, rx_ant = 0; - int res; - res = dev->ops->get_antenna(&dev->wiphy, &tx_ant, &rx_ant); - if (!res) { - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_TX, tx_ant); - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_ANTENNA_RX, rx_ant); - } - } - - if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES, - dev->wiphy.interface_modes)) - goto nla_put_failure; - - nl_bands = nla_nest_start(msg, NL80211_ATTR_WIPHY_BANDS); - if (!nl_bands) - goto nla_put_failure; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - if (!dev->wiphy.bands[band]) - continue; - - nl_band = nla_nest_start(msg, band); - if (!nl_band) - goto nla_put_failure; - - /* add HT info */ - if (dev->wiphy.bands[band]->ht_cap.ht_supported) { - NLA_PUT(msg, NL80211_BAND_ATTR_HT_MCS_SET, - sizeof(dev->wiphy.bands[band]->ht_cap.mcs), - &dev->wiphy.bands[band]->ht_cap.mcs); - NLA_PUT_U16(msg, NL80211_BAND_ATTR_HT_CAPA, - dev->wiphy.bands[band]->ht_cap.cap); - NLA_PUT_U8(msg, NL80211_BAND_ATTR_HT_AMPDU_FACTOR, - dev->wiphy.bands[band]->ht_cap.ampdu_factor); - NLA_PUT_U8(msg, NL80211_BAND_ATTR_HT_AMPDU_DENSITY, - dev->wiphy.bands[band]->ht_cap.ampdu_density); - } - - /* add frequencies */ - nl_freqs = nla_nest_start(msg, NL80211_BAND_ATTR_FREQS); - if (!nl_freqs) - goto nla_put_failure; - - for (i = 0; i < dev->wiphy.bands[band]->n_channels; i++) { - nl_freq = nla_nest_start(msg, i); - if (!nl_freq) - goto nla_put_failure; - - chan = &dev->wiphy.bands[band]->channels[i]; - - if (nl80211_msg_put_channel(msg, chan)) - goto nla_put_failure; - - nla_nest_end(msg, nl_freq); - } - - nla_nest_end(msg, nl_freqs); - - /* add bitrates */ - nl_rates = nla_nest_start(msg, NL80211_BAND_ATTR_RATES); - if (!nl_rates) - goto nla_put_failure; - - for (i = 0; i < dev->wiphy.bands[band]->n_bitrates; i++) { - nl_rate = nla_nest_start(msg, i); - if (!nl_rate) - goto nla_put_failure; - - rate = &dev->wiphy.bands[band]->bitrates[i]; - NLA_PUT_U32(msg, NL80211_BITRATE_ATTR_RATE, - rate->bitrate); - if (rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) - NLA_PUT_FLAG(msg, - NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE); - - nla_nest_end(msg, nl_rate); - } - - nla_nest_end(msg, nl_rates); - - nla_nest_end(msg, nl_band); - } - nla_nest_end(msg, nl_bands); - - nl_cmds = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_COMMANDS); - if (!nl_cmds) - goto nla_put_failure; - - i = 0; -#define CMD(op, n) \ - do { \ - if (dev->ops->op) { \ - i++; \ - NLA_PUT_U32(msg, i, NL80211_CMD_ ## n); \ - } \ - } while (0) - - CMD(add_virtual_intf, NEW_INTERFACE); - CMD(change_virtual_intf, SET_INTERFACE); - CMD(add_key, NEW_KEY); - CMD(start_ap, START_AP); - CMD(add_station, NEW_STATION); - CMD(add_mpath, NEW_MPATH); - CMD(update_mesh_config, SET_MESH_CONFIG); - CMD(change_bss, SET_BSS); - CMD(auth, AUTHENTICATE); - CMD(assoc, ASSOCIATE); - CMD(deauth, DEAUTHENTICATE); - CMD(disassoc, DISASSOCIATE); - CMD(join_ibss, JOIN_IBSS); - CMD(join_mesh, JOIN_MESH); - CMD(set_pmksa, SET_PMKSA); - CMD(del_pmksa, DEL_PMKSA); - CMD(flush_pmksa, FLUSH_PMKSA); - if (dev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) - CMD(remain_on_channel, REMAIN_ON_CHANNEL); - CMD(set_bitrate_mask, SET_TX_BITRATE_MASK); - CMD(mgmt_tx, FRAME); - CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL); - if (dev->wiphy.flags & WIPHY_FLAG_NETNS_OK) { - i++; - NLA_PUT_U32(msg, i, NL80211_CMD_SET_WIPHY_NETNS); - } - CMD(set_channel, SET_CHANNEL); - CMD(set_wds_peer, SET_WDS_PEER); - if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) { - CMD(tdls_mgmt, TDLS_MGMT); - CMD(tdls_oper, TDLS_OPER); - } - if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) - CMD(sched_scan_start, START_SCHED_SCAN); - CMD(probe_client, PROBE_CLIENT); - CMD(set_noack_map, SET_NOACK_MAP); - if (dev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS) { - i++; - NLA_PUT_U32(msg, i, NL80211_CMD_REGISTER_BEACONS); - } - -#ifdef CONFIG_NL80211_TESTMODE - CMD(testmode_cmd, TESTMODE); -#endif - -#undef CMD - - if (dev->ops->connect || dev->ops->auth) { - i++; - NLA_PUT_U32(msg, i, NL80211_CMD_CONNECT); - } - - if (dev->ops->disconnect || dev->ops->deauth) { - i++; - NLA_PUT_U32(msg, i, NL80211_CMD_DISCONNECT); - } - - nla_nest_end(msg, nl_cmds); - - if (dev->ops->remain_on_channel && - dev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) - NLA_PUT_U32(msg, NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, - dev->wiphy.max_remain_on_channel_duration); - - if (dev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX) - NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK); - - if (mgmt_stypes) { - u16 stypes; - struct nlattr *nl_ftypes, *nl_ifs; - enum nl80211_iftype ift; - - nl_ifs = nla_nest_start(msg, NL80211_ATTR_TX_FRAME_TYPES); - if (!nl_ifs) - goto nla_put_failure; - - for (ift = 0; ift < NUM_NL80211_IFTYPES; ift++) { - nl_ftypes = nla_nest_start(msg, ift); - if (!nl_ftypes) - goto nla_put_failure; - i = 0; - stypes = mgmt_stypes[ift].tx; - while (stypes) { - if (stypes & 1) - NLA_PUT_U16(msg, NL80211_ATTR_FRAME_TYPE, - (i << 4) | IEEE80211_FTYPE_MGMT); - stypes >>= 1; - i++; - } - nla_nest_end(msg, nl_ftypes); - } - - nla_nest_end(msg, nl_ifs); - - nl_ifs = nla_nest_start(msg, NL80211_ATTR_RX_FRAME_TYPES); - if (!nl_ifs) - goto nla_put_failure; - - for (ift = 0; ift < NUM_NL80211_IFTYPES; ift++) { - nl_ftypes = nla_nest_start(msg, ift); - if (!nl_ftypes) - goto nla_put_failure; - i = 0; - stypes = mgmt_stypes[ift].rx; - while (stypes) { - if (stypes & 1) - NLA_PUT_U16(msg, NL80211_ATTR_FRAME_TYPE, - (i << 4) | IEEE80211_FTYPE_MGMT); - stypes >>= 1; - i++; - } - nla_nest_end(msg, nl_ftypes); - } - nla_nest_end(msg, nl_ifs); - } - - if (dev->wiphy.wowlan.flags || dev->wiphy.wowlan.n_patterns) { - struct nlattr *nl_wowlan; - - nl_wowlan = nla_nest_start(msg, - NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED); - if (!nl_wowlan) - goto nla_put_failure; - - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_ANY) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_ANY); - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_DISCONNECT) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_DISCONNECT); - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_MAGIC_PKT) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT); - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED); - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE); - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST); - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE); - if (dev->wiphy.wowlan.flags & WIPHY_WOWLAN_RFKILL_RELEASE) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE); - if (dev->wiphy.wowlan.n_patterns) { - struct nl80211_wowlan_pattern_support pat = { - .max_patterns = dev->wiphy.wowlan.n_patterns, - .min_pattern_len = - dev->wiphy.wowlan.pattern_min_len, - .max_pattern_len = - dev->wiphy.wowlan.pattern_max_len, - }; - NLA_PUT(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN, - sizeof(pat), &pat); - } - - nla_nest_end(msg, nl_wowlan); - } - - if (nl80211_put_iftypes(msg, NL80211_ATTR_SOFTWARE_IFTYPES, - dev->wiphy.software_iftypes)) - goto nla_put_failure; - - if (nl80211_put_iface_combinations(&dev->wiphy, msg)) - goto nla_put_failure; - - if (dev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) - NLA_PUT_U32(msg, NL80211_ATTR_DEVICE_AP_SME, - dev->wiphy.ap_sme_capa); - - NLA_PUT_U32(msg, NL80211_ATTR_FEATURE_FLAGS, dev->wiphy.features); - - if (dev->wiphy.ht_capa_mod_mask) - NLA_PUT(msg, NL80211_ATTR_HT_CAPABILITY_MASK, - sizeof(*dev->wiphy.ht_capa_mod_mask), - dev->wiphy.ht_capa_mod_mask); - - return genlmsg_end(msg, hdr); - - nla_put_failure: - genlmsg_cancel(msg, hdr); - return -EMSGSIZE; -} - -static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) -{ - int idx = 0; - int start = cb->args[0]; - struct cfg80211_registered_device *dev; - - mutex_lock(&cfg80211_mutex); - list_for_each_entry(dev, &cfg80211_rdev_list, list) { - if (!net_eq(wiphy_net(&dev->wiphy), sock_net(skb->sk))) - continue; - if (++idx <= start) - continue; - if (nl80211_send_wiphy(skb, NETLINK_CB(cb->skb).pid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - dev) < 0) { - idx--; - break; - } - } - mutex_unlock(&cfg80211_mutex); - - cb->args[0] = idx; - - return skb->len; -} - -static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info) -{ - struct sk_buff *msg; - struct cfg80211_registered_device *dev = info->user_ptr[0]; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - if (nl80211_send_wiphy(msg, info->snd_pid, info->snd_seq, 0, dev) < 0) { - nlmsg_free(msg); - return -ENOBUFS; - } - - return genlmsg_reply(msg, info); -} - -static const struct nla_policy txq_params_policy[NL80211_TXQ_ATTR_MAX + 1] = { - [NL80211_TXQ_ATTR_QUEUE] = { .type = NLA_U8 }, - [NL80211_TXQ_ATTR_TXOP] = { .type = NLA_U16 }, - [NL80211_TXQ_ATTR_CWMIN] = { .type = NLA_U16 }, - [NL80211_TXQ_ATTR_CWMAX] = { .type = NLA_U16 }, - [NL80211_TXQ_ATTR_AIFS] = { .type = NLA_U8 }, -}; - -static int parse_txq_params(struct nlattr *tb[], - struct ieee80211_txq_params *txq_params) -{ - if (!tb[NL80211_TXQ_ATTR_QUEUE] || !tb[NL80211_TXQ_ATTR_TXOP] || - !tb[NL80211_TXQ_ATTR_CWMIN] || !tb[NL80211_TXQ_ATTR_CWMAX] || - !tb[NL80211_TXQ_ATTR_AIFS]) - return -EINVAL; - - txq_params->queue = nla_get_u8(tb[NL80211_TXQ_ATTR_QUEUE]); - txq_params->txop = nla_get_u16(tb[NL80211_TXQ_ATTR_TXOP]); - txq_params->cwmin = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMIN]); - txq_params->cwmax = nla_get_u16(tb[NL80211_TXQ_ATTR_CWMAX]); - txq_params->aifs = nla_get_u8(tb[NL80211_TXQ_ATTR_AIFS]); - - return 0; -} - -static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev) -{ - /* - * You can only set the channel explicitly for AP, mesh - * and WDS type interfaces; all others have their channel - * managed via their respective "establish a connection" - * command (connect, join, ...) - * - * Monitors are special as they are normally slaved to - * whatever else is going on, so they behave as though - * you tried setting the wiphy channel itself. - */ - return !wdev || - wdev->iftype == NL80211_IFTYPE_AP || - wdev->iftype == NL80211_IFTYPE_WDS || - wdev->iftype == NL80211_IFTYPE_MESH_POINT || - wdev->iftype == NL80211_IFTYPE_MONITOR || - wdev->iftype == NL80211_IFTYPE_P2P_GO; -} - -static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev, - struct genl_info *info) -{ - enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; - u32 freq; - int result; - - if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) - return -EINVAL; - - if (!nl80211_can_set_dev_channel(wdev)) - return -EOPNOTSUPP; - - if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { - channel_type = nla_get_u32(info->attrs[ - NL80211_ATTR_WIPHY_CHANNEL_TYPE]); - if (channel_type != NL80211_CHAN_NO_HT && - channel_type != NL80211_CHAN_HT20 && - channel_type != NL80211_CHAN_HT40PLUS && - channel_type != NL80211_CHAN_HT40MINUS) - return -EINVAL; - } - - freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); - - mutex_lock(&rdev->devlist_mtx); - if (wdev) { - wdev_lock(wdev); - result = cfg80211_set_freq(rdev, wdev, freq, channel_type); - wdev_unlock(wdev); - } else { - result = cfg80211_set_freq(rdev, NULL, freq, channel_type); - } - mutex_unlock(&rdev->devlist_mtx); - - return result; -} - -static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *netdev = info->user_ptr[1]; - - return __nl80211_set_channel(rdev, netdev->ieee80211_ptr, info); -} - -static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct wireless_dev *wdev = dev->ieee80211_ptr; - const u8 *bssid; - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - if (netif_running(dev)) - return -EBUSY; - - if (!rdev->ops->set_wds_peer) - return -EOPNOTSUPP; - - if (wdev->iftype != NL80211_IFTYPE_WDS) - return -EOPNOTSUPP; - - bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); - return rdev->ops->set_wds_peer(wdev->wiphy, dev, bssid); -} - - -static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev; - struct net_device *netdev = NULL; - struct wireless_dev *wdev; - int result = 0, rem_txq_params = 0; - struct nlattr *nl_txq_params; - u32 changed; - u8 retry_short = 0, retry_long = 0; - u32 frag_threshold = 0, rts_threshold = 0; - u8 coverage_class = 0; - - /* - * Try to find the wiphy and netdev. Normally this - * function shouldn't need the netdev, but this is - * done for backward compatibility -- previously - * setting the channel was done per wiphy, but now - * it is per netdev. Previous userland like hostapd - * also passed a netdev to set_wiphy, so that it is - * possible to let that go to the right netdev! - */ - mutex_lock(&cfg80211_mutex); - - if (info->attrs[NL80211_ATTR_IFINDEX]) { - int ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]); - - netdev = dev_get_by_index(genl_info_net(info), ifindex); - if (netdev && netdev->ieee80211_ptr) { - rdev = wiphy_to_dev(netdev->ieee80211_ptr->wiphy); - mutex_lock(&rdev->mtx); - } else - netdev = NULL; - } - - if (!netdev) { - rdev = __cfg80211_rdev_from_info(info); - if (IS_ERR(rdev)) { - mutex_unlock(&cfg80211_mutex); - return PTR_ERR(rdev); - } - wdev = NULL; - netdev = NULL; - result = 0; - - mutex_lock(&rdev->mtx); - } else if (netif_running(netdev) && - nl80211_can_set_dev_channel(netdev->ieee80211_ptr)) - wdev = netdev->ieee80211_ptr; - else - wdev = NULL; - - /* - * end workaround code, by now the rdev is available - * and locked, and wdev may or may not be NULL. - */ - - if (info->attrs[NL80211_ATTR_WIPHY_NAME]) - result = cfg80211_dev_rename( - rdev, nla_data(info->attrs[NL80211_ATTR_WIPHY_NAME])); - - mutex_unlock(&cfg80211_mutex); - - if (result) - goto bad_res; - - if (info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS]) { - struct ieee80211_txq_params txq_params; - struct nlattr *tb[NL80211_TXQ_ATTR_MAX + 1]; - - if (!rdev->ops->set_txq_params) { - result = -EOPNOTSUPP; - goto bad_res; - } - - if (!netdev) { - result = -EINVAL; - goto bad_res; - } - - if (netdev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && - netdev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) { - result = -EINVAL; - goto bad_res; - } - - if (!netif_running(netdev)) { - result = -ENETDOWN; - goto bad_res; - } - - nla_for_each_nested(nl_txq_params, - info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS], - rem_txq_params) { - nla_parse(tb, NL80211_TXQ_ATTR_MAX, - nla_data(nl_txq_params), - nla_len(nl_txq_params), - txq_params_policy); - result = parse_txq_params(tb, &txq_params); - if (result) - goto bad_res; - - result = rdev->ops->set_txq_params(&rdev->wiphy, - netdev, - &txq_params); - if (result) - goto bad_res; - } - } - - if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { - result = __nl80211_set_channel(rdev, wdev, info); - if (result) - goto bad_res; - } - - if (info->attrs[NL80211_ATTR_WIPHY_TX_POWER_SETTING]) { - enum nl80211_tx_power_setting type; - int idx, mbm = 0; - - if (!rdev->ops->set_tx_power) { - result = -EOPNOTSUPP; - goto bad_res; - } - - idx = NL80211_ATTR_WIPHY_TX_POWER_SETTING; - type = nla_get_u32(info->attrs[idx]); - - if (!info->attrs[NL80211_ATTR_WIPHY_TX_POWER_LEVEL] && - (type != NL80211_TX_POWER_AUTOMATIC)) { - result = -EINVAL; - goto bad_res; - } - - if (type != NL80211_TX_POWER_AUTOMATIC) { - idx = NL80211_ATTR_WIPHY_TX_POWER_LEVEL; - mbm = nla_get_u32(info->attrs[idx]); - } - - result = rdev->ops->set_tx_power(&rdev->wiphy, type, mbm); - if (result) - goto bad_res; - } - - if (info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX] && - info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]) { - u32 tx_ant, rx_ant; - if ((!rdev->wiphy.available_antennas_tx && - !rdev->wiphy.available_antennas_rx) || - !rdev->ops->set_antenna) { - result = -EOPNOTSUPP; - goto bad_res; - } - - tx_ant = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_ANTENNA_TX]); - rx_ant = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_ANTENNA_RX]); - - /* reject antenna configurations which don't match the - * available antenna masks, except for the "all" mask */ - if ((~tx_ant && (tx_ant & ~rdev->wiphy.available_antennas_tx)) || - (~rx_ant && (rx_ant & ~rdev->wiphy.available_antennas_rx))) { - result = -EINVAL; - goto bad_res; - } - - tx_ant = tx_ant & rdev->wiphy.available_antennas_tx; - rx_ant = rx_ant & rdev->wiphy.available_antennas_rx; - - result = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant); - if (result) - goto bad_res; - } - - changed = 0; - - if (info->attrs[NL80211_ATTR_WIPHY_RETRY_SHORT]) { - retry_short = nla_get_u8( - info->attrs[NL80211_ATTR_WIPHY_RETRY_SHORT]); - if (retry_short == 0) { - result = -EINVAL; - goto bad_res; - } - changed |= WIPHY_PARAM_RETRY_SHORT; - } - - if (info->attrs[NL80211_ATTR_WIPHY_RETRY_LONG]) { - retry_long = nla_get_u8( - info->attrs[NL80211_ATTR_WIPHY_RETRY_LONG]); - if (retry_long == 0) { - result = -EINVAL; - goto bad_res; - } - changed |= WIPHY_PARAM_RETRY_LONG; - } - - if (info->attrs[NL80211_ATTR_WIPHY_FRAG_THRESHOLD]) { - frag_threshold = nla_get_u32( - info->attrs[NL80211_ATTR_WIPHY_FRAG_THRESHOLD]); - if (frag_threshold < 256) { - result = -EINVAL; - goto bad_res; - } - if (frag_threshold != (u32) -1) { - /* - * Fragments (apart from the last one) are required to - * have even length. Make the fragmentation code - * simpler by stripping LSB should someone try to use - * odd threshold value. - */ - frag_threshold &= ~0x1; - } - changed |= WIPHY_PARAM_FRAG_THRESHOLD; - } - - if (info->attrs[NL80211_ATTR_WIPHY_RTS_THRESHOLD]) { - rts_threshold = nla_get_u32( - info->attrs[NL80211_ATTR_WIPHY_RTS_THRESHOLD]); - changed |= WIPHY_PARAM_RTS_THRESHOLD; - } - - if (info->attrs[NL80211_ATTR_WIPHY_COVERAGE_CLASS]) { - coverage_class = nla_get_u8( - info->attrs[NL80211_ATTR_WIPHY_COVERAGE_CLASS]); - changed |= WIPHY_PARAM_COVERAGE_CLASS; - } - - if (changed) { - u8 old_retry_short, old_retry_long; - u32 old_frag_threshold, old_rts_threshold; - u8 old_coverage_class; - - if (!rdev->ops->set_wiphy_params) { - result = -EOPNOTSUPP; - goto bad_res; - } - - old_retry_short = rdev->wiphy.retry_short; - old_retry_long = rdev->wiphy.retry_long; - old_frag_threshold = rdev->wiphy.frag_threshold; - old_rts_threshold = rdev->wiphy.rts_threshold; - old_coverage_class = rdev->wiphy.coverage_class; - - if (changed & WIPHY_PARAM_RETRY_SHORT) - rdev->wiphy.retry_short = retry_short; - if (changed & WIPHY_PARAM_RETRY_LONG) - rdev->wiphy.retry_long = retry_long; - if (changed & WIPHY_PARAM_FRAG_THRESHOLD) - rdev->wiphy.frag_threshold = frag_threshold; - if (changed & WIPHY_PARAM_RTS_THRESHOLD) - rdev->wiphy.rts_threshold = rts_threshold; - if (changed & WIPHY_PARAM_COVERAGE_CLASS) - rdev->wiphy.coverage_class = coverage_class; - - result = rdev->ops->set_wiphy_params(&rdev->wiphy, changed); - if (result) { - rdev->wiphy.retry_short = old_retry_short; - rdev->wiphy.retry_long = old_retry_long; - rdev->wiphy.frag_threshold = old_frag_threshold; - rdev->wiphy.rts_threshold = old_rts_threshold; - rdev->wiphy.coverage_class = old_coverage_class; - } - } - - bad_res: - mutex_unlock(&rdev->mtx); - if (netdev) - dev_put(netdev); - return result; -} - - -static int nl80211_send_iface(struct sk_buff *msg, u32 pid, u32 seq, int flags, - struct cfg80211_registered_device *rdev, - struct net_device *dev) -{ - void *hdr; - - hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_INTERFACE); - if (!hdr) - return -1; - - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, dev->name); - NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, dev->ieee80211_ptr->iftype); - - NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, - rdev->devlist_generation ^ - (cfg80211_rdev_list_generation << 2)); - - return genlmsg_end(msg, hdr); - - nla_put_failure: - genlmsg_cancel(msg, hdr); - return -EMSGSIZE; -} - -static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *cb) -{ - int wp_idx = 0; - int if_idx = 0; - int wp_start = cb->args[0]; - int if_start = cb->args[1]; - struct cfg80211_registered_device *rdev; - struct wireless_dev *wdev; - - mutex_lock(&cfg80211_mutex); - list_for_each_entry(rdev, &cfg80211_rdev_list, list) { - if (!net_eq(wiphy_net(&rdev->wiphy), sock_net(skb->sk))) - continue; - if (wp_idx < wp_start) { - wp_idx++; - continue; - } - if_idx = 0; - - mutex_lock(&rdev->devlist_mtx); - list_for_each_entry(wdev, &rdev->netdev_list, list) { - if (if_idx < if_start) { - if_idx++; - continue; - } - if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).pid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - rdev, wdev->netdev) < 0) { - mutex_unlock(&rdev->devlist_mtx); - goto out; - } - if_idx++; - } - mutex_unlock(&rdev->devlist_mtx); - - wp_idx++; - } - out: - mutex_unlock(&cfg80211_mutex); - - cb->args[0] = wp_idx; - cb->args[1] = if_idx; - - return skb->len; -} - -static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info) -{ - struct sk_buff *msg; - struct cfg80211_registered_device *dev = info->user_ptr[0]; - struct net_device *netdev = info->user_ptr[1]; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - if (nl80211_send_iface(msg, info->snd_pid, info->snd_seq, 0, - dev, netdev) < 0) { - nlmsg_free(msg); - return -ENOBUFS; - } - - return genlmsg_reply(msg, info); -} - -static const struct nla_policy mntr_flags_policy[NL80211_MNTR_FLAG_MAX + 1] = { - [NL80211_MNTR_FLAG_FCSFAIL] = { .type = NLA_FLAG }, - [NL80211_MNTR_FLAG_PLCPFAIL] = { .type = NLA_FLAG }, - [NL80211_MNTR_FLAG_CONTROL] = { .type = NLA_FLAG }, - [NL80211_MNTR_FLAG_OTHER_BSS] = { .type = NLA_FLAG }, - [NL80211_MNTR_FLAG_COOK_FRAMES] = { .type = NLA_FLAG }, -}; - -static int parse_monitor_flags(struct nlattr *nla, u32 *mntrflags) -{ - struct nlattr *flags[NL80211_MNTR_FLAG_MAX + 1]; - int flag; - - *mntrflags = 0; - - if (!nla) - return -EINVAL; - - if (nla_parse_nested(flags, NL80211_MNTR_FLAG_MAX, - nla, mntr_flags_policy)) - return -EINVAL; - - for (flag = 1; flag <= NL80211_MNTR_FLAG_MAX; flag++) - if (flags[flag]) - *mntrflags |= (1<<flag); - - return 0; -} - -static int nl80211_valid_4addr(struct cfg80211_registered_device *rdev, - struct net_device *netdev, u8 use_4addr, - enum nl80211_iftype iftype) -{ - if (!use_4addr) { - if (netdev && br_port_exists(netdev)) - return -EBUSY; - return 0; - } - - switch (iftype) { - case NL80211_IFTYPE_AP_VLAN: - if (rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP) - return 0; - break; - case NL80211_IFTYPE_STATION: - if (rdev->wiphy.flags & WIPHY_FLAG_4ADDR_STATION) - return 0; - break; - default: - break; - } - - return -EOPNOTSUPP; -} - -static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct vif_params params; - int err; - enum nl80211_iftype otype, ntype; - struct net_device *dev = info->user_ptr[1]; - u32 _flags, *flags = NULL; - bool change = false; - - memset(¶ms, 0, sizeof(params)); - - otype = ntype = dev->ieee80211_ptr->iftype; - - if (info->attrs[NL80211_ATTR_IFTYPE]) { - ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]); - if (otype != ntype) - change = true; - if (ntype > NL80211_IFTYPE_MAX) - return -EINVAL; - } - - if (info->attrs[NL80211_ATTR_MESH_ID]) { - struct wireless_dev *wdev = dev->ieee80211_ptr; - - if (ntype != NL80211_IFTYPE_MESH_POINT) - return -EINVAL; - if (netif_running(dev)) - return -EBUSY; - - wdev_lock(wdev); - BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != - IEEE80211_MAX_MESH_ID_LEN); - wdev->mesh_id_up_len = - nla_len(info->attrs[NL80211_ATTR_MESH_ID]); - memcpy(wdev->ssid, nla_data(info->attrs[NL80211_ATTR_MESH_ID]), - wdev->mesh_id_up_len); - wdev_unlock(wdev); - } - - if (info->attrs[NL80211_ATTR_4ADDR]) { - params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); - change = true; - err = nl80211_valid_4addr(rdev, dev, params.use_4addr, ntype); - if (err) - return err; - } else { - params.use_4addr = -1; - } - - if (info->attrs[NL80211_ATTR_MNTR_FLAGS]) { - if (ntype != NL80211_IFTYPE_MONITOR) - return -EINVAL; - err = parse_monitor_flags(info->attrs[NL80211_ATTR_MNTR_FLAGS], - &_flags); - if (err) - return err; - - flags = &_flags; - change = true; - } - - if (change) - err = cfg80211_change_iface(rdev, dev, ntype, flags, ¶ms); - else - err = 0; - - if (!err && params.use_4addr != -1) - dev->ieee80211_ptr->use_4addr = params.use_4addr; - - return err; -} - -static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct vif_params params; - struct net_device *dev; - int err; - enum nl80211_iftype type = NL80211_IFTYPE_UNSPECIFIED; - u32 flags; - - memset(¶ms, 0, sizeof(params)); - - if (!info->attrs[NL80211_ATTR_IFNAME]) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_IFTYPE]) { - type = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]); - if (type > NL80211_IFTYPE_MAX) - return -EINVAL; - } - - if (!rdev->ops->add_virtual_intf || - !(rdev->wiphy.interface_modes & (1 << type))) - return -EOPNOTSUPP; - - if (info->attrs[NL80211_ATTR_4ADDR]) { - params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]); - err = nl80211_valid_4addr(rdev, NULL, params.use_4addr, type); - if (err) - return err; - } - - err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? - info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, - &flags); - dev = rdev->ops->add_virtual_intf(&rdev->wiphy, - nla_data(info->attrs[NL80211_ATTR_IFNAME]), - type, err ? NULL : &flags, ¶ms); - if (IS_ERR(dev)) - return PTR_ERR(dev); - - if (type == NL80211_IFTYPE_MESH_POINT && - info->attrs[NL80211_ATTR_MESH_ID]) { - struct wireless_dev *wdev = dev->ieee80211_ptr; - - wdev_lock(wdev); - BUILD_BUG_ON(IEEE80211_MAX_SSID_LEN != - IEEE80211_MAX_MESH_ID_LEN); - wdev->mesh_id_up_len = - nla_len(info->attrs[NL80211_ATTR_MESH_ID]); - memcpy(wdev->ssid, nla_data(info->attrs[NL80211_ATTR_MESH_ID]), - wdev->mesh_id_up_len); - wdev_unlock(wdev); - } - - return 0; -} - -static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - - if (!rdev->ops->del_virtual_intf) - return -EOPNOTSUPP; - - return rdev->ops->del_virtual_intf(&rdev->wiphy, dev); -} - -static int nl80211_set_noack_map(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - u16 noack_map; - - if (!info->attrs[NL80211_ATTR_NOACK_MAP]) - return -EINVAL; - - if (!rdev->ops->set_noack_map) - return -EOPNOTSUPP; - - noack_map = nla_get_u16(info->attrs[NL80211_ATTR_NOACK_MAP]); - - return rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map); -} - -struct get_key_cookie { - struct sk_buff *msg; - int error; - int idx; -}; - -static void get_key_callback(void *c, struct key_params *params) -{ - struct nlattr *key; - struct get_key_cookie *cookie = c; - - if (params->key) - NLA_PUT(cookie->msg, NL80211_ATTR_KEY_DATA, - params->key_len, params->key); - - if (params->seq) - NLA_PUT(cookie->msg, NL80211_ATTR_KEY_SEQ, - params->seq_len, params->seq); - - if (params->cipher) - NLA_PUT_U32(cookie->msg, NL80211_ATTR_KEY_CIPHER, - params->cipher); - - key = nla_nest_start(cookie->msg, NL80211_ATTR_KEY); - if (!key) - goto nla_put_failure; - - if (params->key) - NLA_PUT(cookie->msg, NL80211_KEY_DATA, - params->key_len, params->key); - - if (params->seq) - NLA_PUT(cookie->msg, NL80211_KEY_SEQ, - params->seq_len, params->seq); - - if (params->cipher) - NLA_PUT_U32(cookie->msg, NL80211_KEY_CIPHER, - params->cipher); - - NLA_PUT_U8(cookie->msg, NL80211_ATTR_KEY_IDX, cookie->idx); - - nla_nest_end(cookie->msg, key); - - return; - nla_put_failure: - cookie->error = 1; -} - -static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - int err; - struct net_device *dev = info->user_ptr[1]; - u8 key_idx = 0; - const u8 *mac_addr = NULL; - bool pairwise; - struct get_key_cookie cookie = { - .error = 0, - }; - void *hdr; - struct sk_buff *msg; - - if (info->attrs[NL80211_ATTR_KEY_IDX]) - key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]); - - if (key_idx > 5) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_MAC]) - mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); - - pairwise = !!mac_addr; - if (info->attrs[NL80211_ATTR_KEY_TYPE]) { - u32 kt = nla_get_u32(info->attrs[NL80211_ATTR_KEY_TYPE]); - if (kt >= NUM_NL80211_KEYTYPES) - return -EINVAL; - if (kt != NL80211_KEYTYPE_GROUP && - kt != NL80211_KEYTYPE_PAIRWISE) - return -EINVAL; - pairwise = kt == NL80211_KEYTYPE_PAIRWISE; - } - - if (!rdev->ops->get_key) - return -EOPNOTSUPP; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, - NL80211_CMD_NEW_KEY); - if (IS_ERR(hdr)) - return PTR_ERR(hdr); - - cookie.msg = msg; - cookie.idx = key_idx; - - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); - NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_idx); - if (mac_addr) - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); - - if (pairwise && mac_addr && - !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) - return -ENOENT; - - err = rdev->ops->get_key(&rdev->wiphy, dev, key_idx, pairwise, - mac_addr, &cookie, get_key_callback); - - if (err) - goto free_msg; - - if (cookie.error) - goto nla_put_failure; - - genlmsg_end(msg, hdr); - return genlmsg_reply(msg, info); - - nla_put_failure: - err = -ENOBUFS; - free_msg: - nlmsg_free(msg); - return err; -} - -static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct key_parse key; - int err; - struct net_device *dev = info->user_ptr[1]; - - err = nl80211_parse_key(info, &key); - if (err) - return err; - - if (key.idx < 0) - return -EINVAL; - - /* only support setting default key */ - if (!key.def && !key.defmgmt) - return -EINVAL; - - wdev_lock(dev->ieee80211_ptr); - - if (key.def) { - if (!rdev->ops->set_default_key) { - err = -EOPNOTSUPP; - goto out; - } - - err = nl80211_key_allowed(dev->ieee80211_ptr); - if (err) - goto out; - - err = rdev->ops->set_default_key(&rdev->wiphy, dev, key.idx, - key.def_uni, key.def_multi); - - if (err) - goto out; - -#ifdef CONFIG_CFG80211_WEXT - dev->ieee80211_ptr->wext.default_key = key.idx; -#endif - } else { - if (key.def_uni || !key.def_multi) { - err = -EINVAL; - goto out; - } - - if (!rdev->ops->set_default_mgmt_key) { - err = -EOPNOTSUPP; - goto out; - } - - err = nl80211_key_allowed(dev->ieee80211_ptr); - if (err) - goto out; - - err = rdev->ops->set_default_mgmt_key(&rdev->wiphy, - dev, key.idx); - if (err) - goto out; - -#ifdef CONFIG_CFG80211_WEXT - dev->ieee80211_ptr->wext.default_mgmt_key = key.idx; -#endif - } - - out: - wdev_unlock(dev->ieee80211_ptr); - - return err; -} - -static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - int err; - struct net_device *dev = info->user_ptr[1]; - struct key_parse key; - const u8 *mac_addr = NULL; - - err = nl80211_parse_key(info, &key); - if (err) - return err; - - if (!key.p.key) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_MAC]) - mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); - - if (key.type == -1) { - if (mac_addr) - key.type = NL80211_KEYTYPE_PAIRWISE; - else - key.type = NL80211_KEYTYPE_GROUP; - } - - /* for now */ - if (key.type != NL80211_KEYTYPE_PAIRWISE && - key.type != NL80211_KEYTYPE_GROUP) - return -EINVAL; - - if (!rdev->ops->add_key) - return -EOPNOTSUPP; - - if (cfg80211_validate_key_settings(rdev, &key.p, key.idx, - key.type == NL80211_KEYTYPE_PAIRWISE, - mac_addr)) - return -EINVAL; - - wdev_lock(dev->ieee80211_ptr); - err = nl80211_key_allowed(dev->ieee80211_ptr); - if (!err) - err = rdev->ops->add_key(&rdev->wiphy, dev, key.idx, - key.type == NL80211_KEYTYPE_PAIRWISE, - mac_addr, &key.p); - wdev_unlock(dev->ieee80211_ptr); - - return err; -} - -static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - int err; - struct net_device *dev = info->user_ptr[1]; - u8 *mac_addr = NULL; - struct key_parse key; - - err = nl80211_parse_key(info, &key); - if (err) - return err; - - if (info->attrs[NL80211_ATTR_MAC]) - mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); - - if (key.type == -1) { - if (mac_addr) - key.type = NL80211_KEYTYPE_PAIRWISE; - else - key.type = NL80211_KEYTYPE_GROUP; - } - - /* for now */ - if (key.type != NL80211_KEYTYPE_PAIRWISE && - key.type != NL80211_KEYTYPE_GROUP) - return -EINVAL; - - if (!rdev->ops->del_key) - return -EOPNOTSUPP; - - wdev_lock(dev->ieee80211_ptr); - err = nl80211_key_allowed(dev->ieee80211_ptr); - - if (key.type == NL80211_KEYTYPE_PAIRWISE && mac_addr && - !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) - err = -ENOENT; - - if (!err) - err = rdev->ops->del_key(&rdev->wiphy, dev, key.idx, - key.type == NL80211_KEYTYPE_PAIRWISE, - mac_addr); - -#ifdef CONFIG_CFG80211_WEXT - if (!err) { - if (key.idx == dev->ieee80211_ptr->wext.default_key) - dev->ieee80211_ptr->wext.default_key = -1; - else if (key.idx == dev->ieee80211_ptr->wext.default_mgmt_key) - dev->ieee80211_ptr->wext.default_mgmt_key = -1; - } -#endif - wdev_unlock(dev->ieee80211_ptr); - - return err; -} - -static int nl80211_parse_beacon(struct genl_info *info, - struct cfg80211_beacon_data *bcn) -{ - bool haveinfo = false; - - if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_BEACON_TAIL]) || - !is_valid_ie_attr(info->attrs[NL80211_ATTR_IE]) || - !is_valid_ie_attr(info->attrs[NL80211_ATTR_IE_PROBE_RESP]) || - !is_valid_ie_attr(info->attrs[NL80211_ATTR_IE_ASSOC_RESP])) - return -EINVAL; - - memset(bcn, 0, sizeof(*bcn)); - - if (info->attrs[NL80211_ATTR_BEACON_HEAD]) { - bcn->head = nla_data(info->attrs[NL80211_ATTR_BEACON_HEAD]); - bcn->head_len = nla_len(info->attrs[NL80211_ATTR_BEACON_HEAD]); - if (!bcn->head_len) - return -EINVAL; - haveinfo = true; - } - - if (info->attrs[NL80211_ATTR_BEACON_TAIL]) { - bcn->tail = nla_data(info->attrs[NL80211_ATTR_BEACON_TAIL]); - bcn->tail_len = - nla_len(info->attrs[NL80211_ATTR_BEACON_TAIL]); - haveinfo = true; - } - - if (!haveinfo) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_IE]) { - bcn->beacon_ies = nla_data(info->attrs[NL80211_ATTR_IE]); - bcn->beacon_ies_len = nla_len(info->attrs[NL80211_ATTR_IE]); - } - - if (info->attrs[NL80211_ATTR_IE_PROBE_RESP]) { - bcn->proberesp_ies = - nla_data(info->attrs[NL80211_ATTR_IE_PROBE_RESP]); - bcn->proberesp_ies_len = - nla_len(info->attrs[NL80211_ATTR_IE_PROBE_RESP]); - } - - if (info->attrs[NL80211_ATTR_IE_ASSOC_RESP]) { - bcn->assocresp_ies = - nla_data(info->attrs[NL80211_ATTR_IE_ASSOC_RESP]); - bcn->assocresp_ies_len = - nla_len(info->attrs[NL80211_ATTR_IE_ASSOC_RESP]); - } - - if (info->attrs[NL80211_ATTR_PROBE_RESP]) { - bcn->probe_resp = - nla_data(info->attrs[NL80211_ATTR_PROBE_RESP]); - bcn->probe_resp_len = - nla_len(info->attrs[NL80211_ATTR_PROBE_RESP]); - } - - return 0; -} - -static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_ap_settings params; - int err; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) - return -EOPNOTSUPP; - - if (!rdev->ops->start_ap) - return -EOPNOTSUPP; - - if (wdev->beacon_interval) - return -EALREADY; - - memset(¶ms, 0, sizeof(params)); - - /* these are required for START_AP */ - if (!info->attrs[NL80211_ATTR_BEACON_INTERVAL] || - !info->attrs[NL80211_ATTR_DTIM_PERIOD] || - !info->attrs[NL80211_ATTR_BEACON_HEAD]) - return -EINVAL; - - err = nl80211_parse_beacon(info, ¶ms.beacon); - if (err) - return err; - - params.beacon_interval = - nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]); - params.dtim_period = - nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]); - - err = cfg80211_validate_beacon_int(rdev, params.beacon_interval); - if (err) - return err; - - /* - * In theory, some of these attributes should be required here - * but since they were not used when the command was originally - * added, keep them optional for old user space programs to let - * them continue to work with drivers that do not need the - * additional information -- drivers must check! - */ - if (info->attrs[NL80211_ATTR_SSID]) { - params.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); - params.ssid_len = - nla_len(info->attrs[NL80211_ATTR_SSID]); - if (params.ssid_len == 0 || - params.ssid_len > IEEE80211_MAX_SSID_LEN) - return -EINVAL; - } - - if (info->attrs[NL80211_ATTR_HIDDEN_SSID]) { - params.hidden_ssid = nla_get_u32( - info->attrs[NL80211_ATTR_HIDDEN_SSID]); - if (params.hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE && - params.hidden_ssid != NL80211_HIDDEN_SSID_ZERO_LEN && - params.hidden_ssid != NL80211_HIDDEN_SSID_ZERO_CONTENTS) - return -EINVAL; - } - - params.privacy = !!info->attrs[NL80211_ATTR_PRIVACY]; - - if (info->attrs[NL80211_ATTR_AUTH_TYPE]) { - params.auth_type = nla_get_u32( - info->attrs[NL80211_ATTR_AUTH_TYPE]); - if (!nl80211_valid_auth_type(params.auth_type)) - return -EINVAL; - } else - params.auth_type = NL80211_AUTHTYPE_AUTOMATIC; - - err = nl80211_crypto_settings(rdev, info, ¶ms.crypto, - NL80211_MAX_NR_CIPHER_SUITES); - if (err) - return err; - - if (info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]) { - if (!(rdev->wiphy.features & NL80211_FEATURE_INACTIVITY_TIMER)) - return -EOPNOTSUPP; - params.inactivity_timeout = nla_get_u16( - info->attrs[NL80211_ATTR_INACTIVITY_TIMEOUT]); - } - - err = rdev->ops->start_ap(&rdev->wiphy, dev, ¶ms); - if (!err) - wdev->beacon_interval = params.beacon_interval; - return err; -} - -static int nl80211_set_beacon(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_beacon_data params; - int err; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) - return -EOPNOTSUPP; - - if (!rdev->ops->change_beacon) - return -EOPNOTSUPP; - - if (!wdev->beacon_interval) - return -EINVAL; - - err = nl80211_parse_beacon(info, ¶ms); - if (err) - return err; - - return rdev->ops->change_beacon(&rdev->wiphy, dev, ¶ms); -} - -static int nl80211_stop_ap(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - if (!rdev->ops->stop_ap) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) - return -EOPNOTSUPP; - - if (!wdev->beacon_interval) - return -ENOENT; - - err = rdev->ops->stop_ap(&rdev->wiphy, dev); - if (!err) - wdev->beacon_interval = 0; - return err; -} - -static const struct nla_policy sta_flags_policy[NL80211_STA_FLAG_MAX + 1] = { - [NL80211_STA_FLAG_AUTHORIZED] = { .type = NLA_FLAG }, - [NL80211_STA_FLAG_SHORT_PREAMBLE] = { .type = NLA_FLAG }, - [NL80211_STA_FLAG_WME] = { .type = NLA_FLAG }, - [NL80211_STA_FLAG_MFP] = { .type = NLA_FLAG }, - [NL80211_STA_FLAG_AUTHENTICATED] = { .type = NLA_FLAG }, - [NL80211_STA_FLAG_TDLS_PEER] = { .type = NLA_FLAG }, -}; - -static int parse_station_flags(struct genl_info *info, - enum nl80211_iftype iftype, - struct station_parameters *params) -{ - struct nlattr *flags[NL80211_STA_FLAG_MAX + 1]; - struct nlattr *nla; - int flag; - - /* - * Try parsing the new attribute first so userspace - * can specify both for older kernels. - */ - nla = info->attrs[NL80211_ATTR_STA_FLAGS2]; - if (nla) { - struct nl80211_sta_flag_update *sta_flags; - - sta_flags = nla_data(nla); - params->sta_flags_mask = sta_flags->mask; - params->sta_flags_set = sta_flags->set; - if ((params->sta_flags_mask | - params->sta_flags_set) & BIT(__NL80211_STA_FLAG_INVALID)) - return -EINVAL; - return 0; - } - - /* if present, parse the old attribute */ - - nla = info->attrs[NL80211_ATTR_STA_FLAGS]; - if (!nla) - return 0; - - if (nla_parse_nested(flags, NL80211_STA_FLAG_MAX, - nla, sta_flags_policy)) - return -EINVAL; - - /* - * Only allow certain flags for interface types so that - * other attributes are silently ignored. Remember that - * this is backward compatibility code with old userspace - * and shouldn't be hit in other cases anyway. - */ - switch (iftype) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_P2P_GO: - params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHORIZED) | - BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) | - BIT(NL80211_STA_FLAG_WME) | - BIT(NL80211_STA_FLAG_MFP); - break; - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_STATION: - params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHORIZED) | - BIT(NL80211_STA_FLAG_TDLS_PEER); - break; - case NL80211_IFTYPE_MESH_POINT: - params->sta_flags_mask = BIT(NL80211_STA_FLAG_AUTHENTICATED) | - BIT(NL80211_STA_FLAG_MFP) | - BIT(NL80211_STA_FLAG_AUTHORIZED); - default: - return -EINVAL; - } - - for (flag = 1; flag <= NL80211_STA_FLAG_MAX; flag++) - if (flags[flag]) - params->sta_flags_set |= (1<<flag); - - return 0; -} - -static bool nl80211_put_sta_rate(struct sk_buff *msg, struct rate_info *info, - int attr) -{ - struct nlattr *rate; - u16 bitrate; - - rate = nla_nest_start(msg, attr); - if (!rate) - goto nla_put_failure; - - /* cfg80211_calculate_bitrate will return 0 for mcs >= 32 */ - bitrate = cfg80211_calculate_bitrate(info); - if (bitrate > 0) - NLA_PUT_U16(msg, NL80211_RATE_INFO_BITRATE, bitrate); - - if (info->flags & RATE_INFO_FLAGS_MCS) - NLA_PUT_U8(msg, NL80211_RATE_INFO_MCS, info->mcs); - if (info->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH) - NLA_PUT_FLAG(msg, NL80211_RATE_INFO_40_MHZ_WIDTH); - if (info->flags & RATE_INFO_FLAGS_SHORT_GI) - NLA_PUT_FLAG(msg, NL80211_RATE_INFO_SHORT_GI); - - nla_nest_end(msg, rate); - return true; - -nla_put_failure: - return false; -} - -static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, - int flags, - struct cfg80211_registered_device *rdev, - struct net_device *dev, - const u8 *mac_addr, struct station_info *sinfo) -{ - void *hdr; - struct nlattr *sinfoattr, *bss_param; - - hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_STATION); - if (!hdr) - return -1; - - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); - - NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, sinfo->generation); - - sinfoattr = nla_nest_start(msg, NL80211_ATTR_STA_INFO); - if (!sinfoattr) - goto nla_put_failure; - if (sinfo->filled & STATION_INFO_CONNECTED_TIME) - NLA_PUT_U32(msg, NL80211_STA_INFO_CONNECTED_TIME, - sinfo->connected_time); - if (sinfo->filled & STATION_INFO_INACTIVE_TIME) - NLA_PUT_U32(msg, NL80211_STA_INFO_INACTIVE_TIME, - sinfo->inactive_time); - if (sinfo->filled & STATION_INFO_RX_BYTES) - NLA_PUT_U32(msg, NL80211_STA_INFO_RX_BYTES, - sinfo->rx_bytes); - if (sinfo->filled & STATION_INFO_TX_BYTES) - NLA_PUT_U32(msg, NL80211_STA_INFO_TX_BYTES, - sinfo->tx_bytes); - if (sinfo->filled & STATION_INFO_LLID) - NLA_PUT_U16(msg, NL80211_STA_INFO_LLID, - sinfo->llid); - if (sinfo->filled & STATION_INFO_PLID) - NLA_PUT_U16(msg, NL80211_STA_INFO_PLID, - sinfo->plid); - if (sinfo->filled & STATION_INFO_PLINK_STATE) - NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE, - sinfo->plink_state); - switch (rdev->wiphy.signal_type) { - case CFG80211_SIGNAL_TYPE_MBM: - if (sinfo->filled & STATION_INFO_SIGNAL) - NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, - sinfo->signal); - if (sinfo->filled & STATION_INFO_SIGNAL_AVG) - NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, - sinfo->signal_avg); - break; - default: - break; - } - if (sinfo->filled & STATION_INFO_TX_BITRATE) { - if (!nl80211_put_sta_rate(msg, &sinfo->txrate, - NL80211_STA_INFO_TX_BITRATE)) - goto nla_put_failure; - } - if (sinfo->filled & STATION_INFO_RX_BITRATE) { - if (!nl80211_put_sta_rate(msg, &sinfo->rxrate, - NL80211_STA_INFO_RX_BITRATE)) - goto nla_put_failure; - } - if (sinfo->filled & STATION_INFO_RX_PACKETS) - NLA_PUT_U32(msg, NL80211_STA_INFO_RX_PACKETS, - sinfo->rx_packets); - if (sinfo->filled & STATION_INFO_TX_PACKETS) - NLA_PUT_U32(msg, NL80211_STA_INFO_TX_PACKETS, - sinfo->tx_packets); - if (sinfo->filled & STATION_INFO_TX_RETRIES) - NLA_PUT_U32(msg, NL80211_STA_INFO_TX_RETRIES, - sinfo->tx_retries); - if (sinfo->filled & STATION_INFO_TX_FAILED) - NLA_PUT_U32(msg, NL80211_STA_INFO_TX_FAILED, - sinfo->tx_failed); - if (sinfo->filled & STATION_INFO_BEACON_LOSS_COUNT) - NLA_PUT_U32(msg, NL80211_STA_INFO_BEACON_LOSS, - sinfo->beacon_loss_count); - if (sinfo->filled & STATION_INFO_BSS_PARAM) { - bss_param = nla_nest_start(msg, NL80211_STA_INFO_BSS_PARAM); - if (!bss_param) - goto nla_put_failure; - - if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_CTS_PROT) - NLA_PUT_FLAG(msg, NL80211_STA_BSS_PARAM_CTS_PROT); - if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_SHORT_PREAMBLE) - NLA_PUT_FLAG(msg, NL80211_STA_BSS_PARAM_SHORT_PREAMBLE); - if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_SHORT_SLOT_TIME) - NLA_PUT_FLAG(msg, - NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME); - NLA_PUT_U8(msg, NL80211_STA_BSS_PARAM_DTIM_PERIOD, - sinfo->bss_param.dtim_period); - NLA_PUT_U16(msg, NL80211_STA_BSS_PARAM_BEACON_INTERVAL, - sinfo->bss_param.beacon_interval); - - nla_nest_end(msg, bss_param); - } - if (sinfo->filled & STATION_INFO_STA_FLAGS) - NLA_PUT(msg, NL80211_STA_INFO_STA_FLAGS, - sizeof(struct nl80211_sta_flag_update), - &sinfo->sta_flags); - nla_nest_end(msg, sinfoattr); - - if (sinfo->filled & STATION_INFO_ASSOC_REQ_IES) - NLA_PUT(msg, NL80211_ATTR_IE, sinfo->assoc_req_ies_len, - sinfo->assoc_req_ies); - - return genlmsg_end(msg, hdr); - - nla_put_failure: - genlmsg_cancel(msg, hdr); - return -EMSGSIZE; -} - -static int nl80211_dump_station(struct sk_buff *skb, - struct netlink_callback *cb) -{ - struct station_info sinfo; - struct cfg80211_registered_device *dev; - struct net_device *netdev; - u8 mac_addr[ETH_ALEN]; - int sta_idx = cb->args[1]; - int err; - - err = nl80211_prepare_netdev_dump(skb, cb, &dev, &netdev); - if (err) - return err; - - if (!dev->ops->dump_station) { - err = -EOPNOTSUPP; - goto out_err; - } - - while (1) { - memset(&sinfo, 0, sizeof(sinfo)); - err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx, - mac_addr, &sinfo); - if (err == -ENOENT) - break; - if (err) - goto out_err; - - if (nl80211_send_station(skb, - NETLINK_CB(cb->skb).pid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - dev, netdev, mac_addr, - &sinfo) < 0) - goto out; - - sta_idx++; - } - - - out: - cb->args[1] = sta_idx; - err = skb->len; - out_err: - nl80211_finish_netdev_dump(dev); - - return err; -} - -static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct station_info sinfo; - struct sk_buff *msg; - u8 *mac_addr = NULL; - int err; - - memset(&sinfo, 0, sizeof(sinfo)); - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); - - if (!rdev->ops->get_station) - return -EOPNOTSUPP; - - err = rdev->ops->get_station(&rdev->wiphy, dev, mac_addr, &sinfo); - if (err) - return err; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - if (nl80211_send_station(msg, info->snd_pid, info->snd_seq, 0, - rdev, dev, mac_addr, &sinfo) < 0) { - nlmsg_free(msg); - return -ENOBUFS; - } - - return genlmsg_reply(msg, info); -} - -/* - * Get vlan interface making sure it is running and on the right wiphy. - */ -static struct net_device *get_vlan(struct genl_info *info, - struct cfg80211_registered_device *rdev) -{ - struct nlattr *vlanattr = info->attrs[NL80211_ATTR_STA_VLAN]; - struct net_device *v; - int ret; - - if (!vlanattr) - return NULL; - - v = dev_get_by_index(genl_info_net(info), nla_get_u32(vlanattr)); - if (!v) - return ERR_PTR(-ENODEV); - - if (!v->ieee80211_ptr || v->ieee80211_ptr->wiphy != &rdev->wiphy) { - ret = -EINVAL; - goto error; - } - - if (!netif_running(v)) { - ret = -ENETDOWN; - goto error; - } - - return v; - error: - dev_put(v); - return ERR_PTR(ret); -} - -static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - int err; - struct net_device *dev = info->user_ptr[1]; - struct station_parameters params; - u8 *mac_addr = NULL; - - memset(¶ms, 0, sizeof(params)); - - params.listen_interval = -1; - params.plink_state = -1; - - if (info->attrs[NL80211_ATTR_STA_AID]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); - - if (info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]) { - params.supported_rates = - nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); - params.supported_rates_len = - nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); - } - - if (info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]) - params.listen_interval = - nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); - - if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) - params.ht_capa = - nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); - - if (!rdev->ops->change_station) - return -EOPNOTSUPP; - - if (parse_station_flags(info, dev->ieee80211_ptr->iftype, ¶ms)) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_STA_PLINK_ACTION]) - params.plink_action = - nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]); - - if (info->attrs[NL80211_ATTR_STA_PLINK_STATE]) - params.plink_state = - nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_STATE]); - - switch (dev->ieee80211_ptr->iftype) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_P2P_GO: - /* disallow mesh-specific things */ - if (params.plink_action) - return -EINVAL; - - /* TDLS can't be set, ... */ - if (params.sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) - return -EINVAL; - /* - * ... but don't bother the driver with it. This works around - * a hostapd/wpa_supplicant issue -- it always includes the - * TLDS_PEER flag in the mask even for AP mode. - */ - params.sta_flags_mask &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); - - /* accept only the listed bits */ - if (params.sta_flags_mask & - ~(BIT(NL80211_STA_FLAG_AUTHORIZED) | - BIT(NL80211_STA_FLAG_SHORT_PREAMBLE) | - BIT(NL80211_STA_FLAG_WME) | - BIT(NL80211_STA_FLAG_MFP))) - return -EINVAL; - - /* must be last in here for error handling */ - params.vlan = get_vlan(info, rdev); - if (IS_ERR(params.vlan)) - return PTR_ERR(params.vlan); - break; - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_STATION: - /* - * Don't allow userspace to change the TDLS_PEER flag, - * but silently ignore attempts to change it since we - * don't have state here to verify that it doesn't try - * to change the flag. - */ - params.sta_flags_mask &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); - /* fall through */ - case NL80211_IFTYPE_ADHOC: - /* disallow things sta doesn't support */ - if (params.plink_action) - return -EINVAL; - if (params.ht_capa) - return -EINVAL; - if (params.listen_interval >= 0) - return -EINVAL; - /* reject any changes other than AUTHORIZED */ - if (params.sta_flags_mask & ~BIT(NL80211_STA_FLAG_AUTHORIZED)) - return -EINVAL; - break; - case NL80211_IFTYPE_MESH_POINT: - /* disallow things mesh doesn't support */ - if (params.vlan) - return -EINVAL; - if (params.ht_capa) - return -EINVAL; - if (params.listen_interval >= 0) - return -EINVAL; - /* - * No special handling for TDLS here -- the userspace - * mesh code doesn't have this bug. - */ - if (params.sta_flags_mask & - ~(BIT(NL80211_STA_FLAG_AUTHENTICATED) | - BIT(NL80211_STA_FLAG_MFP) | - BIT(NL80211_STA_FLAG_AUTHORIZED))) - return -EINVAL; - break; - default: - return -EOPNOTSUPP; - } - - /* be aware of params.vlan when changing code here */ - - err = rdev->ops->change_station(&rdev->wiphy, dev, mac_addr, ¶ms); - - if (params.vlan) - dev_put(params.vlan); - - return err; -} - -static struct nla_policy -nl80211_sta_wme_policy[NL80211_STA_WME_MAX + 1] __read_mostly = { - [NL80211_STA_WME_UAPSD_QUEUES] = { .type = NLA_U8 }, - [NL80211_STA_WME_MAX_SP] = { .type = NLA_U8 }, -}; - -static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - int err; - struct net_device *dev = info->user_ptr[1]; - struct station_parameters params; - u8 *mac_addr = NULL; - - memset(¶ms, 0, sizeof(params)); - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_STA_AID]) - return -EINVAL; - - mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); - params.supported_rates = - nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); - params.supported_rates_len = - nla_len(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]); - params.listen_interval = - nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]); - - params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]); - if (!params.aid || params.aid > IEEE80211_MAX_AID) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) - params.ht_capa = - nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); - - if (info->attrs[NL80211_ATTR_STA_PLINK_ACTION]) - params.plink_action = - nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]); - - if (!rdev->ops->add_station) - return -EOPNOTSUPP; - - if (parse_station_flags(info, dev->ieee80211_ptr->iftype, ¶ms)) - return -EINVAL; - - switch (dev->ieee80211_ptr->iftype) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_P2P_GO: - /* parse WME attributes if sta is WME capable */ - if ((rdev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) && - (params.sta_flags_set & BIT(NL80211_STA_FLAG_WME)) && - info->attrs[NL80211_ATTR_STA_WME]) { - struct nlattr *tb[NL80211_STA_WME_MAX + 1]; - struct nlattr *nla; - - nla = info->attrs[NL80211_ATTR_STA_WME]; - err = nla_parse_nested(tb, NL80211_STA_WME_MAX, nla, - nl80211_sta_wme_policy); - if (err) - return err; - - if (tb[NL80211_STA_WME_UAPSD_QUEUES]) - params.uapsd_queues = - nla_get_u8(tb[NL80211_STA_WME_UAPSD_QUEUES]); - if (params.uapsd_queues & - ~IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK) - return -EINVAL; - - if (tb[NL80211_STA_WME_MAX_SP]) - params.max_sp = - nla_get_u8(tb[NL80211_STA_WME_MAX_SP]); - - if (params.max_sp & - ~IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK) - return -EINVAL; - - params.sta_modify_mask |= STATION_PARAM_APPLY_UAPSD; - } - /* TDLS peers cannot be added */ - if (params.sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) - return -EINVAL; - /* but don't bother the driver with it */ - params.sta_flags_mask &= ~BIT(NL80211_STA_FLAG_TDLS_PEER); - - /* must be last in here for error handling */ - params.vlan = get_vlan(info, rdev); - if (IS_ERR(params.vlan)) - return PTR_ERR(params.vlan); - break; - case NL80211_IFTYPE_MESH_POINT: - /* TDLS peers cannot be added */ - if (params.sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) - return -EINVAL; - break; - case NL80211_IFTYPE_STATION: - /* Only TDLS peers can be added */ - if (!(params.sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))) - return -EINVAL; - /* Can only add if TDLS ... */ - if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS)) - return -EOPNOTSUPP; - /* ... with external setup is supported */ - if (!(rdev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP)) - return -EOPNOTSUPP; - break; - default: - return -EOPNOTSUPP; - } - - /* be aware of params.vlan when changing code here */ - - err = rdev->ops->add_station(&rdev->wiphy, dev, mac_addr, ¶ms); - - if (params.vlan) - dev_put(params.vlan); - return err; -} - -static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - u8 *mac_addr = NULL; - - if (info->attrs[NL80211_ATTR_MAC]) - mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) - return -EINVAL; - - if (!rdev->ops->del_station) - return -EOPNOTSUPP; - - return rdev->ops->del_station(&rdev->wiphy, dev, mac_addr); -} - -static int nl80211_send_mpath(struct sk_buff *msg, u32 pid, u32 seq, - int flags, struct net_device *dev, - u8 *dst, u8 *next_hop, - struct mpath_info *pinfo) -{ - void *hdr; - struct nlattr *pinfoattr; - - hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_STATION); - if (!hdr) - return -1; - - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, dst); - NLA_PUT(msg, NL80211_ATTR_MPATH_NEXT_HOP, ETH_ALEN, next_hop); - - NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, pinfo->generation); - - pinfoattr = nla_nest_start(msg, NL80211_ATTR_MPATH_INFO); - if (!pinfoattr) - goto nla_put_failure; - if (pinfo->filled & MPATH_INFO_FRAME_QLEN) - NLA_PUT_U32(msg, NL80211_MPATH_INFO_FRAME_QLEN, - pinfo->frame_qlen); - if (pinfo->filled & MPATH_INFO_SN) - NLA_PUT_U32(msg, NL80211_MPATH_INFO_SN, - pinfo->sn); - if (pinfo->filled & MPATH_INFO_METRIC) - NLA_PUT_U32(msg, NL80211_MPATH_INFO_METRIC, - pinfo->metric); - if (pinfo->filled & MPATH_INFO_EXPTIME) - NLA_PUT_U32(msg, NL80211_MPATH_INFO_EXPTIME, - pinfo->exptime); - if (pinfo->filled & MPATH_INFO_FLAGS) - NLA_PUT_U8(msg, NL80211_MPATH_INFO_FLAGS, - pinfo->flags); - if (pinfo->filled & MPATH_INFO_DISCOVERY_TIMEOUT) - NLA_PUT_U32(msg, NL80211_MPATH_INFO_DISCOVERY_TIMEOUT, - pinfo->discovery_timeout); - if (pinfo->filled & MPATH_INFO_DISCOVERY_RETRIES) - NLA_PUT_U8(msg, NL80211_MPATH_INFO_DISCOVERY_RETRIES, - pinfo->discovery_retries); - - nla_nest_end(msg, pinfoattr); - - return genlmsg_end(msg, hdr); - - nla_put_failure: - genlmsg_cancel(msg, hdr); - return -EMSGSIZE; -} - -static int nl80211_dump_mpath(struct sk_buff *skb, - struct netlink_callback *cb) -{ - struct mpath_info pinfo; - struct cfg80211_registered_device *dev; - struct net_device *netdev; - u8 dst[ETH_ALEN]; - u8 next_hop[ETH_ALEN]; - int path_idx = cb->args[1]; - int err; - - err = nl80211_prepare_netdev_dump(skb, cb, &dev, &netdev); - if (err) - return err; - - if (!dev->ops->dump_mpath) { - err = -EOPNOTSUPP; - goto out_err; - } - - if (netdev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) { - err = -EOPNOTSUPP; - goto out_err; - } - - while (1) { - err = dev->ops->dump_mpath(&dev->wiphy, netdev, path_idx, - dst, next_hop, &pinfo); - if (err == -ENOENT) - break; - if (err) - goto out_err; - - if (nl80211_send_mpath(skb, NETLINK_CB(cb->skb).pid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - netdev, dst, next_hop, - &pinfo) < 0) - goto out; - - path_idx++; - } - - - out: - cb->args[1] = path_idx; - err = skb->len; - out_err: - nl80211_finish_netdev_dump(dev); - return err; -} - -static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - int err; - struct net_device *dev = info->user_ptr[1]; - struct mpath_info pinfo; - struct sk_buff *msg; - u8 *dst = NULL; - u8 next_hop[ETH_ALEN]; - - memset(&pinfo, 0, sizeof(pinfo)); - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - dst = nla_data(info->attrs[NL80211_ATTR_MAC]); - - if (!rdev->ops->get_mpath) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) - return -EOPNOTSUPP; - - err = rdev->ops->get_mpath(&rdev->wiphy, dev, dst, next_hop, &pinfo); - if (err) - return err; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - if (nl80211_send_mpath(msg, info->snd_pid, info->snd_seq, 0, - dev, dst, next_hop, &pinfo) < 0) { - nlmsg_free(msg); - return -ENOBUFS; - } - - return genlmsg_reply(msg, info); -} - -static int nl80211_set_mpath(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - u8 *dst = NULL; - u8 *next_hop = NULL; - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]) - return -EINVAL; - - dst = nla_data(info->attrs[NL80211_ATTR_MAC]); - next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]); - - if (!rdev->ops->change_mpath) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) - return -EOPNOTSUPP; - - return rdev->ops->change_mpath(&rdev->wiphy, dev, dst, next_hop); -} - -static int nl80211_new_mpath(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - u8 *dst = NULL; - u8 *next_hop = NULL; - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]) - return -EINVAL; - - dst = nla_data(info->attrs[NL80211_ATTR_MAC]); - next_hop = nla_data(info->attrs[NL80211_ATTR_MPATH_NEXT_HOP]); - - if (!rdev->ops->add_mpath) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) - return -EOPNOTSUPP; - - return rdev->ops->add_mpath(&rdev->wiphy, dev, dst, next_hop); -} - -static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - u8 *dst = NULL; - - if (info->attrs[NL80211_ATTR_MAC]) - dst = nla_data(info->attrs[NL80211_ATTR_MAC]); - - if (!rdev->ops->del_mpath) - return -EOPNOTSUPP; - - return rdev->ops->del_mpath(&rdev->wiphy, dev, dst); -} - -static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct bss_parameters params; - - memset(¶ms, 0, sizeof(params)); - /* default to not changing parameters */ - params.use_cts_prot = -1; - params.use_short_preamble = -1; - params.use_short_slot_time = -1; - params.ap_isolate = -1; - params.ht_opmode = -1; - - if (info->attrs[NL80211_ATTR_BSS_CTS_PROT]) - params.use_cts_prot = - nla_get_u8(info->attrs[NL80211_ATTR_BSS_CTS_PROT]); - if (info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]) - params.use_short_preamble = - nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_PREAMBLE]); - if (info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]) - params.use_short_slot_time = - nla_get_u8(info->attrs[NL80211_ATTR_BSS_SHORT_SLOT_TIME]); - if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) { - params.basic_rates = - nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); - params.basic_rates_len = - nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); - } - if (info->attrs[NL80211_ATTR_AP_ISOLATE]) - params.ap_isolate = !!nla_get_u8(info->attrs[NL80211_ATTR_AP_ISOLATE]); - if (info->attrs[NL80211_ATTR_BSS_HT_OPMODE]) - params.ht_opmode = - nla_get_u16(info->attrs[NL80211_ATTR_BSS_HT_OPMODE]); - - if (!rdev->ops->change_bss) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) - return -EOPNOTSUPP; - - return rdev->ops->change_bss(&rdev->wiphy, dev, ¶ms); -} - -static const struct nla_policy reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] = { - [NL80211_ATTR_REG_RULE_FLAGS] = { .type = NLA_U32 }, - [NL80211_ATTR_FREQ_RANGE_START] = { .type = NLA_U32 }, - [NL80211_ATTR_FREQ_RANGE_END] = { .type = NLA_U32 }, - [NL80211_ATTR_FREQ_RANGE_MAX_BW] = { .type = NLA_U32 }, - [NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN] = { .type = NLA_U32 }, - [NL80211_ATTR_POWER_RULE_MAX_EIRP] = { .type = NLA_U32 }, -}; - -static int parse_reg_rule(struct nlattr *tb[], - struct ieee80211_reg_rule *reg_rule) -{ - struct ieee80211_freq_range *freq_range = ®_rule->freq_range; - struct ieee80211_power_rule *power_rule = ®_rule->power_rule; - - if (!tb[NL80211_ATTR_REG_RULE_FLAGS]) - return -EINVAL; - if (!tb[NL80211_ATTR_FREQ_RANGE_START]) - return -EINVAL; - if (!tb[NL80211_ATTR_FREQ_RANGE_END]) - return -EINVAL; - if (!tb[NL80211_ATTR_FREQ_RANGE_MAX_BW]) - return -EINVAL; - if (!tb[NL80211_ATTR_POWER_RULE_MAX_EIRP]) - return -EINVAL; - - reg_rule->flags = nla_get_u32(tb[NL80211_ATTR_REG_RULE_FLAGS]); - - freq_range->start_freq_khz = - nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_START]); - freq_range->end_freq_khz = - nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_END]); - freq_range->max_bandwidth_khz = - nla_get_u32(tb[NL80211_ATTR_FREQ_RANGE_MAX_BW]); - - power_rule->max_eirp = - nla_get_u32(tb[NL80211_ATTR_POWER_RULE_MAX_EIRP]); - - if (tb[NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN]) - power_rule->max_antenna_gain = - nla_get_u32(tb[NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN]); - - return 0; -} - -static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info) -{ - int r; - char *data = NULL; - - /* - * You should only get this when cfg80211 hasn't yet initialized - * completely when built-in to the kernel right between the time - * window between nl80211_init() and regulatory_init(), if that is - * even possible. - */ - mutex_lock(&cfg80211_mutex); - if (unlikely(!cfg80211_regdomain)) { - mutex_unlock(&cfg80211_mutex); - return -EINPROGRESS; - } - mutex_unlock(&cfg80211_mutex); - - if (!info->attrs[NL80211_ATTR_REG_ALPHA2]) - return -EINVAL; - - data = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]); - - r = regulatory_hint_user(data); - - return r; -} - -static int nl80211_get_mesh_config(struct sk_buff *skb, - struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct mesh_config cur_params; - int err = 0; - void *hdr; - struct nlattr *pinfoattr; - struct sk_buff *msg; - - if (wdev->iftype != NL80211_IFTYPE_MESH_POINT) - return -EOPNOTSUPP; - - if (!rdev->ops->get_mesh_config) - return -EOPNOTSUPP; - - wdev_lock(wdev); - /* If not connected, get default parameters */ - if (!wdev->mesh_id_len) - memcpy(&cur_params, &default_mesh_config, sizeof(cur_params)); - else - err = rdev->ops->get_mesh_config(&rdev->wiphy, dev, - &cur_params); - wdev_unlock(wdev); - - if (err) - return err; - - /* Draw up a netlink message to send back */ - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; - hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, - NL80211_CMD_GET_MESH_CONFIG); - if (!hdr) - goto out; - pinfoattr = nla_nest_start(msg, NL80211_ATTR_MESH_CONFIG); - if (!pinfoattr) - goto nla_put_failure; - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); - NLA_PUT_U16(msg, NL80211_MESHCONF_RETRY_TIMEOUT, - cur_params.dot11MeshRetryTimeout); - NLA_PUT_U16(msg, NL80211_MESHCONF_CONFIRM_TIMEOUT, - cur_params.dot11MeshConfirmTimeout); - NLA_PUT_U16(msg, NL80211_MESHCONF_HOLDING_TIMEOUT, - cur_params.dot11MeshHoldingTimeout); - NLA_PUT_U16(msg, NL80211_MESHCONF_MAX_PEER_LINKS, - cur_params.dot11MeshMaxPeerLinks); - NLA_PUT_U8(msg, NL80211_MESHCONF_MAX_RETRIES, - cur_params.dot11MeshMaxRetries); - NLA_PUT_U8(msg, NL80211_MESHCONF_TTL, - cur_params.dot11MeshTTL); - NLA_PUT_U8(msg, NL80211_MESHCONF_ELEMENT_TTL, - cur_params.element_ttl); - NLA_PUT_U8(msg, NL80211_MESHCONF_AUTO_OPEN_PLINKS, - cur_params.auto_open_plinks); - NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, - cur_params.dot11MeshHWMPmaxPREQretries); - NLA_PUT_U32(msg, NL80211_MESHCONF_PATH_REFRESH_TIME, - cur_params.path_refresh_time); - NLA_PUT_U16(msg, NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, - cur_params.min_discovery_timeout); - NLA_PUT_U32(msg, NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, - cur_params.dot11MeshHWMPactivePathTimeout); - NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, - cur_params.dot11MeshHWMPpreqMinInterval); - NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, - cur_params.dot11MeshHWMPperrMinInterval); - NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, - cur_params.dot11MeshHWMPnetDiameterTraversalTime); - NLA_PUT_U8(msg, NL80211_MESHCONF_HWMP_ROOTMODE, - cur_params.dot11MeshHWMPRootMode); - NLA_PUT_U16(msg, NL80211_MESHCONF_HWMP_RANN_INTERVAL, - cur_params.dot11MeshHWMPRannInterval); - NLA_PUT_U8(msg, NL80211_MESHCONF_GATE_ANNOUNCEMENTS, - cur_params.dot11MeshGateAnnouncementProtocol); - NLA_PUT_U8(msg, NL80211_MESHCONF_FORWARDING, - cur_params.dot11MeshForwarding); - NLA_PUT_U32(msg, NL80211_MESHCONF_RSSI_THRESHOLD, - cur_params.rssi_threshold); - nla_nest_end(msg, pinfoattr); - genlmsg_end(msg, hdr); - return genlmsg_reply(msg, info); - - nla_put_failure: - genlmsg_cancel(msg, hdr); - out: - nlmsg_free(msg); - return -ENOBUFS; -} - -static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_ATTR_MAX+1] = { - [NL80211_MESHCONF_RETRY_TIMEOUT] = { .type = NLA_U16 }, - [NL80211_MESHCONF_CONFIRM_TIMEOUT] = { .type = NLA_U16 }, - [NL80211_MESHCONF_HOLDING_TIMEOUT] = { .type = NLA_U16 }, - [NL80211_MESHCONF_MAX_PEER_LINKS] = { .type = NLA_U16 }, - [NL80211_MESHCONF_MAX_RETRIES] = { .type = NLA_U8 }, - [NL80211_MESHCONF_TTL] = { .type = NLA_U8 }, - [NL80211_MESHCONF_ELEMENT_TTL] = { .type = NLA_U8 }, - [NL80211_MESHCONF_AUTO_OPEN_PLINKS] = { .type = NLA_U8 }, - - [NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES] = { .type = NLA_U8 }, - [NL80211_MESHCONF_PATH_REFRESH_TIME] = { .type = NLA_U32 }, - [NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT] = { .type = NLA_U16 }, - [NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT] = { .type = NLA_U32 }, - [NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL] = { .type = NLA_U16 }, - [NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL] = { .type = NLA_U16 }, - [NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME] = { .type = NLA_U16 }, - [NL80211_MESHCONF_HWMP_ROOTMODE] = { .type = NLA_U8 }, - [NL80211_MESHCONF_HWMP_RANN_INTERVAL] = { .type = NLA_U16 }, - [NL80211_MESHCONF_GATE_ANNOUNCEMENTS] = { .type = NLA_U8 }, - [NL80211_MESHCONF_FORWARDING] = { .type = NLA_U8 }, - [NL80211_MESHCONF_RSSI_THRESHOLD] = { .type = NLA_U32}, -}; - -static const struct nla_policy - nl80211_mesh_setup_params_policy[NL80211_MESH_SETUP_ATTR_MAX+1] = { - [NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL] = { .type = NLA_U8 }, - [NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC] = { .type = NLA_U8 }, - [NL80211_MESH_SETUP_USERSPACE_AUTH] = { .type = NLA_FLAG }, - [NL80211_MESH_SETUP_IE] = { .type = NLA_BINARY, - .len = IEEE80211_MAX_DATA_LEN }, - [NL80211_MESH_SETUP_USERSPACE_AMPE] = { .type = NLA_FLAG }, -}; - -static int nl80211_parse_mesh_config(struct genl_info *info, - struct mesh_config *cfg, - u32 *mask_out) -{ - struct nlattr *tb[NL80211_MESHCONF_ATTR_MAX + 1]; - u32 mask = 0; - -#define FILL_IN_MESH_PARAM_IF_SET(table, cfg, param, mask, attr_num, nla_fn) \ -do {\ - if (table[attr_num]) {\ - cfg->param = nla_fn(table[attr_num]); \ - mask |= (1 << (attr_num - 1)); \ - } \ -} while (0);\ - - - if (!info->attrs[NL80211_ATTR_MESH_CONFIG]) - return -EINVAL; - if (nla_parse_nested(tb, NL80211_MESHCONF_ATTR_MAX, - info->attrs[NL80211_ATTR_MESH_CONFIG], - nl80211_meshconf_params_policy)) - return -EINVAL; - - /* This makes sure that there aren't more than 32 mesh config - * parameters (otherwise our bitfield scheme would not work.) */ - BUILD_BUG_ON(NL80211_MESHCONF_ATTR_MAX > 32); - - /* Fill in the params struct */ - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshRetryTimeout, - mask, NL80211_MESHCONF_RETRY_TIMEOUT, nla_get_u16); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshConfirmTimeout, - mask, NL80211_MESHCONF_CONFIRM_TIMEOUT, nla_get_u16); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHoldingTimeout, - mask, NL80211_MESHCONF_HOLDING_TIMEOUT, nla_get_u16); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshMaxPeerLinks, - mask, NL80211_MESHCONF_MAX_PEER_LINKS, nla_get_u16); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshMaxRetries, - mask, NL80211_MESHCONF_MAX_RETRIES, nla_get_u8); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshTTL, - mask, NL80211_MESHCONF_TTL, nla_get_u8); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, element_ttl, - mask, NL80211_MESHCONF_ELEMENT_TTL, nla_get_u8); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, auto_open_plinks, - mask, NL80211_MESHCONF_AUTO_OPEN_PLINKS, nla_get_u8); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPmaxPREQretries, - mask, NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES, - nla_get_u8); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, path_refresh_time, - mask, NL80211_MESHCONF_PATH_REFRESH_TIME, nla_get_u32); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, min_discovery_timeout, - mask, NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT, - nla_get_u16); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPactivePathTimeout, - mask, NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT, - nla_get_u32); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPpreqMinInterval, - mask, NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL, - nla_get_u16); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPperrMinInterval, - mask, NL80211_MESHCONF_HWMP_PERR_MIN_INTERVAL, - nla_get_u16); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, - dot11MeshHWMPnetDiameterTraversalTime, - mask, NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME, - nla_get_u16); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, - dot11MeshHWMPRootMode, mask, - NL80211_MESHCONF_HWMP_ROOTMODE, - nla_get_u8); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, - dot11MeshHWMPRannInterval, mask, - NL80211_MESHCONF_HWMP_RANN_INTERVAL, - nla_get_u16); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, - dot11MeshGateAnnouncementProtocol, mask, - NL80211_MESHCONF_GATE_ANNOUNCEMENTS, - nla_get_u8); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshForwarding, - mask, NL80211_MESHCONF_FORWARDING, nla_get_u8); - FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, - mask, NL80211_MESHCONF_RSSI_THRESHOLD, nla_get_u32); - if (mask_out) - *mask_out = mask; - - return 0; - -#undef FILL_IN_MESH_PARAM_IF_SET -} - -static int nl80211_parse_mesh_setup(struct genl_info *info, - struct mesh_setup *setup) -{ - struct nlattr *tb[NL80211_MESH_SETUP_ATTR_MAX + 1]; - - if (!info->attrs[NL80211_ATTR_MESH_SETUP]) - return -EINVAL; - if (nla_parse_nested(tb, NL80211_MESH_SETUP_ATTR_MAX, - info->attrs[NL80211_ATTR_MESH_SETUP], - nl80211_mesh_setup_params_policy)) - return -EINVAL; - - if (tb[NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL]) - setup->path_sel_proto = - (nla_get_u8(tb[NL80211_MESH_SETUP_ENABLE_VENDOR_PATH_SEL])) ? - IEEE80211_PATH_PROTOCOL_VENDOR : - IEEE80211_PATH_PROTOCOL_HWMP; - - if (tb[NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC]) - setup->path_metric = - (nla_get_u8(tb[NL80211_MESH_SETUP_ENABLE_VENDOR_METRIC])) ? - IEEE80211_PATH_METRIC_VENDOR : - IEEE80211_PATH_METRIC_AIRTIME; - - - if (tb[NL80211_MESH_SETUP_IE]) { - struct nlattr *ieattr = - tb[NL80211_MESH_SETUP_IE]; - if (!is_valid_ie_attr(ieattr)) - return -EINVAL; - setup->ie = nla_data(ieattr); - setup->ie_len = nla_len(ieattr); - } - setup->is_authenticated = nla_get_flag(tb[NL80211_MESH_SETUP_USERSPACE_AUTH]); - setup->is_secure = nla_get_flag(tb[NL80211_MESH_SETUP_USERSPACE_AMPE]); - - return 0; -} - -static int nl80211_update_mesh_config(struct sk_buff *skb, - struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct mesh_config cfg; - u32 mask; - int err; - - if (wdev->iftype != NL80211_IFTYPE_MESH_POINT) - return -EOPNOTSUPP; - - if (!rdev->ops->update_mesh_config) - return -EOPNOTSUPP; - - err = nl80211_parse_mesh_config(info, &cfg, &mask); - if (err) - return err; - - wdev_lock(wdev); - if (!wdev->mesh_id_len) - err = -ENOLINK; - - if (!err) - err = rdev->ops->update_mesh_config(&rdev->wiphy, dev, - mask, &cfg); - - wdev_unlock(wdev); - - return err; -} - -static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info) -{ - struct sk_buff *msg; - void *hdr = NULL; - struct nlattr *nl_reg_rules; - unsigned int i; - int err = -EINVAL; - - mutex_lock(&cfg80211_mutex); - - if (!cfg80211_regdomain) - goto out; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) { - err = -ENOBUFS; - goto out; - } - - hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, - NL80211_CMD_GET_REG); - if (!hdr) - goto put_failure; - - NLA_PUT_STRING(msg, NL80211_ATTR_REG_ALPHA2, - cfg80211_regdomain->alpha2); - if (cfg80211_regdomain->dfs_region) - NLA_PUT_U8(msg, NL80211_ATTR_DFS_REGION, - cfg80211_regdomain->dfs_region); - - nl_reg_rules = nla_nest_start(msg, NL80211_ATTR_REG_RULES); - if (!nl_reg_rules) - goto nla_put_failure; - - for (i = 0; i < cfg80211_regdomain->n_reg_rules; i++) { - struct nlattr *nl_reg_rule; - const struct ieee80211_reg_rule *reg_rule; - const struct ieee80211_freq_range *freq_range; - const struct ieee80211_power_rule *power_rule; - - reg_rule = &cfg80211_regdomain->reg_rules[i]; - freq_range = ®_rule->freq_range; - power_rule = ®_rule->power_rule; - - nl_reg_rule = nla_nest_start(msg, i); - if (!nl_reg_rule) - goto nla_put_failure; - - NLA_PUT_U32(msg, NL80211_ATTR_REG_RULE_FLAGS, - reg_rule->flags); - NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_START, - freq_range->start_freq_khz); - NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_END, - freq_range->end_freq_khz); - NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_MAX_BW, - freq_range->max_bandwidth_khz); - NLA_PUT_U32(msg, NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN, - power_rule->max_antenna_gain); - NLA_PUT_U32(msg, NL80211_ATTR_POWER_RULE_MAX_EIRP, - power_rule->max_eirp); - - nla_nest_end(msg, nl_reg_rule); - } - - nla_nest_end(msg, nl_reg_rules); - - genlmsg_end(msg, hdr); - err = genlmsg_reply(msg, info); - goto out; - -nla_put_failure: - genlmsg_cancel(msg, hdr); -put_failure: - nlmsg_free(msg); - err = -EMSGSIZE; -out: - mutex_unlock(&cfg80211_mutex); - return err; -} - -static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info) -{ - struct nlattr *tb[NL80211_REG_RULE_ATTR_MAX + 1]; - struct nlattr *nl_reg_rule; - char *alpha2 = NULL; - int rem_reg_rules = 0, r = 0; - u32 num_rules = 0, rule_idx = 0, size_of_regd; - u8 dfs_region = 0; - struct ieee80211_regdomain *rd = NULL; - - if (!info->attrs[NL80211_ATTR_REG_ALPHA2]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_REG_RULES]) - return -EINVAL; - - alpha2 = nla_data(info->attrs[NL80211_ATTR_REG_ALPHA2]); - - if (info->attrs[NL80211_ATTR_DFS_REGION]) - dfs_region = nla_get_u8(info->attrs[NL80211_ATTR_DFS_REGION]); - - nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES], - rem_reg_rules) { - num_rules++; - if (num_rules > NL80211_MAX_SUPP_REG_RULES) - return -EINVAL; - } - - mutex_lock(&cfg80211_mutex); - - if (!reg_is_valid_request(alpha2)) { - r = -EINVAL; - goto bad_reg; - } - - size_of_regd = sizeof(struct ieee80211_regdomain) + - (num_rules * sizeof(struct ieee80211_reg_rule)); - - rd = kzalloc(size_of_regd, GFP_KERNEL); - if (!rd) { - r = -ENOMEM; - goto bad_reg; - } - - rd->n_reg_rules = num_rules; - rd->alpha2[0] = alpha2[0]; - rd->alpha2[1] = alpha2[1]; - - /* - * Disable DFS master mode if the DFS region was - * not supported or known on this kernel. - */ - if (reg_supported_dfs_region(dfs_region)) - rd->dfs_region = dfs_region; - - nla_for_each_nested(nl_reg_rule, info->attrs[NL80211_ATTR_REG_RULES], - rem_reg_rules) { - nla_parse(tb, NL80211_REG_RULE_ATTR_MAX, - nla_data(nl_reg_rule), nla_len(nl_reg_rule), - reg_rule_policy); - r = parse_reg_rule(tb, &rd->reg_rules[rule_idx]); - if (r) - goto bad_reg; - - rule_idx++; - - if (rule_idx > NL80211_MAX_SUPP_REG_RULES) { - r = -EINVAL; - goto bad_reg; - } - } - - BUG_ON(rule_idx != num_rules); - - r = set_regdom(rd); - - mutex_unlock(&cfg80211_mutex); - - return r; - - bad_reg: - mutex_unlock(&cfg80211_mutex); - kfree(rd); - return r; -} - -static int validate_scan_freqs(struct nlattr *freqs) -{ - struct nlattr *attr1, *attr2; - int n_channels = 0, tmp1, tmp2; - - nla_for_each_nested(attr1, freqs, tmp1) { - n_channels++; - /* - * Some hardware has a limited channel list for - * scanning, and it is pretty much nonsensical - * to scan for a channel twice, so disallow that - * and don't require drivers to check that the - * channel list they get isn't longer than what - * they can scan, as long as they can scan all - * the channels they registered at once. - */ - nla_for_each_nested(attr2, freqs, tmp2) - if (attr1 != attr2 && - nla_get_u32(attr1) == nla_get_u32(attr2)) - return 0; - } - - return n_channels; -} - -/* - * [PLATA] qui appelle cette fonction? - */ -static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct cfg80211_scan_request *request; - struct nlattr *attr; - struct wiphy *wiphy; - int err, tmp, n_ssids = 0, n_channels, i; - size_t ie_len; - - if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) - return -EINVAL; - - wiphy = &rdev->wiphy; - - /* - * [PLATA] - this method is called and it is hard to block it. But if the next if clause returns 0, then we also exit without scanning - */ - if (!rdev->ops->scan) - return -EOPNOTSUPP; - - if (rdev->scan_req) - return -EBUSY; - - if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { - n_channels = validate_scan_freqs( - info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]); - if (!n_channels) - return -EINVAL; - } else { - enum ieee80211_band band; - n_channels = 0; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) - if (wiphy->bands[band]) - n_channels += wiphy->bands[band]->n_channels; - } - - if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) - nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) - n_ssids++; - - if (n_ssids > wiphy->max_scan_ssids) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_IE]) - ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); - else - ie_len = 0; - - if (ie_len > wiphy->max_scan_ie_len) - return -EINVAL; - - request = kzalloc(sizeof(*request) - + sizeof(*request->ssids) * n_ssids - + sizeof(*request->channels) * n_channels - + ie_len, GFP_KERNEL); - if (!request) - return -ENOMEM; - - if (n_ssids) - request->ssids = (void *)&request->channels[n_channels]; - request->n_ssids = n_ssids; - if (ie_len) { - if (request->ssids) - request->ie = (void *)(request->ssids + n_ssids); - else - request->ie = (void *)(request->channels + n_channels); - } - - i = 0; - if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { - /* user specified, bail out if channel not found */ - nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_FREQUENCIES], tmp) { - struct ieee80211_channel *chan; - - chan = ieee80211_get_channel(wiphy, nla_get_u32(attr)); - - if (!chan) { - err = -EINVAL; - goto out_free; - } - - /* ignore disabled channels */ - if (chan->flags & IEEE80211_CHAN_DISABLED) - continue; - - request->channels[i] = chan; - i++; - } - } else { - enum ieee80211_band band; - - /* all channels */ - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - int j; - if (!wiphy->bands[band]) - continue; - for (j = 0; j < wiphy->bands[band]->n_channels; j++) { - struct ieee80211_channel *chan; - - chan = &wiphy->bands[band]->channels[j]; - - if (chan->flags & IEEE80211_CHAN_DISABLED) - continue; - - request->channels[i] = chan; - i++; - } - } - } - - if (!i) { - err = -EINVAL; - goto out_free; - } - - request->n_channels = i; - - i = 0; - if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { - nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) { - if (nla_len(attr) > IEEE80211_MAX_SSID_LEN) { - err = -EINVAL; - goto out_free; - } - request->ssids[i].ssid_len = nla_len(attr); - memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr)); - i++; - } - } - - if (info->attrs[NL80211_ATTR_IE]) { - request->ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); - memcpy((void *)request->ie, - nla_data(info->attrs[NL80211_ATTR_IE]), - request->ie_len); - } - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) - if (wiphy->bands[i]) - request->rates[i] = - (1 << wiphy->bands[i]->n_bitrates) - 1; - - if (info->attrs[NL80211_ATTR_SCAN_SUPP_RATES]) { - nla_for_each_nested(attr, - info->attrs[NL80211_ATTR_SCAN_SUPP_RATES], - tmp) { - enum ieee80211_band band = nla_type(attr); - - if (band < 0 || band >= IEEE80211_NUM_BANDS) { - err = -EINVAL; - goto out_free; - } - err = ieee80211_get_ratemask(wiphy->bands[band], - nla_data(attr), - nla_len(attr), - &request->rates[band]); - if (err) - goto out_free; - } - } - - request->no_cck = - nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); - - request->dev = dev; - request->wiphy = &rdev->wiphy; - - rdev->scan_req = request; - err = rdev->ops->scan(&rdev->wiphy, dev, request); - - if (!err) { - nl80211_send_scan_start(rdev, dev); - dev_hold(dev); - } else { - out_free: - rdev->scan_req = NULL; - kfree(request); - } - - return err; -} - -static int nl80211_start_sched_scan(struct sk_buff *skb, - struct genl_info *info) -{ - struct cfg80211_sched_scan_request *request; - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct nlattr *attr; - struct wiphy *wiphy; - int err, tmp, n_ssids = 0, n_match_sets = 0, n_channels, i; - u32 interval; - enum ieee80211_band band; - size_t ie_len; - struct nlattr *tb[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1]; - - if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) || - !rdev->ops->sched_scan_start) - return -EOPNOTSUPP; - - if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]) - return -EINVAL; - - interval = nla_get_u32(info->attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]); - if (interval == 0) - return -EINVAL; - - wiphy = &rdev->wiphy; - - if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { - n_channels = validate_scan_freqs( - info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]); - if (!n_channels) - return -EINVAL; - } else { - n_channels = 0; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) - if (wiphy->bands[band]) - n_channels += wiphy->bands[band]->n_channels; - } - - if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) - nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], - tmp) - n_ssids++; - - if (n_ssids > wiphy->max_sched_scan_ssids) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_SCHED_SCAN_MATCH]) - nla_for_each_nested(attr, - info->attrs[NL80211_ATTR_SCHED_SCAN_MATCH], - tmp) - n_match_sets++; - - if (n_match_sets > wiphy->max_match_sets) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_IE]) - ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); - else - ie_len = 0; - - if (ie_len > wiphy->max_sched_scan_ie_len) - return -EINVAL; - - mutex_lock(&rdev->sched_scan_mtx); - - if (rdev->sched_scan_req) { - err = -EINPROGRESS; - goto out; - } - - request = kzalloc(sizeof(*request) - + sizeof(*request->ssids) * n_ssids - + sizeof(*request->match_sets) * n_match_sets - + sizeof(*request->channels) * n_channels - + ie_len, GFP_KERNEL); - if (!request) { - err = -ENOMEM; - goto out; - } - - if (n_ssids) - request->ssids = (void *)&request->channels[n_channels]; - request->n_ssids = n_ssids; - if (ie_len) { - if (request->ssids) - request->ie = (void *)(request->ssids + n_ssids); - else - request->ie = (void *)(request->channels + n_channels); - } - - if (n_match_sets) { - if (request->ie) - request->match_sets = (void *)(request->ie + ie_len); - else if (request->ssids) - request->match_sets = - (void *)(request->ssids + n_ssids); - else - request->match_sets = - (void *)(request->channels + n_channels); - } - request->n_match_sets = n_match_sets; - - i = 0; - if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) { - /* user specified, bail out if channel not found */ - nla_for_each_nested(attr, - info->attrs[NL80211_ATTR_SCAN_FREQUENCIES], - tmp) { - struct ieee80211_channel *chan; - - chan = ieee80211_get_channel(wiphy, nla_get_u32(attr)); - - if (!chan) { - err = -EINVAL; - goto out_free; - } - - /* ignore disabled channels */ - if (chan->flags & IEEE80211_CHAN_DISABLED) - continue; - - request->channels[i] = chan; - i++; - } - } else { - /* all channels */ - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - int j; - if (!wiphy->bands[band]) - continue; - for (j = 0; j < wiphy->bands[band]->n_channels; j++) { - struct ieee80211_channel *chan; - - chan = &wiphy->bands[band]->channels[j]; - - if (chan->flags & IEEE80211_CHAN_DISABLED) - continue; - - request->channels[i] = chan; - i++; - } - } - } - - if (!i) { - err = -EINVAL; - goto out_free; - } - - request->n_channels = i; - - i = 0; - if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) { - nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], - tmp) { - if (nla_len(attr) > IEEE80211_MAX_SSID_LEN) { - err = -EINVAL; - goto out_free; - } - request->ssids[i].ssid_len = nla_len(attr); - memcpy(request->ssids[i].ssid, nla_data(attr), - nla_len(attr)); - i++; - } - } - - i = 0; - if (info->attrs[NL80211_ATTR_SCHED_SCAN_MATCH]) { - nla_for_each_nested(attr, - info->attrs[NL80211_ATTR_SCHED_SCAN_MATCH], - tmp) { - struct nlattr *ssid; - - nla_parse(tb, NL80211_SCHED_SCAN_MATCH_ATTR_MAX, - nla_data(attr), nla_len(attr), - nl80211_match_policy); - ssid = tb[NL80211_ATTR_SCHED_SCAN_MATCH_SSID]; - if (ssid) { - if (nla_len(ssid) > IEEE80211_MAX_SSID_LEN) { - err = -EINVAL; - goto out_free; - } - memcpy(request->match_sets[i].ssid.ssid, - nla_data(ssid), nla_len(ssid)); - request->match_sets[i].ssid.ssid_len = - nla_len(ssid); - } - i++; - } - } - - if (info->attrs[NL80211_ATTR_IE]) { - request->ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); - memcpy((void *)request->ie, - nla_data(info->attrs[NL80211_ATTR_IE]), - request->ie_len); - } - - request->dev = dev; - request->wiphy = &rdev->wiphy; - request->interval = interval; - - err = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request); - if (!err) { - rdev->sched_scan_req = request; - nl80211_send_sched_scan(rdev, dev, - NL80211_CMD_START_SCHED_SCAN); - goto out; - } - -out_free: - kfree(request); -out: - mutex_unlock(&rdev->sched_scan_mtx); - return err; -} - -static int nl80211_stop_sched_scan(struct sk_buff *skb, - struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - int err; - - if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) || - !rdev->ops->sched_scan_stop) - return -EOPNOTSUPP; - - mutex_lock(&rdev->sched_scan_mtx); - err = __cfg80211_stop_sched_scan(rdev, false); - mutex_unlock(&rdev->sched_scan_mtx); - - return err; -} - -static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, - u32 seq, int flags, - struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev, - struct cfg80211_internal_bss *intbss) -{ - struct cfg80211_bss *res = &intbss->pub; - void *hdr; - struct nlattr *bss; - - ASSERT_WDEV_LOCK(wdev); - - hdr = nl80211hdr_put(msg, NETLINK_CB(cb->skb).pid, seq, flags, - NL80211_CMD_NEW_SCAN_RESULTS); - if (!hdr) - return -1; - - genl_dump_check_consistent(cb, hdr, &nl80211_fam); - - NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, rdev->bss_generation); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, wdev->netdev->ifindex); - - bss = nla_nest_start(msg, NL80211_ATTR_BSS); - if (!bss) - goto nla_put_failure; - if (!is_zero_ether_addr(res->bssid)) - NLA_PUT(msg, NL80211_BSS_BSSID, ETH_ALEN, res->bssid); - if (res->information_elements && res->len_information_elements) - NLA_PUT(msg, NL80211_BSS_INFORMATION_ELEMENTS, - res->len_information_elements, - res->information_elements); - if (res->beacon_ies && res->len_beacon_ies && - res->beacon_ies != res->information_elements) - NLA_PUT(msg, NL80211_BSS_BEACON_IES, - res->len_beacon_ies, res->beacon_ies); - if (res->tsf) - NLA_PUT_U64(msg, NL80211_BSS_TSF, res->tsf); - if (res->beacon_interval) - NLA_PUT_U16(msg, NL80211_BSS_BEACON_INTERVAL, res->beacon_interval); - NLA_PUT_U16(msg, NL80211_BSS_CAPABILITY, res->capability); - NLA_PUT_U32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq); - NLA_PUT_U32(msg, NL80211_BSS_SEEN_MS_AGO, - jiffies_to_msecs(jiffies - intbss->ts)); - - switch (rdev->wiphy.signal_type) { - case CFG80211_SIGNAL_TYPE_MBM: - NLA_PUT_U32(msg, NL80211_BSS_SIGNAL_MBM, res->signal); - break; - case CFG80211_SIGNAL_TYPE_UNSPEC: - NLA_PUT_U8(msg, NL80211_BSS_SIGNAL_UNSPEC, res->signal); - break; - default: - break; - } - - switch (wdev->iftype) { - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_STATION: - if (intbss == wdev->current_bss) - NLA_PUT_U32(msg, NL80211_BSS_STATUS, - NL80211_BSS_STATUS_ASSOCIATED); - break; - case NL80211_IFTYPE_ADHOC: - if (intbss == wdev->current_bss) - NLA_PUT_U32(msg, NL80211_BSS_STATUS, - NL80211_BSS_STATUS_IBSS_JOINED); - break; - default: - break; - } - - nla_nest_end(msg, bss); - - return genlmsg_end(msg, hdr); - - nla_put_failure: - genlmsg_cancel(msg, hdr); - return -EMSGSIZE; -} - -static int nl80211_dump_scan(struct sk_buff *skb, - struct netlink_callback *cb) -{ - struct cfg80211_registered_device *rdev; - struct net_device *dev; - struct cfg80211_internal_bss *scan; - struct wireless_dev *wdev; - int start = cb->args[1], idx = 0; - int err; - - err = nl80211_prepare_netdev_dump(skb, cb, &rdev, &dev); - if (err) - return err; - - wdev = dev->ieee80211_ptr; - - wdev_lock(wdev); - spin_lock_bh(&rdev->bss_lock); - cfg80211_bss_expire(rdev); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) - cb->seq = rdev->bss_generation; -#endif - - list_for_each_entry(scan, &rdev->bss_list, list) { - if (++idx <= start) - continue; - if (nl80211_send_bss(skb, cb, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - rdev, wdev, scan) < 0) { - idx--; - break; - } - } - - spin_unlock_bh(&rdev->bss_lock); - wdev_unlock(wdev); - - cb->args[1] = idx; - nl80211_finish_netdev_dump(rdev); - - return skb->len; -} - -static int nl80211_send_survey(struct sk_buff *msg, u32 pid, u32 seq, - int flags, struct net_device *dev, - struct survey_info *survey) -{ - void *hdr; - struct nlattr *infoattr; - - hdr = nl80211hdr_put(msg, pid, seq, flags, - NL80211_CMD_NEW_SURVEY_RESULTS); - if (!hdr) - return -ENOMEM; - - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); - - infoattr = nla_nest_start(msg, NL80211_ATTR_SURVEY_INFO); - if (!infoattr) - goto nla_put_failure; - - NLA_PUT_U32(msg, NL80211_SURVEY_INFO_FREQUENCY, - survey->channel->center_freq); - if (survey->filled & SURVEY_INFO_NOISE_DBM) - NLA_PUT_U8(msg, NL80211_SURVEY_INFO_NOISE, - survey->noise); - if (survey->filled & SURVEY_INFO_IN_USE) - NLA_PUT_FLAG(msg, NL80211_SURVEY_INFO_IN_USE); - if (survey->filled & SURVEY_INFO_CHANNEL_TIME) - NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME, - survey->channel_time); - if (survey->filled & SURVEY_INFO_CHANNEL_TIME_BUSY) - NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_BUSY, - survey->channel_time_busy); - if (survey->filled & SURVEY_INFO_CHANNEL_TIME_EXT_BUSY) - NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_EXT_BUSY, - survey->channel_time_ext_busy); - if (survey->filled & SURVEY_INFO_CHANNEL_TIME_RX) - NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_RX, - survey->channel_time_rx); - if (survey->filled & SURVEY_INFO_CHANNEL_TIME_TX) - NLA_PUT_U64(msg, NL80211_SURVEY_INFO_CHANNEL_TIME_TX, - survey->channel_time_tx); - - nla_nest_end(msg, infoattr); - - return genlmsg_end(msg, hdr); - - nla_put_failure: - genlmsg_cancel(msg, hdr); - return -EMSGSIZE; -} - -static int nl80211_dump_survey(struct sk_buff *skb, - struct netlink_callback *cb) -{ - struct survey_info survey; - struct cfg80211_registered_device *dev; - struct net_device *netdev; - int survey_idx = cb->args[1]; - int res; - - res = nl80211_prepare_netdev_dump(skb, cb, &dev, &netdev); - if (res) - return res; - - if (!dev->ops->dump_survey) { - res = -EOPNOTSUPP; - goto out_err; - } - - while (1) { - struct ieee80211_channel *chan; - - res = dev->ops->dump_survey(&dev->wiphy, netdev, survey_idx, - &survey); - if (res == -ENOENT) - break; - if (res) - goto out_err; - - /* Survey without a channel doesn't make sense */ - if (!survey.channel) { - res = -EINVAL; - goto out; - } - - chan = ieee80211_get_channel(&dev->wiphy, - survey.channel->center_freq); - if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) { - survey_idx++; - continue; - } - - if (nl80211_send_survey(skb, - NETLINK_CB(cb->skb).pid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - netdev, - &survey) < 0) - goto out; - survey_idx++; - } - - out: - cb->args[1] = survey_idx; - res = skb->len; - out_err: - nl80211_finish_netdev_dump(dev); - return res; -} - -static bool nl80211_valid_auth_type(enum nl80211_auth_type auth_type) -{ - return auth_type <= NL80211_AUTHTYPE_MAX; -} - -static bool nl80211_valid_wpa_versions(u32 wpa_versions) -{ - return !(wpa_versions & ~(NL80211_WPA_VERSION_1 | - NL80211_WPA_VERSION_2)); -} - -static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct ieee80211_channel *chan; - const u8 *bssid, *ssid, *ie = NULL; - int err, ssid_len, ie_len = 0; - enum nl80211_auth_type auth_type; - struct key_parse key; - bool local_state_change; - - if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_AUTH_TYPE]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_SSID]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) - return -EINVAL; - - err = nl80211_parse_key(info, &key); - if (err) - return err; - - if (key.idx >= 0) { - if (key.type != -1 && key.type != NL80211_KEYTYPE_GROUP) - return -EINVAL; - if (!key.p.key || !key.p.key_len) - return -EINVAL; - if ((key.p.cipher != WLAN_CIPHER_SUITE_WEP40 || - key.p.key_len != WLAN_KEY_LEN_WEP40) && - (key.p.cipher != WLAN_CIPHER_SUITE_WEP104 || - key.p.key_len != WLAN_KEY_LEN_WEP104)) - return -EINVAL; - if (key.idx > 4) - return -EINVAL; - } else { - key.p.key_len = 0; - key.p.key = NULL; - } - - if (key.idx >= 0) { - int i; - bool ok = false; - for (i = 0; i < rdev->wiphy.n_cipher_suites; i++) { - if (key.p.cipher == rdev->wiphy.cipher_suites[i]) { - ok = true; - break; - } - } - if (!ok) - return -EINVAL; - } - - if (!rdev->ops->auth) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) - return -EOPNOTSUPP; - - bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); - chan = ieee80211_get_channel(&rdev->wiphy, - nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ])); - if (!chan || (chan->flags & IEEE80211_CHAN_DISABLED)) - return -EINVAL; - - ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); - ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); - - if (info->attrs[NL80211_ATTR_IE]) { - ie = nla_data(info->attrs[NL80211_ATTR_IE]); - ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); - } - - auth_type = nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]); - if (!nl80211_valid_auth_type(auth_type)) - return -EINVAL; - - local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE]; - - /* - * Since we no longer track auth state, ignore - * requests to only change local state. - */ - if (local_state_change) - return 0; - - return cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid, - ssid, ssid_len, ie, ie_len, - key.p.key, key.p.key_len, key.idx); -} - -static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, - struct genl_info *info, - struct cfg80211_crypto_settings *settings, - int cipher_limit) -{ - memset(settings, 0, sizeof(*settings)); - - settings->control_port = info->attrs[NL80211_ATTR_CONTROL_PORT]; - - if (info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]) { - u16 proto; - proto = nla_get_u16( - info->attrs[NL80211_ATTR_CONTROL_PORT_ETHERTYPE]); - settings->control_port_ethertype = cpu_to_be16(proto); - if (!(rdev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) && - proto != ETH_P_PAE) - return -EINVAL; - if (info->attrs[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT]) - settings->control_port_no_encrypt = true; - } else - settings->control_port_ethertype = cpu_to_be16(ETH_P_PAE); - - if (info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]) { - void *data; - int len, i; - - data = nla_data(info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]); - len = nla_len(info->attrs[NL80211_ATTR_CIPHER_SUITES_PAIRWISE]); - settings->n_ciphers_pairwise = len / sizeof(u32); - - if (len % sizeof(u32)) - return -EINVAL; - - if (settings->n_ciphers_pairwise > cipher_limit) - return -EINVAL; - - memcpy(settings->ciphers_pairwise, data, len); - - for (i = 0; i < settings->n_ciphers_pairwise; i++) - if (!cfg80211_supported_cipher_suite( - &rdev->wiphy, - settings->ciphers_pairwise[i])) - return -EINVAL; - } - - if (info->attrs[NL80211_ATTR_CIPHER_SUITE_GROUP]) { - settings->cipher_group = - nla_get_u32(info->attrs[NL80211_ATTR_CIPHER_SUITE_GROUP]); - if (!cfg80211_supported_cipher_suite(&rdev->wiphy, - settings->cipher_group)) - return -EINVAL; - } - - if (info->attrs[NL80211_ATTR_WPA_VERSIONS]) { - settings->wpa_versions = - nla_get_u32(info->attrs[NL80211_ATTR_WPA_VERSIONS]); - if (!nl80211_valid_wpa_versions(settings->wpa_versions)) - return -EINVAL; - } - - if (info->attrs[NL80211_ATTR_AKM_SUITES]) { - void *data; - int len; - - data = nla_data(info->attrs[NL80211_ATTR_AKM_SUITES]); - len = nla_len(info->attrs[NL80211_ATTR_AKM_SUITES]); - settings->n_akm_suites = len / sizeof(u32); - - if (len % sizeof(u32)) - return -EINVAL; - - if (settings->n_akm_suites > NL80211_MAX_NR_AKM_SUITES) - return -EINVAL; - - memcpy(settings->akm_suites, data, len); - } - - return 0; -} - -static int nl80211_associate(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct cfg80211_crypto_settings crypto; - struct ieee80211_channel *chan; - const u8 *bssid, *ssid, *ie = NULL, *prev_bssid = NULL; - int err, ssid_len, ie_len = 0; - bool use_mfp = false; - u32 flags = 0; - struct ieee80211_ht_cap *ht_capa = NULL; - struct ieee80211_ht_cap *ht_capa_mask = NULL; - - if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_MAC] || - !info->attrs[NL80211_ATTR_SSID] || - !info->attrs[NL80211_ATTR_WIPHY_FREQ]) // JHNOTE: should maybe add the OCB here...as we would directly return... - return -EINVAL; - - if (!rdev->ops->assoc) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) - return -EOPNOTSUPP; - - bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); - - chan = ieee80211_get_channel(&rdev->wiphy, - nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ])); - if (!chan || (chan->flags & IEEE80211_CHAN_DISABLED)) - return -EINVAL; - - ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); - ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); - - if (info->attrs[NL80211_ATTR_IE]) { - ie = nla_data(info->attrs[NL80211_ATTR_IE]); - ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); - } - - if (info->attrs[NL80211_ATTR_USE_MFP]) { - enum nl80211_mfp mfp = - nla_get_u32(info->attrs[NL80211_ATTR_USE_MFP]); - if (mfp == NL80211_MFP_REQUIRED) - use_mfp = true; - else if (mfp != NL80211_MFP_NO) - return -EINVAL; - } - - if (info->attrs[NL80211_ATTR_PREV_BSSID]) - prev_bssid = nla_data(info->attrs[NL80211_ATTR_PREV_BSSID]); - - if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HT])) - flags |= ASSOC_REQ_DISABLE_HT; - - if (info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) - ht_capa_mask = - nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]); - - if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) { - if (!ht_capa_mask) - return -EINVAL; - ht_capa = nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); - } - - err = nl80211_crypto_settings(rdev, info, &crypto, 1); - if (!err) - err = cfg80211_mlme_assoc(rdev, dev, chan, bssid, prev_bssid, - ssid, ssid_len, ie, ie_len, use_mfp, - &crypto, flags, ht_capa, - ht_capa_mask); - - return err; -} - -static int nl80211_deauthenticate(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - const u8 *ie = NULL, *bssid; - int ie_len = 0; - u16 reason_code; - bool local_state_change; - - if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_REASON_CODE]) - return -EINVAL; - - if (!rdev->ops->deauth) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) - return -EOPNOTSUPP; - - bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); - - reason_code = nla_get_u16(info->attrs[NL80211_ATTR_REASON_CODE]); - if (reason_code == 0) { - /* Reason Code 0 is reserved */ - return -EINVAL; - } - - if (info->attrs[NL80211_ATTR_IE]) { - ie = nla_data(info->attrs[NL80211_ATTR_IE]); - ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); - } - - local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE]; - - return cfg80211_mlme_deauth(rdev, dev, bssid, ie, ie_len, reason_code, - local_state_change); -} - -static int nl80211_disassociate(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - const u8 *ie = NULL, *bssid; - int ie_len = 0; - u16 reason_code; - bool local_state_change; - - if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_REASON_CODE]) - return -EINVAL; - - if (!rdev->ops->disassoc) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) - return -EOPNOTSUPP; - - bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); - - reason_code = nla_get_u16(info->attrs[NL80211_ATTR_REASON_CODE]); - if (reason_code == 0) { - /* Reason Code 0 is reserved */ - return -EINVAL; - } - - if (info->attrs[NL80211_ATTR_IE]) { - ie = nla_data(info->attrs[NL80211_ATTR_IE]); - ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); - } - - local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE]; - - return cfg80211_mlme_disassoc(rdev, dev, bssid, ie, ie_len, reason_code, - local_state_change); -} - -static bool -nl80211_parse_mcast_rate(struct cfg80211_registered_device *rdev, - int mcast_rate[IEEE80211_NUM_BANDS], - int rateval) -{ - struct wiphy *wiphy = &rdev->wiphy; - bool found = false; - int band, i; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - struct ieee80211_supported_band *sband; - - sband = wiphy->bands[band]; - if (!sband) - continue; - - for (i = 0; i < sband->n_bitrates; i++) { - if (sband->bitrates[i].bitrate == rateval) { - mcast_rate[band] = i + 1; - found = true; - break; - } - } - } - - return found; -} - -static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct cfg80211_ibss_params ibss; - struct wiphy *wiphy; - struct cfg80211_cached_keys *connkeys = NULL; - int err; - - memset(&ibss, 0, sizeof(ibss)); - - if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_WIPHY_FREQ] || - !info->attrs[NL80211_ATTR_SSID] || - !nla_len(info->attrs[NL80211_ATTR_SSID])) - return -EINVAL; - - ibss.beacon_interval = 100; - - if (info->attrs[NL80211_ATTR_BEACON_INTERVAL]) { - ibss.beacon_interval = - nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]); - if (ibss.beacon_interval < 1 || ibss.beacon_interval > 10000) - return -EINVAL; - } - - if (!rdev->ops->join_ibss) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC) - return -EOPNOTSUPP; - - wiphy = &rdev->wiphy; - - if (info->attrs[NL80211_ATTR_MAC]) { - ibss.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); - - if (!is_valid_ether_addr(ibss.bssid)) - return -EINVAL; - } - ibss.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); - ibss.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); - - if (info->attrs[NL80211_ATTR_IE]) { - ibss.ie = nla_data(info->attrs[NL80211_ATTR_IE]); - ibss.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); - } - - if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { - enum nl80211_channel_type channel_type; - - channel_type = nla_get_u32( - info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]); - if (channel_type != NL80211_CHAN_NO_HT && - channel_type != NL80211_CHAN_HT20 && - channel_type != NL80211_CHAN_HT40MINUS && - channel_type != NL80211_CHAN_HT40PLUS) - return -EINVAL; - - if (channel_type != NL80211_CHAN_NO_HT && - !(wiphy->features & NL80211_FEATURE_HT_IBSS)) - return -EINVAL; - - ibss.channel_type = channel_type; - } else { - ibss.channel_type = NL80211_CHAN_NO_HT; - } - - ibss.channel = rdev_freq_to_chan(rdev, - nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]), - ibss.channel_type); - if (!ibss.channel || - ibss.channel->flags & IEEE80211_CHAN_NO_IBSS || - ibss.channel->flags & IEEE80211_CHAN_DISABLED) - return -EINVAL; - - /* Both channels should be able to initiate communication */ - if ((ibss.channel_type == NL80211_CHAN_HT40PLUS || - ibss.channel_type == NL80211_CHAN_HT40MINUS) && - !cfg80211_can_beacon_sec_chan(&rdev->wiphy, ibss.channel, - ibss.channel_type)) - return -EINVAL; - - ibss.channel_fixed = !!info->attrs[NL80211_ATTR_FREQ_FIXED]; - ibss.privacy = !!info->attrs[NL80211_ATTR_PRIVACY]; - - if (info->attrs[NL80211_ATTR_BSS_BASIC_RATES]) { - u8 *rates = - nla_data(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); - int n_rates = - nla_len(info->attrs[NL80211_ATTR_BSS_BASIC_RATES]); - struct ieee80211_supported_band *sband = - wiphy->bands[ibss.channel->band]; - - err = ieee80211_get_ratemask(sband, rates, n_rates, - &ibss.basic_rates); - if (err) - return err; - } - - if (info->attrs[NL80211_ATTR_MCAST_RATE] && - !nl80211_parse_mcast_rate(rdev, ibss.mcast_rate, - nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]))) - return -EINVAL; - - if (ibss.privacy && info->attrs[NL80211_ATTR_KEYS]) { - connkeys = nl80211_parse_connkeys(rdev, - info->attrs[NL80211_ATTR_KEYS]); - if (IS_ERR(connkeys)) - return PTR_ERR(connkeys); - } - - ibss.control_port = - nla_get_flag(info->attrs[NL80211_ATTR_CONTROL_PORT]); - - err = cfg80211_join_ibss(rdev, dev, &ibss, connkeys); - if (err) - kfree(connkeys); - return err; -} - -static int nl80211_leave_ibss(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - - if (!rdev->ops->leave_ibss) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC) - return -EOPNOTSUPP; - - return cfg80211_leave_ibss(rdev, dev, false); -} - -#ifdef CONFIG_NL80211_TESTMODE -static struct genl_multicast_group nl80211_testmode_mcgrp = { - .name = "testmode", -}; - -static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - int err; - - if (!info->attrs[NL80211_ATTR_TESTDATA]) - return -EINVAL; - - err = -EOPNOTSUPP; - if (rdev->ops->testmode_cmd) { - rdev->testmode_info = info; - err = rdev->ops->testmode_cmd(&rdev->wiphy, - nla_data(info->attrs[NL80211_ATTR_TESTDATA]), - nla_len(info->attrs[NL80211_ATTR_TESTDATA])); - rdev->testmode_info = NULL; - } - - return err; -} - -static int nl80211_testmode_dump(struct sk_buff *skb, - struct netlink_callback *cb) -{ - struct cfg80211_registered_device *rdev; - int err; - long phy_idx; - void *data = NULL; - int data_len = 0; - - if (cb->args[0]) { - /* - * 0 is a valid index, but not valid for args[0], - * so we need to offset by 1. - */ - phy_idx = cb->args[0] - 1; - } else { - err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize, - nl80211_fam.attrbuf, nl80211_fam.maxattr, - nl80211_policy); - if (err) - return err; - if (nl80211_fam.attrbuf[NL80211_ATTR_WIPHY]) { - phy_idx = nla_get_u32( - nl80211_fam.attrbuf[NL80211_ATTR_WIPHY]); - } else { - struct net_device *netdev; - - err = get_rdev_dev_by_ifindex(sock_net(skb->sk), - nl80211_fam.attrbuf, - &rdev, &netdev); - if (err) - return err; - dev_put(netdev); - phy_idx = rdev->wiphy_idx; - cfg80211_unlock_rdev(rdev); - } - if (nl80211_fam.attrbuf[NL80211_ATTR_TESTDATA]) - cb->args[1] = - (long)nl80211_fam.attrbuf[NL80211_ATTR_TESTDATA]; - } - - if (cb->args[1]) { - data = nla_data((void *)cb->args[1]); - data_len = nla_len((void *)cb->args[1]); - } - - mutex_lock(&cfg80211_mutex); - rdev = cfg80211_rdev_by_wiphy_idx(phy_idx); - if (!rdev) { - mutex_unlock(&cfg80211_mutex); - return -ENOENT; - } - cfg80211_lock_rdev(rdev); - mutex_unlock(&cfg80211_mutex); - - if (!rdev->ops->testmode_dump) { - err = -EOPNOTSUPP; - goto out_err; - } - - while (1) { - void *hdr = nl80211hdr_put(skb, NETLINK_CB(cb->skb).pid, - cb->nlh->nlmsg_seq, NLM_F_MULTI, - NL80211_CMD_TESTMODE); - struct nlattr *tmdata; - - if (nla_put_u32(skb, NL80211_ATTR_WIPHY, phy_idx) < 0) { - genlmsg_cancel(skb, hdr); - break; - } - - tmdata = nla_nest_start(skb, NL80211_ATTR_TESTDATA); - if (!tmdata) { - genlmsg_cancel(skb, hdr); - break; - } - err = rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, - data, data_len); - nla_nest_end(skb, tmdata); - - if (err == -ENOBUFS || err == -ENOENT) { - genlmsg_cancel(skb, hdr); - break; - } else if (err) { - genlmsg_cancel(skb, hdr); - goto out_err; - } - - genlmsg_end(skb, hdr); - } - - err = skb->len; - /* see above */ - cb->args[0] = phy_idx + 1; - out_err: - cfg80211_unlock_rdev(rdev); - return err; -} - -static struct sk_buff * -__cfg80211_testmode_alloc_skb(struct cfg80211_registered_device *rdev, - int approxlen, u32 pid, u32 seq, gfp_t gfp) -{ - struct sk_buff *skb; - void *hdr; - struct nlattr *data; - - skb = nlmsg_new(approxlen + 100, gfp); - if (!skb) - return NULL; - - hdr = nl80211hdr_put(skb, pid, seq, 0, NL80211_CMD_TESTMODE); - if (!hdr) { - kfree_skb(skb); - return NULL; - } - - NLA_PUT_U32(skb, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - data = nla_nest_start(skb, NL80211_ATTR_TESTDATA); - - ((void **)skb->cb)[0] = rdev; - ((void **)skb->cb)[1] = hdr; - ((void **)skb->cb)[2] = data; - - return skb; - - nla_put_failure: - kfree_skb(skb); - return NULL; -} - -struct sk_buff *cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, - int approxlen) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - if (WARN_ON(!rdev->testmode_info)) - return NULL; - - return __cfg80211_testmode_alloc_skb(rdev, approxlen, - rdev->testmode_info->snd_pid, - rdev->testmode_info->snd_seq, - GFP_KERNEL); -} -EXPORT_SYMBOL(cfg80211_testmode_alloc_reply_skb); - -int cfg80211_testmode_reply(struct sk_buff *skb) -{ - struct cfg80211_registered_device *rdev = ((void **)skb->cb)[0]; - void *hdr = ((void **)skb->cb)[1]; - struct nlattr *data = ((void **)skb->cb)[2]; - - if (WARN_ON(!rdev->testmode_info)) { - kfree_skb(skb); - return -EINVAL; - } - - nla_nest_end(skb, data); - genlmsg_end(skb, hdr); - return genlmsg_reply(skb, rdev->testmode_info); -} -EXPORT_SYMBOL(cfg80211_testmode_reply); - -struct sk_buff *cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, - int approxlen, gfp_t gfp) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - return __cfg80211_testmode_alloc_skb(rdev, approxlen, 0, 0, gfp); -} -EXPORT_SYMBOL(cfg80211_testmode_alloc_event_skb); - -void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp) -{ - void *hdr = ((void **)skb->cb)[1]; - struct nlattr *data = ((void **)skb->cb)[2]; - - nla_nest_end(skb, data); - genlmsg_end(skb, hdr); - genlmsg_multicast(skb, 0, nl80211_testmode_mcgrp.id, gfp); -} -EXPORT_SYMBOL(cfg80211_testmode_event); -#endif - -static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct cfg80211_connect_params connect; - struct wiphy *wiphy; - struct cfg80211_cached_keys *connkeys = NULL; - int err; - - memset(&connect, 0, sizeof(connect)); - - if (!is_valid_ie_attr(info->attrs[NL80211_ATTR_IE])) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_SSID] || - !nla_len(info->attrs[NL80211_ATTR_SSID])) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_AUTH_TYPE]) { - connect.auth_type = - nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]); - if (!nl80211_valid_auth_type(connect.auth_type)) - return -EINVAL; - } else - connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; - - connect.privacy = info->attrs[NL80211_ATTR_PRIVACY]; - - err = nl80211_crypto_settings(rdev, info, &connect.crypto, - NL80211_MAX_NR_CIPHER_SUITES); - if (err) - return err; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) - return -EOPNOTSUPP; - - wiphy = &rdev->wiphy; - - connect.bg_scan_period = -1; - if (info->attrs[NL80211_ATTR_BG_SCAN_PERIOD] && - (wiphy->flags & WIPHY_FLAG_SUPPORTS_FW_ROAM)) { - connect.bg_scan_period = - nla_get_u16(info->attrs[NL80211_ATTR_BG_SCAN_PERIOD]); - } - - if (info->attrs[NL80211_ATTR_MAC]) - connect.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); - connect.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]); - connect.ssid_len = nla_len(info->attrs[NL80211_ATTR_SSID]); - - if (info->attrs[NL80211_ATTR_IE]) { - connect.ie = nla_data(info->attrs[NL80211_ATTR_IE]); - connect.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); - } - - if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { - connect.channel = - ieee80211_get_channel(wiphy, - nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ])); - if (!connect.channel || - connect.channel->flags & IEEE80211_CHAN_DISABLED) - return -EINVAL; - } - - if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) { - connkeys = nl80211_parse_connkeys(rdev, - info->attrs[NL80211_ATTR_KEYS]); - if (IS_ERR(connkeys)) - return PTR_ERR(connkeys); - } - - if (nla_get_flag(info->attrs[NL80211_ATTR_DISABLE_HT])) - connect.flags |= ASSOC_REQ_DISABLE_HT; - - if (info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) - memcpy(&connect.ht_capa_mask, - nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]), - sizeof(connect.ht_capa_mask)); - - if (info->attrs[NL80211_ATTR_HT_CAPABILITY]) { - if (!info->attrs[NL80211_ATTR_HT_CAPABILITY_MASK]) - return -EINVAL; - memcpy(&connect.ht_capa, - nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]), - sizeof(connect.ht_capa)); - } - - err = cfg80211_connect(rdev, dev, &connect, connkeys); - if (err) - kfree(connkeys); - return err; -} - -static int nl80211_disconnect(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - u16 reason; - - if (!info->attrs[NL80211_ATTR_REASON_CODE]) - reason = WLAN_REASON_DEAUTH_LEAVING; - else - reason = nla_get_u16(info->attrs[NL80211_ATTR_REASON_CODE]); - - if (reason == 0) - return -EINVAL; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) - return -EOPNOTSUPP; - - return cfg80211_disconnect(rdev, dev, reason, true); -} - -static int nl80211_wiphy_netns(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net *net; - int err; - u32 pid; - - if (!info->attrs[NL80211_ATTR_PID]) - return -EINVAL; - - pid = nla_get_u32(info->attrs[NL80211_ATTR_PID]); - - net = get_net_ns_by_pid(pid); - if (IS_ERR(net)) - return PTR_ERR(net); - - err = 0; - - /* check if anything to do */ - if (!net_eq(wiphy_net(&rdev->wiphy), net)) - err = cfg80211_switch_netns(rdev, net); - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) - put_net(net); -#endif - return err; -} - -static int nl80211_setdel_pmksa(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - int (*rdev_ops)(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_pmksa *pmksa) = NULL; - struct net_device *dev = info->user_ptr[1]; - struct cfg80211_pmksa pmksa; - - memset(&pmksa, 0, sizeof(struct cfg80211_pmksa)); - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - if (!info->attrs[NL80211_ATTR_PMKID]) - return -EINVAL; - - pmksa.pmkid = nla_data(info->attrs[NL80211_ATTR_PMKID]); - pmksa.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) - return -EOPNOTSUPP; - - switch (info->genlhdr->cmd) { - case NL80211_CMD_SET_PMKSA: - rdev_ops = rdev->ops->set_pmksa; - break; - case NL80211_CMD_DEL_PMKSA: - rdev_ops = rdev->ops->del_pmksa; - break; - default: - WARN_ON(1); - break; - } - - if (!rdev_ops) - return -EOPNOTSUPP; - - return rdev_ops(&rdev->wiphy, dev, &pmksa); -} - -static int nl80211_flush_pmksa(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) - return -EOPNOTSUPP; - - if (!rdev->ops->flush_pmksa) - return -EOPNOTSUPP; - - return rdev->ops->flush_pmksa(&rdev->wiphy, dev); -} - -static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - u8 action_code, dialog_token; - u16 status_code; - u8 *peer; - - if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) || - !rdev->ops->tdls_mgmt) - return -EOPNOTSUPP; - - if (!info->attrs[NL80211_ATTR_TDLS_ACTION] || - !info->attrs[NL80211_ATTR_STATUS_CODE] || - !info->attrs[NL80211_ATTR_TDLS_DIALOG_TOKEN] || - !info->attrs[NL80211_ATTR_IE] || - !info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - peer = nla_data(info->attrs[NL80211_ATTR_MAC]); - action_code = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_ACTION]); - status_code = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]); - dialog_token = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_DIALOG_TOKEN]); - - return rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code, - dialog_token, status_code, - nla_data(info->attrs[NL80211_ATTR_IE]), - nla_len(info->attrs[NL80211_ATTR_IE])); -} - -static int nl80211_tdls_oper(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - enum nl80211_tdls_operation operation; - u8 *peer; - - if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) || - !rdev->ops->tdls_oper) - return -EOPNOTSUPP; - - if (!info->attrs[NL80211_ATTR_TDLS_OPERATION] || - !info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - operation = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_OPERATION]); - peer = nla_data(info->attrs[NL80211_ATTR_MAC]); - - return rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, operation); -} - -static int nl80211_remain_on_channel(struct sk_buff *skb, - struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct ieee80211_channel *chan; - struct sk_buff *msg; - void *hdr; - u64 cookie; - enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; - u32 freq, duration; - int err; - - if (!info->attrs[NL80211_ATTR_WIPHY_FREQ] || - !info->attrs[NL80211_ATTR_DURATION]) - return -EINVAL; - - duration = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]); - - /* - * We should be on that channel for at least one jiffie, - * and more than 5 seconds seems excessive. - */ - if (!duration || !msecs_to_jiffies(duration) || - duration > rdev->wiphy.max_remain_on_channel_duration) - return -EINVAL; - - if (!rdev->ops->remain_on_channel || - !(rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL)) - return -EOPNOTSUPP; - - if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { - channel_type = nla_get_u32( - info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]); - if (channel_type != NL80211_CHAN_NO_HT && - channel_type != NL80211_CHAN_HT20 && - channel_type != NL80211_CHAN_HT40PLUS && - channel_type != NL80211_CHAN_HT40MINUS) - return -EINVAL; - } - - freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); - chan = rdev_freq_to_chan(rdev, freq, channel_type); - if (chan == NULL) - return -EINVAL; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, - NL80211_CMD_REMAIN_ON_CHANNEL); - - if (IS_ERR(hdr)) { - err = PTR_ERR(hdr); - goto free_msg; - } - - err = rdev->ops->remain_on_channel(&rdev->wiphy, dev, chan, - channel_type, duration, &cookie); - - if (err) - goto free_msg; - - NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); - - genlmsg_end(msg, hdr); - - return genlmsg_reply(msg, info); - - nla_put_failure: - err = -ENOBUFS; - free_msg: - nlmsg_free(msg); - return err; -} - -static int nl80211_cancel_remain_on_channel(struct sk_buff *skb, - struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - u64 cookie; - - if (!info->attrs[NL80211_ATTR_COOKIE]) - return -EINVAL; - - if (!rdev->ops->cancel_remain_on_channel) - return -EOPNOTSUPP; - - cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); - - return rdev->ops->cancel_remain_on_channel(&rdev->wiphy, dev, cookie); -} - -static u32 rateset_to_mask(struct ieee80211_supported_band *sband, - u8 *rates, u8 rates_len) -{ - u8 i; - u32 mask = 0; - - for (i = 0; i < rates_len; i++) { - int rate = (rates[i] & 0x7f) * 5; - int ridx; - for (ridx = 0; ridx < sband->n_bitrates; ridx++) { - struct ieee80211_rate *srate = - &sband->bitrates[ridx]; - if (rate == srate->bitrate) { - mask |= 1 << ridx; - break; - } - } - if (ridx == sband->n_bitrates) - return 0; /* rate not found */ - } - - return mask; -} - -static bool ht_rateset_to_mask(struct ieee80211_supported_band *sband, - u8 *rates, u8 rates_len, - u8 mcs[IEEE80211_HT_MCS_MASK_LEN]) -{ - u8 i; - - memset(mcs, 0, IEEE80211_HT_MCS_MASK_LEN); - - for (i = 0; i < rates_len; i++) { - int ridx, rbit; - - ridx = rates[i] / 8; - rbit = BIT(rates[i] % 8); - - /* check validity */ - if ((ridx < 0) || (ridx >= IEEE80211_HT_MCS_MASK_LEN)) - return false; - - /* check availability */ - if (sband->ht_cap.mcs.rx_mask[ridx] & rbit) - mcs[ridx] |= rbit; - else - return false; - } - - return true; -} - -static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = { - [NL80211_TXRATE_LEGACY] = { .type = NLA_BINARY, - .len = NL80211_MAX_SUPP_RATES }, - [NL80211_TXRATE_MCS] = { .type = NLA_BINARY, - .len = NL80211_MAX_SUPP_HT_RATES }, -}; - -static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb, - struct genl_info *info) -{ - struct nlattr *tb[NL80211_TXRATE_MAX + 1]; - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct cfg80211_bitrate_mask mask; - int rem, i; - struct net_device *dev = info->user_ptr[1]; - struct nlattr *tx_rates; - struct ieee80211_supported_band *sband; - - if (info->attrs[NL80211_ATTR_TX_RATES] == NULL) - return -EINVAL; - - if (!rdev->ops->set_bitrate_mask) - return -EOPNOTSUPP; - - memset(&mask, 0, sizeof(mask)); - /* Default to all rates enabled */ - for (i = 0; i < IEEE80211_NUM_BANDS; i++) { - sband = rdev->wiphy.bands[i]; - mask.control[i].legacy = - sband ? (1 << sband->n_bitrates) - 1 : 0; - if (sband) - memcpy(mask.control[i].mcs, - sband->ht_cap.mcs.rx_mask, - sizeof(mask.control[i].mcs)); - else - memset(mask.control[i].mcs, 0, - sizeof(mask.control[i].mcs)); - } - - /* - * The nested attribute uses enum nl80211_band as the index. This maps - * directly to the enum ieee80211_band values used in cfg80211. - */ - BUILD_BUG_ON(NL80211_MAX_SUPP_HT_RATES > IEEE80211_HT_MCS_MASK_LEN * 8); - nla_for_each_nested(tx_rates, info->attrs[NL80211_ATTR_TX_RATES], rem) - { - enum ieee80211_band band = nla_type(tx_rates); - if (band < 0 || band >= IEEE80211_NUM_BANDS) - return -EINVAL; - sband = rdev->wiphy.bands[band]; - if (sband == NULL) - return -EINVAL; - nla_parse(tb, NL80211_TXRATE_MAX, nla_data(tx_rates), - nla_len(tx_rates), nl80211_txattr_policy); - if (tb[NL80211_TXRATE_LEGACY]) { - mask.control[band].legacy = rateset_to_mask( - sband, - nla_data(tb[NL80211_TXRATE_LEGACY]), - nla_len(tb[NL80211_TXRATE_LEGACY])); - } - if (tb[NL80211_TXRATE_MCS]) { - if (!ht_rateset_to_mask( - sband, - nla_data(tb[NL80211_TXRATE_MCS]), - nla_len(tb[NL80211_TXRATE_MCS]), - mask.control[band].mcs)) - return -EINVAL; - } - - if (mask.control[band].legacy == 0) { - /* don't allow empty legacy rates if HT - * is not even supported. */ - if (!rdev->wiphy.bands[band]->ht_cap.ht_supported) - return -EINVAL; - - for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; i++) - if (mask.control[band].mcs[i]) - break; - - /* legacy and mcs rates may not be both empty */ - if (i == IEEE80211_HT_MCS_MASK_LEN) - return -EINVAL; - } - } - - return rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, NULL, &mask); -} - -static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - u16 frame_type = IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION; - - if (!info->attrs[NL80211_ATTR_FRAME_MATCH]) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_FRAME_TYPE]) - frame_type = nla_get_u16(info->attrs[NL80211_ATTR_FRAME_TYPE]); - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) - return -EOPNOTSUPP; - - /* not much point in registering if we can't reply */ - if (!rdev->ops->mgmt_tx) - return -EOPNOTSUPP; - - return cfg80211_mlme_register_mgmt(dev->ieee80211_ptr, info->snd_pid, - frame_type, - nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]), - nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH])); -} - -static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct ieee80211_channel *chan; - enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; - bool channel_type_valid = false; - u32 freq; - int err; - void *hdr = NULL; - u64 cookie; - struct sk_buff *msg = NULL; - unsigned int wait = 0; - bool offchan, no_cck, dont_wait_for_ack; - - dont_wait_for_ack = info->attrs[NL80211_ATTR_DONT_WAIT_FOR_ACK]; - - if (!info->attrs[NL80211_ATTR_FRAME] || - !info->attrs[NL80211_ATTR_WIPHY_FREQ]) - return -EINVAL; - - if (!rdev->ops->mgmt_tx) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) - return -EOPNOTSUPP; - - if (info->attrs[NL80211_ATTR_DURATION]) { - if (!(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX)) - return -EINVAL; - wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]); - } - - if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { - channel_type = nla_get_u32( - info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]); - if (channel_type != NL80211_CHAN_NO_HT && - channel_type != NL80211_CHAN_HT20 && - channel_type != NL80211_CHAN_HT40PLUS && - channel_type != NL80211_CHAN_HT40MINUS) - return -EINVAL; - channel_type_valid = true; - } - - offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; - - if (offchan && !(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX)) - return -EINVAL; - - no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); - - freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); - chan = rdev_freq_to_chan(rdev, freq, channel_type); - if (chan == NULL) - return -EINVAL; - - if (!dont_wait_for_ack) { - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, - NL80211_CMD_FRAME); - - if (IS_ERR(hdr)) { - err = PTR_ERR(hdr); - goto free_msg; - } - } - - err = cfg80211_mlme_mgmt_tx(rdev, dev, chan, offchan, channel_type, - channel_type_valid, wait, - nla_data(info->attrs[NL80211_ATTR_FRAME]), - nla_len(info->attrs[NL80211_ATTR_FRAME]), - no_cck, dont_wait_for_ack, &cookie); - if (err) - goto free_msg; - - if (msg) { - NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); - - genlmsg_end(msg, hdr); - return genlmsg_reply(msg, info); - } - - return 0; - - nla_put_failure: - err = -ENOBUFS; - free_msg: - nlmsg_free(msg); - return err; -} - -static int nl80211_tx_mgmt_cancel_wait(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - u64 cookie; - - if (!info->attrs[NL80211_ATTR_COOKIE]) - return -EINVAL; - - if (!rdev->ops->mgmt_tx_cancel_wait) - return -EOPNOTSUPP; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) - return -EOPNOTSUPP; - - cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); - - return rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, dev, cookie); -} - -static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct wireless_dev *wdev; - struct net_device *dev = info->user_ptr[1]; - u8 ps_state; - bool state; - int err; - - if (!info->attrs[NL80211_ATTR_PS_STATE]) - return -EINVAL; - - ps_state = nla_get_u32(info->attrs[NL80211_ATTR_PS_STATE]); - - if (ps_state != NL80211_PS_DISABLED && ps_state != NL80211_PS_ENABLED) - return -EINVAL; - - wdev = dev->ieee80211_ptr; - - if (!rdev->ops->set_power_mgmt) - return -EOPNOTSUPP; - - state = (ps_state == NL80211_PS_ENABLED) ? true : false; - - if (state == wdev->ps) - return 0; - - err = rdev->ops->set_power_mgmt(wdev->wiphy, dev, state, - wdev->ps_timeout); - if (!err) - wdev->ps = state; - return err; -} - -static int nl80211_get_power_save(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - enum nl80211_ps_state ps_state; - struct wireless_dev *wdev; - struct net_device *dev = info->user_ptr[1]; - struct sk_buff *msg; - void *hdr; - int err; - - wdev = dev->ieee80211_ptr; - - if (!rdev->ops->set_power_mgmt) - return -EOPNOTSUPP; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, - NL80211_CMD_GET_POWER_SAVE); - if (!hdr) { - err = -ENOBUFS; - goto free_msg; - } - - if (wdev->ps) - ps_state = NL80211_PS_ENABLED; - else - ps_state = NL80211_PS_DISABLED; - - NLA_PUT_U32(msg, NL80211_ATTR_PS_STATE, ps_state); - - genlmsg_end(msg, hdr); - return genlmsg_reply(msg, info); - - nla_put_failure: - err = -ENOBUFS; - free_msg: - nlmsg_free(msg); - return err; -} - -static struct nla_policy -nl80211_attr_cqm_policy[NL80211_ATTR_CQM_MAX + 1] __read_mostly = { - [NL80211_ATTR_CQM_RSSI_THOLD] = { .type = NLA_U32 }, - [NL80211_ATTR_CQM_RSSI_HYST] = { .type = NLA_U32 }, - [NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT] = { .type = NLA_U32 }, -}; - -static int nl80211_set_cqm_rssi(struct genl_info *info, - s32 threshold, u32 hysteresis) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct wireless_dev *wdev; - struct net_device *dev = info->user_ptr[1]; - - if (threshold > 0) - return -EINVAL; - - wdev = dev->ieee80211_ptr; - - if (!rdev->ops->set_cqm_rssi_config) - return -EOPNOTSUPP; - - if (wdev->iftype != NL80211_IFTYPE_STATION && - wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) - return -EOPNOTSUPP; - - return rdev->ops->set_cqm_rssi_config(wdev->wiphy, dev, - threshold, hysteresis); -} - -static int nl80211_set_cqm(struct sk_buff *skb, struct genl_info *info) -{ - struct nlattr *attrs[NL80211_ATTR_CQM_MAX + 1]; - struct nlattr *cqm; - int err; - - cqm = info->attrs[NL80211_ATTR_CQM]; - if (!cqm) { - err = -EINVAL; - goto out; - } - - err = nla_parse_nested(attrs, NL80211_ATTR_CQM_MAX, cqm, - nl80211_attr_cqm_policy); - if (err) - goto out; - - if (attrs[NL80211_ATTR_CQM_RSSI_THOLD] && - attrs[NL80211_ATTR_CQM_RSSI_HYST]) { - s32 threshold; - u32 hysteresis; - threshold = nla_get_u32(attrs[NL80211_ATTR_CQM_RSSI_THOLD]); - hysteresis = nla_get_u32(attrs[NL80211_ATTR_CQM_RSSI_HYST]); - err = nl80211_set_cqm_rssi(info, threshold, hysteresis); - } else - err = -EINVAL; - -out: - return err; -} - -static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct mesh_config cfg; - struct mesh_setup setup; - int err; - - /* start with default */ - memcpy(&cfg, &default_mesh_config, sizeof(cfg)); - memcpy(&setup, &default_mesh_setup, sizeof(setup)); - - if (info->attrs[NL80211_ATTR_MESH_CONFIG]) { - /* and parse parameters if given */ - err = nl80211_parse_mesh_config(info, &cfg, NULL); - if (err) - return err; - } - - if (!info->attrs[NL80211_ATTR_MESH_ID] || - !nla_len(info->attrs[NL80211_ATTR_MESH_ID])) - return -EINVAL; - - setup.mesh_id = nla_data(info->attrs[NL80211_ATTR_MESH_ID]); - setup.mesh_id_len = nla_len(info->attrs[NL80211_ATTR_MESH_ID]); - - if (info->attrs[NL80211_ATTR_MCAST_RATE] && - !nl80211_parse_mcast_rate(rdev, setup.mcast_rate, - nla_get_u32(info->attrs[NL80211_ATTR_MCAST_RATE]))) - return -EINVAL; - - if (info->attrs[NL80211_ATTR_MESH_SETUP]) { - /* parse additional setup parameters if given */ - err = nl80211_parse_mesh_setup(info, &setup); - if (err) - return err; - } - - return cfg80211_join_mesh(rdev, dev, &setup, &cfg); -} - -static int nl80211_leave_mesh(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - - return cfg80211_leave_mesh(rdev, dev); -} - -static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct sk_buff *msg; - void *hdr; - - if (!rdev->wiphy.wowlan.flags && !rdev->wiphy.wowlan.n_patterns) - return -EOPNOTSUPP; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, - NL80211_CMD_GET_WOWLAN); - if (!hdr) - goto nla_put_failure; - - if (rdev->wowlan) { - struct nlattr *nl_wowlan; - - nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS); - if (!nl_wowlan) - goto nla_put_failure; - - if (rdev->wowlan->any) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_ANY); - if (rdev->wowlan->disconnect) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_DISCONNECT); - if (rdev->wowlan->magic_pkt) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT); - if (rdev->wowlan->gtk_rekey_failure) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE); - if (rdev->wowlan->eap_identity_req) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST); - if (rdev->wowlan->four_way_handshake) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE); - if (rdev->wowlan->rfkill_release) - NLA_PUT_FLAG(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE); - if (rdev->wowlan->n_patterns) { - struct nlattr *nl_pats, *nl_pat; - int i, pat_len; - - nl_pats = nla_nest_start(msg, - NL80211_WOWLAN_TRIG_PKT_PATTERN); - if (!nl_pats) - goto nla_put_failure; - - for (i = 0; i < rdev->wowlan->n_patterns; i++) { - nl_pat = nla_nest_start(msg, i + 1); - if (!nl_pat) - goto nla_put_failure; - pat_len = rdev->wowlan->patterns[i].pattern_len; - NLA_PUT(msg, NL80211_WOWLAN_PKTPAT_MASK, - DIV_ROUND_UP(pat_len, 8), - rdev->wowlan->patterns[i].mask); - NLA_PUT(msg, NL80211_WOWLAN_PKTPAT_PATTERN, - pat_len, - rdev->wowlan->patterns[i].pattern); - nla_nest_end(msg, nl_pat); - } - nla_nest_end(msg, nl_pats); - } - - nla_nest_end(msg, nl_wowlan); - } - - genlmsg_end(msg, hdr); - return genlmsg_reply(msg, info); - -nla_put_failure: - nlmsg_free(msg); - return -ENOBUFS; -} - -static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct nlattr *tb[NUM_NL80211_WOWLAN_TRIG]; - struct cfg80211_wowlan no_triggers = {}; - struct cfg80211_wowlan new_triggers = {}; - struct wiphy_wowlan_support *wowlan = &rdev->wiphy.wowlan; - int err, i; - - if (!rdev->wiphy.wowlan.flags && !rdev->wiphy.wowlan.n_patterns) - return -EOPNOTSUPP; - - if (!info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]) - goto no_triggers; - - err = nla_parse(tb, MAX_NL80211_WOWLAN_TRIG, - nla_data(info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]), - nla_len(info->attrs[NL80211_ATTR_WOWLAN_TRIGGERS]), - nl80211_wowlan_policy); - if (err) - return err; - - if (tb[NL80211_WOWLAN_TRIG_ANY]) { - if (!(wowlan->flags & WIPHY_WOWLAN_ANY)) - return -EINVAL; - new_triggers.any = true; - } - - if (tb[NL80211_WOWLAN_TRIG_DISCONNECT]) { - if (!(wowlan->flags & WIPHY_WOWLAN_DISCONNECT)) - return -EINVAL; - new_triggers.disconnect = true; - } - - if (tb[NL80211_WOWLAN_TRIG_MAGIC_PKT]) { - if (!(wowlan->flags & WIPHY_WOWLAN_MAGIC_PKT)) - return -EINVAL; - new_triggers.magic_pkt = true; - } - - if (tb[NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED]) - return -EINVAL; - - if (tb[NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE]) { - if (!(wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE)) - return -EINVAL; - new_triggers.gtk_rekey_failure = true; - } - - if (tb[NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST]) { - if (!(wowlan->flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ)) - return -EINVAL; - new_triggers.eap_identity_req = true; - } - - if (tb[NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE]) { - if (!(wowlan->flags & WIPHY_WOWLAN_4WAY_HANDSHAKE)) - return -EINVAL; - new_triggers.four_way_handshake = true; - } - - if (tb[NL80211_WOWLAN_TRIG_RFKILL_RELEASE]) { - if (!(wowlan->flags & WIPHY_WOWLAN_RFKILL_RELEASE)) - return -EINVAL; - new_triggers.rfkill_release = true; - } - - if (tb[NL80211_WOWLAN_TRIG_PKT_PATTERN]) { - struct nlattr *pat; - int n_patterns = 0; - int rem, pat_len, mask_len; - struct nlattr *pat_tb[NUM_NL80211_WOWLAN_PKTPAT]; - - nla_for_each_nested(pat, tb[NL80211_WOWLAN_TRIG_PKT_PATTERN], - rem) - n_patterns++; - if (n_patterns > wowlan->n_patterns) - return -EINVAL; - - new_triggers.patterns = kcalloc(n_patterns, - sizeof(new_triggers.patterns[0]), - GFP_KERNEL); - if (!new_triggers.patterns) - return -ENOMEM; - - new_triggers.n_patterns = n_patterns; - i = 0; - - nla_for_each_nested(pat, tb[NL80211_WOWLAN_TRIG_PKT_PATTERN], - rem) { - nla_parse(pat_tb, MAX_NL80211_WOWLAN_PKTPAT, - nla_data(pat), nla_len(pat), NULL); - err = -EINVAL; - if (!pat_tb[NL80211_WOWLAN_PKTPAT_MASK] || - !pat_tb[NL80211_WOWLAN_PKTPAT_PATTERN]) - goto error; - pat_len = nla_len(pat_tb[NL80211_WOWLAN_PKTPAT_PATTERN]); - mask_len = DIV_ROUND_UP(pat_len, 8); - if (nla_len(pat_tb[NL80211_WOWLAN_PKTPAT_MASK]) != - mask_len) - goto error; - if (pat_len > wowlan->pattern_max_len || - pat_len < wowlan->pattern_min_len) - goto error; - - new_triggers.patterns[i].mask = - kmalloc(mask_len + pat_len, GFP_KERNEL); - if (!new_triggers.patterns[i].mask) { - err = -ENOMEM; - goto error; - } - new_triggers.patterns[i].pattern = - new_triggers.patterns[i].mask + mask_len; - memcpy(new_triggers.patterns[i].mask, - nla_data(pat_tb[NL80211_WOWLAN_PKTPAT_MASK]), - mask_len); - new_triggers.patterns[i].pattern_len = pat_len; - memcpy(new_triggers.patterns[i].pattern, - nla_data(pat_tb[NL80211_WOWLAN_PKTPAT_PATTERN]), - pat_len); - i++; - } - } - - if (memcmp(&new_triggers, &no_triggers, sizeof(new_triggers))) { - struct cfg80211_wowlan *ntrig; - ntrig = kmemdup(&new_triggers, sizeof(new_triggers), - GFP_KERNEL); - if (!ntrig) { - err = -ENOMEM; - goto error; - } - cfg80211_rdev_free_wowlan(rdev); - rdev->wowlan = ntrig; - } else { - no_triggers: - cfg80211_rdev_free_wowlan(rdev); - rdev->wowlan = NULL; - } - - return 0; - error: - for (i = 0; i < new_triggers.n_patterns; i++) - kfree(new_triggers.patterns[i].mask); - kfree(new_triggers.patterns); - return err; -} - -static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct nlattr *tb[NUM_NL80211_REKEY_DATA]; - struct cfg80211_gtk_rekey_data rekey_data; - int err; - - if (!info->attrs[NL80211_ATTR_REKEY_DATA]) - return -EINVAL; - - err = nla_parse(tb, MAX_NL80211_REKEY_DATA, - nla_data(info->attrs[NL80211_ATTR_REKEY_DATA]), - nla_len(info->attrs[NL80211_ATTR_REKEY_DATA]), - nl80211_rekey_policy); - if (err) - return err; - - if (nla_len(tb[NL80211_REKEY_DATA_REPLAY_CTR]) != NL80211_REPLAY_CTR_LEN) - return -ERANGE; - if (nla_len(tb[NL80211_REKEY_DATA_KEK]) != NL80211_KEK_LEN) - return -ERANGE; - if (nla_len(tb[NL80211_REKEY_DATA_KCK]) != NL80211_KCK_LEN) - return -ERANGE; - - memcpy(rekey_data.kek, nla_data(tb[NL80211_REKEY_DATA_KEK]), - NL80211_KEK_LEN); - memcpy(rekey_data.kck, nla_data(tb[NL80211_REKEY_DATA_KCK]), - NL80211_KCK_LEN); - memcpy(rekey_data.replay_ctr, - nla_data(tb[NL80211_REKEY_DATA_REPLAY_CTR]), - NL80211_REPLAY_CTR_LEN); - - wdev_lock(wdev); - if (!wdev->current_bss) { - err = -ENOTCONN; - goto out; - } - - if (!rdev->ops->set_rekey_data) { - err = -EOPNOTSUPP; - goto out; - } - - err = rdev->ops->set_rekey_data(&rdev->wiphy, dev, &rekey_data); - out: - wdev_unlock(wdev); - return err; -} - -static int nl80211_register_unexpected_frame(struct sk_buff *skb, - struct genl_info *info) -{ - struct net_device *dev = info->user_ptr[1]; - struct wireless_dev *wdev = dev->ieee80211_ptr; - - if (wdev->iftype != NL80211_IFTYPE_AP && - wdev->iftype != NL80211_IFTYPE_P2P_GO) - return -EINVAL; - - if (wdev->ap_unexpected_nlpid) - return -EBUSY; - - wdev->ap_unexpected_nlpid = info->snd_pid; - return 0; -} - -static int nl80211_probe_client(struct sk_buff *skb, - struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - struct net_device *dev = info->user_ptr[1]; - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct sk_buff *msg; - void *hdr; - const u8 *addr; - u64 cookie; - int err; - - if (wdev->iftype != NL80211_IFTYPE_AP && - wdev->iftype != NL80211_IFTYPE_P2P_GO) - return -EOPNOTSUPP; - - if (!info->attrs[NL80211_ATTR_MAC]) - return -EINVAL; - - if (!rdev->ops->probe_client) - return -EOPNOTSUPP; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return -ENOMEM; - - hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0, - NL80211_CMD_PROBE_CLIENT); - - if (IS_ERR(hdr)) { - err = PTR_ERR(hdr); - goto free_msg; - } - - addr = nla_data(info->attrs[NL80211_ATTR_MAC]); - - err = rdev->ops->probe_client(&rdev->wiphy, dev, addr, &cookie); - if (err) - goto free_msg; - - NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); - - genlmsg_end(msg, hdr); - - return genlmsg_reply(msg, info); - - nla_put_failure: - err = -ENOBUFS; - free_msg: - nlmsg_free(msg); - return err; -} - -static int nl80211_register_beacons(struct sk_buff *skb, struct genl_info *info) -{ - struct cfg80211_registered_device *rdev = info->user_ptr[0]; - - if (!(rdev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS)) - return -EOPNOTSUPP; - - if (rdev->ap_beacons_nlpid) - return -EBUSY; - - rdev->ap_beacons_nlpid = info->snd_pid; - - return 0; -} - -#define NL80211_FLAG_NEED_WIPHY 0x01 -#define NL80211_FLAG_NEED_NETDEV 0x02 -#define NL80211_FLAG_NEED_RTNL 0x04 -#define NL80211_FLAG_CHECK_NETDEV_UP 0x08 -#define NL80211_FLAG_NEED_NETDEV_UP (NL80211_FLAG_NEED_NETDEV |\ - NL80211_FLAG_CHECK_NETDEV_UP) - -static int nl80211_pre_doit(struct genl_ops *ops, struct sk_buff *skb, - struct genl_info *info) -{ - struct cfg80211_registered_device *rdev; - struct net_device *dev; - int err; - bool rtnl = ops->internal_flags & NL80211_FLAG_NEED_RTNL; - - if (rtnl) - rtnl_lock(); - - if (ops->internal_flags & NL80211_FLAG_NEED_WIPHY) { - rdev = cfg80211_get_dev_from_info(info); - if (IS_ERR(rdev)) { - if (rtnl) - rtnl_unlock(); - return PTR_ERR(rdev); - } - info->user_ptr[0] = rdev; - } else if (ops->internal_flags & NL80211_FLAG_NEED_NETDEV) { - err = get_rdev_dev_by_ifindex(genl_info_net(info), info->attrs, - &rdev, &dev); - if (err) { - if (rtnl) - rtnl_unlock(); - return err; - } - if (ops->internal_flags & NL80211_FLAG_CHECK_NETDEV_UP && - !netif_running(dev)) { - cfg80211_unlock_rdev(rdev); - dev_put(dev); - if (rtnl) - rtnl_unlock(); - return -ENETDOWN; - } - info->user_ptr[0] = rdev; - info->user_ptr[1] = dev; - } - - return 0; -} - -static void nl80211_post_doit(struct genl_ops *ops, struct sk_buff *skb, - struct genl_info *info) -{ - if (info->user_ptr[0]) - cfg80211_unlock_rdev(info->user_ptr[0]); - if (info->user_ptr[1]) - dev_put(info->user_ptr[1]); - if (ops->internal_flags & NL80211_FLAG_NEED_RTNL) - rtnl_unlock(); -} - -static struct genl_ops nl80211_ops[] = { - { - .cmd = NL80211_CMD_GET_WIPHY, - .doit = nl80211_get_wiphy, - .dumpit = nl80211_dump_wiphy, - .policy = nl80211_policy, - /* can be retrieved by unprivileged users */ - .internal_flags = NL80211_FLAG_NEED_WIPHY, - }, - { - .cmd = NL80211_CMD_SET_WIPHY, - .doit = nl80211_set_wiphy, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_GET_INTERFACE, - .doit = nl80211_get_interface, - .dumpit = nl80211_dump_interface, - .policy = nl80211_policy, - /* can be retrieved by unprivileged users */ - .internal_flags = NL80211_FLAG_NEED_NETDEV, - }, - { - .cmd = NL80211_CMD_SET_INTERFACE, - .doit = nl80211_set_interface, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_NEW_INTERFACE, - .doit = nl80211_new_interface, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_WIPHY | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_DEL_INTERFACE, - .doit = nl80211_del_interface, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_GET_KEY, - .doit = nl80211_get_key, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_KEY, - .doit = nl80211_set_key, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_NEW_KEY, - .doit = nl80211_new_key, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_DEL_KEY, - .doit = nl80211_del_key, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_BEACON, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .doit = nl80211_set_beacon, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_START_AP, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .doit = nl80211_start_ap, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_STOP_AP, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .doit = nl80211_stop_ap, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_GET_STATION, - .doit = nl80211_get_station, - .dumpit = nl80211_dump_station, - .policy = nl80211_policy, - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_STATION, - .doit = nl80211_set_station, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_NEW_STATION, - .doit = nl80211_new_station, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_DEL_STATION, - .doit = nl80211_del_station, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_GET_MPATH, - .doit = nl80211_get_mpath, - .dumpit = nl80211_dump_mpath, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_MPATH, - .doit = nl80211_set_mpath, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_NEW_MPATH, - .doit = nl80211_new_mpath, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_DEL_MPATH, - .doit = nl80211_del_mpath, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_BSS, - .doit = nl80211_set_bss, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_GET_REG, - .doit = nl80211_get_reg, - .policy = nl80211_policy, - /* can be retrieved by unprivileged users */ - }, - { - .cmd = NL80211_CMD_SET_REG, - .doit = nl80211_set_reg, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - }, - { - .cmd = NL80211_CMD_REQ_SET_REG, - .doit = nl80211_req_set_reg, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - }, - { - .cmd = NL80211_CMD_GET_MESH_CONFIG, - .doit = nl80211_get_mesh_config, - .policy = nl80211_policy, - /* can be retrieved by unprivileged users */ - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_MESH_CONFIG, - .doit = nl80211_update_mesh_config, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_TRIGGER_SCAN, - .doit = nl80211_trigger_scan, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_GET_SCAN, - .policy = nl80211_policy, - .dumpit = nl80211_dump_scan, - }, - { - .cmd = NL80211_CMD_START_SCHED_SCAN, - .doit = nl80211_start_sched_scan, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_STOP_SCHED_SCAN, - .doit = nl80211_stop_sched_scan, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_AUTHENTICATE, - .doit = nl80211_authenticate, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_ASSOCIATE, - .doit = nl80211_associate, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_DEAUTHENTICATE, - .doit = nl80211_deauthenticate, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_DISASSOCIATE, - .doit = nl80211_disassociate, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_JOIN_IBSS, - .doit = nl80211_join_ibss, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_LEAVE_IBSS, - .doit = nl80211_leave_ibss, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, -#ifdef CONFIG_NL80211_TESTMODE - { - .cmd = NL80211_CMD_TESTMODE, - .doit = nl80211_testmode_do, - .dumpit = nl80211_testmode_dump, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_WIPHY | - NL80211_FLAG_NEED_RTNL, - }, -#endif - { - .cmd = NL80211_CMD_CONNECT, - .doit = nl80211_connect, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_DISCONNECT, - .doit = nl80211_disconnect, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_WIPHY_NETNS, - .doit = nl80211_wiphy_netns, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_WIPHY | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_GET_SURVEY, - .policy = nl80211_policy, - .dumpit = nl80211_dump_survey, - }, - { - .cmd = NL80211_CMD_SET_PMKSA, - .doit = nl80211_setdel_pmksa, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_DEL_PMKSA, - .doit = nl80211_setdel_pmksa, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_FLUSH_PMKSA, - .doit = nl80211_flush_pmksa, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_REMAIN_ON_CHANNEL, - .doit = nl80211_remain_on_channel, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, - .doit = nl80211_cancel_remain_on_channel, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_TX_BITRATE_MASK, - .doit = nl80211_set_tx_bitrate_mask, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_REGISTER_FRAME, - .doit = nl80211_register_mgmt, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_FRAME, - .doit = nl80211_tx_mgmt, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_FRAME_WAIT_CANCEL, - .doit = nl80211_tx_mgmt_cancel_wait, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_POWER_SAVE, - .doit = nl80211_set_power_save, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_GET_POWER_SAVE, - .doit = nl80211_get_power_save, - .policy = nl80211_policy, - /* can be retrieved by unprivileged users */ - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_CQM, - .doit = nl80211_set_cqm, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_CHANNEL, - .doit = nl80211_set_channel, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_WDS_PEER, - .doit = nl80211_set_wds_peer, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_JOIN_MESH, - .doit = nl80211_join_mesh, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_LEAVE_MESH, - .doit = nl80211_leave_mesh, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_GET_WOWLAN, - .doit = nl80211_get_wowlan, - .policy = nl80211_policy, - /* can be retrieved by unprivileged users */ - .internal_flags = NL80211_FLAG_NEED_WIPHY | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_WOWLAN, - .doit = nl80211_set_wowlan, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_WIPHY | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_REKEY_OFFLOAD, - .doit = nl80211_set_rekey_data, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_TDLS_MGMT, - .doit = nl80211_tdls_mgmt, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_TDLS_OPER, - .doit = nl80211_tdls_oper, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_UNEXPECTED_FRAME, - .doit = nl80211_register_unexpected_frame, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_PROBE_CLIENT, - .doit = nl80211_probe_client, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_REGISTER_BEACONS, - .doit = nl80211_register_beacons, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_WIPHY | - NL80211_FLAG_NEED_RTNL, - }, - { - .cmd = NL80211_CMD_SET_NOACK_MAP, - .doit = nl80211_set_noack_map, - .policy = nl80211_policy, - .flags = GENL_ADMIN_PERM, - .internal_flags = NL80211_FLAG_NEED_NETDEV | - NL80211_FLAG_NEED_RTNL, - }, - -}; - -static struct genl_multicast_group nl80211_mlme_mcgrp = { - .name = "mlme", -}; - -/* multicast groups */ -static struct genl_multicast_group nl80211_config_mcgrp = { - .name = "config", -}; -static struct genl_multicast_group nl80211_scan_mcgrp = { - .name = "scan", -}; -static struct genl_multicast_group nl80211_regulatory_mcgrp = { - .name = "regulatory", -}; - -/* notification functions */ - -void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev) -{ - struct sk_buff *msg; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return; - - if (nl80211_send_wiphy(msg, 0, 0, 0, rdev) < 0) { - nlmsg_free(msg); - return; - } - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_config_mcgrp.id, GFP_KERNEL); -} - -static int nl80211_add_scan_req(struct sk_buff *msg, - struct cfg80211_registered_device *rdev) -{ - struct cfg80211_scan_request *req = rdev->scan_req; - struct nlattr *nest; - int i; - - ASSERT_RDEV_LOCK(rdev); - - if (WARN_ON(!req)) - return 0; - - nest = nla_nest_start(msg, NL80211_ATTR_SCAN_SSIDS); - if (!nest) - goto nla_put_failure; - for (i = 0; i < req->n_ssids; i++) - NLA_PUT(msg, i, req->ssids[i].ssid_len, req->ssids[i].ssid); - nla_nest_end(msg, nest); - - nest = nla_nest_start(msg, NL80211_ATTR_SCAN_FREQUENCIES); - if (!nest) - goto nla_put_failure; - for (i = 0; i < req->n_channels; i++) - NLA_PUT_U32(msg, i, req->channels[i]->center_freq); - nla_nest_end(msg, nest); - - if (req->ie) - NLA_PUT(msg, NL80211_ATTR_IE, req->ie_len, req->ie); - - return 0; - nla_put_failure: - return -ENOBUFS; -} - -static int nl80211_send_scan_msg(struct sk_buff *msg, - struct cfg80211_registered_device *rdev, - struct net_device *netdev, - u32 pid, u32 seq, int flags, - u32 cmd) -{ - void *hdr; - - hdr = nl80211hdr_put(msg, pid, seq, flags, cmd); - if (!hdr) - return -1; - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - - /* ignore errors and send incomplete event anyway */ - nl80211_add_scan_req(msg, rdev); - - return genlmsg_end(msg, hdr); - - nla_put_failure: - genlmsg_cancel(msg, hdr); - return -EMSGSIZE; -} - -static int -nl80211_send_sched_scan_msg(struct sk_buff *msg, - struct cfg80211_registered_device *rdev, - struct net_device *netdev, - u32 pid, u32 seq, int flags, u32 cmd) -{ - void *hdr; - - hdr = nl80211hdr_put(msg, pid, seq, flags, cmd); - if (!hdr) - return -1; - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - - return genlmsg_end(msg, hdr); - - nla_put_failure: - genlmsg_cancel(msg, hdr); - return -EMSGSIZE; -} - -void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, - struct net_device *netdev) -{ - struct sk_buff *msg; - - msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); - if (!msg) - return; - - if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, - NL80211_CMD_TRIGGER_SCAN) < 0) { - nlmsg_free(msg); - return; - } - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_scan_mcgrp.id, GFP_KERNEL); -} - -void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, - struct net_device *netdev) -{ - struct sk_buff *msg; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return; - - if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, - NL80211_CMD_NEW_SCAN_RESULTS) < 0) { - nlmsg_free(msg); - return; - } - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_scan_mcgrp.id, GFP_KERNEL); -} - -void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, - struct net_device *netdev) -{ - struct sk_buff *msg; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return; - - if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, - NL80211_CMD_SCAN_ABORTED) < 0) { - nlmsg_free(msg); - return; - } - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_scan_mcgrp.id, GFP_KERNEL); -} - -void nl80211_send_sched_scan_results(struct cfg80211_registered_device *rdev, - struct net_device *netdev) -{ - struct sk_buff *msg; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return; - - if (nl80211_send_sched_scan_msg(msg, rdev, netdev, 0, 0, 0, - NL80211_CMD_SCHED_SCAN_RESULTS) < 0) { - nlmsg_free(msg); - return; - } - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_scan_mcgrp.id, GFP_KERNEL); -} - -void nl80211_send_sched_scan(struct cfg80211_registered_device *rdev, - struct net_device *netdev, u32 cmd) -{ - struct sk_buff *msg; - - msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); - if (!msg) - return; - - if (nl80211_send_sched_scan_msg(msg, rdev, netdev, 0, 0, 0, cmd) < 0) { - nlmsg_free(msg); - return; - } - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_scan_mcgrp.id, GFP_KERNEL); -} - -/* - * This can happen on global regulatory changes or device specific settings - * based on custom world regulatory domains. - */ -void nl80211_send_reg_change_event(struct regulatory_request *request) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_REG_CHANGE); - if (!hdr) { - nlmsg_free(msg); - return; - } - - /* Userspace can always count this one always being set */ - NLA_PUT_U8(msg, NL80211_ATTR_REG_INITIATOR, request->initiator); - - if (request->alpha2[0] == '0' && request->alpha2[1] == '0') - NLA_PUT_U8(msg, NL80211_ATTR_REG_TYPE, - NL80211_REGDOM_TYPE_WORLD); - else if (request->alpha2[0] == '9' && request->alpha2[1] == '9') - NLA_PUT_U8(msg, NL80211_ATTR_REG_TYPE, - NL80211_REGDOM_TYPE_CUSTOM_WORLD); - else if ((request->alpha2[0] == '9' && request->alpha2[1] == '8') || - request->intersect) - NLA_PUT_U8(msg, NL80211_ATTR_REG_TYPE, - NL80211_REGDOM_TYPE_INTERSECTION); - else { - NLA_PUT_U8(msg, NL80211_ATTR_REG_TYPE, - NL80211_REGDOM_TYPE_COUNTRY); - NLA_PUT_STRING(msg, NL80211_ATTR_REG_ALPHA2, request->alpha2); - } - - if (wiphy_idx_valid(request->wiphy_idx)) - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, request->wiphy_idx); - - genlmsg_end(msg, hdr); - - rcu_read_lock(); - genlmsg_multicast_allns(msg, 0, nl80211_regulatory_mcgrp.id, - GFP_ATOMIC); - rcu_read_unlock(); - - return; - -nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *buf, size_t len, - enum nl80211_commands cmd, gfp_t gfp) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, cmd); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *buf, - size_t len, gfp_t gfp) -{ - nl80211_send_mlme_event(rdev, netdev, buf, len, - NL80211_CMD_AUTHENTICATE, gfp); -} - -void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *buf, - size_t len, gfp_t gfp) -{ - nl80211_send_mlme_event(rdev, netdev, buf, len, - NL80211_CMD_ASSOCIATE, gfp); -} - -void nl80211_send_deauth(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *buf, - size_t len, gfp_t gfp) -{ - nl80211_send_mlme_event(rdev, netdev, buf, len, - NL80211_CMD_DEAUTHENTICATE, gfp); -} - -void nl80211_send_disassoc(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *buf, - size_t len, gfp_t gfp) -{ - nl80211_send_mlme_event(rdev, netdev, buf, len, - NL80211_CMD_DISASSOCIATE, gfp); -} - -void nl80211_send_unprot_deauth(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *buf, - size_t len, gfp_t gfp) -{ - nl80211_send_mlme_event(rdev, netdev, buf, len, - NL80211_CMD_UNPROT_DEAUTHENTICATE, gfp); -} - -void nl80211_send_unprot_disassoc(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *buf, - size_t len, gfp_t gfp) -{ - nl80211_send_mlme_event(rdev, netdev, buf, len, - NL80211_CMD_UNPROT_DISASSOCIATE, gfp); -} - -static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev, - struct net_device *netdev, int cmd, - const u8 *addr, gfp_t gfp) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, cmd); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - NLA_PUT_FLAG(msg, NL80211_ATTR_TIMED_OUT); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *addr, - gfp_t gfp) -{ - nl80211_send_mlme_timeout(rdev, netdev, NL80211_CMD_AUTHENTICATE, - addr, gfp); -} - -void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *addr, - gfp_t gfp) -{ - nl80211_send_mlme_timeout(rdev, netdev, NL80211_CMD_ASSOCIATE, - addr, gfp); -} - -void nl80211_send_connect_result(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *bssid, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len, - u16 status, gfp_t gfp) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_GOODSIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_CONNECT); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - if (bssid) - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid); - NLA_PUT_U16(msg, NL80211_ATTR_STATUS_CODE, status); - if (req_ie) - NLA_PUT(msg, NL80211_ATTR_REQ_IE, req_ie_len, req_ie); - if (resp_ie) - NLA_PUT(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); - -} - -void nl80211_send_roamed(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *bssid, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_GOODSIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_ROAM); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid); - if (req_ie) - NLA_PUT(msg, NL80211_ATTR_REQ_IE, req_ie_len, req_ie); - if (resp_ie) - NLA_PUT(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); - -} - -void nl80211_send_disconnected(struct cfg80211_registered_device *rdev, - struct net_device *netdev, u16 reason, - const u8 *ie, size_t ie_len, bool from_ap) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_DISCONNECT); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - if (from_ap && reason) - NLA_PUT_U16(msg, NL80211_ATTR_REASON_CODE, reason); - if (from_ap) - NLA_PUT_FLAG(msg, NL80211_ATTR_DISCONNECTED_BY_AP); - if (ie) - NLA_PUT(msg, NL80211_ATTR_IE, ie_len, ie); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, GFP_KERNEL); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); - -} - -void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *bssid, - gfp_t gfp) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_JOIN_IBSS); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -void nl80211_send_new_peer_candidate(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *macaddr, const u8* ie, u8 ie_len, - gfp_t gfp) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_NEW_PEER_CANDIDATE); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, macaddr); - if (ie_len && ie) - NLA_PUT(msg, NL80211_ATTR_IE, ie_len , ie); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *addr, - enum nl80211_key_type key_type, int key_id, - const u8 *tsc, gfp_t gfp) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_MICHAEL_MIC_FAILURE); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - if (addr) - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); - NLA_PUT_U32(msg, NL80211_ATTR_KEY_TYPE, key_type); - if (key_id != -1) - NLA_PUT_U8(msg, NL80211_ATTR_KEY_IDX, key_id); - if (tsc) - NLA_PUT(msg, NL80211_ATTR_KEY_SEQ, 6, tsc); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -void nl80211_send_beacon_hint_event(struct wiphy *wiphy, - struct ieee80211_channel *channel_before, - struct ieee80211_channel *channel_after) -{ - struct sk_buff *msg; - void *hdr; - struct nlattr *nl_freq; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_REG_BEACON_HINT); - if (!hdr) { - nlmsg_free(msg); - return; - } - - /* - * Since we are applying the beacon hint to a wiphy we know its - * wiphy_idx is valid - */ - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy)); - - /* Before */ - nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_BEFORE); - if (!nl_freq) - goto nla_put_failure; - if (nl80211_msg_put_channel(msg, channel_before)) - goto nla_put_failure; - nla_nest_end(msg, nl_freq); - - /* After */ - nl_freq = nla_nest_start(msg, NL80211_ATTR_FREQ_AFTER); - if (!nl_freq) - goto nla_put_failure; - if (nl80211_msg_put_channel(msg, channel_after)) - goto nla_put_failure; - nla_nest_end(msg, nl_freq); - - genlmsg_end(msg, hdr); - - rcu_read_lock(); - genlmsg_multicast_allns(msg, 0, nl80211_regulatory_mcgrp.id, - GFP_ATOMIC); - rcu_read_unlock(); - - return; - -nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -static void nl80211_send_remain_on_chan_event( - int cmd, struct cfg80211_registered_device *rdev, - struct net_device *netdev, u64 cookie, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, gfp_t gfp) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, cmd); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq); - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, channel_type); - NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); - - if (cmd == NL80211_CMD_REMAIN_ON_CHANNEL) - NLA_PUT_U32(msg, NL80211_ATTR_DURATION, duration); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev, - struct net_device *netdev, u64 cookie, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, gfp_t gfp) -{ - nl80211_send_remain_on_chan_event(NL80211_CMD_REMAIN_ON_CHANNEL, - rdev, netdev, cookie, chan, - channel_type, duration, gfp); -} - -void nl80211_send_remain_on_channel_cancel( - struct cfg80211_registered_device *rdev, struct net_device *netdev, - u64 cookie, struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, gfp_t gfp) -{ - nl80211_send_remain_on_chan_event(NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, - rdev, netdev, cookie, chan, - channel_type, 0, gfp); -} - -void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, - struct net_device *dev, const u8 *mac_addr, - struct station_info *sinfo, gfp_t gfp) -{ - struct sk_buff *msg; - - msg = nlmsg_new(NLMSG_GOODSIZE, gfp); - if (!msg) - return; - - if (nl80211_send_station(msg, 0, 0, 0, - rdev, dev, mac_addr, sinfo) < 0) { - nlmsg_free(msg); - return; - } - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); -} - -void nl80211_send_sta_del_event(struct cfg80211_registered_device *rdev, - struct net_device *dev, const u8 *mac_addr, - gfp_t gfp) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_GOODSIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_DEL_STATION); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd, - const u8 *addr, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct sk_buff *msg; - void *hdr; - int err; - u32 nlpid = ACCESS_ONCE(wdev->ap_unexpected_nlpid); - - if (!nlpid) - return false; - - msg = nlmsg_new(100, gfp); - if (!msg) - return true; - - hdr = nl80211hdr_put(msg, 0, 0, 0, cmd); - if (!hdr) { - nlmsg_free(msg); - return true; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); - - err = genlmsg_end(msg, hdr); - if (err < 0) { - nlmsg_free(msg); - return true; - } - - genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlpid); - return true; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); - return true; -} - -bool nl80211_unexpected_frame(struct net_device *dev, const u8 *addr, gfp_t gfp) -{ - return __nl80211_unexpected_frame(dev, NL80211_CMD_UNEXPECTED_FRAME, - addr, gfp); -} - -bool nl80211_unexpected_4addr_frame(struct net_device *dev, - const u8 *addr, gfp_t gfp) -{ - return __nl80211_unexpected_frame(dev, - NL80211_CMD_UNEXPECTED_4ADDR_FRAME, - addr, gfp); -} - -int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, - struct net_device *netdev, u32 nlpid, - int freq, int sig_dbm, - const u8 *buf, size_t len, gfp_t gfp) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); - if (!msg) - return -ENOMEM; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_FRAME); - if (!hdr) { - nlmsg_free(msg); - return -ENOMEM; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq); - if (sig_dbm) - NLA_PUT_U32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm); - NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf); - - genlmsg_end(msg, hdr); - - return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlpid); - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); - return -ENOBUFS; -} - -void nl80211_send_mgmt_tx_status(struct cfg80211_registered_device *rdev, - struct net_device *netdev, u64 cookie, - const u8 *buf, size_t len, bool ack, - gfp_t gfp) -{ - struct sk_buff *msg; - void *hdr; - - msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_FRAME_TX_STATUS); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - NLA_PUT(msg, NL80211_ATTR_FRAME, len, buf); - NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); - if (ack) - NLA_PUT_FLAG(msg, NL80211_ATTR_ACK); - - genlmsg_end(msg, hdr); - - genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -void -nl80211_send_cqm_rssi_notify(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - enum nl80211_cqm_rssi_threshold_event rssi_event, - gfp_t gfp) -{ - struct sk_buff *msg; - struct nlattr *pinfoattr; - void *hdr; - - msg = nlmsg_new(NLMSG_GOODSIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_NOTIFY_CQM); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - - pinfoattr = nla_nest_start(msg, NL80211_ATTR_CQM); - if (!pinfoattr) - goto nla_put_failure; - - NLA_PUT_U32(msg, NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT, - rssi_event); - - nla_nest_end(msg, pinfoattr); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *bssid, - const u8 *replay_ctr, gfp_t gfp) -{ - struct sk_buff *msg; - struct nlattr *rekey_attr; - void *hdr; - - msg = nlmsg_new(NLMSG_GOODSIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_SET_REKEY_OFFLOAD); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid); - - rekey_attr = nla_nest_start(msg, NL80211_ATTR_REKEY_DATA); - if (!rekey_attr) - goto nla_put_failure; - - NLA_PUT(msg, NL80211_REKEY_DATA_REPLAY_CTR, - NL80211_REPLAY_CTR_LEN, replay_ctr); - - nla_nest_end(msg, rekey_attr); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -void nl80211_pmksa_candidate_notify(struct cfg80211_registered_device *rdev, - struct net_device *netdev, int index, - const u8 *bssid, bool preauth, gfp_t gfp) -{ - struct sk_buff *msg; - struct nlattr *attr; - void *hdr; - - msg = nlmsg_new(NLMSG_GOODSIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_PMKSA_CANDIDATE); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - - attr = nla_nest_start(msg, NL80211_ATTR_PMKSA_CANDIDATE); - if (!attr) - goto nla_put_failure; - - NLA_PUT_U32(msg, NL80211_PMKSA_CANDIDATE_INDEX, index); - NLA_PUT(msg, NL80211_PMKSA_CANDIDATE_BSSID, ETH_ALEN, bssid); - if (preauth) - NLA_PUT_FLAG(msg, NL80211_PMKSA_CANDIDATE_PREAUTH); - - nla_nest_end(msg, attr); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -void -nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *peer, - u32 num_packets, gfp_t gfp) -{ - struct sk_buff *msg; - struct nlattr *pinfoattr; - void *hdr; - - msg = nlmsg_new(NLMSG_GOODSIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_NOTIFY_CQM); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, peer); - - pinfoattr = nla_nest_start(msg, NL80211_ATTR_CQM); - if (!pinfoattr) - goto nla_put_failure; - - NLA_PUT_U32(msg, NL80211_ATTR_CQM_PKT_LOSS_EVENT, num_packets); - - nla_nest_end(msg, pinfoattr); - - genlmsg_end(msg, hdr); - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} - -void cfg80211_probe_status(struct net_device *dev, const u8 *addr, - u64 cookie, bool acked, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct sk_buff *msg; - void *hdr; - int err; - - msg = nlmsg_new(NLMSG_GOODSIZE, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_PROBE_CLIENT); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); - NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr); - NLA_PUT_U64(msg, NL80211_ATTR_COOKIE, cookie); - if (acked) - NLA_PUT_FLAG(msg, NL80211_ATTR_ACK); - - err = genlmsg_end(msg, hdr); - if (err < 0) { - nlmsg_free(msg); - return; - } - - genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0, - nl80211_mlme_mcgrp.id, gfp); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} -EXPORT_SYMBOL(cfg80211_probe_status); - -void cfg80211_report_obss_beacon(struct wiphy *wiphy, - const u8 *frame, size_t len, - int freq, int sig_dbm, gfp_t gfp) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - struct sk_buff *msg; - void *hdr; - u32 nlpid = ACCESS_ONCE(rdev->ap_beacons_nlpid); - - if (!nlpid) - return; - - msg = nlmsg_new(len + 100, gfp); - if (!msg) - return; - - hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_FRAME); - if (!hdr) { - nlmsg_free(msg); - return; - } - - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx); - if (freq) - NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq); - if (sig_dbm) - NLA_PUT_U32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm); - NLA_PUT(msg, NL80211_ATTR_FRAME, len, frame); - - genlmsg_end(msg, hdr); - - genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlpid); - return; - - nla_put_failure: - genlmsg_cancel(msg, hdr); - nlmsg_free(msg); -} -EXPORT_SYMBOL(cfg80211_report_obss_beacon); - -static int nl80211_netlink_notify(struct notifier_block * nb, - unsigned long state, - void *_notify) -{ - struct netlink_notify *notify = _notify; - struct cfg80211_registered_device *rdev; - struct wireless_dev *wdev; - - if (state != NETLINK_URELEASE) - return NOTIFY_DONE; - - rcu_read_lock(); - - list_for_each_entry_rcu(rdev, &cfg80211_rdev_list, list) { - list_for_each_entry_rcu(wdev, &rdev->netdev_list, list) - cfg80211_mlme_unregister_socket(wdev, notify->pid); - if (rdev->ap_beacons_nlpid == notify->pid) - rdev->ap_beacons_nlpid = 0; - } - - rcu_read_unlock(); - - return NOTIFY_DONE; -} - -static struct notifier_block nl80211_netlink_notifier = { - .notifier_call = nl80211_netlink_notify, -}; - -/* initialisation/exit functions */ - -int nl80211_init(void) -{ - int err; - - err = genl_register_family_with_ops(&nl80211_fam, - nl80211_ops, ARRAY_SIZE(nl80211_ops)); - if (err) - return err; - - err = genl_register_mc_group(&nl80211_fam, &nl80211_config_mcgrp); - if (err) - goto err_out; - - err = genl_register_mc_group(&nl80211_fam, &nl80211_scan_mcgrp); - if (err) - goto err_out; - - err = genl_register_mc_group(&nl80211_fam, &nl80211_regulatory_mcgrp); - if (err) - goto err_out; - - err = genl_register_mc_group(&nl80211_fam, &nl80211_mlme_mcgrp); - if (err) - goto err_out; - -#ifdef CONFIG_NL80211_TESTMODE - err = genl_register_mc_group(&nl80211_fam, &nl80211_testmode_mcgrp); - if (err) - goto err_out; -#endif - - err = netlink_register_notifier(&nl80211_netlink_notifier); - if (err) - goto err_out; - - return 0; - err_out: - genl_unregister_family(&nl80211_fam); - return err; -} - -void nl80211_exit(void) -{ - netlink_unregister_notifier(&nl80211_netlink_notifier); - genl_unregister_family(&nl80211_fam); -} diff --git a/openairITS/mac/DOT11/net/wireless/nl80211.h b/openairITS/mac/DOT11/net/wireless/nl80211.h deleted file mode 100644 index 4ffe50df9f3..00000000000 --- a/openairITS/mac/DOT11/net/wireless/nl80211.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef __NET_WIRELESS_NL80211_H -#define __NET_WIRELESS_NL80211_H - -#include "core.h" - -int nl80211_init(void); -void nl80211_exit(void); -void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev); -void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, - struct net_device *netdev); -void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, - struct net_device *netdev); -void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, - struct net_device *netdev); -void nl80211_send_sched_scan(struct cfg80211_registered_device *rdev, - struct net_device *netdev, u32 cmd); -void nl80211_send_sched_scan_results(struct cfg80211_registered_device *rdev, - struct net_device *netdev); -void nl80211_send_reg_change_event(struct regulatory_request *request); -void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *buf, size_t len, gfp_t gfp); -void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *buf, size_t len, gfp_t gfp); -void nl80211_send_deauth(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *buf, size_t len, gfp_t gfp); -void nl80211_send_disassoc(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *buf, size_t len, gfp_t gfp); -void nl80211_send_unprot_deauth(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *buf, size_t len, gfp_t gfp); -void nl80211_send_unprot_disassoc(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *buf, size_t len, gfp_t gfp); -void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *addr, gfp_t gfp); -void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *addr, gfp_t gfp); -void nl80211_send_connect_result(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *bssid, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len, - u16 status, gfp_t gfp); -void nl80211_send_roamed(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *bssid, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); -void nl80211_send_disconnected(struct cfg80211_registered_device *rdev, - struct net_device *netdev, u16 reason, - const u8 *ie, size_t ie_len, bool from_ap); - -void nl80211_send_new_peer_candidate(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - const u8 *macaddr, const u8* ie, u8 ie_len, - gfp_t gfp); -void -nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *addr, - enum nl80211_key_type key_type, - int key_id, const u8 *tsc, gfp_t gfp); - -void -nl80211_send_beacon_hint_event(struct wiphy *wiphy, - struct ieee80211_channel *channel_before, - struct ieee80211_channel *channel_after); - -void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *bssid, - gfp_t gfp); - -void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - u64 cookie, - struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, - unsigned int duration, gfp_t gfp); -void nl80211_send_remain_on_channel_cancel( - struct cfg80211_registered_device *rdev, struct net_device *netdev, - u64 cookie, struct ieee80211_channel *chan, - enum nl80211_channel_type channel_type, gfp_t gfp); - -void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, - struct net_device *dev, const u8 *mac_addr, - struct station_info *sinfo, gfp_t gfp); -void nl80211_send_sta_del_event(struct cfg80211_registered_device *rdev, - struct net_device *dev, const u8 *mac_addr, - gfp_t gfp); - -int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, - struct net_device *netdev, u32 nlpid, - int freq, int sig_dbm, - const u8 *buf, size_t len, gfp_t gfp); -void nl80211_send_mgmt_tx_status(struct cfg80211_registered_device *rdev, - struct net_device *netdev, u64 cookie, - const u8 *buf, size_t len, bool ack, - gfp_t gfp); - -void -nl80211_send_cqm_rssi_notify(struct cfg80211_registered_device *rdev, - struct net_device *netdev, - enum nl80211_cqm_rssi_threshold_event rssi_event, - gfp_t gfp); -void -nl80211_send_cqm_pktloss_notify(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *peer, - u32 num_packets, gfp_t gfp); - -void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev, - struct net_device *netdev, const u8 *bssid, - const u8 *replay_ctr, gfp_t gfp); - -void nl80211_pmksa_candidate_notify(struct cfg80211_registered_device *rdev, - struct net_device *netdev, int index, - const u8 *bssid, bool preauth, gfp_t gfp); - -bool nl80211_unexpected_frame(struct net_device *dev, - const u8 *addr, gfp_t gfp); -bool nl80211_unexpected_4addr_frame(struct net_device *dev, - const u8 *addr, gfp_t gfp); - -#endif /* __NET_WIRELESS_NL80211_H */ diff --git a/openairITS/mac/DOT11/net/wireless/radiotap.c b/openairITS/mac/DOT11/net/wireless/radiotap.c deleted file mode 100644 index c4ad7958af5..00000000000 --- a/openairITS/mac/DOT11/net/wireless/radiotap.c +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Radiotap parser - * - * Copyright 2007 Andy Green <andy@warmcat.com> - * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * Alternatively, this software may be distributed under the terms of BSD - * license. - * - * See COPYING for more details. - */ - -#include <linux/kernel.h> -#include <linux/export.h> -#include <net/cfg80211.h> -#include <net/ieee80211_radiotap.h> -#include <asm/unaligned.h> - -/* function prototypes and related defs are in include/net/cfg80211.h */ - -static const struct radiotap_align_size rtap_namespace_sizes[] = { - [IEEE80211_RADIOTAP_TSFT] = { .align = 8, .size = 8, }, - [IEEE80211_RADIOTAP_FLAGS] = { .align = 1, .size = 1, }, - [IEEE80211_RADIOTAP_RATE] = { .align = 1, .size = 1, }, - [IEEE80211_RADIOTAP_CHANNEL] = { .align = 2, .size = 4, }, - [IEEE80211_RADIOTAP_FHSS] = { .align = 2, .size = 2, }, - [IEEE80211_RADIOTAP_DBM_ANTSIGNAL] = { .align = 1, .size = 1, }, - [IEEE80211_RADIOTAP_DBM_ANTNOISE] = { .align = 1, .size = 1, }, - [IEEE80211_RADIOTAP_LOCK_QUALITY] = { .align = 2, .size = 2, }, - [IEEE80211_RADIOTAP_TX_ATTENUATION] = { .align = 2, .size = 2, }, - [IEEE80211_RADIOTAP_DB_TX_ATTENUATION] = { .align = 2, .size = 2, }, - [IEEE80211_RADIOTAP_DBM_TX_POWER] = { .align = 1, .size = 1, }, - [IEEE80211_RADIOTAP_ANTENNA] = { .align = 1, .size = 1, }, - [IEEE80211_RADIOTAP_DB_ANTSIGNAL] = { .align = 1, .size = 1, }, - [IEEE80211_RADIOTAP_DB_ANTNOISE] = { .align = 1, .size = 1, }, - [IEEE80211_RADIOTAP_RX_FLAGS] = { .align = 2, .size = 2, }, - [IEEE80211_RADIOTAP_TX_FLAGS] = { .align = 2, .size = 2, }, - [IEEE80211_RADIOTAP_RTS_RETRIES] = { .align = 1, .size = 1, }, - [IEEE80211_RADIOTAP_DATA_RETRIES] = { .align = 1, .size = 1, }, - /* - * add more here as they are defined in radiotap.h - */ -}; - -static const struct ieee80211_radiotap_namespace radiotap_ns = { - .n_bits = ARRAY_SIZE(rtap_namespace_sizes), - .align_size = rtap_namespace_sizes, -}; - -/** - * ieee80211_radiotap_iterator_init - radiotap parser iterator initialization - * @iterator: radiotap_iterator to initialize - * @radiotap_header: radiotap header to parse - * @max_length: total length we can parse into (eg, whole packet length) - * - * Returns: 0 or a negative error code if there is a problem. - * - * This function initializes an opaque iterator struct which can then - * be passed to ieee80211_radiotap_iterator_next() to visit every radiotap - * argument which is present in the header. It knows about extended - * present headers and handles them. - * - * How to use: - * call __ieee80211_radiotap_iterator_init() to init a semi-opaque iterator - * struct ieee80211_radiotap_iterator (no need to init the struct beforehand) - * checking for a good 0 return code. Then loop calling - * __ieee80211_radiotap_iterator_next()... it returns either 0, - * -ENOENT if there are no more args to parse, or -EINVAL if there is a problem. - * The iterator's @this_arg member points to the start of the argument - * associated with the current argument index that is present, which can be - * found in the iterator's @this_arg_index member. This arg index corresponds - * to the IEEE80211_RADIOTAP_... defines. - * - * Radiotap header length: - * You can find the CPU-endian total radiotap header length in - * iterator->max_length after executing ieee80211_radiotap_iterator_init() - * successfully. - * - * Alignment Gotcha: - * You must take care when dereferencing iterator.this_arg - * for multibyte types... the pointer is not aligned. Use - * get_unaligned((type *)iterator.this_arg) to dereference - * iterator.this_arg for type "type" safely on all arches. - * - * Example code: - * See Documentation/networking/radiotap-headers.txt - */ - -int ieee80211_radiotap_iterator_init( - struct ieee80211_radiotap_iterator *iterator, - struct ieee80211_radiotap_header *radiotap_header, - int max_length, const struct ieee80211_radiotap_vendor_namespaces *vns) -{ - /* Linux only supports version 0 radiotap format */ - if (radiotap_header->it_version) - return -EINVAL; - - /* sanity check for allowed length and radiotap length field */ - if (max_length < get_unaligned_le16(&radiotap_header->it_len)) - return -EINVAL; - - iterator->_rtheader = radiotap_header; - iterator->_max_length = get_unaligned_le16(&radiotap_header->it_len); - iterator->_arg_index = 0; - iterator->_bitmap_shifter = get_unaligned_le32(&radiotap_header->it_present); - iterator->_arg = (uint8_t *)radiotap_header + sizeof(*radiotap_header); - iterator->_reset_on_ext = 0; - iterator->_next_bitmap = &radiotap_header->it_present; - iterator->_next_bitmap++; - iterator->_vns = vns; - iterator->current_namespace = &radiotap_ns; - iterator->is_radiotap_ns = 1; - - /* find payload start allowing for extended bitmap(s) */ - - if (iterator->_bitmap_shifter & (1<<IEEE80211_RADIOTAP_EXT)) { - while (get_unaligned_le32(iterator->_arg) & - (1 << IEEE80211_RADIOTAP_EXT)) { - iterator->_arg += sizeof(uint32_t); - - /* - * check for insanity where the present bitmaps - * keep claiming to extend up to or even beyond the - * stated radiotap header length - */ - - if ((unsigned long)iterator->_arg - - (unsigned long)iterator->_rtheader > - (unsigned long)iterator->_max_length) - return -EINVAL; - } - - iterator->_arg += sizeof(uint32_t); - - /* - * no need to check again for blowing past stated radiotap - * header length, because ieee80211_radiotap_iterator_next - * checks it before it is dereferenced - */ - } - - iterator->this_arg = iterator->_arg; - - /* we are all initialized happily */ - - return 0; -} -EXPORT_SYMBOL(ieee80211_radiotap_iterator_init); - -static void find_ns(struct ieee80211_radiotap_iterator *iterator, - uint32_t oui, uint8_t subns) -{ - int i; - - iterator->current_namespace = NULL; - - if (!iterator->_vns) - return; - - for (i = 0; i < iterator->_vns->n_ns; i++) { - if (iterator->_vns->ns[i].oui != oui) - continue; - if (iterator->_vns->ns[i].subns != subns) - continue; - - iterator->current_namespace = &iterator->_vns->ns[i]; - break; - } -} - - - -/** - * ieee80211_radiotap_iterator_next - return next radiotap parser iterator arg - * @iterator: radiotap_iterator to move to next arg (if any) - * - * Returns: 0 if there is an argument to handle, - * -ENOENT if there are no more args or -EINVAL - * if there is something else wrong. - * - * This function provides the next radiotap arg index (IEEE80211_RADIOTAP_*) - * in @this_arg_index and sets @this_arg to point to the - * payload for the field. It takes care of alignment handling and extended - * present fields. @this_arg can be changed by the caller (eg, - * incremented to move inside a compound argument like - * IEEE80211_RADIOTAP_CHANNEL). The args pointed to are in - * little-endian format whatever the endianess of your CPU. - * - * Alignment Gotcha: - * You must take care when dereferencing iterator.this_arg - * for multibyte types... the pointer is not aligned. Use - * get_unaligned((type *)iterator.this_arg) to dereference - * iterator.this_arg for type "type" safely on all arches. - */ - -int ieee80211_radiotap_iterator_next( - struct ieee80211_radiotap_iterator *iterator) -{ - while (1) { - int hit = 0; - int pad, align, size, subns; - uint32_t oui; - - /* if no more EXT bits, that's it */ - if ((iterator->_arg_index % 32) == IEEE80211_RADIOTAP_EXT && - !(iterator->_bitmap_shifter & 1)) - return -ENOENT; - - if (!(iterator->_bitmap_shifter & 1)) - goto next_entry; /* arg not present */ - - /* get alignment/size of data */ - switch (iterator->_arg_index % 32) { - case IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE: - case IEEE80211_RADIOTAP_EXT: - align = 1; - size = 0; - break; - case IEEE80211_RADIOTAP_VENDOR_NAMESPACE: - align = 2; - size = 6; - break; - default: - if (!iterator->current_namespace || - iterator->_arg_index >= iterator->current_namespace->n_bits) { - if (iterator->current_namespace == &radiotap_ns) - return -ENOENT; - align = 0; - } else { - align = iterator->current_namespace->align_size[iterator->_arg_index].align; - size = iterator->current_namespace->align_size[iterator->_arg_index].size; - } - if (!align) { - /* skip all subsequent data */ - iterator->_arg = iterator->_next_ns_data; - /* give up on this namespace */ - iterator->current_namespace = NULL; - goto next_entry; - } - break; - } - - /* - * arg is present, account for alignment padding - * - * Note that these alignments are relative to the start - * of the radiotap header. There is no guarantee - * that the radiotap header itself is aligned on any - * kind of boundary. - * - * The above is why get_unaligned() is used to dereference - * multibyte elements from the radiotap area. - */ - - pad = ((unsigned long)iterator->_arg - - (unsigned long)iterator->_rtheader) & (align - 1); - - if (pad) - iterator->_arg += align - pad; - - if (iterator->_arg_index % 32 == IEEE80211_RADIOTAP_VENDOR_NAMESPACE) { - int vnslen; - - if ((unsigned long)iterator->_arg + size - - (unsigned long)iterator->_rtheader > - (unsigned long)iterator->_max_length) - return -EINVAL; - - oui = (*iterator->_arg << 16) | - (*(iterator->_arg + 1) << 8) | - *(iterator->_arg + 2); - subns = *(iterator->_arg + 3); - - find_ns(iterator, oui, subns); - - vnslen = get_unaligned_le16(iterator->_arg + 4); - iterator->_next_ns_data = iterator->_arg + size + vnslen; - if (!iterator->current_namespace) - size += vnslen; - } - - /* - * this is what we will return to user, but we need to - * move on first so next call has something fresh to test - */ - iterator->this_arg_index = iterator->_arg_index; - iterator->this_arg = iterator->_arg; - iterator->this_arg_size = size; - - /* internally move on the size of this arg */ - iterator->_arg += size; - - /* - * check for insanity where we are given a bitmap that - * claims to have more arg content than the length of the - * radiotap section. We will normally end up equalling this - * max_length on the last arg, never exceeding it. - */ - - if ((unsigned long)iterator->_arg - - (unsigned long)iterator->_rtheader > - (unsigned long)iterator->_max_length) - return -EINVAL; - - /* these special ones are valid in each bitmap word */ - switch (iterator->_arg_index % 32) { - case IEEE80211_RADIOTAP_VENDOR_NAMESPACE: - iterator->_reset_on_ext = 1; - - iterator->is_radiotap_ns = 0; - /* - * If parser didn't register this vendor - * namespace with us, allow it to show it - * as 'raw. Do do that, set argument index - * to vendor namespace. - */ - iterator->this_arg_index = - IEEE80211_RADIOTAP_VENDOR_NAMESPACE; - if (!iterator->current_namespace) - hit = 1; - goto next_entry; - case IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE: - iterator->_reset_on_ext = 1; - iterator->current_namespace = &radiotap_ns; - iterator->is_radiotap_ns = 1; - goto next_entry; - case IEEE80211_RADIOTAP_EXT: - /* - * bit 31 was set, there is more - * -- move to next u32 bitmap - */ - iterator->_bitmap_shifter = - get_unaligned_le32(iterator->_next_bitmap); - iterator->_next_bitmap++; - if (iterator->_reset_on_ext) - iterator->_arg_index = 0; - else - iterator->_arg_index++; - iterator->_reset_on_ext = 0; - break; - default: - /* we've got a hit! */ - hit = 1; - next_entry: - iterator->_bitmap_shifter >>= 1; - iterator->_arg_index++; - } - - /* if we found a valid arg earlier, return it now */ - if (hit) - return 0; - } -} -EXPORT_SYMBOL(ieee80211_radiotap_iterator_next); diff --git a/openairITS/mac/DOT11/net/wireless/reg.c b/openairITS/mac/DOT11/net/wireless/reg.c deleted file mode 100644 index 06f98e742e1..00000000000 --- a/openairITS/mac/DOT11/net/wireless/reg.c +++ /dev/null @@ -1,2408 +0,0 @@ -/* - * Copyright 2002-2005, Instant802 Networks, Inc. - * Copyright 2005-2006, Devicescape Software, Inc. - * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> - * Copyright 2008-2011 Luis R. Rodriguez <mcgrof@qca.qualcomm.com> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -/** - * DOC: Wireless regulatory infrastructure - * - * The usual implementation is for a driver to read a device EEPROM to - * determine which regulatory domain it should be operating under, then - * looking up the allowable channels in a driver-local table and finally - * registering those channels in the wiphy structure. - * - * Another set of compliance enforcement is for drivers to use their - * own compliance limits which can be stored on the EEPROM. The host - * driver or firmware may ensure these are used. - * - * In addition to all this we provide an extra layer of regulatory - * conformance. For drivers which do not have any regulatory - * information CRDA provides the complete regulatory solution. - * For others it provides a community effort on further restrictions - * to enhance compliance. - * - * Note: When number of rules --> infinity we will not be able to - * index on alpha2 any more, instead we'll probably have to - * rely on some SHA1 checksum of the regdomain for example. - * - */ - -#undef pr_fmt -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt - -#include <linux/kernel.h> -#include <linux/printk.h> -#include <linux/export.h> -#include <linux/slab.h> -#include <linux/list.h> -#include <linux/random.h> -#include <linux/ctype.h> -#include <linux/nl80211.h> -#include <linux/platform_device.h> -#include <linux/moduleparam.h> -#include <net/cfg80211.h> -#include "core.h" -#include "reg.h" -#include "regdb.h" -#include "nl80211.h" - -#ifdef CONFIG_CFG80211_REG_DEBUG -#define REG_DBG_PRINT(format, args...) \ - printk(KERN_DEBUG pr_fmt(format), ##args) -#else -#define REG_DBG_PRINT(args...) -#endif - -static struct regulatory_request core_request_world = { - .initiator = NL80211_REGDOM_SET_BY_CORE, - .alpha2[0] = '0', - .alpha2[1] = '0', - .intersect = false, - .processed = true, - .country_ie_env = ENVIRON_ANY, -}; - -/* Receipt of information from last regulatory request */ -static struct regulatory_request *last_request = &core_request_world; - -/* To trigger userspace events */ -static struct platform_device *reg_pdev; - -static struct device_type reg_device_type = { - .uevent = reg_device_uevent, -}; - -/* - * Central wireless core regulatory domains, we only need two, - * the current one and a world regulatory domain in case we have no - * information to give us an alpha2 - */ -const struct ieee80211_regdomain *cfg80211_regdomain; - -/* - * Protects static reg.c components: - * - cfg80211_world_regdom - * - cfg80211_regdom - * - last_request - */ -static DEFINE_MUTEX(reg_mutex); - -static inline void assert_reg_lock(void) -{ - lockdep_assert_held(®_mutex); -} - -/* Used to queue up regulatory hints */ -static LIST_HEAD(reg_requests_list); -static spinlock_t reg_requests_lock; - -/* Used to queue up beacon hints for review */ -static LIST_HEAD(reg_pending_beacons); -static spinlock_t reg_pending_beacons_lock; - -/* Used to keep track of processed beacon hints */ -static LIST_HEAD(reg_beacon_list); - -struct reg_beacon { - struct list_head list; - struct ieee80211_channel chan; -}; - -static void reg_todo(struct work_struct *work); -static DECLARE_WORK(reg_work, reg_todo); - -static void reg_timeout_work(struct work_struct *work); -static DECLARE_DELAYED_WORK(reg_timeout, reg_timeout_work); - -/* We keep a static world regulatory domain in case of the absence of CRDA */ -static const struct ieee80211_regdomain world_regdom = { - .n_reg_rules = 5, - .alpha2 = "00", - .reg_rules = { - /* IEEE 802.11b/g, channels 1..11 */ - REG_RULE(2412-10, 2462+10, 40, 6, 20, 0), - /* IEEE 802.11b/g, channels 12..13. No HT40 - * channel fits here. */ - REG_RULE(2467-10, 2472+10, 20, 6, 20, - NL80211_RRF_PASSIVE_SCAN | - NL80211_RRF_NO_IBSS), - /* IEEE 802.11 channel 14 - Only JP enables - * this and for 802.11b only */ - REG_RULE(2484-10, 2484+10, 20, 6, 20, - NL80211_RRF_PASSIVE_SCAN | - NL80211_RRF_NO_IBSS | - NL80211_RRF_NO_OFDM), - /* IEEE 802.11a, channel 36..48 */ - REG_RULE(5180-10, 5240+10, 40, 6, 20, - NL80211_RRF_PASSIVE_SCAN | - NL80211_RRF_NO_IBSS), - - /* NB: 5260 MHz - 5700 MHz requies DFS */ - - /* IEEE 802.11a, channel 149..165 */ - REG_RULE(5745-10, 5825+10, 40, 6, 20, - NL80211_RRF_PASSIVE_SCAN | - NL80211_RRF_NO_IBSS), - } -}; - -static const struct ieee80211_regdomain *cfg80211_world_regdom = - &world_regdom; - -static char *ieee80211_regdom = "00"; -static char user_alpha2[2]; - -module_param(ieee80211_regdom, charp, 0444); -MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain code"); - -static void reset_regdomains(bool full_reset) -{ - /* avoid freeing static information or freeing something twice */ - if (cfg80211_regdomain == cfg80211_world_regdom) - cfg80211_regdomain = NULL; - if (cfg80211_world_regdom == &world_regdom) - cfg80211_world_regdom = NULL; - if (cfg80211_regdomain == &world_regdom) - cfg80211_regdomain = NULL; - - kfree(cfg80211_regdomain); - kfree(cfg80211_world_regdom); - - cfg80211_world_regdom = &world_regdom; - cfg80211_regdomain = NULL; - - if (!full_reset) - return; - - if (last_request != &core_request_world) - kfree(last_request); - last_request = &core_request_world; -} - -/* - * Dynamic world regulatory domain requested by the wireless - * core upon initialization - */ -static void update_world_regdomain(const struct ieee80211_regdomain *rd) -{ - BUG_ON(!last_request); - - reset_regdomains(false); - - cfg80211_world_regdom = rd; - cfg80211_regdomain = rd; -} - -bool is_world_regdom(const char *alpha2) -{ - if (!alpha2) - return false; - if (alpha2[0] == '0' && alpha2[1] == '0') - return true; - return false; -} - -static bool is_alpha2_set(const char *alpha2) -{ - if (!alpha2) - return false; - if (alpha2[0] != 0 && alpha2[1] != 0) - return true; - return false; -} - -static bool is_unknown_alpha2(const char *alpha2) -{ - if (!alpha2) - return false; - /* - * Special case where regulatory domain was built by driver - * but a specific alpha2 cannot be determined - */ - if (alpha2[0] == '9' && alpha2[1] == '9') - return true; - return false; -} - -static bool is_intersected_alpha2(const char *alpha2) -{ - if (!alpha2) - return false; - /* - * Special case where regulatory domain is the - * result of an intersection between two regulatory domain - * structures - */ - if (alpha2[0] == '9' && alpha2[1] == '8') - return true; - return false; -} - -static bool is_an_alpha2(const char *alpha2) -{ - if (!alpha2) - return false; - if (isalpha(alpha2[0]) && isalpha(alpha2[1])) - return true; - return false; -} - -static bool alpha2_equal(const char *alpha2_x, const char *alpha2_y) -{ - if (!alpha2_x || !alpha2_y) - return false; - if (alpha2_x[0] == alpha2_y[0] && - alpha2_x[1] == alpha2_y[1]) - return true; - return false; -} - -static bool regdom_changes(const char *alpha2) -{ - assert_cfg80211_lock(); - - if (!cfg80211_regdomain) - return true; - if (alpha2_equal(cfg80211_regdomain->alpha2, alpha2)) - return false; - return true; -} - -/* - * The NL80211_REGDOM_SET_BY_USER regdom alpha2 is cached, this lets - * you know if a valid regulatory hint with NL80211_REGDOM_SET_BY_USER - * has ever been issued. - */ -static bool is_user_regdom_saved(void) -{ - if (user_alpha2[0] == '9' && user_alpha2[1] == '7') - return false; - - /* This would indicate a mistake on the design */ - if (WARN((!is_world_regdom(user_alpha2) && - !is_an_alpha2(user_alpha2)), - "Unexpected user alpha2: %c%c\n", - user_alpha2[0], - user_alpha2[1])) - return false; - - return true; -} - -static int reg_copy_regd(const struct ieee80211_regdomain **dst_regd, - const struct ieee80211_regdomain *src_regd) -{ - struct ieee80211_regdomain *regd; - int size_of_regd = 0; - unsigned int i; - - size_of_regd = sizeof(struct ieee80211_regdomain) + - ((src_regd->n_reg_rules + 1) * sizeof(struct ieee80211_reg_rule)); - - regd = kzalloc(size_of_regd, GFP_KERNEL); - if (!regd) - return -ENOMEM; - - memcpy(regd, src_regd, sizeof(struct ieee80211_regdomain)); - - for (i = 0; i < src_regd->n_reg_rules; i++) - memcpy(®d->reg_rules[i], &src_regd->reg_rules[i], - sizeof(struct ieee80211_reg_rule)); - - *dst_regd = regd; - return 0; -} - -#ifdef CONFIG_CFG80211_INTERNAL_REGDB -struct reg_regdb_search_request { - char alpha2[2]; - struct list_head list; -}; - -static LIST_HEAD(reg_regdb_search_list); -static DEFINE_MUTEX(reg_regdb_search_mutex); - -static void reg_regdb_search(struct work_struct *work) -{ - struct reg_regdb_search_request *request; - const struct ieee80211_regdomain *curdom, *regdom; - int i, r; - - mutex_lock(®_regdb_search_mutex); - while (!list_empty(®_regdb_search_list)) { - request = list_first_entry(®_regdb_search_list, - struct reg_regdb_search_request, - list); - list_del(&request->list); - - for (i=0; i<reg_regdb_size; i++) { - curdom = reg_regdb[i]; - - if (!memcmp(request->alpha2, curdom->alpha2, 2)) { - r = reg_copy_regd(®dom, curdom); - if (r) - break; - mutex_lock(&cfg80211_mutex); - set_regdom(regdom); - mutex_unlock(&cfg80211_mutex); - break; - } - } - - kfree(request); - } - mutex_unlock(®_regdb_search_mutex); -} - -static DECLARE_WORK(reg_regdb_work, reg_regdb_search); - -static void reg_regdb_query(const char *alpha2) -{ - struct reg_regdb_search_request *request; - - if (!alpha2) - return; - - request = kzalloc(sizeof(struct reg_regdb_search_request), GFP_KERNEL); - if (!request) - return; - - memcpy(request->alpha2, alpha2, 2); - - mutex_lock(®_regdb_search_mutex); - list_add_tail(&request->list, ®_regdb_search_list); - mutex_unlock(®_regdb_search_mutex); - - schedule_work(®_regdb_work); -} -#else -static inline void reg_regdb_query(const char *alpha2) {} -#endif /* CONFIG_CFG80211_INTERNAL_REGDB */ - -/* - * This lets us keep regulatory code which is updated on a regulatory - * basis in userspace. Country information is filled in by - * reg_device_uevent - */ -static int call_crda(const char *alpha2) -{ - if (!is_world_regdom((char *) alpha2)) - pr_info("Calling CRDA for country: %c%c\n", - alpha2[0], alpha2[1]); - else - pr_info("Calling CRDA to update world regulatory domain\n"); - - /* query internal regulatory database (if it exists) */ - reg_regdb_query(alpha2); - - return kobject_uevent(®_pdev->dev.kobj, KOBJ_CHANGE); -} - -/* Used by nl80211 before kmalloc'ing our regulatory domain */ -bool reg_is_valid_request(const char *alpha2) -{ - assert_cfg80211_lock(); - - if (!last_request) - return false; - - return alpha2_equal(last_request->alpha2, alpha2); -} - -/* Sanity check on a regulatory rule */ -static bool is_valid_reg_rule(const struct ieee80211_reg_rule *rule) -{ - const struct ieee80211_freq_range *freq_range = &rule->freq_range; - u32 freq_diff; - - if (freq_range->start_freq_khz <= 0 || freq_range->end_freq_khz <= 0) - return false; - - if (freq_range->start_freq_khz > freq_range->end_freq_khz) - return false; - - freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz; - - if (freq_range->end_freq_khz <= freq_range->start_freq_khz || - freq_range->max_bandwidth_khz > freq_diff) - return false; - - return true; -} - -static bool is_valid_rd(const struct ieee80211_regdomain *rd) -{ - const struct ieee80211_reg_rule *reg_rule = NULL; - unsigned int i; - - if (!rd->n_reg_rules) - return false; - - if (WARN_ON(rd->n_reg_rules > NL80211_MAX_SUPP_REG_RULES)) - return false; - - for (i = 0; i < rd->n_reg_rules; i++) { - reg_rule = &rd->reg_rules[i]; - if (!is_valid_reg_rule(reg_rule)) - return false; - } - - return true; -} - -static bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range, - u32 center_freq_khz, - u32 bw_khz) -{ - u32 start_freq_khz, end_freq_khz; - - start_freq_khz = center_freq_khz - (bw_khz/2); - end_freq_khz = center_freq_khz + (bw_khz/2); - - if (start_freq_khz >= freq_range->start_freq_khz && - end_freq_khz <= freq_range->end_freq_khz) - return true; - - return false; -} - -/** - * freq_in_rule_band - tells us if a frequency is in a frequency band - * @freq_range: frequency rule we want to query - * @freq_khz: frequency we are inquiring about - * - * This lets us know if a specific frequency rule is or is not relevant to - * a specific frequency's band. Bands are device specific and artificial - * definitions (the "2.4 GHz band" and the "5 GHz band"), however it is - * safe for now to assume that a frequency rule should not be part of a - * frequency's band if the start freq or end freq are off by more than 2 GHz. - * This resolution can be lowered and should be considered as we add - * regulatory rule support for other "bands". - **/ -static bool freq_in_rule_band(const struct ieee80211_freq_range *freq_range, - u32 freq_khz) -{ -#define ONE_GHZ_IN_KHZ 1000000 - if (abs(freq_khz - freq_range->start_freq_khz) <= (2 * ONE_GHZ_IN_KHZ)) - return true; - if (abs(freq_khz - freq_range->end_freq_khz) <= (2 * ONE_GHZ_IN_KHZ)) - return true; - return false; -#undef ONE_GHZ_IN_KHZ -} - -/* - * Helper for regdom_intersect(), this does the real - * mathematical intersection fun - */ -static int reg_rules_intersect( - const struct ieee80211_reg_rule *rule1, - const struct ieee80211_reg_rule *rule2, - struct ieee80211_reg_rule *intersected_rule) -{ - const struct ieee80211_freq_range *freq_range1, *freq_range2; - struct ieee80211_freq_range *freq_range; - const struct ieee80211_power_rule *power_rule1, *power_rule2; - struct ieee80211_power_rule *power_rule; - u32 freq_diff; - - freq_range1 = &rule1->freq_range; - freq_range2 = &rule2->freq_range; - freq_range = &intersected_rule->freq_range; - - power_rule1 = &rule1->power_rule; - power_rule2 = &rule2->power_rule; - power_rule = &intersected_rule->power_rule; - - freq_range->start_freq_khz = max(freq_range1->start_freq_khz, - freq_range2->start_freq_khz); - freq_range->end_freq_khz = min(freq_range1->end_freq_khz, - freq_range2->end_freq_khz); - freq_range->max_bandwidth_khz = min(freq_range1->max_bandwidth_khz, - freq_range2->max_bandwidth_khz); - - freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz; - if (freq_range->max_bandwidth_khz > freq_diff) - freq_range->max_bandwidth_khz = freq_diff; - - power_rule->max_eirp = min(power_rule1->max_eirp, - power_rule2->max_eirp); - power_rule->max_antenna_gain = min(power_rule1->max_antenna_gain, - power_rule2->max_antenna_gain); - - intersected_rule->flags = (rule1->flags | rule2->flags); - - if (!is_valid_reg_rule(intersected_rule)) - return -EINVAL; - - return 0; -} - -/** - * regdom_intersect - do the intersection between two regulatory domains - * @rd1: first regulatory domain - * @rd2: second regulatory domain - * - * Use this function to get the intersection between two regulatory domains. - * Once completed we will mark the alpha2 for the rd as intersected, "98", - * as no one single alpha2 can represent this regulatory domain. - * - * Returns a pointer to the regulatory domain structure which will hold the - * resulting intersection of rules between rd1 and rd2. We will - * kzalloc() this structure for you. - */ -static struct ieee80211_regdomain *regdom_intersect( - const struct ieee80211_regdomain *rd1, - const struct ieee80211_regdomain *rd2) -{ - int r, size_of_regd; - unsigned int x, y; - unsigned int num_rules = 0, rule_idx = 0; - const struct ieee80211_reg_rule *rule1, *rule2; - struct ieee80211_reg_rule *intersected_rule; - struct ieee80211_regdomain *rd; - /* This is just a dummy holder to help us count */ - struct ieee80211_reg_rule irule; - - /* Uses the stack temporarily for counter arithmetic */ - intersected_rule = &irule; - - memset(intersected_rule, 0, sizeof(struct ieee80211_reg_rule)); - - if (!rd1 || !rd2) - return NULL; - - /* - * First we get a count of the rules we'll need, then we actually - * build them. This is to so we can malloc() and free() a - * regdomain once. The reason we use reg_rules_intersect() here - * is it will return -EINVAL if the rule computed makes no sense. - * All rules that do check out OK are valid. - */ - - for (x = 0; x < rd1->n_reg_rules; x++) { - rule1 = &rd1->reg_rules[x]; - for (y = 0; y < rd2->n_reg_rules; y++) { - rule2 = &rd2->reg_rules[y]; - if (!reg_rules_intersect(rule1, rule2, - intersected_rule)) - num_rules++; - memset(intersected_rule, 0, - sizeof(struct ieee80211_reg_rule)); - } - } - - if (!num_rules) - return NULL; - - size_of_regd = sizeof(struct ieee80211_regdomain) + - ((num_rules + 1) * sizeof(struct ieee80211_reg_rule)); - - rd = kzalloc(size_of_regd, GFP_KERNEL); - if (!rd) - return NULL; - - for (x = 0; x < rd1->n_reg_rules; x++) { - rule1 = &rd1->reg_rules[x]; - for (y = 0; y < rd2->n_reg_rules; y++) { - rule2 = &rd2->reg_rules[y]; - /* - * This time around instead of using the stack lets - * write to the target rule directly saving ourselves - * a memcpy() - */ - intersected_rule = &rd->reg_rules[rule_idx]; - r = reg_rules_intersect(rule1, rule2, - intersected_rule); - /* - * No need to memset here the intersected rule here as - * we're not using the stack anymore - */ - if (r) - continue; - rule_idx++; - } - } - - if (rule_idx != num_rules) { - kfree(rd); - return NULL; - } - - rd->n_reg_rules = num_rules; - rd->alpha2[0] = '9'; - rd->alpha2[1] = '8'; - - return rd; -} - -/* - * XXX: add support for the rest of enum nl80211_reg_rule_flags, we may - * want to just have the channel structure use these - */ -static u32 map_regdom_flags(u32 rd_flags) -{ - u32 channel_flags = 0; - if (rd_flags & NL80211_RRF_PASSIVE_SCAN) - channel_flags |= IEEE80211_CHAN_PASSIVE_SCAN; - if (rd_flags & NL80211_RRF_NO_IBSS) - channel_flags |= IEEE80211_CHAN_NO_IBSS; - if (rd_flags & NL80211_RRF_DFS) - channel_flags |= IEEE80211_CHAN_RADAR; - return channel_flags; -} - -static int freq_reg_info_regd(struct wiphy *wiphy, - u32 center_freq, - u32 desired_bw_khz, - const struct ieee80211_reg_rule **reg_rule, - const struct ieee80211_regdomain *custom_regd) -{ - int i; - bool band_rule_found = false; - const struct ieee80211_regdomain *regd; - bool bw_fits = false; - - if (!desired_bw_khz) - desired_bw_khz = MHZ_TO_KHZ(20); - - regd = custom_regd ? custom_regd : cfg80211_regdomain; - - /* - * Follow the driver's regulatory domain, if present, unless a country - * IE has been processed or a user wants to help complaince further - */ - if (!custom_regd && - last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && - last_request->initiator != NL80211_REGDOM_SET_BY_USER && - wiphy->regd) - regd = wiphy->regd; - - if (!regd) - return -EINVAL; - - for (i = 0; i < regd->n_reg_rules; i++) { - const struct ieee80211_reg_rule *rr; - const struct ieee80211_freq_range *fr = NULL; - - rr = ®d->reg_rules[i]; - fr = &rr->freq_range; - - /* - * We only need to know if one frequency rule was - * was in center_freq's band, that's enough, so lets - * not overwrite it once found - */ - if (!band_rule_found) - band_rule_found = freq_in_rule_band(fr, center_freq); - - bw_fits = reg_does_bw_fit(fr, - center_freq, - desired_bw_khz); - - if (band_rule_found && bw_fits) { - *reg_rule = rr; - return 0; - } - } - - if (!band_rule_found) - return -ERANGE; - - return -EINVAL; -} - -int freq_reg_info(struct wiphy *wiphy, - u32 center_freq, - u32 desired_bw_khz, - const struct ieee80211_reg_rule **reg_rule) -{ - assert_cfg80211_lock(); - return freq_reg_info_regd(wiphy, - center_freq, - desired_bw_khz, - reg_rule, - NULL); -} -EXPORT_SYMBOL(freq_reg_info); - -#ifdef CONFIG_CFG80211_REG_DEBUG -static const char *reg_initiator_name(enum nl80211_reg_initiator initiator) -{ - switch (initiator) { - case NL80211_REGDOM_SET_BY_CORE: - return "Set by core"; - case NL80211_REGDOM_SET_BY_USER: - return "Set by user"; - case NL80211_REGDOM_SET_BY_DRIVER: - return "Set by driver"; - case NL80211_REGDOM_SET_BY_COUNTRY_IE: - return "Set by country IE"; - default: - WARN_ON(1); - return "Set by bug"; - } -} - -static void chan_reg_rule_print_dbg(struct ieee80211_channel *chan, - u32 desired_bw_khz, - const struct ieee80211_reg_rule *reg_rule) -{ - const struct ieee80211_power_rule *power_rule; - const struct ieee80211_freq_range *freq_range; - char max_antenna_gain[32]; - - power_rule = ®_rule->power_rule; - freq_range = ®_rule->freq_range; - - if (!power_rule->max_antenna_gain) - snprintf(max_antenna_gain, 32, "N/A"); - else - snprintf(max_antenna_gain, 32, "%d", power_rule->max_antenna_gain); - - REG_DBG_PRINT("Updating information on frequency %d MHz " - "for a %d MHz width channel with regulatory rule:\n", - chan->center_freq, - KHZ_TO_MHZ(desired_bw_khz)); - - REG_DBG_PRINT("%d KHz - %d KHz @ %d KHz), (%s mBi, %d mBm)\n", - freq_range->start_freq_khz, - freq_range->end_freq_khz, - freq_range->max_bandwidth_khz, - max_antenna_gain, - power_rule->max_eirp); -} -#else -static void chan_reg_rule_print_dbg(struct ieee80211_channel *chan, - u32 desired_bw_khz, - const struct ieee80211_reg_rule *reg_rule) -{ - return; -} -#endif - -/* - * Note that right now we assume the desired channel bandwidth - * is always 20 MHz for each individual channel (HT40 uses 20 MHz - * per channel, the primary and the extension channel). To support - * smaller custom bandwidths such as 5 MHz or 10 MHz we'll need a - * new ieee80211_channel.target_bw and re run the regulatory check - * on the wiphy with the target_bw specified. Then we can simply use - * that below for the desired_bw_khz below. - */ -static void handle_channel(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator, - enum ieee80211_band band, - unsigned int chan_idx) -{ - int r; - u32 flags, bw_flags = 0; - u32 desired_bw_khz = MHZ_TO_KHZ(20); - const struct ieee80211_reg_rule *reg_rule = NULL; - const struct ieee80211_power_rule *power_rule = NULL; - const struct ieee80211_freq_range *freq_range = NULL; - struct ieee80211_supported_band *sband; - struct ieee80211_channel *chan; - struct wiphy *request_wiphy = NULL; - - assert_cfg80211_lock(); - - request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); - - sband = wiphy->bands[band]; - BUG_ON(chan_idx >= sband->n_channels); - chan = &sband->channels[chan_idx]; - - flags = chan->orig_flags; - - r = freq_reg_info(wiphy, - MHZ_TO_KHZ(chan->center_freq), - desired_bw_khz, - ®_rule); - - if (r) { - /* - * We will disable all channels that do not match our - * received regulatory rule unless the hint is coming - * from a Country IE and the Country IE had no information - * about a band. The IEEE 802.11 spec allows for an AP - * to send only a subset of the regulatory rules allowed, - * so an AP in the US that only supports 2.4 GHz may only send - * a country IE with information for the 2.4 GHz band - * while 5 GHz is still supported. - */ - if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE && - r == -ERANGE) - return; - - REG_DBG_PRINT("Disabling freq %d MHz\n", chan->center_freq); - chan->flags = IEEE80211_CHAN_DISABLED; - return; - } - - chan_reg_rule_print_dbg(chan, desired_bw_khz, reg_rule); - - power_rule = ®_rule->power_rule; - freq_range = ®_rule->freq_range; - - if (freq_range->max_bandwidth_khz < MHZ_TO_KHZ(40)) - bw_flags = IEEE80211_CHAN_NO_HT40; - - if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER && - request_wiphy && request_wiphy == wiphy && - request_wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) { - /* - * This guarantees the driver's requested regulatory domain - * will always be used as a base for further regulatory - * settings - */ - chan->flags = chan->orig_flags = - map_regdom_flags(reg_rule->flags) | bw_flags; - chan->max_antenna_gain = chan->orig_mag = - (int) MBI_TO_DBI(power_rule->max_antenna_gain); - chan->max_power = chan->orig_mpwr = - (int) MBM_TO_DBM(power_rule->max_eirp); - return; - } - - chan->beacon_found = false; - chan->flags = flags | bw_flags | map_regdom_flags(reg_rule->flags); - chan->max_antenna_gain = min(chan->orig_mag, - (int) MBI_TO_DBI(power_rule->max_antenna_gain)); - chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp); - chan->max_power = min(chan->max_power, chan->max_reg_power); -} - -static void handle_band(struct wiphy *wiphy, - enum ieee80211_band band, - enum nl80211_reg_initiator initiator) -{ - unsigned int i; - struct ieee80211_supported_band *sband; - - BUG_ON(!wiphy->bands[band]); - sband = wiphy->bands[band]; - - for (i = 0; i < sband->n_channels; i++) - handle_channel(wiphy, initiator, band, i); -} - -static bool ignore_reg_update(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator) -{ - if (!last_request) { - REG_DBG_PRINT("Ignoring regulatory request %s since " - "last_request is not set\n", - reg_initiator_name(initiator)); - return true; - } - - if (initiator == NL80211_REGDOM_SET_BY_CORE && - wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) { - REG_DBG_PRINT("Ignoring regulatory request %s " - "since the driver uses its own custom " - "regulatory domain\n", - reg_initiator_name(initiator)); - return true; - } - - /* - * wiphy->regd will be set once the device has its own - * desired regulatory domain set - */ - if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && !wiphy->regd && - initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && - !is_world_regdom(last_request->alpha2)) { - REG_DBG_PRINT("Ignoring regulatory request %s " - "since the driver requires its own regulatory " - "domain to be set first\n", - reg_initiator_name(initiator)); - return true; - } - - return false; -} - -static void handle_reg_beacon(struct wiphy *wiphy, - unsigned int chan_idx, - struct reg_beacon *reg_beacon) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_channel *chan; - bool channel_changed = false; - struct ieee80211_channel chan_before; - - assert_cfg80211_lock(); - - sband = wiphy->bands[reg_beacon->chan.band]; - chan = &sband->channels[chan_idx]; - - if (likely(chan->center_freq != reg_beacon->chan.center_freq)) - return; - - if (chan->beacon_found) - return; - - chan->beacon_found = true; - - if (wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS) - return; - - chan_before.center_freq = chan->center_freq; - chan_before.flags = chan->flags; - - if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN) { - chan->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; - channel_changed = true; - } - - if (chan->flags & IEEE80211_CHAN_NO_IBSS) { - chan->flags &= ~IEEE80211_CHAN_NO_IBSS; - channel_changed = true; - } - - if (channel_changed) - nl80211_send_beacon_hint_event(wiphy, &chan_before, chan); -} - -/* - * Called when a scan on a wiphy finds a beacon on - * new channel - */ -static void wiphy_update_new_beacon(struct wiphy *wiphy, - struct reg_beacon *reg_beacon) -{ - unsigned int i; - struct ieee80211_supported_band *sband; - - assert_cfg80211_lock(); - - if (!wiphy->bands[reg_beacon->chan.band]) - return; - - sband = wiphy->bands[reg_beacon->chan.band]; - - for (i = 0; i < sband->n_channels; i++) - handle_reg_beacon(wiphy, i, reg_beacon); -} - -/* - * Called upon reg changes or a new wiphy is added - */ -static void wiphy_update_beacon_reg(struct wiphy *wiphy) -{ - unsigned int i; - struct ieee80211_supported_band *sband; - struct reg_beacon *reg_beacon; - - assert_cfg80211_lock(); - - if (list_empty(®_beacon_list)) - return; - - list_for_each_entry(reg_beacon, ®_beacon_list, list) { - if (!wiphy->bands[reg_beacon->chan.band]) - continue; - sband = wiphy->bands[reg_beacon->chan.band]; - for (i = 0; i < sband->n_channels; i++) - handle_reg_beacon(wiphy, i, reg_beacon); - } -} - -static bool reg_is_world_roaming(struct wiphy *wiphy) -{ - if (is_world_regdom(cfg80211_regdomain->alpha2) || - (wiphy->regd && is_world_regdom(wiphy->regd->alpha2))) - return true; - if (last_request && - last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && - wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) - return true; - return false; -} - -/* Reap the advantages of previously found beacons */ -static void reg_process_beacons(struct wiphy *wiphy) -{ - /* - * Means we are just firing up cfg80211, so no beacons would - * have been processed yet. - */ - if (!last_request) - return; - if (!reg_is_world_roaming(wiphy)) - return; - wiphy_update_beacon_reg(wiphy); -} - -static bool is_ht40_not_allowed(struct ieee80211_channel *chan) -{ - if (!chan) - return true; - if (chan->flags & IEEE80211_CHAN_DISABLED) - return true; - /* This would happen when regulatory rules disallow HT40 completely */ - if (IEEE80211_CHAN_NO_HT40 == (chan->flags & (IEEE80211_CHAN_NO_HT40))) - return true; - return false; -} - -static void reg_process_ht_flags_channel(struct wiphy *wiphy, - enum ieee80211_band band, - unsigned int chan_idx) -{ - struct ieee80211_supported_band *sband; - struct ieee80211_channel *channel; - struct ieee80211_channel *channel_before = NULL, *channel_after = NULL; - unsigned int i; - - assert_cfg80211_lock(); - - sband = wiphy->bands[band]; - BUG_ON(chan_idx >= sband->n_channels); - channel = &sband->channels[chan_idx]; - - if (is_ht40_not_allowed(channel)) { - channel->flags |= IEEE80211_CHAN_NO_HT40; - return; - } - - /* - * We need to ensure the extension channels exist to - * be able to use HT40- or HT40+, this finds them (or not) - */ - for (i = 0; i < sband->n_channels; i++) { - struct ieee80211_channel *c = &sband->channels[i]; - if (c->center_freq == (channel->center_freq - 20)) - channel_before = c; - if (c->center_freq == (channel->center_freq + 20)) - channel_after = c; - } - - /* - * Please note that this assumes target bandwidth is 20 MHz, - * if that ever changes we also need to change the below logic - * to include that as well. - */ - if (is_ht40_not_allowed(channel_before)) - channel->flags |= IEEE80211_CHAN_NO_HT40MINUS; - else - channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS; - - if (is_ht40_not_allowed(channel_after)) - channel->flags |= IEEE80211_CHAN_NO_HT40PLUS; - else - channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS; -} - -static void reg_process_ht_flags_band(struct wiphy *wiphy, - enum ieee80211_band band) -{ - unsigned int i; - struct ieee80211_supported_band *sband; - - BUG_ON(!wiphy->bands[band]); - sband = wiphy->bands[band]; - - for (i = 0; i < sband->n_channels; i++) - reg_process_ht_flags_channel(wiphy, band, i); -} - -static void reg_process_ht_flags(struct wiphy *wiphy) -{ - enum ieee80211_band band; - - if (!wiphy) - return; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - if (wiphy->bands[band]) - reg_process_ht_flags_band(wiphy, band); - } - -} - -static void wiphy_update_regulatory(struct wiphy *wiphy, - enum nl80211_reg_initiator initiator) -{ - enum ieee80211_band band; - - assert_reg_lock(); - - if (ignore_reg_update(wiphy, initiator)) - return; - - last_request->dfs_region = cfg80211_regdomain->dfs_region; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - if (wiphy->bands[band]) - handle_band(wiphy, band, initiator); - } - - reg_process_beacons(wiphy); - reg_process_ht_flags(wiphy); - if (wiphy->reg_notifier) - wiphy->reg_notifier(wiphy, last_request); -} - -void regulatory_update(struct wiphy *wiphy, - enum nl80211_reg_initiator setby) -{ - mutex_lock(®_mutex); - wiphy_update_regulatory(wiphy, setby); - mutex_unlock(®_mutex); -} - -static void update_all_wiphy_regulatory(enum nl80211_reg_initiator initiator) -{ - struct cfg80211_registered_device *rdev; - struct wiphy *wiphy; - - list_for_each_entry(rdev, &cfg80211_rdev_list, list) { - wiphy = &rdev->wiphy; - wiphy_update_regulatory(wiphy, initiator); - /* - * Regulatory updates set by CORE are ignored for custom - * regulatory cards. Let us notify the changes to the driver, - * as some drivers used this to restore its orig_* reg domain. - */ - if (initiator == NL80211_REGDOM_SET_BY_CORE && - wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY && - wiphy->reg_notifier) - wiphy->reg_notifier(wiphy, last_request); - } -} - -static void handle_channel_custom(struct wiphy *wiphy, - enum ieee80211_band band, - unsigned int chan_idx, - const struct ieee80211_regdomain *regd) -{ - int r; - u32 desired_bw_khz = MHZ_TO_KHZ(20); - u32 bw_flags = 0; - const struct ieee80211_reg_rule *reg_rule = NULL; - const struct ieee80211_power_rule *power_rule = NULL; - const struct ieee80211_freq_range *freq_range = NULL; - struct ieee80211_supported_band *sband; - struct ieee80211_channel *chan; - - assert_reg_lock(); - - sband = wiphy->bands[band]; - BUG_ON(chan_idx >= sband->n_channels); - chan = &sband->channels[chan_idx]; - - r = freq_reg_info_regd(wiphy, - MHZ_TO_KHZ(chan->center_freq), - desired_bw_khz, - ®_rule, - regd); - - if (r) { - REG_DBG_PRINT("Disabling freq %d MHz as custom " - "regd has no rule that fits a %d MHz " - "wide channel\n", - chan->center_freq, - KHZ_TO_MHZ(desired_bw_khz)); - chan->flags = IEEE80211_CHAN_DISABLED; - return; - } - - chan_reg_rule_print_dbg(chan, desired_bw_khz, reg_rule); - - power_rule = ®_rule->power_rule; - freq_range = ®_rule->freq_range; - - if (freq_range->max_bandwidth_khz < MHZ_TO_KHZ(40)) - bw_flags = IEEE80211_CHAN_NO_HT40; - - chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags; - chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain); - chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp); -} - -static void handle_band_custom(struct wiphy *wiphy, enum ieee80211_band band, - const struct ieee80211_regdomain *regd) -{ - unsigned int i; - struct ieee80211_supported_band *sband; - - BUG_ON(!wiphy->bands[band]); - sband = wiphy->bands[band]; - - for (i = 0; i < sband->n_channels; i++) - handle_channel_custom(wiphy, band, i, regd); -} - -/* Used by drivers prior to wiphy registration */ -void wiphy_apply_custom_regulatory(struct wiphy *wiphy, - const struct ieee80211_regdomain *regd) -{ - enum ieee80211_band band; - unsigned int bands_set = 0; - - mutex_lock(®_mutex); - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - if (!wiphy->bands[band]) - continue; - handle_band_custom(wiphy, band, regd); - bands_set++; - } - mutex_unlock(®_mutex); - - /* - * no point in calling this if it won't have any effect - * on your device's supportd bands. - */ - WARN_ON(!bands_set); -} -EXPORT_SYMBOL(wiphy_apply_custom_regulatory); - -/* - * Return value which can be used by ignore_request() to indicate - * it has been determined we should intersect two regulatory domains - */ -#define REG_INTERSECT 1 - -/* This has the logic which determines when a new request - * should be ignored. */ -static int ignore_request(struct wiphy *wiphy, - struct regulatory_request *pending_request) -{ - struct wiphy *last_wiphy = NULL; - - assert_cfg80211_lock(); - - /* All initial requests are respected */ - if (!last_request) - return 0; - - switch (pending_request->initiator) { - case NL80211_REGDOM_SET_BY_CORE: - return 0; - case NL80211_REGDOM_SET_BY_COUNTRY_IE: - - last_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); - - if (unlikely(!is_an_alpha2(pending_request->alpha2))) - return -EINVAL; - if (last_request->initiator == - NL80211_REGDOM_SET_BY_COUNTRY_IE) { - if (last_wiphy != wiphy) { - /* - * Two cards with two APs claiming different - * Country IE alpha2s. We could - * intersect them, but that seems unlikely - * to be correct. Reject second one for now. - */ - if (regdom_changes(pending_request->alpha2)) - return -EOPNOTSUPP; - return -EALREADY; - } - /* - * Two consecutive Country IE hints on the same wiphy. - * This should be picked up early by the driver/stack - */ - if (WARN_ON(regdom_changes(pending_request->alpha2))) - return 0; - return -EALREADY; - } - return 0; - case NL80211_REGDOM_SET_BY_DRIVER: - if (last_request->initiator == NL80211_REGDOM_SET_BY_CORE) { - if (regdom_changes(pending_request->alpha2)) - return 0; - return -EALREADY; - } - - /* - * This would happen if you unplug and plug your card - * back in or if you add a new device for which the previously - * loaded card also agrees on the regulatory domain. - */ - if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER && - !regdom_changes(pending_request->alpha2)) - return -EALREADY; - - return REG_INTERSECT; - case NL80211_REGDOM_SET_BY_USER: - if (last_request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) - return REG_INTERSECT; - /* - * If the user knows better the user should set the regdom - * to their country before the IE is picked up - */ - if (last_request->initiator == NL80211_REGDOM_SET_BY_USER && - last_request->intersect) - return -EOPNOTSUPP; - /* - * Process user requests only after previous user/driver/core - * requests have been processed - */ - if (last_request->initiator == NL80211_REGDOM_SET_BY_CORE || - last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER || - last_request->initiator == NL80211_REGDOM_SET_BY_USER) { - if (regdom_changes(last_request->alpha2)) - return -EAGAIN; - } - - if (!regdom_changes(pending_request->alpha2)) - return -EALREADY; - - return 0; - } - - return -EINVAL; -} - -static void reg_set_request_processed(void) -{ - bool need_more_processing = false; - - last_request->processed = true; - - spin_lock(®_requests_lock); - if (!list_empty(®_requests_list)) - need_more_processing = true; - spin_unlock(®_requests_lock); - - if (last_request->initiator == NL80211_REGDOM_SET_BY_USER) - cancel_delayed_work_sync(®_timeout); - - if (need_more_processing) - schedule_work(®_work); -} - -/** - * __regulatory_hint - hint to the wireless core a regulatory domain - * @wiphy: if the hint comes from country information from an AP, this - * is required to be set to the wiphy that received the information - * @pending_request: the regulatory request currently being processed - * - * The Wireless subsystem can use this function to hint to the wireless core - * what it believes should be the current regulatory domain. - * - * Returns zero if all went fine, %-EALREADY if a regulatory domain had - * already been set or other standard error codes. - * - * Caller must hold &cfg80211_mutex and ®_mutex - */ -static int __regulatory_hint(struct wiphy *wiphy, - struct regulatory_request *pending_request) -{ - bool intersect = false; - int r = 0; - - assert_cfg80211_lock(); - - r = ignore_request(wiphy, pending_request); - - if (r == REG_INTERSECT) { - if (pending_request->initiator == - NL80211_REGDOM_SET_BY_DRIVER) { - r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain); - if (r) { - kfree(pending_request); - return r; - } - } - intersect = true; - } else if (r) { - /* - * If the regulatory domain being requested by the - * driver has already been set just copy it to the - * wiphy - */ - if (r == -EALREADY && - pending_request->initiator == - NL80211_REGDOM_SET_BY_DRIVER) { - r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain); - if (r) { - kfree(pending_request); - return r; - } - r = -EALREADY; - goto new_request; - } - kfree(pending_request); - return r; - } - -new_request: - if (last_request != &core_request_world) - kfree(last_request); - - last_request = pending_request; - last_request->intersect = intersect; - - pending_request = NULL; - - if (last_request->initiator == NL80211_REGDOM_SET_BY_USER) { - user_alpha2[0] = last_request->alpha2[0]; - user_alpha2[1] = last_request->alpha2[1]; - } - - /* When r == REG_INTERSECT we do need to call CRDA */ - if (r < 0) { - /* - * Since CRDA will not be called in this case as we already - * have applied the requested regulatory domain before we just - * inform userspace we have processed the request - */ - if (r == -EALREADY) { - nl80211_send_reg_change_event(last_request); - reg_set_request_processed(); - } - return r; - } - - return call_crda(last_request->alpha2); -} - -/* This processes *all* regulatory hints */ -static void reg_process_hint(struct regulatory_request *reg_request, - enum nl80211_reg_initiator reg_initiator) -{ - int r = 0; - struct wiphy *wiphy = NULL; - - BUG_ON(!reg_request->alpha2); - - if (wiphy_idx_valid(reg_request->wiphy_idx)) - wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); - - if (reg_initiator == NL80211_REGDOM_SET_BY_DRIVER && - !wiphy) { - kfree(reg_request); - return; - } - - r = __regulatory_hint(wiphy, reg_request); - /* This is required so that the orig_* parameters are saved */ - if (r == -EALREADY && wiphy && - wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) { - wiphy_update_regulatory(wiphy, reg_initiator); - return; - } - - /* - * We only time out user hints, given that they should be the only - * source of bogus requests. - */ - if (r != -EALREADY && - reg_initiator == NL80211_REGDOM_SET_BY_USER) - schedule_delayed_work(®_timeout, msecs_to_jiffies(3142)); -} - -/* - * Processes regulatory hints, this is all the NL80211_REGDOM_SET_BY_* - * Regulatory hints come on a first come first serve basis and we - * must process each one atomically. - */ -static void reg_process_pending_hints(void) -{ - struct regulatory_request *reg_request; - - mutex_lock(&cfg80211_mutex); - mutex_lock(®_mutex); - - /* When last_request->processed becomes true this will be rescheduled */ - if (last_request && !last_request->processed) { - REG_DBG_PRINT("Pending regulatory request, waiting " - "for it to be processed...\n"); - goto out; - } - - spin_lock(®_requests_lock); - - if (list_empty(®_requests_list)) { - spin_unlock(®_requests_lock); - goto out; - } - - reg_request = list_first_entry(®_requests_list, - struct regulatory_request, - list); - list_del_init(®_request->list); - - spin_unlock(®_requests_lock); - - reg_process_hint(reg_request, reg_request->initiator); - -out: - mutex_unlock(®_mutex); - mutex_unlock(&cfg80211_mutex); -} - -/* Processes beacon hints -- this has nothing to do with country IEs */ -static void reg_process_pending_beacon_hints(void) -{ - struct cfg80211_registered_device *rdev; - struct reg_beacon *pending_beacon, *tmp; - - /* - * No need to hold the reg_mutex here as we just touch wiphys - * and do not read or access regulatory variables. - */ - mutex_lock(&cfg80211_mutex); - - /* This goes through the _pending_ beacon list */ - spin_lock_bh(®_pending_beacons_lock); - - if (list_empty(®_pending_beacons)) { - spin_unlock_bh(®_pending_beacons_lock); - goto out; - } - - list_for_each_entry_safe(pending_beacon, tmp, - ®_pending_beacons, list) { - - list_del_init(&pending_beacon->list); - - /* Applies the beacon hint to current wiphys */ - list_for_each_entry(rdev, &cfg80211_rdev_list, list) - wiphy_update_new_beacon(&rdev->wiphy, pending_beacon); - - /* Remembers the beacon hint for new wiphys or reg changes */ - list_add_tail(&pending_beacon->list, ®_beacon_list); - } - - spin_unlock_bh(®_pending_beacons_lock); -out: - mutex_unlock(&cfg80211_mutex); -} - -static void reg_todo(struct work_struct *work) -{ - reg_process_pending_hints(); - reg_process_pending_beacon_hints(); -} - -static void queue_regulatory_request(struct regulatory_request *request) -{ - if (isalpha(request->alpha2[0])) - request->alpha2[0] = toupper(request->alpha2[0]); - if (isalpha(request->alpha2[1])) - request->alpha2[1] = toupper(request->alpha2[1]); - - spin_lock(®_requests_lock); - list_add_tail(&request->list, ®_requests_list); - spin_unlock(®_requests_lock); - - schedule_work(®_work); -} - -/* - * Core regulatory hint -- happens during cfg80211_init() - * and when we restore regulatory settings. - */ -static int regulatory_hint_core(const char *alpha2) -{ - struct regulatory_request *request; - - request = kzalloc(sizeof(struct regulatory_request), - GFP_KERNEL); - if (!request) - return -ENOMEM; - - request->alpha2[0] = alpha2[0]; - request->alpha2[1] = alpha2[1]; - request->initiator = NL80211_REGDOM_SET_BY_CORE; - - queue_regulatory_request(request); - - return 0; -} - -/* User hints */ -int regulatory_hint_user(const char *alpha2) -{ - struct regulatory_request *request; - - BUG_ON(!alpha2); - - request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); - if (!request) - return -ENOMEM; - - request->wiphy_idx = WIPHY_IDX_STALE; - request->alpha2[0] = alpha2[0]; - request->alpha2[1] = alpha2[1]; - request->initiator = NL80211_REGDOM_SET_BY_USER; - - queue_regulatory_request(request); - - return 0; -} - -/* Driver hints */ -int regulatory_hint(struct wiphy *wiphy, const char *alpha2) -{ - struct regulatory_request *request; - - BUG_ON(!alpha2); - BUG_ON(!wiphy); - - request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); - if (!request) - return -ENOMEM; - - request->wiphy_idx = get_wiphy_idx(wiphy); - - /* Must have registered wiphy first */ - BUG_ON(!wiphy_idx_valid(request->wiphy_idx)); - - request->alpha2[0] = alpha2[0]; - request->alpha2[1] = alpha2[1]; - request->initiator = NL80211_REGDOM_SET_BY_DRIVER; - - queue_regulatory_request(request); - - return 0; -} -EXPORT_SYMBOL(regulatory_hint); - -/* - * We hold wdev_lock() here so we cannot hold cfg80211_mutex() and - * therefore cannot iterate over the rdev list here. - */ -void regulatory_hint_11d(struct wiphy *wiphy, - enum ieee80211_band band, - u8 *country_ie, - u8 country_ie_len) -{ - char alpha2[2]; - enum environment_cap env = ENVIRON_ANY; - struct regulatory_request *request; - - mutex_lock(®_mutex); - - if (unlikely(!last_request)) - goto out; - - /* IE len must be evenly divisible by 2 */ - if (country_ie_len & 0x01) - goto out; - - if (country_ie_len < IEEE80211_COUNTRY_IE_MIN_LEN) - goto out; - - alpha2[0] = country_ie[0]; - alpha2[1] = country_ie[1]; - - if (country_ie[2] == 'I') - env = ENVIRON_INDOOR; - else if (country_ie[2] == 'O') - env = ENVIRON_OUTDOOR; - - /* - * We will run this only upon a successful connection on cfg80211. - * We leave conflict resolution to the workqueue, where can hold - * cfg80211_mutex. - */ - if (likely(last_request->initiator == - NL80211_REGDOM_SET_BY_COUNTRY_IE && - wiphy_idx_valid(last_request->wiphy_idx))) - goto out; - - request = kzalloc(sizeof(struct regulatory_request), GFP_KERNEL); - if (!request) - goto out; - - request->wiphy_idx = get_wiphy_idx(wiphy); - request->alpha2[0] = alpha2[0]; - request->alpha2[1] = alpha2[1]; - request->initiator = NL80211_REGDOM_SET_BY_COUNTRY_IE; - request->country_ie_env = env; - - mutex_unlock(®_mutex); - - queue_regulatory_request(request); - - return; - -out: - mutex_unlock(®_mutex); -} - -static void restore_alpha2(char *alpha2, bool reset_user) -{ - /* indicates there is no alpha2 to consider for restoration */ - alpha2[0] = '9'; - alpha2[1] = '7'; - - /* The user setting has precedence over the module parameter */ - if (is_user_regdom_saved()) { - /* Unless we're asked to ignore it and reset it */ - if (reset_user) { - REG_DBG_PRINT("Restoring regulatory settings " - "including user preference\n"); - user_alpha2[0] = '9'; - user_alpha2[1] = '7'; - - /* - * If we're ignoring user settings, we still need to - * check the module parameter to ensure we put things - * back as they were for a full restore. - */ - if (!is_world_regdom(ieee80211_regdom)) { - REG_DBG_PRINT("Keeping preference on " - "module parameter ieee80211_regdom: %c%c\n", - ieee80211_regdom[0], - ieee80211_regdom[1]); - alpha2[0] = ieee80211_regdom[0]; - alpha2[1] = ieee80211_regdom[1]; - } - } else { - REG_DBG_PRINT("Restoring regulatory settings " - "while preserving user preference for: %c%c\n", - user_alpha2[0], - user_alpha2[1]); - alpha2[0] = user_alpha2[0]; - alpha2[1] = user_alpha2[1]; - } - } else if (!is_world_regdom(ieee80211_regdom)) { - REG_DBG_PRINT("Keeping preference on " - "module parameter ieee80211_regdom: %c%c\n", - ieee80211_regdom[0], - ieee80211_regdom[1]); - alpha2[0] = ieee80211_regdom[0]; - alpha2[1] = ieee80211_regdom[1]; - } else - REG_DBG_PRINT("Restoring regulatory settings\n"); -} - -static void restore_custom_reg_settings(struct wiphy *wiphy) -{ - struct ieee80211_supported_band *sband; - enum ieee80211_band band; - struct ieee80211_channel *chan; - int i; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - sband = wiphy->bands[band]; - if (!sband) - continue; - for (i = 0; i < sband->n_channels; i++) { - chan = &sband->channels[i]; - chan->flags = chan->orig_flags; - chan->max_antenna_gain = chan->orig_mag; - chan->max_power = chan->orig_mpwr; - } - } -} - -/* - * Restoring regulatory settings involves ingoring any - * possibly stale country IE information and user regulatory - * settings if so desired, this includes any beacon hints - * learned as we could have traveled outside to another country - * after disconnection. To restore regulatory settings we do - * exactly what we did at bootup: - * - * - send a core regulatory hint - * - send a user regulatory hint if applicable - * - * Device drivers that send a regulatory hint for a specific country - * keep their own regulatory domain on wiphy->regd so that does does - * not need to be remembered. - */ -static void restore_regulatory_settings(bool reset_user) -{ - char alpha2[2]; - char world_alpha2[2]; - struct reg_beacon *reg_beacon, *btmp; - struct regulatory_request *reg_request, *tmp; - LIST_HEAD(tmp_reg_req_list); - struct cfg80211_registered_device *rdev; - - mutex_lock(&cfg80211_mutex); - mutex_lock(®_mutex); - - reset_regdomains(true); - restore_alpha2(alpha2, reset_user); - - /* - * If there's any pending requests we simply - * stash them to a temporary pending queue and - * add then after we've restored regulatory - * settings. - */ - spin_lock(®_requests_lock); - if (!list_empty(®_requests_list)) { - list_for_each_entry_safe(reg_request, tmp, - ®_requests_list, list) { - if (reg_request->initiator != - NL80211_REGDOM_SET_BY_USER) - continue; - list_del(®_request->list); - list_add_tail(®_request->list, &tmp_reg_req_list); - } - } - spin_unlock(®_requests_lock); - - /* Clear beacon hints */ - spin_lock_bh(®_pending_beacons_lock); - if (!list_empty(®_pending_beacons)) { - list_for_each_entry_safe(reg_beacon, btmp, - ®_pending_beacons, list) { - list_del(®_beacon->list); - kfree(reg_beacon); - } - } - spin_unlock_bh(®_pending_beacons_lock); - - if (!list_empty(®_beacon_list)) { - list_for_each_entry_safe(reg_beacon, btmp, - ®_beacon_list, list) { - list_del(®_beacon->list); - kfree(reg_beacon); - } - } - - /* First restore to the basic regulatory settings */ - cfg80211_regdomain = cfg80211_world_regdom; - world_alpha2[0] = cfg80211_regdomain->alpha2[0]; - world_alpha2[1] = cfg80211_regdomain->alpha2[1]; - - list_for_each_entry(rdev, &cfg80211_rdev_list, list) { - if (rdev->wiphy.flags & WIPHY_FLAG_CUSTOM_REGULATORY) - restore_custom_reg_settings(&rdev->wiphy); - } - - mutex_unlock(®_mutex); - mutex_unlock(&cfg80211_mutex); - - regulatory_hint_core(world_alpha2); - - /* - * This restores the ieee80211_regdom module parameter - * preference or the last user requested regulatory - * settings, user regulatory settings takes precedence. - */ - if (is_an_alpha2(alpha2)) - regulatory_hint_user(user_alpha2); - - if (list_empty(&tmp_reg_req_list)) - return; - - mutex_lock(&cfg80211_mutex); - mutex_lock(®_mutex); - - spin_lock(®_requests_lock); - list_for_each_entry_safe(reg_request, tmp, &tmp_reg_req_list, list) { - REG_DBG_PRINT("Adding request for country %c%c back " - "into the queue\n", - reg_request->alpha2[0], - reg_request->alpha2[1]); - list_del(®_request->list); - list_add_tail(®_request->list, ®_requests_list); - } - spin_unlock(®_requests_lock); - - mutex_unlock(®_mutex); - mutex_unlock(&cfg80211_mutex); - - REG_DBG_PRINT("Kicking the queue\n"); - - schedule_work(®_work); -} - -void regulatory_hint_disconnect(void) -{ - REG_DBG_PRINT("All devices are disconnected, going to " - "restore regulatory settings\n"); - restore_regulatory_settings(false); -} - -static bool freq_is_chan_12_13_14(u16 freq) -{ - if (freq == ieee80211_channel_to_frequency(12, IEEE80211_BAND_2GHZ) || - freq == ieee80211_channel_to_frequency(13, IEEE80211_BAND_2GHZ) || - freq == ieee80211_channel_to_frequency(14, IEEE80211_BAND_2GHZ)) - return true; - return false; -} - -int regulatory_hint_found_beacon(struct wiphy *wiphy, - struct ieee80211_channel *beacon_chan, - gfp_t gfp) -{ - struct reg_beacon *reg_beacon; - - if (likely((beacon_chan->beacon_found || - (beacon_chan->flags & IEEE80211_CHAN_RADAR) || - (beacon_chan->band == IEEE80211_BAND_2GHZ && - !freq_is_chan_12_13_14(beacon_chan->center_freq))))) - return 0; - - reg_beacon = kzalloc(sizeof(struct reg_beacon), gfp); - if (!reg_beacon) - return -ENOMEM; - - REG_DBG_PRINT("Found new beacon on " - "frequency: %d MHz (Ch %d) on %s\n", - beacon_chan->center_freq, - ieee80211_frequency_to_channel(beacon_chan->center_freq), - wiphy_name(wiphy)); - - memcpy(®_beacon->chan, beacon_chan, - sizeof(struct ieee80211_channel)); - - - /* - * Since we can be called from BH or and non-BH context - * we must use spin_lock_bh() - */ - spin_lock_bh(®_pending_beacons_lock); - list_add_tail(®_beacon->list, ®_pending_beacons); - spin_unlock_bh(®_pending_beacons_lock); - - schedule_work(®_work); - - return 0; -} - -static void print_rd_rules(const struct ieee80211_regdomain *rd) -{ - unsigned int i; - const struct ieee80211_reg_rule *reg_rule = NULL; - const struct ieee80211_freq_range *freq_range = NULL; - const struct ieee80211_power_rule *power_rule = NULL; - - pr_info(" (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)\n"); - - for (i = 0; i < rd->n_reg_rules; i++) { - reg_rule = &rd->reg_rules[i]; - freq_range = ®_rule->freq_range; - power_rule = ®_rule->power_rule; - - /* - * There may not be documentation for max antenna gain - * in certain regions - */ - if (power_rule->max_antenna_gain) - pr_info(" (%d KHz - %d KHz @ %d KHz), (%d mBi, %d mBm)\n", - freq_range->start_freq_khz, - freq_range->end_freq_khz, - freq_range->max_bandwidth_khz, - power_rule->max_antenna_gain, - power_rule->max_eirp); - else - pr_info(" (%d KHz - %d KHz @ %d KHz), (N/A, %d mBm)\n", - freq_range->start_freq_khz, - freq_range->end_freq_khz, - freq_range->max_bandwidth_khz, - power_rule->max_eirp); - } -} - -bool reg_supported_dfs_region(u8 dfs_region) -{ - switch (dfs_region) { - case NL80211_DFS_UNSET: - case NL80211_DFS_FCC: - case NL80211_DFS_ETSI: - case NL80211_DFS_JP: - return true; - default: - REG_DBG_PRINT("Ignoring uknown DFS master region: %d\n", - dfs_region); - return false; - } -} - -static void print_dfs_region(u8 dfs_region) -{ - if (!dfs_region) - return; - - switch (dfs_region) { - case NL80211_DFS_FCC: - pr_info(" DFS Master region FCC"); - break; - case NL80211_DFS_ETSI: - pr_info(" DFS Master region ETSI"); - break; - case NL80211_DFS_JP: - pr_info(" DFS Master region JP"); - break; - default: - pr_info(" DFS Master region Uknown"); - break; - } -} - -static void print_regdomain(const struct ieee80211_regdomain *rd) -{ - - if (is_intersected_alpha2(rd->alpha2)) { - - if (last_request->initiator == - NL80211_REGDOM_SET_BY_COUNTRY_IE) { - struct cfg80211_registered_device *rdev; - rdev = cfg80211_rdev_by_wiphy_idx( - last_request->wiphy_idx); - if (rdev) { - pr_info("Current regulatory domain updated by AP to: %c%c\n", - rdev->country_ie_alpha2[0], - rdev->country_ie_alpha2[1]); - } else - pr_info("Current regulatory domain intersected:\n"); - } else - pr_info("Current regulatory domain intersected:\n"); - } else if (is_world_regdom(rd->alpha2)) - pr_info("World regulatory domain updated:\n"); - else { - if (is_unknown_alpha2(rd->alpha2)) - pr_info("Regulatory domain changed to driver built-in settings (unknown country)\n"); - else - pr_info("Regulatory domain changed to country: %c%c\n", - rd->alpha2[0], rd->alpha2[1]); - } - print_dfs_region(rd->dfs_region); - print_rd_rules(rd); -} - -static void print_regdomain_info(const struct ieee80211_regdomain *rd) -{ - pr_info("Regulatory domain: %c%c\n", rd->alpha2[0], rd->alpha2[1]); - print_rd_rules(rd); -} - -/* Takes ownership of rd only if it doesn't fail */ -static int __set_regdom(const struct ieee80211_regdomain *rd) -{ - const struct ieee80211_regdomain *intersected_rd = NULL; - struct cfg80211_registered_device *rdev = NULL; - struct wiphy *request_wiphy; - /* Some basic sanity checks first */ - - if (is_world_regdom(rd->alpha2)) { - if (WARN_ON(!reg_is_valid_request(rd->alpha2))) - return -EINVAL; - update_world_regdomain(rd); - return 0; - } - - if (!is_alpha2_set(rd->alpha2) && !is_an_alpha2(rd->alpha2) && - !is_unknown_alpha2(rd->alpha2)) - return -EINVAL; - - if (!last_request) - return -EINVAL; - - /* - * Lets only bother proceeding on the same alpha2 if the current - * rd is non static (it means CRDA was present and was used last) - * and the pending request came in from a country IE - */ - if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) { - /* - * If someone else asked us to change the rd lets only bother - * checking if the alpha2 changes if CRDA was already called - */ - if (!regdom_changes(rd->alpha2)) - return -EINVAL; - } - - /* - * Now lets set the regulatory domain, update all driver channels - * and finally inform them of what we have done, in case they want - * to review or adjust their own settings based on their own - * internal EEPROM data - */ - - if (WARN_ON(!reg_is_valid_request(rd->alpha2))) - return -EINVAL; - - if (!is_valid_rd(rd)) { - pr_err("Invalid regulatory domain detected:\n"); - print_regdomain_info(rd); - return -EINVAL; - } - - request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); - if (!request_wiphy && - (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER || - last_request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE)) { - schedule_delayed_work(®_timeout, 0); - return -ENODEV; - } - - if (!last_request->intersect) { - int r; - - if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) { - reset_regdomains(false); - cfg80211_regdomain = rd; - return 0; - } - - /* - * For a driver hint, lets copy the regulatory domain the - * driver wanted to the wiphy to deal with conflicts - */ - - /* - * Userspace could have sent two replies with only - * one kernel request. - */ - if (request_wiphy->regd) - return -EALREADY; - - r = reg_copy_regd(&request_wiphy->regd, rd); - if (r) - return r; - - reset_regdomains(false); - cfg80211_regdomain = rd; - return 0; - } - - /* Intersection requires a bit more work */ - - if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) { - - intersected_rd = regdom_intersect(rd, cfg80211_regdomain); - if (!intersected_rd) - return -EINVAL; - - /* - * We can trash what CRDA provided now. - * However if a driver requested this specific regulatory - * domain we keep it for its private use - */ - if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER) - request_wiphy->regd = rd; - else - kfree(rd); - - rd = NULL; - - reset_regdomains(false); - cfg80211_regdomain = intersected_rd; - - return 0; - } - - if (!intersected_rd) - return -EINVAL; - - rdev = wiphy_to_dev(request_wiphy); - - rdev->country_ie_alpha2[0] = rd->alpha2[0]; - rdev->country_ie_alpha2[1] = rd->alpha2[1]; - rdev->env = last_request->country_ie_env; - - BUG_ON(intersected_rd == rd); - - kfree(rd); - rd = NULL; - - reset_regdomains(false); - cfg80211_regdomain = intersected_rd; - - return 0; -} - - -/* - * Use this call to set the current regulatory domain. Conflicts with - * multiple drivers can be ironed out later. Caller must've already - * kmalloc'd the rd structure. Caller must hold cfg80211_mutex - */ -int set_regdom(const struct ieee80211_regdomain *rd) -{ - int r; - - assert_cfg80211_lock(); - - mutex_lock(®_mutex); - - /* Note that this doesn't update the wiphys, this is done below */ - r = __set_regdom(rd); - if (r) { - kfree(rd); - mutex_unlock(®_mutex); - return r; - } - - /* This would make this whole thing pointless */ - if (!last_request->intersect) - BUG_ON(rd != cfg80211_regdomain); - - /* update all wiphys now with the new established regulatory domain */ - update_all_wiphy_regulatory(last_request->initiator); - - print_regdomain(cfg80211_regdomain); - - nl80211_send_reg_change_event(last_request); - - reg_set_request_processed(); - - mutex_unlock(®_mutex); - - return r; -} - -#ifdef CONFIG_HOTPLUG -int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env) -{ - if (last_request && !last_request->processed) { - if (add_uevent_var(env, "COUNTRY=%c%c", - last_request->alpha2[0], - last_request->alpha2[1])) - return -ENOMEM; - } - - return 0; -} -#else -int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env) -{ - return -ENODEV; -} -#endif /* CONFIG_HOTPLUG */ - -/* Caller must hold cfg80211_mutex */ -void reg_device_remove(struct wiphy *wiphy) -{ - struct wiphy *request_wiphy = NULL; - - assert_cfg80211_lock(); - - mutex_lock(®_mutex); - - kfree(wiphy->regd); - - if (last_request) - request_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); - - if (!request_wiphy || request_wiphy != wiphy) - goto out; - - last_request->wiphy_idx = WIPHY_IDX_STALE; - last_request->country_ie_env = ENVIRON_ANY; -out: - mutex_unlock(®_mutex); -} - -static void reg_timeout_work(struct work_struct *work) -{ - REG_DBG_PRINT("Timeout while waiting for CRDA to reply, " - "restoring regulatory settings\n"); - restore_regulatory_settings(true); -} - -int __init regulatory_init(void) -{ - int err = 0; - - reg_pdev = platform_device_register_simple("regulatory", 0, NULL, 0); - if (IS_ERR(reg_pdev)) - return PTR_ERR(reg_pdev); - - reg_pdev->dev.type = ®_device_type; - - spin_lock_init(®_requests_lock); - spin_lock_init(®_pending_beacons_lock); - - cfg80211_regdomain = cfg80211_world_regdom; - - user_alpha2[0] = '9'; - user_alpha2[1] = '7'; - - /* We always try to get an update for the static regdomain */ - err = regulatory_hint_core(cfg80211_regdomain->alpha2); - if (err) { - if (err == -ENOMEM) - return err; - /* - * N.B. kobject_uevent_env() can fail mainly for when we're out - * memory which is handled and propagated appropriately above - * but it can also fail during a netlink_broadcast() or during - * early boot for call_usermodehelper(). For now treat these - * errors as non-fatal. - */ - pr_err("kobject_uevent_env() was unable to call CRDA during init\n"); -#ifdef CONFIG_CFG80211_REG_DEBUG - /* We want to find out exactly why when debugging */ - WARN_ON(err); -#endif - } - - /* - * Finally, if the user set the module parameter treat it - * as a user hint. - */ - if (!is_world_regdom(ieee80211_regdom)) - regulatory_hint_user(ieee80211_regdom); - - return 0; -} - -void /* __init_or_exit */ regulatory_exit(void) -{ - struct regulatory_request *reg_request, *tmp; - struct reg_beacon *reg_beacon, *btmp; - - cancel_work_sync(®_work); - cancel_delayed_work_sync(®_timeout); - - mutex_lock(&cfg80211_mutex); - mutex_lock(®_mutex); - - reset_regdomains(true); - - dev_set_uevent_suppress(®_pdev->dev, true); - - platform_device_unregister(reg_pdev); - - spin_lock_bh(®_pending_beacons_lock); - if (!list_empty(®_pending_beacons)) { - list_for_each_entry_safe(reg_beacon, btmp, - ®_pending_beacons, list) { - list_del(®_beacon->list); - kfree(reg_beacon); - } - } - spin_unlock_bh(®_pending_beacons_lock); - - if (!list_empty(®_beacon_list)) { - list_for_each_entry_safe(reg_beacon, btmp, - ®_beacon_list, list) { - list_del(®_beacon->list); - kfree(reg_beacon); - } - } - - spin_lock(®_requests_lock); - if (!list_empty(®_requests_list)) { - list_for_each_entry_safe(reg_request, tmp, - ®_requests_list, list) { - list_del(®_request->list); - kfree(reg_request); - } - } - spin_unlock(®_requests_lock); - - mutex_unlock(®_mutex); - mutex_unlock(&cfg80211_mutex); -} diff --git a/openairITS/mac/DOT11/net/wireless/reg.h b/openairITS/mac/DOT11/net/wireless/reg.h deleted file mode 100644 index e2aaaf525a2..00000000000 --- a/openairITS/mac/DOT11/net/wireless/reg.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef __NET_WIRELESS_REG_H -#define __NET_WIRELESS_REG_H -/* - * Copyright 2008-2011 Luis R. Rodriguez <mcgrof@qca.qualcomm.com> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -extern const struct ieee80211_regdomain *cfg80211_regdomain; - -bool is_world_regdom(const char *alpha2); -bool reg_is_valid_request(const char *alpha2); -bool reg_supported_dfs_region(u8 dfs_region); - -int regulatory_hint_user(const char *alpha2); - -int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env); -void reg_device_remove(struct wiphy *wiphy); - -int __init regulatory_init(void); -void regulatory_exit(void); - -int set_regdom(const struct ieee80211_regdomain *rd); - -void regulatory_update(struct wiphy *wiphy, enum nl80211_reg_initiator setby); - -/** - * regulatory_hint_found_beacon - hints a beacon was found on a channel - * @wiphy: the wireless device where the beacon was found on - * @beacon_chan: the channel on which the beacon was found on - * @gfp: context flags - * - * This informs the wireless core that a beacon from an AP was found on - * the channel provided. This allows the wireless core to make educated - * guesses on regulatory to help with world roaming. This is only used for - * world roaming -- when we do not know our current location. This is - * only useful on channels 12, 13 and 14 on the 2 GHz band as channels - * 1-11 are already enabled by the world regulatory domain; and on - * non-radar 5 GHz channels. - * - * Drivers do not need to call this, cfg80211 will do it for after a scan - * on a newly found BSS. If you cannot make use of this feature you can - * set the wiphy->disable_beacon_hints to true. - */ -int regulatory_hint_found_beacon(struct wiphy *wiphy, - struct ieee80211_channel *beacon_chan, - gfp_t gfp); - -/** - * regulatory_hint_11d - hints a country IE as a regulatory domain - * @wiphy: the wireless device giving the hint (used only for reporting - * conflicts) - * @band: the band on which the country IE was received on. This determines - * the band we'll process the country IE channel triplets for. - * @country_ie: pointer to the country IE - * @country_ie_len: length of the country IE - * - * We will intersect the rd with the what CRDA tells us should apply - * for the alpha2 this country IE belongs to, this prevents APs from - * sending us incorrect or outdated information against a country. - * - * The AP is expected to provide Country IE channel triplets for the - * band it is on. It is technically possible for APs to send channel - * country IE triplets even for channels outside of the band they are - * in but for that they would have to use the regulatory extension - * in combination with a triplet but this behaviour is currently - * not observed. For this reason if a triplet is seen with channel - * information for a band the BSS is not present in it will be ignored. - */ -void regulatory_hint_11d(struct wiphy *wiphy, - enum ieee80211_band band, - u8 *country_ie, - u8 country_ie_len); - -/** - * regulatory_hint_disconnect - informs all devices have been disconneted - * - * Regulotory rules can be enhanced further upon scanning and upon - * connection to an AP. These rules become stale if we disconnect - * and go to another country, whether or not we suspend and resume. - * If we suspend, go to another country and resume we'll automatically - * get disconnected shortly after resuming and things will be reset as well. - * This routine is a helper to restore regulatory settings to how they were - * prior to our first connect attempt. This includes ignoring country IE and - * beacon regulatory hints. The ieee80211_regdom module parameter will always - * be respected but if a user had set the regulatory domain that will take - * precedence. - * - * Must be called from process context. - */ -void regulatory_hint_disconnect(void); - -#endif /* __NET_WIRELESS_REG_H */ diff --git a/openairITS/mac/DOT11/net/wireless/regdb.h b/openairITS/mac/DOT11/net/wireless/regdb.h deleted file mode 100644 index 3279cfcefb0..00000000000 --- a/openairITS/mac/DOT11/net/wireless/regdb.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __REGDB_H__ -#define __REGDB_H__ - -/* - * Copyright 2009 John W. Linville <linville@tuxdriver.com> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -extern const struct ieee80211_regdomain *reg_regdb[]; -extern int reg_regdb_size; - -#endif /* __REGDB_H__ */ diff --git a/openairITS/mac/DOT11/net/wireless/scan.c b/openairITS/mac/DOT11/net/wireless/scan.c deleted file mode 100644 index 89918246645..00000000000 --- a/openairITS/mac/DOT11/net/wireless/scan.c +++ /dev/null @@ -1,1366 +0,0 @@ -/* - * cfg80211 scan result handling - * - * Copyright 2008 Johannes Berg <johannes@sipsolutions.net> - */ -#include <linux/kernel.h> -#include <linux/slab.h> -#include <linux/module.h> -#include <linux/netdevice.h> -#include <linux/wireless.h> -#include <linux/nl80211.h> -#include <linux/etherdevice.h> -#include <net/arp.h> -#include <net/cfg80211.h> -#include <net/cfg80211-wext.h> -#include <net/iw_handler.h> -#include "core.h" -#include "nl80211.h" -#include "wext-compat.h" - -#define IEEE80211_SCAN_RESULT_EXPIRE (15 * HZ) - -void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak) -{ - struct cfg80211_scan_request *request; - struct net_device *dev; -#ifdef CONFIG_CFG80211_WEXT - union iwreq_data wrqu; -#endif - - ASSERT_RDEV_LOCK(rdev); - - request = rdev->scan_req; - - if (!request) - return; - - dev = request->dev; - - /* - * This must be before sending the other events! - * Otherwise, wpa_supplicant gets completely confused with - * wext events. - */ - cfg80211_sme_scan_done(dev); - - if (request->aborted) - nl80211_send_scan_aborted(rdev, dev); - else - nl80211_send_scan_done(rdev, dev); - -#ifdef CONFIG_CFG80211_WEXT - if (!request->aborted) { - memset(&wrqu, 0, sizeof(wrqu)); - - wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL); - } -#endif - - dev_put(dev); - - rdev->scan_req = NULL; - - /* - * OK. If this is invoked with "leak" then we can't - * free this ... but we've cleaned it up anyway. The - * driver failed to call the scan_done callback, so - * all bets are off, it might still be trying to use - * the scan request or not ... if it accesses the dev - * in there (it shouldn't anyway) then it may crash. - */ - if (!leak) - kfree(request); -} - -void __cfg80211_scan_done(struct work_struct *wk) -{ - struct cfg80211_registered_device *rdev; - - rdev = container_of(wk, struct cfg80211_registered_device, - scan_done_wk); - - cfg80211_lock_rdev(rdev); - ___cfg80211_scan_done(rdev, false); - cfg80211_unlock_rdev(rdev); -} - -void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted) -{ - WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); - - request->aborted = aborted; - queue_work(cfg80211_wq, &wiphy_to_dev(request->wiphy)->scan_done_wk); -} -EXPORT_SYMBOL(cfg80211_scan_done); - -void __cfg80211_sched_scan_results(struct work_struct *wk) -{ - struct cfg80211_registered_device *rdev; - - rdev = container_of(wk, struct cfg80211_registered_device, - sched_scan_results_wk); - - mutex_lock(&rdev->sched_scan_mtx); - - /* we don't have sched_scan_req anymore if the scan is stopping */ - if (rdev->sched_scan_req) - nl80211_send_sched_scan_results(rdev, - rdev->sched_scan_req->dev); - - mutex_unlock(&rdev->sched_scan_mtx); -} - -void cfg80211_sched_scan_results(struct wiphy *wiphy) -{ - /* ignore if we're not scanning */ - if (wiphy_to_dev(wiphy)->sched_scan_req) - queue_work(cfg80211_wq, - &wiphy_to_dev(wiphy)->sched_scan_results_wk); -} -EXPORT_SYMBOL(cfg80211_sched_scan_results); - -void cfg80211_sched_scan_stopped(struct wiphy *wiphy) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - mutex_lock(&rdev->sched_scan_mtx); - __cfg80211_stop_sched_scan(rdev, true); - mutex_unlock(&rdev->sched_scan_mtx); -} -EXPORT_SYMBOL(cfg80211_sched_scan_stopped); - -int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev, - bool driver_initiated) -{ - struct net_device *dev; - - lockdep_assert_held(&rdev->sched_scan_mtx); - - if (!rdev->sched_scan_req) - return -ENOENT; - - dev = rdev->sched_scan_req->dev; - - if (!driver_initiated) { - int err = rdev->ops->sched_scan_stop(&rdev->wiphy, dev); - if (err) - return err; - } - - nl80211_send_sched_scan(rdev, dev, NL80211_CMD_SCHED_SCAN_STOPPED); - - kfree(rdev->sched_scan_req); - rdev->sched_scan_req = NULL; - - return 0; -} - -static void bss_release(struct kref *ref) -{ - struct cfg80211_internal_bss *bss; - - bss = container_of(ref, struct cfg80211_internal_bss, ref); - if (bss->pub.free_priv) - bss->pub.free_priv(&bss->pub); - - if (bss->beacon_ies_allocated) - kfree(bss->pub.beacon_ies); - if (bss->proberesp_ies_allocated) - kfree(bss->pub.proberesp_ies); - - BUG_ON(atomic_read(&bss->hold)); - - kfree(bss); -} - -/* must hold dev->bss_lock! */ -void cfg80211_bss_age(struct cfg80211_registered_device *dev, - unsigned long age_secs) -{ - struct cfg80211_internal_bss *bss; - unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC); - - list_for_each_entry(bss, &dev->bss_list, list) { - bss->ts -= age_jiffies; - } -} - -/* must hold dev->bss_lock! */ -static void __cfg80211_unlink_bss(struct cfg80211_registered_device *dev, - struct cfg80211_internal_bss *bss) -{ - list_del_init(&bss->list); - rb_erase(&bss->rbn, &dev->bss_tree); - kref_put(&bss->ref, bss_release); -} - -/* must hold dev->bss_lock! */ -void cfg80211_bss_expire(struct cfg80211_registered_device *dev) -{ - struct cfg80211_internal_bss *bss, *tmp; - bool expired = false; - - list_for_each_entry_safe(bss, tmp, &dev->bss_list, list) { - if (atomic_read(&bss->hold)) - continue; - if (!time_after(jiffies, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE)) - continue; - __cfg80211_unlink_bss(dev, bss); - expired = true; - } - - if (expired) - dev->bss_generation++; -} - -const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) -{ - while (len > 2 && ies[0] != eid) { - len -= ies[1] + 2; - ies += ies[1] + 2; - } - if (len < 2) - return NULL; - if (len < 2 + ies[1]) - return NULL; - return ies; -} -EXPORT_SYMBOL(cfg80211_find_ie); - -const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, - const u8 *ies, int len) -{ - struct ieee80211_vendor_ie *ie; - const u8 *pos = ies, *end = ies + len; - int ie_oui; - - while (pos < end) { - pos = cfg80211_find_ie(WLAN_EID_VENDOR_SPECIFIC, pos, - end - pos); - if (!pos) - return NULL; - - if (end - pos < sizeof(*ie)) - return NULL; - - ie = (struct ieee80211_vendor_ie *)pos; - ie_oui = ie->oui[0] << 16 | ie->oui[1] << 8 | ie->oui[2]; - if (ie_oui == oui && ie->oui_type == oui_type) - return pos; - - pos += 2 + ie->len; - } - return NULL; -} -EXPORT_SYMBOL(cfg80211_find_vendor_ie); - -static int cmp_ies(u8 num, u8 *ies1, size_t len1, u8 *ies2, size_t len2) -{ - const u8 *ie1 = cfg80211_find_ie(num, ies1, len1); - const u8 *ie2 = cfg80211_find_ie(num, ies2, len2); - - /* equal if both missing */ - if (!ie1 && !ie2) - return 0; - /* sort missing IE before (left of) present IE */ - if (!ie1) - return -1; - if (!ie2) - return 1; - - /* sort by length first, then by contents */ - if (ie1[1] != ie2[1]) - return ie2[1] - ie1[1]; - return memcmp(ie1 + 2, ie2 + 2, ie1[1]); -} - -static bool is_bss(struct cfg80211_bss *a, - const u8 *bssid, - const u8 *ssid, size_t ssid_len) -{ - const u8 *ssidie; - - if (bssid && compare_ether_addr(a->bssid, bssid)) - return false; - - if (!ssid) - return true; - - ssidie = cfg80211_find_ie(WLAN_EID_SSID, - a->information_elements, - a->len_information_elements); - if (!ssidie) - return false; - if (ssidie[1] != ssid_len) - return false; - return memcmp(ssidie + 2, ssid, ssid_len) == 0; -} - -static bool is_mesh_bss(struct cfg80211_bss *a) -{ - const u8 *ie; - - if (!WLAN_CAPABILITY_IS_STA_BSS(a->capability)) - return false; - - ie = cfg80211_find_ie(WLAN_EID_MESH_ID, - a->information_elements, - a->len_information_elements); - if (!ie) - return false; - - ie = cfg80211_find_ie(WLAN_EID_MESH_CONFIG, - a->information_elements, - a->len_information_elements); - if (!ie) - return false; - - return true; -} - -static bool is_mesh(struct cfg80211_bss *a, - const u8 *meshid, size_t meshidlen, - const u8 *meshcfg) -{ - const u8 *ie; - - if (!WLAN_CAPABILITY_IS_STA_BSS(a->capability)) - return false; - - ie = cfg80211_find_ie(WLAN_EID_MESH_ID, - a->information_elements, - a->len_information_elements); - if (!ie) - return false; - if (ie[1] != meshidlen) - return false; - if (memcmp(ie + 2, meshid, meshidlen)) - return false; - - ie = cfg80211_find_ie(WLAN_EID_MESH_CONFIG, - a->information_elements, - a->len_information_elements); - if (!ie) - return false; - if (ie[1] != sizeof(struct ieee80211_meshconf_ie)) - return false; - - /* - * Ignore mesh capability (last two bytes of the IE) when - * comparing since that may differ between stations taking - * part in the same mesh. - */ - return memcmp(ie + 2, meshcfg, - sizeof(struct ieee80211_meshconf_ie) - 2) == 0; -} - -static int cmp_bss_core(struct cfg80211_bss *a, - struct cfg80211_bss *b) -{ - int r; - - if (a->channel != b->channel) - return b->channel->center_freq - a->channel->center_freq; - - if (is_mesh_bss(a) && is_mesh_bss(b)) { - r = cmp_ies(WLAN_EID_MESH_ID, - a->information_elements, - a->len_information_elements, - b->information_elements, - b->len_information_elements); - if (r) - return r; - return cmp_ies(WLAN_EID_MESH_CONFIG, - a->information_elements, - a->len_information_elements, - b->information_elements, - b->len_information_elements); - } - - return memcmp(a->bssid, b->bssid, ETH_ALEN); -} - -static int cmp_bss(struct cfg80211_bss *a, - struct cfg80211_bss *b) -{ - int r; - - r = cmp_bss_core(a, b); - if (r) - return r; - - return cmp_ies(WLAN_EID_SSID, - a->information_elements, - a->len_information_elements, - b->information_elements, - b->len_information_elements); -} - -static int cmp_hidden_bss(struct cfg80211_bss *a, - struct cfg80211_bss *b) -{ - const u8 *ie1; - const u8 *ie2; - int i; - int r; - - r = cmp_bss_core(a, b); - if (r) - return r; - - ie1 = cfg80211_find_ie(WLAN_EID_SSID, - a->information_elements, - a->len_information_elements); - ie2 = cfg80211_find_ie(WLAN_EID_SSID, - b->information_elements, - b->len_information_elements); - - /* Key comparator must use same algorithm in any rb-tree - * search function (order is important), otherwise ordering - * of items in the tree is broken and search gives incorrect - * results. This code uses same order as cmp_ies() does. */ - - /* sort missing IE before (left of) present IE */ - if (!ie1) - return -1; - if (!ie2) - return 1; - - /* zero-size SSID is used as an indication of the hidden bss */ - if (!ie2[1]) - return 0; - - /* sort by length first, then by contents */ - if (ie1[1] != ie2[1]) - return ie2[1] - ie1[1]; - - /* zeroed SSID ie is another indication of a hidden bss */ - for (i = 0; i < ie2[1]; i++) - if (ie2[i + 2]) - return -1; - - return 0; -} - -struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, - struct ieee80211_channel *channel, - const u8 *bssid, - const u8 *ssid, size_t ssid_len, - u16 capa_mask, u16 capa_val) -{ - struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); - struct cfg80211_internal_bss *bss, *res = NULL; - unsigned long now = jiffies; - - spin_lock_bh(&dev->bss_lock); - - list_for_each_entry(bss, &dev->bss_list, list) { - if ((bss->pub.capability & capa_mask) != capa_val) - continue; - if (channel && bss->pub.channel != channel) - continue; - /* Don't get expired BSS structs */ - if (time_after(now, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE) && - !atomic_read(&bss->hold)) - continue; - if (is_bss(&bss->pub, bssid, ssid, ssid_len)) { - res = bss; - kref_get(&res->ref); - break; - } - } - - spin_unlock_bh(&dev->bss_lock); - if (!res) - return NULL; - return &res->pub; -} -EXPORT_SYMBOL(cfg80211_get_bss); - -struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, - struct ieee80211_channel *channel, - const u8 *meshid, size_t meshidlen, - const u8 *meshcfg) -{ - struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); - struct cfg80211_internal_bss *bss, *res = NULL; - - spin_lock_bh(&dev->bss_lock); - - list_for_each_entry(bss, &dev->bss_list, list) { - if (channel && bss->pub.channel != channel) - continue; - if (is_mesh(&bss->pub, meshid, meshidlen, meshcfg)) { - res = bss; - kref_get(&res->ref); - break; - } - } - - spin_unlock_bh(&dev->bss_lock); - if (!res) - return NULL; - return &res->pub; -} -EXPORT_SYMBOL(cfg80211_get_mesh); - - -static void rb_insert_bss(struct cfg80211_registered_device *dev, - struct cfg80211_internal_bss *bss) -{ - struct rb_node **p = &dev->bss_tree.rb_node; - struct rb_node *parent = NULL; - struct cfg80211_internal_bss *tbss; - int cmp; - - while (*p) { - parent = *p; - tbss = rb_entry(parent, struct cfg80211_internal_bss, rbn); - - cmp = cmp_bss(&bss->pub, &tbss->pub); - - if (WARN_ON(!cmp)) { - /* will sort of leak this BSS */ - return; - } - - if (cmp < 0) - p = &(*p)->rb_left; - else - p = &(*p)->rb_right; - } - - rb_link_node(&bss->rbn, parent, p); - rb_insert_color(&bss->rbn, &dev->bss_tree); -} - -static struct cfg80211_internal_bss * -rb_find_bss(struct cfg80211_registered_device *dev, - struct cfg80211_internal_bss *res) -{ - struct rb_node *n = dev->bss_tree.rb_node; - struct cfg80211_internal_bss *bss; - int r; - - while (n) { - bss = rb_entry(n, struct cfg80211_internal_bss, rbn); - r = cmp_bss(&res->pub, &bss->pub); - - if (r == 0) - return bss; - else if (r < 0) - n = n->rb_left; - else - n = n->rb_right; - } - - return NULL; -} - -static struct cfg80211_internal_bss * -rb_find_hidden_bss(struct cfg80211_registered_device *dev, - struct cfg80211_internal_bss *res) -{ - struct rb_node *n = dev->bss_tree.rb_node; - struct cfg80211_internal_bss *bss; - int r; - - while (n) { - bss = rb_entry(n, struct cfg80211_internal_bss, rbn); - r = cmp_hidden_bss(&res->pub, &bss->pub); - - if (r == 0) - return bss; - else if (r < 0) - n = n->rb_left; - else - n = n->rb_right; - } - - return NULL; -} - -static void -copy_hidden_ies(struct cfg80211_internal_bss *res, - struct cfg80211_internal_bss *hidden) -{ - if (unlikely(res->pub.beacon_ies)) - return; - if (WARN_ON(!hidden->pub.beacon_ies)) - return; - - res->pub.beacon_ies = kmalloc(hidden->pub.len_beacon_ies, GFP_ATOMIC); - if (unlikely(!res->pub.beacon_ies)) - return; - - res->beacon_ies_allocated = true; - res->pub.len_beacon_ies = hidden->pub.len_beacon_ies; - memcpy(res->pub.beacon_ies, hidden->pub.beacon_ies, - res->pub.len_beacon_ies); -} - -static struct cfg80211_internal_bss * -cfg80211_bss_update(struct cfg80211_registered_device *dev, - struct cfg80211_internal_bss *res) -{ - struct cfg80211_internal_bss *found = NULL; - - /* - * The reference to "res" is donated to this function. - */ - - if (WARN_ON(!res->pub.channel)) { - kref_put(&res->ref, bss_release); - return NULL; - } - - res->ts = jiffies; - - spin_lock_bh(&dev->bss_lock); - - found = rb_find_bss(dev, res); - - if (found) { - found->pub.beacon_interval = res->pub.beacon_interval; - found->pub.tsf = res->pub.tsf; - found->pub.signal = res->pub.signal; - found->pub.capability = res->pub.capability; - found->ts = res->ts; - - /* Update IEs */ - if (res->pub.proberesp_ies) { - size_t used = dev->wiphy.bss_priv_size + sizeof(*res); - size_t ielen = res->pub.len_proberesp_ies; - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28) - if (0) { - used = 0; /* just to shut up the compiler */ -#else - if (found->pub.proberesp_ies && - !found->proberesp_ies_allocated && - ksize(found) >= used + ielen) { -#endif - memcpy(found->pub.proberesp_ies, - res->pub.proberesp_ies, ielen); - found->pub.len_proberesp_ies = ielen; - } else { - u8 *ies = found->pub.proberesp_ies; - - if (found->proberesp_ies_allocated) - ies = krealloc(ies, ielen, GFP_ATOMIC); - else - ies = kmalloc(ielen, GFP_ATOMIC); - - if (ies) { - memcpy(ies, res->pub.proberesp_ies, - ielen); - found->proberesp_ies_allocated = true; - found->pub.proberesp_ies = ies; - found->pub.len_proberesp_ies = ielen; - } - } - - /* Override possible earlier Beacon frame IEs */ - found->pub.information_elements = - found->pub.proberesp_ies; - found->pub.len_information_elements = - found->pub.len_proberesp_ies; - } - if (res->pub.beacon_ies) { - size_t used = dev->wiphy.bss_priv_size + sizeof(*res); - size_t ielen = res->pub.len_beacon_ies; - bool information_elements_is_beacon_ies = - (found->pub.information_elements == - found->pub.beacon_ies); - -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28) - if (0) { - used = 0; /* just to shut up the compiler */ -#else - if (found->pub.beacon_ies && - !found->beacon_ies_allocated && - ksize(found) >= used + ielen) { -#endif - memcpy(found->pub.beacon_ies, - res->pub.beacon_ies, ielen); - found->pub.len_beacon_ies = ielen; - } else { - u8 *ies = found->pub.beacon_ies; - - if (found->beacon_ies_allocated) - ies = krealloc(ies, ielen, GFP_ATOMIC); - else - ies = kmalloc(ielen, GFP_ATOMIC); - - if (ies) { - memcpy(ies, res->pub.beacon_ies, - ielen); - found->beacon_ies_allocated = true; - found->pub.beacon_ies = ies; - found->pub.len_beacon_ies = ielen; - } - } - - /* Override IEs if they were from a beacon before */ - if (information_elements_is_beacon_ies) { - found->pub.information_elements = - found->pub.beacon_ies; - found->pub.len_information_elements = - found->pub.len_beacon_ies; - } - } - - kref_put(&res->ref, bss_release); - } else { - struct cfg80211_internal_bss *hidden; - - /* First check if the beacon is a probe response from - * a hidden bss. If so, copy beacon ies (with nullified - * ssid) into the probe response bss entry (with real ssid). - * It is required basically for PSM implementation - * (probe responses do not contain tim ie) */ - - /* TODO: The code is not trying to update existing probe - * response bss entries when beacon ies are - * getting changed. */ - hidden = rb_find_hidden_bss(dev, res); - if (hidden) - copy_hidden_ies(res, hidden); - - /* this "consumes" the reference */ - list_add_tail(&res->list, &dev->bss_list); - rb_insert_bss(dev, res); - found = res; - } - - dev->bss_generation++; - spin_unlock_bh(&dev->bss_lock); - - kref_get(&found->ref); - return found; -} - -struct cfg80211_bss* -cfg80211_inform_bss(struct wiphy *wiphy, - struct ieee80211_channel *channel, - const u8 *bssid, u64 tsf, u16 capability, - u16 beacon_interval, const u8 *ie, size_t ielen, - s32 signal, gfp_t gfp) -{ - struct cfg80211_internal_bss *res; - size_t privsz; - - if (WARN_ON(!wiphy)) - return NULL; - - privsz = wiphy->bss_priv_size; - - if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC && - (signal < 0 || signal > 100))) - return NULL; - - res = kzalloc(sizeof(*res) + privsz + ielen, gfp); - if (!res) - return NULL; - - memcpy(res->pub.bssid, bssid, ETH_ALEN); - res->pub.channel = channel; - res->pub.signal = signal; - res->pub.tsf = tsf; - res->pub.beacon_interval = beacon_interval; - res->pub.capability = capability; - /* - * Since we do not know here whether the IEs are from a Beacon or Probe - * Response frame, we need to pick one of the options and only use it - * with the driver that does not provide the full Beacon/Probe Response - * frame. Use Beacon frame pointer to avoid indicating that this should - * override the information_elements pointer should we have received an - * earlier indication of Probe Response data. - * - * The initial buffer for the IEs is allocated with the BSS entry and - * is located after the private area. - */ - res->pub.beacon_ies = (u8 *)res + sizeof(*res) + privsz; - memcpy(res->pub.beacon_ies, ie, ielen); - res->pub.len_beacon_ies = ielen; - res->pub.information_elements = res->pub.beacon_ies; - res->pub.len_information_elements = res->pub.len_beacon_ies; - - kref_init(&res->ref); - - res = cfg80211_bss_update(wiphy_to_dev(wiphy), res); - if (!res) - return NULL; - - if (res->pub.capability & WLAN_CAPABILITY_ESS) - regulatory_hint_found_beacon(wiphy, channel, gfp); - - /* cfg80211_bss_update gives us a referenced result */ - return &res->pub; -} -EXPORT_SYMBOL(cfg80211_inform_bss); - -struct cfg80211_bss * -cfg80211_inform_bss_frame(struct wiphy *wiphy, - struct ieee80211_channel *channel, - struct ieee80211_mgmt *mgmt, size_t len, - s32 signal, gfp_t gfp) -{ - struct cfg80211_internal_bss *res; - size_t ielen = len - offsetof(struct ieee80211_mgmt, - u.probe_resp.variable); - size_t privsz; - - if (WARN_ON(!mgmt)) - return NULL; - - if (WARN_ON(!wiphy)) - return NULL; - - if (WARN_ON(wiphy->signal_type == CFG80211_SIGNAL_TYPE_UNSPEC && - (signal < 0 || signal > 100))) - return NULL; - - if (WARN_ON(len < offsetof(struct ieee80211_mgmt, u.probe_resp.variable))) - return NULL; - - privsz = wiphy->bss_priv_size; - - res = kzalloc(sizeof(*res) + privsz + ielen, gfp); - if (!res) - return NULL; - - memcpy(res->pub.bssid, mgmt->bssid, ETH_ALEN); - res->pub.channel = channel; - res->pub.signal = signal; - res->pub.tsf = le64_to_cpu(mgmt->u.probe_resp.timestamp); - res->pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int); - res->pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info); - /* - * The initial buffer for the IEs is allocated with the BSS entry and - * is located after the private area. - */ - if (ieee80211_is_probe_resp(mgmt->frame_control)) { - res->pub.proberesp_ies = (u8 *) res + sizeof(*res) + privsz; - memcpy(res->pub.proberesp_ies, mgmt->u.probe_resp.variable, - ielen); - res->pub.len_proberesp_ies = ielen; - res->pub.information_elements = res->pub.proberesp_ies; - res->pub.len_information_elements = res->pub.len_proberesp_ies; - } else { - res->pub.beacon_ies = (u8 *) res + sizeof(*res) + privsz; - memcpy(res->pub.beacon_ies, mgmt->u.beacon.variable, ielen); - res->pub.len_beacon_ies = ielen; - res->pub.information_elements = res->pub.beacon_ies; - res->pub.len_information_elements = res->pub.len_beacon_ies; - } - - kref_init(&res->ref); - - res = cfg80211_bss_update(wiphy_to_dev(wiphy), res); - if (!res) - return NULL; - - if (res->pub.capability & WLAN_CAPABILITY_ESS) - regulatory_hint_found_beacon(wiphy, channel, gfp); - - /* cfg80211_bss_update gives us a referenced result */ - return &res->pub; -} -EXPORT_SYMBOL(cfg80211_inform_bss_frame); - -void cfg80211_ref_bss(struct cfg80211_bss *pub) -{ - struct cfg80211_internal_bss *bss; - - if (!pub) - return; - - bss = container_of(pub, struct cfg80211_internal_bss, pub); - kref_get(&bss->ref); -} -EXPORT_SYMBOL(cfg80211_ref_bss); - -void cfg80211_put_bss(struct cfg80211_bss *pub) -{ - struct cfg80211_internal_bss *bss; - - if (!pub) - return; - - bss = container_of(pub, struct cfg80211_internal_bss, pub); - kref_put(&bss->ref, bss_release); -} -EXPORT_SYMBOL(cfg80211_put_bss); - -void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) -{ - struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); - struct cfg80211_internal_bss *bss; - - if (WARN_ON(!pub)) - return; - - bss = container_of(pub, struct cfg80211_internal_bss, pub); - - spin_lock_bh(&dev->bss_lock); - if (!list_empty(&bss->list)) { - __cfg80211_unlink_bss(dev, bss); - dev->bss_generation++; - } - spin_unlock_bh(&dev->bss_lock); -} -EXPORT_SYMBOL(cfg80211_unlink_bss); - -/* - * [PLATA] - qui appelle cette fonction? - */ -#ifdef CONFIG_CFG80211_WEXT -int cfg80211_wext_siwscan(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *wrqu, char *extra) -{ - struct cfg80211_registered_device *rdev; - struct wiphy *wiphy; - struct iw_scan_req *wreq = NULL; - struct cfg80211_scan_request *creq = NULL; - int i, err, n_channels = 0; - enum ieee80211_band band; - - if (!netif_running(dev)) - return -ENETDOWN; - - if (wrqu->data.length == sizeof(struct iw_scan_req)) - wreq = (struct iw_scan_req *)extra; - - rdev = cfg80211_get_dev_from_ifindex(dev_net(dev), dev->ifindex); - - if (IS_ERR(rdev)) - return PTR_ERR(rdev); - - if (rdev->scan_req) { - err = -EBUSY; - goto out; - } - - wiphy = &rdev->wiphy; - - /* Determine number of channels, needed to allocate creq */ - if (wreq && wreq->num_channels) - n_channels = wreq->num_channels; - else { - for (band = 0; band < IEEE80211_NUM_BANDS; band++) - if (wiphy->bands[band]) - n_channels += wiphy->bands[band]->n_channels; - } - - creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) + - n_channels * sizeof(void *), - GFP_ATOMIC); - if (!creq) { - err = -ENOMEM; - goto out; - } - - creq->wiphy = wiphy; - creq->dev = dev; - /* SSIDs come after channels */ - creq->ssids = (void *)&creq->channels[n_channels]; - creq->n_channels = n_channels; - creq->n_ssids = 1; - - /* translate "Scan on frequencies" request */ - i = 0; - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - int j; - - if (!wiphy->bands[band]) - continue; - - for (j = 0; j < wiphy->bands[band]->n_channels; j++) { - /* ignore disabled channels */ - if (wiphy->bands[band]->channels[j].flags & - IEEE80211_CHAN_DISABLED) - continue; - - /* If we have a wireless request structure and the - * wireless request specifies frequencies, then search - * for the matching hardware channel. - */ - if (wreq && wreq->num_channels) { - int k; - int wiphy_freq = wiphy->bands[band]->channels[j].center_freq; - for (k = 0; k < wreq->num_channels; k++) { - int wext_freq = cfg80211_wext_freq(wiphy, &wreq->channel_list[k]); - if (wext_freq == wiphy_freq) - goto wext_freq_found; - } - goto wext_freq_not_found; - } - - wext_freq_found: - creq->channels[i] = &wiphy->bands[band]->channels[j]; - i++; - wext_freq_not_found: ; - } - } - /* No channels found? */ - if (!i) { - err = -EINVAL; - goto out; - } - - /* Set real number of channels specified in creq->channels[] */ - creq->n_channels = i; - - /* translate "Scan for SSID" request */ - if (wreq) { - if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { - if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) { - err = -EINVAL; - goto out; - } - memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len); - creq->ssids[0].ssid_len = wreq->essid_len; - } - if (wreq->scan_type == IW_SCAN_TYPE_PASSIVE) - creq->n_ssids = 0; - } - - for (i = 0; i < IEEE80211_NUM_BANDS; i++) - if (wiphy->bands[i]) - creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1; - - rdev->scan_req = creq; - err = rdev->ops->scan(wiphy, dev, creq); - if (err) { - rdev->scan_req = NULL; - /* creq will be freed below */ - } else { - nl80211_send_scan_start(rdev, dev); - /* creq now owned by driver */ - creq = NULL; - dev_hold(dev); - } - out: - kfree(creq); - cfg80211_unlock_rdev(rdev); - return err; -} -EXPORT_SYMBOL_GPL(cfg80211_wext_siwscan); - -static void ieee80211_scan_add_ies(struct iw_request_info *info, - struct cfg80211_bss *bss, - char **current_ev, char *end_buf) -{ - u8 *pos, *end, *next; - struct iw_event iwe; - - if (!bss->information_elements || - !bss->len_information_elements) - return; - - /* - * If needed, fragment the IEs buffer (at IE boundaries) into short - * enough fragments to fit into IW_GENERIC_IE_MAX octet messages. - */ - pos = bss->information_elements; - end = pos + bss->len_information_elements; - - while (end - pos > IW_GENERIC_IE_MAX) { - next = pos + 2 + pos[1]; - while (next + 2 + next[1] - pos < IW_GENERIC_IE_MAX) - next = next + 2 + next[1]; - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = next - pos; - *current_ev = iwe_stream_add_point(info, *current_ev, - end_buf, &iwe, pos); - - pos = next; - } - - if (end > pos) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVGENIE; - iwe.u.data.length = end - pos; - *current_ev = iwe_stream_add_point(info, *current_ev, - end_buf, &iwe, pos); - } -} - -static inline unsigned int elapsed_jiffies_msecs(unsigned long start) -{ - unsigned long end = jiffies; - - if (end >= start) - return jiffies_to_msecs(end - start); - - return jiffies_to_msecs(end + (MAX_JIFFY_OFFSET - start) + 1); -} - -static char * -ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info, - struct cfg80211_internal_bss *bss, char *current_ev, - char *end_buf) -{ - struct iw_event iwe; - u8 *buf, *cfg, *p; - u8 *ie = bss->pub.information_elements; - int rem = bss->pub.len_information_elements, i, sig; - bool ismesh = false; - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWAP; - iwe.u.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(iwe.u.ap_addr.sa_data, bss->pub.bssid, ETH_ALEN); - current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, - IW_EV_ADDR_LEN); - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = ieee80211_frequency_to_channel(bss->pub.channel->center_freq); - iwe.u.freq.e = 0; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, - IW_EV_FREQ_LEN); - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWFREQ; - iwe.u.freq.m = bss->pub.channel->center_freq; - iwe.u.freq.e = 6; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, - IW_EV_FREQ_LEN); - - if (wiphy->signal_type != CFG80211_SIGNAL_TYPE_NONE) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVQUAL; - iwe.u.qual.updated = IW_QUAL_LEVEL_UPDATED | - IW_QUAL_NOISE_INVALID | - IW_QUAL_QUAL_UPDATED; - switch (wiphy->signal_type) { - case CFG80211_SIGNAL_TYPE_MBM: - sig = bss->pub.signal / 100; - iwe.u.qual.level = sig; - iwe.u.qual.updated |= IW_QUAL_DBM; - if (sig < -110) /* rather bad */ - sig = -110; - else if (sig > -40) /* perfect */ - sig = -40; - /* will give a range of 0 .. 70 */ - iwe.u.qual.qual = sig + 110; - break; - case CFG80211_SIGNAL_TYPE_UNSPEC: - iwe.u.qual.level = bss->pub.signal; - /* will give range 0 .. 100 */ - iwe.u.qual.qual = bss->pub.signal; - break; - default: - /* not reached */ - break; - } - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_QUAL_LEN); - } - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWENCODE; - if (bss->pub.capability & WLAN_CAPABILITY_PRIVACY) - iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; - else - iwe.u.data.flags = IW_ENCODE_DISABLED; - iwe.u.data.length = 0; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, ""); - - while (rem >= 2) { - /* invalid data */ - if (ie[1] > rem - 2) - break; - - switch (ie[0]) { - case WLAN_EID_SSID: - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWESSID; - iwe.u.data.length = ie[1]; - iwe.u.data.flags = 1; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, ie + 2); - break; - case WLAN_EID_MESH_ID: - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWESSID; - iwe.u.data.length = ie[1]; - iwe.u.data.flags = 1; - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, ie + 2); - break; - case WLAN_EID_MESH_CONFIG: - ismesh = true; - if (ie[1] != sizeof(struct ieee80211_meshconf_ie)) - break; - buf = kmalloc(50, GFP_ATOMIC); - if (!buf) - break; - cfg = ie + 2; - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - sprintf(buf, "Mesh Network Path Selection Protocol ID: " - "0x%02X", cfg[0]); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, - &iwe, buf); - sprintf(buf, "Path Selection Metric ID: 0x%02X", - cfg[1]); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, - &iwe, buf); - sprintf(buf, "Congestion Control Mode ID: 0x%02X", - cfg[2]); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, - &iwe, buf); - sprintf(buf, "Synchronization ID: 0x%02X", cfg[3]); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, - &iwe, buf); - sprintf(buf, "Authentication ID: 0x%02X", cfg[4]); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, - &iwe, buf); - sprintf(buf, "Formation Info: 0x%02X", cfg[5]); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, - &iwe, buf); - sprintf(buf, "Capabilities: 0x%02X", cfg[6]); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, - &iwe, buf); - kfree(buf); - break; - case WLAN_EID_SUPP_RATES: - case WLAN_EID_EXT_SUPP_RATES: - /* display all supported rates in readable format */ - p = current_ev + iwe_stream_lcp_len(info); - - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWRATE; - /* Those two flags are ignored... */ - iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; - - for (i = 0; i < ie[1]; i++) { - iwe.u.bitrate.value = - ((ie[i + 2] & 0x7f) * 500000); - p = iwe_stream_add_value(info, current_ev, p, - end_buf, &iwe, IW_EV_PARAM_LEN); - } - current_ev = p; - break; - } - rem -= ie[1] + 2; - ie += ie[1] + 2; - } - - if (bss->pub.capability & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS) || - ismesh) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = SIOCGIWMODE; - if (ismesh) - iwe.u.mode = IW_MODE_MESH; - else if (bss->pub.capability & WLAN_CAPABILITY_ESS) - iwe.u.mode = IW_MODE_MASTER; - else - iwe.u.mode = IW_MODE_ADHOC; - current_ev = iwe_stream_add_event(info, current_ev, end_buf, - &iwe, IW_EV_UINT_LEN); - } - - buf = kmalloc(30, GFP_ATOMIC); - if (buf) { - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - sprintf(buf, "tsf=%016llx", (unsigned long long)(bss->pub.tsf)); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, end_buf, - &iwe, buf); - memset(&iwe, 0, sizeof(iwe)); - iwe.cmd = IWEVCUSTOM; - sprintf(buf, " Last beacon: %ums ago", - elapsed_jiffies_msecs(bss->ts)); - iwe.u.data.length = strlen(buf); - current_ev = iwe_stream_add_point(info, current_ev, - end_buf, &iwe, buf); - kfree(buf); - } - - ieee80211_scan_add_ies(info, &bss->pub, ¤t_ev, end_buf); - - return current_ev; -} - - -static int ieee80211_scan_results(struct cfg80211_registered_device *dev, - struct iw_request_info *info, - char *buf, size_t len) -{ - char *current_ev = buf; - char *end_buf = buf + len; - struct cfg80211_internal_bss *bss; - - spin_lock_bh(&dev->bss_lock); - cfg80211_bss_expire(dev); - - list_for_each_entry(bss, &dev->bss_list, list) { - if (buf + len - current_ev <= IW_EV_ADDR_LEN) { - spin_unlock_bh(&dev->bss_lock); - return -E2BIG; - } - current_ev = ieee80211_bss(&dev->wiphy, info, bss, - current_ev, end_buf); - } - spin_unlock_bh(&dev->bss_lock); - return current_ev - buf; -} - - -int cfg80211_wext_giwscan(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - struct cfg80211_registered_device *rdev; - int res; - - if (!netif_running(dev)) - return -ENETDOWN; - - rdev = cfg80211_get_dev_from_ifindex(dev_net(dev), dev->ifindex); - - if (IS_ERR(rdev)) - return PTR_ERR(rdev); - - if (rdev->scan_req) { - res = -EAGAIN; - goto out; - } - - res = ieee80211_scan_results(rdev, info, extra, data->length); - data->length = 0; - if (res >= 0) { - data->length = res; - res = 0; - } - - out: - cfg80211_unlock_rdev(rdev); - return res; -} -EXPORT_SYMBOL_GPL(cfg80211_wext_giwscan); -#endif diff --git a/openairITS/mac/DOT11/net/wireless/sme.c b/openairITS/mac/DOT11/net/wireless/sme.c deleted file mode 100644 index a1a0b966dd9..00000000000 --- a/openairITS/mac/DOT11/net/wireless/sme.c +++ /dev/null @@ -1,1025 +0,0 @@ -/* - * SME code for cfg80211's connect emulation. - * - * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> - * Copyright (C) 2009 Intel Corporation. All rights reserved. - */ - -#include <linux/etherdevice.h> -#include <linux/if_arp.h> -#include <linux/slab.h> -#include <linux/workqueue.h> -#include <linux/wireless.h> -#include <linux/export.h> -#include <net/iw_handler.h> -#include <net/cfg80211.h> -#include <net/rtnetlink.h> -#include "nl80211.h" -#include "reg.h" - -struct cfg80211_conn { - struct cfg80211_connect_params params; - /* these are sub-states of the _CONNECTING sme_state */ - enum { - CFG80211_CONN_IDLE, - CFG80211_CONN_SCANNING, - CFG80211_CONN_SCAN_AGAIN, - CFG80211_CONN_AUTHENTICATE_NEXT, - CFG80211_CONN_AUTHENTICATING, - CFG80211_CONN_ASSOCIATE_NEXT, - CFG80211_CONN_ASSOCIATING, - CFG80211_CONN_DEAUTH_ASSOC_FAIL, - } state; - u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; - u8 *ie; - size_t ie_len; - bool auto_auth, prev_bssid_valid; -}; - -static bool cfg80211_is_all_idle(void) -{ - struct cfg80211_registered_device *rdev; - struct wireless_dev *wdev; - bool is_all_idle = true; - - mutex_lock(&cfg80211_mutex); - - /* - * All devices must be idle as otherwise if you are actively - * scanning some new beacon hints could be learned and would - * count as new regulatory hints. - */ - list_for_each_entry(rdev, &cfg80211_rdev_list, list) { - cfg80211_lock_rdev(rdev); - list_for_each_entry(wdev, &rdev->netdev_list, list) { - wdev_lock(wdev); - if (wdev->sme_state != CFG80211_SME_IDLE) - is_all_idle = false; - wdev_unlock(wdev); - } - cfg80211_unlock_rdev(rdev); - } - - mutex_unlock(&cfg80211_mutex); - - return is_all_idle; -} - -static void disconnect_work(struct work_struct *work) -{ - if (!cfg80211_is_all_idle()) - return; - - regulatory_hint_disconnect(); -} - -static DECLARE_WORK(cfg80211_disconnect_work, disconnect_work); - -/* - * [PLATA] qui appelle cette fonction? - */ -static int cfg80211_conn_scan(struct wireless_dev *wdev) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct cfg80211_scan_request *request; - int n_channels, err; - - ASSERT_RTNL(); - ASSERT_RDEV_LOCK(rdev); - ASSERT_WDEV_LOCK(wdev); - - if (rdev->scan_req) - return -EBUSY; - - if (wdev->conn->params.channel) { - n_channels = 1; - } else { - enum ieee80211_band band; - n_channels = 0; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - if (!wdev->wiphy->bands[band]) - continue; - n_channels += wdev->wiphy->bands[band]->n_channels; - } - } - request = kzalloc(sizeof(*request) + sizeof(request->ssids[0]) + - sizeof(request->channels[0]) * n_channels, - GFP_KERNEL); - if (!request) - return -ENOMEM; - - if (wdev->conn->params.channel) - request->channels[0] = wdev->conn->params.channel; - else { - int i = 0, j; - enum ieee80211_band band; - struct ieee80211_supported_band *bands; - struct ieee80211_channel *channel; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - bands = wdev->wiphy->bands[band]; - if (!bands) - continue; - for (j = 0; j < bands->n_channels; j++) { - channel = &bands->channels[j]; - if (channel->flags & IEEE80211_CHAN_DISABLED) - continue; - request->channels[i++] = channel; - } - request->rates[band] = (1 << bands->n_bitrates) - 1; - } - n_channels = i; - } - request->n_channels = n_channels; - request->ssids = (void *)&request->channels[n_channels]; - request->n_ssids = 1; - - memcpy(request->ssids[0].ssid, wdev->conn->params.ssid, - wdev->conn->params.ssid_len); - request->ssids[0].ssid_len = wdev->conn->params.ssid_len; - - request->dev = wdev->netdev; - request->wiphy = &rdev->wiphy; - - rdev->scan_req = request; - - err = rdev->ops->scan(wdev->wiphy, wdev->netdev, request); - if (!err) { - wdev->conn->state = CFG80211_CONN_SCANNING; - nl80211_send_scan_start(rdev, wdev->netdev); - dev_hold(wdev->netdev); - } else { - rdev->scan_req = NULL; - kfree(request); - } - return err; -} - -static int cfg80211_conn_do_work(struct wireless_dev *wdev) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct cfg80211_connect_params *params; - const u8 *prev_bssid = NULL; - int err; - - ASSERT_WDEV_LOCK(wdev); - - if (!wdev->conn) - return 0; - - params = &wdev->conn->params; - - switch (wdev->conn->state) { - case CFG80211_CONN_SCAN_AGAIN: - return cfg80211_conn_scan(wdev); - case CFG80211_CONN_AUTHENTICATE_NEXT: - BUG_ON(!rdev->ops->auth); - wdev->conn->state = CFG80211_CONN_AUTHENTICATING; - return __cfg80211_mlme_auth(rdev, wdev->netdev, - params->channel, params->auth_type, - params->bssid, - params->ssid, params->ssid_len, - NULL, 0, - params->key, params->key_len, - params->key_idx); - case CFG80211_CONN_ASSOCIATE_NEXT: - BUG_ON(!rdev->ops->assoc); - wdev->conn->state = CFG80211_CONN_ASSOCIATING; - if (wdev->conn->prev_bssid_valid) - prev_bssid = wdev->conn->prev_bssid; - err = __cfg80211_mlme_assoc(rdev, wdev->netdev, - params->channel, params->bssid, - prev_bssid, - params->ssid, params->ssid_len, - params->ie, params->ie_len, - false, ¶ms->crypto, - params->flags, ¶ms->ht_capa, - ¶ms->ht_capa_mask); - if (err) - __cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, - NULL, 0, - WLAN_REASON_DEAUTH_LEAVING, - false); - return err; - case CFG80211_CONN_DEAUTH_ASSOC_FAIL: - __cfg80211_mlme_deauth(rdev, wdev->netdev, params->bssid, - NULL, 0, - WLAN_REASON_DEAUTH_LEAVING, false); - /* return an error so that we call __cfg80211_connect_result() */ - return -EINVAL; - default: - return 0; - } -} - -void cfg80211_conn_work(struct work_struct *work) -{ - struct cfg80211_registered_device *rdev = - container_of(work, struct cfg80211_registered_device, conn_work); - struct wireless_dev *wdev; - u8 bssid_buf[ETH_ALEN], *bssid = NULL; - - rtnl_lock(); - cfg80211_lock_rdev(rdev); - mutex_lock(&rdev->devlist_mtx); - - list_for_each_entry(wdev, &rdev->netdev_list, list) { - wdev_lock(wdev); - if (!netif_running(wdev->netdev)) { - wdev_unlock(wdev); - continue; - } - if (wdev->sme_state != CFG80211_SME_CONNECTING) { - wdev_unlock(wdev); - continue; - } - if (wdev->conn->params.bssid) { - memcpy(bssid_buf, wdev->conn->params.bssid, ETH_ALEN); - bssid = bssid_buf; - } - if (cfg80211_conn_do_work(wdev)) - __cfg80211_connect_result( - wdev->netdev, bssid, - NULL, 0, NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - false, NULL); - wdev_unlock(wdev); - } - - mutex_unlock(&rdev->devlist_mtx); - cfg80211_unlock_rdev(rdev); - rtnl_unlock(); -} - -static struct cfg80211_bss *cfg80211_get_conn_bss(struct wireless_dev *wdev) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct cfg80211_bss *bss; - u16 capa = WLAN_CAPABILITY_ESS; - - ASSERT_WDEV_LOCK(wdev); - - if (wdev->conn->params.privacy) - capa |= WLAN_CAPABILITY_PRIVACY; - - bss = cfg80211_get_bss(wdev->wiphy, wdev->conn->params.channel, - wdev->conn->params.bssid, - wdev->conn->params.ssid, - wdev->conn->params.ssid_len, - WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_PRIVACY, - capa); - if (!bss) - return NULL; - - memcpy(wdev->conn->bssid, bss->bssid, ETH_ALEN); - wdev->conn->params.bssid = wdev->conn->bssid; - wdev->conn->params.channel = bss->channel; - wdev->conn->state = CFG80211_CONN_AUTHENTICATE_NEXT; - schedule_work(&rdev->conn_work); - - return bss; -} - -static void __cfg80211_sme_scan_done(struct net_device *dev) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct cfg80211_bss *bss; - - ASSERT_WDEV_LOCK(wdev); - - if (wdev->sme_state != CFG80211_SME_CONNECTING) - return; - - if (!wdev->conn) - return; - - if (wdev->conn->state != CFG80211_CONN_SCANNING && - wdev->conn->state != CFG80211_CONN_SCAN_AGAIN) - return; - - bss = cfg80211_get_conn_bss(wdev); - if (bss) { - cfg80211_put_bss(bss); - } else { - /* not found */ - if (wdev->conn->state == CFG80211_CONN_SCAN_AGAIN) - schedule_work(&rdev->conn_work); - else - __cfg80211_connect_result( - wdev->netdev, - wdev->conn->params.bssid, - NULL, 0, NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - false, NULL); - } -} - -void cfg80211_sme_scan_done(struct net_device *dev) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - mutex_lock(&wiphy_to_dev(wdev->wiphy)->devlist_mtx); - wdev_lock(wdev); - __cfg80211_sme_scan_done(dev); - wdev_unlock(wdev); - mutex_unlock(&wiphy_to_dev(wdev->wiphy)->devlist_mtx); -} - -void cfg80211_sme_rx_auth(struct net_device *dev, - const u8 *buf, size_t len) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf; - u16 status_code = le16_to_cpu(mgmt->u.auth.status_code); - - ASSERT_WDEV_LOCK(wdev); - - /* should only RX auth frames when connecting */ - if (wdev->sme_state != CFG80211_SME_CONNECTING) - return; - - if (WARN_ON(!wdev->conn)) - return; - - if (status_code == WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG && - wdev->conn->auto_auth && - wdev->conn->params.auth_type != NL80211_AUTHTYPE_NETWORK_EAP) { - /* select automatically between only open, shared, leap */ - switch (wdev->conn->params.auth_type) { - case NL80211_AUTHTYPE_OPEN_SYSTEM: - if (wdev->connect_keys) - wdev->conn->params.auth_type = - NL80211_AUTHTYPE_SHARED_KEY; - else - wdev->conn->params.auth_type = - NL80211_AUTHTYPE_NETWORK_EAP; - break; - case NL80211_AUTHTYPE_SHARED_KEY: - wdev->conn->params.auth_type = - NL80211_AUTHTYPE_NETWORK_EAP; - break; - default: - /* huh? */ - wdev->conn->params.auth_type = - NL80211_AUTHTYPE_OPEN_SYSTEM; - break; - } - wdev->conn->state = CFG80211_CONN_AUTHENTICATE_NEXT; - schedule_work(&rdev->conn_work); - } else if (status_code != WLAN_STATUS_SUCCESS) { - __cfg80211_connect_result(dev, mgmt->bssid, NULL, 0, NULL, 0, - status_code, false, NULL); - } else if (wdev->sme_state == CFG80211_SME_CONNECTING && - wdev->conn->state == CFG80211_CONN_AUTHENTICATING) { - wdev->conn->state = CFG80211_CONN_ASSOCIATE_NEXT; - schedule_work(&rdev->conn_work); - } -} - -bool cfg80211_sme_failed_reassoc(struct wireless_dev *wdev) -{ - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - if (WARN_ON(!wdev->conn)) - return false; - - if (!wdev->conn->prev_bssid_valid) - return false; - - /* - * Some stupid APs don't accept reassoc, so we - * need to fall back to trying regular assoc. - */ - wdev->conn->prev_bssid_valid = false; - wdev->conn->state = CFG80211_CONN_ASSOCIATE_NEXT; - schedule_work(&rdev->conn_work); - - return true; -} - -void cfg80211_sme_failed_assoc(struct wireless_dev *wdev) -{ - struct wiphy *wiphy = wdev->wiphy; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); - - wdev->conn->state = CFG80211_CONN_DEAUTH_ASSOC_FAIL; - schedule_work(&rdev->conn_work); -} - -void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len, - u16 status, bool wextev, - struct cfg80211_bss *bss) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - u8 *country_ie; -#ifdef CONFIG_CFG80211_WEXT - union iwreq_data wrqu; -#endif - - ASSERT_WDEV_LOCK(wdev); - - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && - wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) - return; - - if (wdev->sme_state != CFG80211_SME_CONNECTING) - return; - - nl80211_send_connect_result(wiphy_to_dev(wdev->wiphy), dev, - bssid, req_ie, req_ie_len, - resp_ie, resp_ie_len, - status, GFP_KERNEL); - -#ifdef CONFIG_CFG80211_WEXT - if (wextev) { - if (req_ie && status == WLAN_STATUS_SUCCESS) { - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = req_ie_len; - wireless_send_event(dev, IWEVASSOCREQIE, &wrqu, req_ie); - } - - if (resp_ie && status == WLAN_STATUS_SUCCESS) { - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = resp_ie_len; - wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, resp_ie); - } - - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - if (bssid && status == WLAN_STATUS_SUCCESS) { - memcpy(wrqu.ap_addr.sa_data, bssid, ETH_ALEN); - memcpy(wdev->wext.prev_bssid, bssid, ETH_ALEN); - wdev->wext.prev_bssid_valid = true; - } - wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); - } -#endif - - if (wdev->current_bss) { - cfg80211_unhold_bss(wdev->current_bss); - cfg80211_put_bss(&wdev->current_bss->pub); - wdev->current_bss = NULL; - } - - if (wdev->conn) - wdev->conn->state = CFG80211_CONN_IDLE; - - if (status != WLAN_STATUS_SUCCESS) { - wdev->sme_state = CFG80211_SME_IDLE; - if (wdev->conn) - kfree(wdev->conn->ie); - kfree(wdev->conn); - wdev->conn = NULL; - kfree(wdev->connect_keys); - wdev->connect_keys = NULL; - wdev->ssid_len = 0; - cfg80211_put_bss(bss); - return; - } - - if (!bss) - bss = cfg80211_get_bss(wdev->wiphy, - wdev->conn ? wdev->conn->params.channel : - NULL, - bssid, - wdev->ssid, wdev->ssid_len, - WLAN_CAPABILITY_ESS, - WLAN_CAPABILITY_ESS); - - if (WARN_ON(!bss)) - return; - - cfg80211_hold_bss(bss_from_pub(bss)); - wdev->current_bss = bss_from_pub(bss); - - wdev->sme_state = CFG80211_SME_CONNECTED; - cfg80211_upload_connect_keys(wdev); - - country_ie = (u8 *) ieee80211_bss_get_ie(bss, WLAN_EID_COUNTRY); - - if (!country_ie) - return; - - /* - * ieee80211_bss_get_ie() ensures we can access: - * - country_ie + 2, the start of the country ie data, and - * - and country_ie[1] which is the IE length - */ - regulatory_hint_11d(wdev->wiphy, - bss->channel->band, - country_ie + 2, - country_ie[1]); -} - -void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len, - u16 status, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct cfg80211_event *ev; - unsigned long flags; - - CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTING); - - ev = kzalloc(sizeof(*ev) + req_ie_len + resp_ie_len, gfp); - if (!ev) - return; - - ev->type = EVENT_CONNECT_RESULT; - if (bssid) - memcpy(ev->cr.bssid, bssid, ETH_ALEN); - if (req_ie_len) { - ev->cr.req_ie = ((u8 *)ev) + sizeof(*ev); - ev->cr.req_ie_len = req_ie_len; - memcpy((void *)ev->cr.req_ie, req_ie, req_ie_len); - } - if (resp_ie_len) { - ev->cr.resp_ie = ((u8 *)ev) + sizeof(*ev) + req_ie_len; - ev->cr.resp_ie_len = resp_ie_len; - memcpy((void *)ev->cr.resp_ie, resp_ie, resp_ie_len); - } - ev->cr.status = status; - - spin_lock_irqsave(&wdev->event_lock, flags); - list_add_tail(&ev->list, &wdev->event_list); - spin_unlock_irqrestore(&wdev->event_lock, flags); - queue_work(cfg80211_wq, &rdev->event_work); -} -EXPORT_SYMBOL(cfg80211_connect_result); - -void __cfg80211_roamed(struct wireless_dev *wdev, - struct cfg80211_bss *bss, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len) -{ -#ifdef CONFIG_CFG80211_WEXT - union iwreq_data wrqu; -#endif - ASSERT_WDEV_LOCK(wdev); - - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && - wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) - goto out; - - if (wdev->sme_state != CFG80211_SME_CONNECTED) - goto out; - - /* internal error -- how did we get to CONNECTED w/o BSS? */ - if (WARN_ON(!wdev->current_bss)) { - goto out; - } - - cfg80211_unhold_bss(wdev->current_bss); - cfg80211_put_bss(&wdev->current_bss->pub); - wdev->current_bss = NULL; - - cfg80211_hold_bss(bss_from_pub(bss)); - wdev->current_bss = bss_from_pub(bss); - - nl80211_send_roamed(wiphy_to_dev(wdev->wiphy), wdev->netdev, bss->bssid, - req_ie, req_ie_len, resp_ie, resp_ie_len, - GFP_KERNEL); - -#ifdef CONFIG_CFG80211_WEXT - if (req_ie) { - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = req_ie_len; - wireless_send_event(wdev->netdev, IWEVASSOCREQIE, - &wrqu, req_ie); - } - - if (resp_ie) { - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.data.length = resp_ie_len; - wireless_send_event(wdev->netdev, IWEVASSOCRESPIE, - &wrqu, resp_ie); - } - - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - memcpy(wrqu.ap_addr.sa_data, bss->bssid, ETH_ALEN); - memcpy(wdev->wext.prev_bssid, bss->bssid, ETH_ALEN); - wdev->wext.prev_bssid_valid = true; - wireless_send_event(wdev->netdev, SIOCGIWAP, &wrqu, NULL); -#endif - - return; -out: - cfg80211_put_bss(bss); -} - -void cfg80211_roamed(struct net_device *dev, - struct ieee80211_channel *channel, - const u8 *bssid, - const u8 *req_ie, size_t req_ie_len, - const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_bss *bss; - - CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTED); - - bss = cfg80211_get_bss(wdev->wiphy, channel, bssid, wdev->ssid, - wdev->ssid_len, WLAN_CAPABILITY_ESS, - WLAN_CAPABILITY_ESS); - if (WARN_ON(!bss)) - return; - - cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie, - resp_ie_len, gfp); -} -EXPORT_SYMBOL(cfg80211_roamed); - -void cfg80211_roamed_bss(struct net_device *dev, - struct cfg80211_bss *bss, const u8 *req_ie, - size_t req_ie_len, const u8 *resp_ie, - size_t resp_ie_len, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct cfg80211_event *ev; - unsigned long flags; - - CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTED); - - if (WARN_ON(!bss)) - return; - - ev = kzalloc(sizeof(*ev) + req_ie_len + resp_ie_len, gfp); - if (!ev) { - cfg80211_put_bss(bss); - return; - } - - ev->type = EVENT_ROAMED; - ev->rm.req_ie = ((u8 *)ev) + sizeof(*ev); - ev->rm.req_ie_len = req_ie_len; - memcpy((void *)ev->rm.req_ie, req_ie, req_ie_len); - ev->rm.resp_ie = ((u8 *)ev) + sizeof(*ev) + req_ie_len; - ev->rm.resp_ie_len = resp_ie_len; - memcpy((void *)ev->rm.resp_ie, resp_ie, resp_ie_len); - ev->rm.bss = bss; - - spin_lock_irqsave(&wdev->event_lock, flags); - list_add_tail(&ev->list, &wdev->event_list); - spin_unlock_irqrestore(&wdev->event_lock, flags); - queue_work(cfg80211_wq, &rdev->event_work); -} -EXPORT_SYMBOL(cfg80211_roamed_bss); - -void __cfg80211_disconnected(struct net_device *dev, const u8 *ie, - size_t ie_len, u16 reason, bool from_ap) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - int i; -#ifdef CONFIG_CFG80211_WEXT - union iwreq_data wrqu; -#endif - - ASSERT_WDEV_LOCK(wdev); - - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION && - wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) - return; - - if (wdev->sme_state != CFG80211_SME_CONNECTED) - return; - - if (wdev->current_bss) { - cfg80211_unhold_bss(wdev->current_bss); - cfg80211_put_bss(&wdev->current_bss->pub); - } - - wdev->current_bss = NULL; - wdev->sme_state = CFG80211_SME_IDLE; - wdev->ssid_len = 0; - - if (wdev->conn) { - kfree(wdev->conn->ie); - wdev->conn->ie = NULL; - kfree(wdev->conn); - wdev->conn = NULL; - } - - nl80211_send_disconnected(rdev, dev, reason, ie, ie_len, from_ap); - - /* - * Delete all the keys ... pairwise keys can't really - * exist any more anyway, but default keys might. - */ - if (rdev->ops->del_key) - for (i = 0; i < 6; i++) - rdev->ops->del_key(wdev->wiphy, dev, i, false, NULL); - -#ifdef CONFIG_CFG80211_WEXT - memset(&wrqu, 0, sizeof(wrqu)); - wrqu.ap_addr.sa_family = ARPHRD_ETHER; - wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL); - wdev->wext.connect.ssid_len = 0; -#endif - - schedule_work(&cfg80211_disconnect_work); -} - -void cfg80211_disconnected(struct net_device *dev, u16 reason, - u8 *ie, size_t ie_len, gfp_t gfp) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct cfg80211_event *ev; - unsigned long flags; - - CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTED); - - ev = kzalloc(sizeof(*ev) + ie_len, gfp); - if (!ev) - return; - - ev->type = EVENT_DISCONNECTED; - ev->dc.ie = ((u8 *)ev) + sizeof(*ev); - ev->dc.ie_len = ie_len; - memcpy((void *)ev->dc.ie, ie, ie_len); - ev->dc.reason = reason; - - spin_lock_irqsave(&wdev->event_lock, flags); - list_add_tail(&ev->list, &wdev->event_list); - spin_unlock_irqrestore(&wdev->event_lock, flags); - queue_work(cfg80211_wq, &rdev->event_work); -} -EXPORT_SYMBOL(cfg80211_disconnected); - -/* - * [PLATA] is this method called? if so, need to follow the ops->connect... - */ -int __cfg80211_connect(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct cfg80211_connect_params *connect, - struct cfg80211_cached_keys *connkeys, - const u8 *prev_bssid) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_bss *bss = NULL; - int err; - - ASSERT_WDEV_LOCK(wdev); - - if (wdev->sme_state != CFG80211_SME_IDLE) - return -EALREADY; - - if (WARN_ON(wdev->connect_keys)) { - kfree(wdev->connect_keys); - wdev->connect_keys = NULL; - } - - cfg80211_oper_and_ht_capa(&connect->ht_capa_mask, - rdev->wiphy.ht_capa_mod_mask); - - if (connkeys && connkeys->def >= 0) { - int idx; - u32 cipher; - - idx = connkeys->def; - cipher = connkeys->params[idx].cipher; - /* If given a WEP key we may need it for shared key auth */ - if (cipher == WLAN_CIPHER_SUITE_WEP40 || - cipher == WLAN_CIPHER_SUITE_WEP104) { - connect->key_idx = idx; - connect->key = connkeys->params[idx].key; - connect->key_len = connkeys->params[idx].key_len; - - /* - * If ciphers are not set (e.g. when going through - * iwconfig), we have to set them appropriately here. - */ - if (connect->crypto.cipher_group == 0) - connect->crypto.cipher_group = cipher; - - if (connect->crypto.n_ciphers_pairwise == 0) { - connect->crypto.n_ciphers_pairwise = 1; - connect->crypto.ciphers_pairwise[0] = cipher; - } - } - } - - if (!rdev->ops->connect) { - if (!rdev->ops->auth || !rdev->ops->assoc) - return -EOPNOTSUPP; - - if (WARN_ON(wdev->conn)) - return -EINPROGRESS; - - wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL); - if (!wdev->conn) - return -ENOMEM; - - /* - * Copy all parameters, and treat explicitly IEs, BSSID, SSID. - */ - memcpy(&wdev->conn->params, connect, sizeof(*connect)); - if (connect->bssid) { - wdev->conn->params.bssid = wdev->conn->bssid; - memcpy(wdev->conn->bssid, connect->bssid, ETH_ALEN); - } - - if (connect->ie) { - wdev->conn->ie = kmemdup(connect->ie, connect->ie_len, - GFP_KERNEL); - wdev->conn->params.ie = wdev->conn->ie; - if (!wdev->conn->ie) { - kfree(wdev->conn); - wdev->conn = NULL; - return -ENOMEM; - } - } - - if (connect->auth_type == NL80211_AUTHTYPE_AUTOMATIC) { - wdev->conn->auto_auth = true; - /* start with open system ... should mostly work */ - wdev->conn->params.auth_type = - NL80211_AUTHTYPE_OPEN_SYSTEM; - } else { - wdev->conn->auto_auth = false; - } - - memcpy(wdev->ssid, connect->ssid, connect->ssid_len); - wdev->ssid_len = connect->ssid_len; - wdev->conn->params.ssid = wdev->ssid; - wdev->conn->params.ssid_len = connect->ssid_len; - - /* see if we have the bss already */ - bss = cfg80211_get_conn_bss(wdev); - - wdev->sme_state = CFG80211_SME_CONNECTING; - wdev->connect_keys = connkeys; - - if (prev_bssid) { - memcpy(wdev->conn->prev_bssid, prev_bssid, ETH_ALEN); - wdev->conn->prev_bssid_valid = true; - } - - /* we're good if we have a matching bss struct */ - if (bss) { - wdev->conn->state = CFG80211_CONN_AUTHENTICATE_NEXT; - err = cfg80211_conn_do_work(wdev); - cfg80211_put_bss(bss); - } else { - /* otherwise we'll need to scan for the AP first */ - err = cfg80211_conn_scan(wdev); - /* - * If we can't scan right now, then we need to scan again - * after the current scan finished, since the parameters - * changed (unless we find a good AP anyway). - */ - if (err == -EBUSY) { - err = 0; - wdev->conn->state = CFG80211_CONN_SCAN_AGAIN; - } - } - if (err) { - kfree(wdev->conn->ie); - kfree(wdev->conn); - wdev->conn = NULL; - wdev->sme_state = CFG80211_SME_IDLE; - wdev->connect_keys = NULL; - wdev->ssid_len = 0; - } - - return err; - } else { - wdev->sme_state = CFG80211_SME_CONNECTING; - wdev->connect_keys = connkeys; - err = rdev->ops->connect(&rdev->wiphy, dev, connect); - if (err) { - wdev->connect_keys = NULL; - wdev->sme_state = CFG80211_SME_IDLE; - return err; - } - - memcpy(wdev->ssid, connect->ssid, connect->ssid_len); - wdev->ssid_len = connect->ssid_len; - - return 0; - } -} - -int cfg80211_connect(struct cfg80211_registered_device *rdev, - struct net_device *dev, - struct cfg80211_connect_params *connect, - struct cfg80211_cached_keys *connkeys) -{ - int err; - - mutex_lock(&rdev->devlist_mtx); - wdev_lock(dev->ieee80211_ptr); - err = __cfg80211_connect(rdev, dev, connect, connkeys, NULL); - wdev_unlock(dev->ieee80211_ptr); - mutex_unlock(&rdev->devlist_mtx); - - return err; -} - -int __cfg80211_disconnect(struct cfg80211_registered_device *rdev, - struct net_device *dev, u16 reason, bool wextev) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err; - - ASSERT_WDEV_LOCK(wdev); - - if (wdev->sme_state == CFG80211_SME_IDLE) - return -EINVAL; - - kfree(wdev->connect_keys); - wdev->connect_keys = NULL; - - if (!rdev->ops->disconnect) { - if (!rdev->ops->deauth) - return -EOPNOTSUPP; - - /* was it connected by userspace SME? */ - if (!wdev->conn) { - cfg80211_mlme_down(rdev, dev); - return 0; - } - - if (wdev->sme_state == CFG80211_SME_CONNECTING && - (wdev->conn->state == CFG80211_CONN_SCANNING || - wdev->conn->state == CFG80211_CONN_SCAN_AGAIN)) { - wdev->sme_state = CFG80211_SME_IDLE; - kfree(wdev->conn->ie); - kfree(wdev->conn); - wdev->conn = NULL; - wdev->ssid_len = 0; - return 0; - } - - /* wdev->conn->params.bssid must be set if > SCANNING */ - err = __cfg80211_mlme_deauth(rdev, dev, - wdev->conn->params.bssid, - NULL, 0, reason, false); - if (err) - return err; - } else { - err = rdev->ops->disconnect(&rdev->wiphy, dev, reason); - if (err) - return err; - } - - if (wdev->sme_state == CFG80211_SME_CONNECTED) - __cfg80211_disconnected(dev, NULL, 0, 0, false); - else if (wdev->sme_state == CFG80211_SME_CONNECTING) - __cfg80211_connect_result(dev, NULL, NULL, 0, NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - wextev, NULL); - - return 0; -} - -int cfg80211_disconnect(struct cfg80211_registered_device *rdev, - struct net_device *dev, - u16 reason, bool wextev) -{ - int err; - - wdev_lock(dev->ieee80211_ptr); - err = __cfg80211_disconnect(rdev, dev, reason, wextev); - wdev_unlock(dev->ieee80211_ptr); - - return err; -} - -void cfg80211_sme_disassoc(struct net_device *dev, - struct cfg80211_internal_bss *bss) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - u8 bssid[ETH_ALEN]; - - ASSERT_WDEV_LOCK(wdev); - - if (!wdev->conn) - return; - - if (wdev->conn->state == CFG80211_CONN_IDLE) - return; - - /* - * Ok, so the association was made by this SME -- we don't - * want it any more so deauthenticate too. - */ - - memcpy(bssid, bss->pub.bssid, ETH_ALEN); - - __cfg80211_mlme_deauth(rdev, dev, bssid, NULL, 0, - WLAN_REASON_DEAUTH_LEAVING, false); -} diff --git a/openairITS/mac/DOT11/net/wireless/sysfs.c b/openairITS/mac/DOT11/net/wireless/sysfs.c deleted file mode 100644 index 2f8af6e27e3..00000000000 --- a/openairITS/mac/DOT11/net/wireless/sysfs.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * This file provides /sys/class/ieee80211/<wiphy name>/ - * and some default attributes. - * - * Copyright 2005-2006 Jiri Benc <jbenc@suse.cz> - * Copyright 2006 Johannes Berg <johannes@sipsolutions.net> - * - * This file is GPLv2 as found in COPYING. - */ - -#include <linux/device.h> -#include <linux/module.h> -#include <linux/netdevice.h> -#include <linux/nl80211.h> -#include <linux/rtnetlink.h> -#include <net/cfg80211.h> -#include "sysfs.h" -#include "core.h" - -static inline struct cfg80211_registered_device *dev_to_rdev( - struct device *dev) -{ - return container_of(dev, struct cfg80211_registered_device, wiphy.dev); -} - -#define SHOW_FMT(name, fmt, member) \ -static ssize_t name ## _show(struct device *dev, \ - struct device_attribute *attr, \ - char *buf) \ -{ \ - return sprintf(buf, fmt "\n", dev_to_rdev(dev)->member); \ -} - -SHOW_FMT(index, "%d", wiphy_idx); -SHOW_FMT(macaddress, "%pM", wiphy.perm_addr); -SHOW_FMT(address_mask, "%pM", wiphy.addr_mask); - -static ssize_t name_show(struct device *dev, - struct device_attribute *attr, - char *buf) { - struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy; - return sprintf(buf, "%s\n", dev_name(&wiphy->dev)); -} - - -static ssize_t addresses_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy; - char *start = buf; - int i; - - if (!wiphy->addresses) - return sprintf(buf, "%pM\n", wiphy->perm_addr); - - for (i = 0; i < wiphy->n_addresses; i++) - buf += sprintf(buf, "%pM\n", &wiphy->addresses[i].addr); - - return buf - start; -} - -static struct device_attribute ieee80211_dev_attrs[] = { - __ATTR_RO(index), - __ATTR_RO(macaddress), - __ATTR_RO(address_mask), - __ATTR_RO(addresses), - __ATTR_RO(name), - {} -}; - -static void wiphy_dev_release(struct device *dev) -{ - struct cfg80211_registered_device *rdev = dev_to_rdev(dev); - - cfg80211_dev_free(rdev); -} - -#ifdef CONFIG_HOTPLUG -static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env) -{ - /* TODO, we probably need stuff here */ - return 0; -} -#endif - -static int wiphy_suspend(struct device *dev, pm_message_t state) -{ - struct cfg80211_registered_device *rdev = dev_to_rdev(dev); - int ret = 0; - - rdev->suspend_at = get_seconds(); - - if (rdev->ops->suspend) { - rtnl_lock(); - if (rdev->wiphy.registered) - ret = rdev->ops->suspend(&rdev->wiphy, rdev->wowlan); - rtnl_unlock(); - } - - return ret; -} - -static int wiphy_resume(struct device *dev) -{ - struct cfg80211_registered_device *rdev = dev_to_rdev(dev); - int ret = 0; - - /* Age scan results with time spent in suspend */ - spin_lock_bh(&rdev->bss_lock); - cfg80211_bss_age(rdev, get_seconds() - rdev->suspend_at); - spin_unlock_bh(&rdev->bss_lock); - - if (rdev->ops->resume) { - rtnl_lock(); - if (rdev->wiphy.registered) - ret = rdev->ops->resume(&rdev->wiphy); - rtnl_unlock(); - } - - return ret; -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) -static const void *wiphy_namespace(struct device *d) -{ - struct wiphy *wiphy = container_of(d, struct wiphy, dev); - - return wiphy_net(wiphy); -} -#endif - -struct class ieee80211_class = { - .name = "ieee80211", - .owner = THIS_MODULE, - .dev_release = wiphy_dev_release, - .dev_attrs = ieee80211_dev_attrs, -#ifdef CONFIG_HOTPLUG - .dev_uevent = wiphy_uevent, -#endif - .suspend = wiphy_suspend, - .resume = wiphy_resume, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - .ns_type = &net_ns_type_operations, - .namespace = wiphy_namespace, -#endif -}; - -int wiphy_sysfs_init(void) -{ - return class_register(&ieee80211_class); -} - -void wiphy_sysfs_exit(void) -{ - class_unregister(&ieee80211_class); -} diff --git a/openairITS/mac/DOT11/net/wireless/sysfs.h b/openairITS/mac/DOT11/net/wireless/sysfs.h deleted file mode 100644 index 65acbebd371..00000000000 --- a/openairITS/mac/DOT11/net/wireless/sysfs.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __WIRELESS_SYSFS_H -#define __WIRELESS_SYSFS_H - -extern int wiphy_sysfs_init(void); -extern void wiphy_sysfs_exit(void); - -extern struct class ieee80211_class; - -#endif /* __WIRELESS_SYSFS_H */ diff --git a/openairITS/mac/DOT11/net/wireless/util.c b/openairITS/mac/DOT11/net/wireless/util.c deleted file mode 100644 index 10bbbbefc98..00000000000 --- a/openairITS/mac/DOT11/net/wireless/util.c +++ /dev/null @@ -1,1059 +0,0 @@ -/* - * Wireless utility functions - * - * Copyright 2007-2009 Johannes Berg <johannes@sipsolutions.net> - */ -#include <linux/export.h> -#include <linux/bitops.h> -#include <linux/etherdevice.h> -#include <linux/slab.h> -#include <net/cfg80211.h> -#include <net/ip.h> -#include <net/dsfield.h> -#include "core.h" - -struct ieee80211_rate * -ieee80211_get_response_rate(struct ieee80211_supported_band *sband, - u32 basic_rates, int bitrate) -{ - struct ieee80211_rate *result = &sband->bitrates[0]; - int i; - - for (i = 0; i < sband->n_bitrates; i++) { - if (!(basic_rates & BIT(i))) - continue; - if (sband->bitrates[i].bitrate > bitrate) - continue; - result = &sband->bitrates[i]; - } - - return result; -} -EXPORT_SYMBOL(ieee80211_get_response_rate); - -int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band) -{ - /* see 802.11 17.3.8.3.2 and Annex J - * there are overlapping channel numbers in 5GHz and 2GHz bands */ - if (band == IEEE80211_BAND_5GHZ) { - if (chan >= 182 && chan <= 196) - return 4000 + chan * 5; - else - return 5000 + chan * 5; - } else { /* IEEE80211_BAND_2GHZ */ - if (chan == 14) - return 2484; - else if (chan < 14) - return 2407 + chan * 5; - else - return 0; /* not supported */ - } -} -EXPORT_SYMBOL(ieee80211_channel_to_frequency); - -int ieee80211_frequency_to_channel(int freq) -{ - /* see 802.11 17.3.8.3.2 and Annex J */ - if (freq == 2484) - return 14; - else if (freq < 2484) - return (freq - 2407) / 5; - else if (freq >= 4910 && freq <= 4980) - return (freq - 4000) / 5; - else - return (freq - 5000) / 5; -} -EXPORT_SYMBOL(ieee80211_frequency_to_channel); - -struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy, - int freq) -{ - enum ieee80211_band band; - struct ieee80211_supported_band *sband; - int i; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - sband = wiphy->bands[band]; - - if (!sband) - continue; - - for (i = 0; i < sband->n_channels; i++) { - if (sband->channels[i].center_freq == freq) - return &sband->channels[i]; - } - } - - return NULL; -} -EXPORT_SYMBOL(__ieee80211_get_channel); - -static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, - enum ieee80211_band band) -{ - int i, want; - - switch (band) { - case IEEE80211_BAND_5GHZ: - want = 3; - for (i = 0; i < sband->n_bitrates; i++) { - if (sband->bitrates[i].bitrate == 60 || - sband->bitrates[i].bitrate == 120 || - sband->bitrates[i].bitrate == 240) { - sband->bitrates[i].flags |= - IEEE80211_RATE_MANDATORY_A; - want--; - } - } - WARN_ON(want); - break; - case IEEE80211_BAND_2GHZ: - want = 7; - for (i = 0; i < sband->n_bitrates; i++) { - if (sband->bitrates[i].bitrate == 10) { - sband->bitrates[i].flags |= - IEEE80211_RATE_MANDATORY_B | - IEEE80211_RATE_MANDATORY_G; - want--; - } - - if (sband->bitrates[i].bitrate == 20 || - sband->bitrates[i].bitrate == 55 || - sband->bitrates[i].bitrate == 110 || - sband->bitrates[i].bitrate == 60 || - sband->bitrates[i].bitrate == 120 || - sband->bitrates[i].bitrate == 240) { - sband->bitrates[i].flags |= - IEEE80211_RATE_MANDATORY_G; - want--; - } - - if (sband->bitrates[i].bitrate != 10 && - sband->bitrates[i].bitrate != 20 && - sband->bitrates[i].bitrate != 55 && - sband->bitrates[i].bitrate != 110) - sband->bitrates[i].flags |= - IEEE80211_RATE_ERP_G; - } - WARN_ON(want != 0 && want != 3 && want != 6); - break; - case IEEE80211_BAND_5_9GHZ: - case IEEE80211_BAND_0_8GHZ: - break; - case IEEE80211_NUM_BANDS: - WARN_ON(1); - break; - } -} - -void ieee80211_set_bitrate_flags(struct wiphy *wiphy) -{ - enum ieee80211_band band; - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) - if (wiphy->bands[band]) - set_mandatory_flags_band(wiphy->bands[band], band); -} - -bool cfg80211_supported_cipher_suite(struct wiphy *wiphy, u32 cipher) -{ - int i; - for (i = 0; i < wiphy->n_cipher_suites; i++) - if (cipher == wiphy->cipher_suites[i]) - return true; - return false; -} - -int cfg80211_validate_key_settings(struct cfg80211_registered_device *rdev, - struct key_params *params, int key_idx, - bool pairwise, const u8 *mac_addr) -{ - if (key_idx > 5) - return -EINVAL; - - if (!pairwise && mac_addr && !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) - return -EINVAL; - - if (pairwise && !mac_addr) - return -EINVAL; - - /* - * Disallow pairwise keys with non-zero index unless it's WEP - * or a vendor specific cipher (because current deployments use - * pairwise WEP keys with non-zero indices and for vendor specific - * ciphers this should be validated in the driver or hardware level - * - but 802.11i clearly specifies to use zero) - */ - if (pairwise && key_idx && - ((params->cipher == WLAN_CIPHER_SUITE_TKIP) || - (params->cipher == WLAN_CIPHER_SUITE_CCMP) || - (params->cipher == WLAN_CIPHER_SUITE_AES_CMAC))) - return -EINVAL; - - switch (params->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - if (params->key_len != WLAN_KEY_LEN_WEP40) - return -EINVAL; - break; - case WLAN_CIPHER_SUITE_TKIP: - if (params->key_len != WLAN_KEY_LEN_TKIP) - return -EINVAL; - break; - case WLAN_CIPHER_SUITE_CCMP: - if (params->key_len != WLAN_KEY_LEN_CCMP) - return -EINVAL; - break; - case WLAN_CIPHER_SUITE_WEP104: - if (params->key_len != WLAN_KEY_LEN_WEP104) - return -EINVAL; - break; - case WLAN_CIPHER_SUITE_AES_CMAC: - if (params->key_len != WLAN_KEY_LEN_AES_CMAC) - return -EINVAL; - break; - default: - /* - * We don't know anything about this algorithm, - * allow using it -- but the driver must check - * all parameters! We still check below whether - * or not the driver supports this algorithm, - * of course. - */ - break; - } - - if (params->seq) { - switch (params->cipher) { - case WLAN_CIPHER_SUITE_WEP40: - case WLAN_CIPHER_SUITE_WEP104: - /* These ciphers do not use key sequence */ - return -EINVAL; - case WLAN_CIPHER_SUITE_TKIP: - case WLAN_CIPHER_SUITE_CCMP: - case WLAN_CIPHER_SUITE_AES_CMAC: - if (params->seq_len != 6) - return -EINVAL; - break; - } - } - - if (!cfg80211_supported_cipher_suite(&rdev->wiphy, params->cipher)) - return -EINVAL; - - return 0; -} - -unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc) -{ - unsigned int hdrlen = 24; - - if (ieee80211_is_data(fc)) { - if (ieee80211_has_a4(fc)) - hdrlen = 30; - if (ieee80211_is_data_qos(fc)) { - hdrlen += IEEE80211_QOS_CTL_LEN; - if (ieee80211_has_order(fc)) - hdrlen += IEEE80211_HT_CTL_LEN; - } - goto out; - } - - if (ieee80211_is_ctl(fc)) { - /* - * ACK and CTS are 10 bytes, all others 16. To see how - * to get this condition consider - * subtype mask: 0b0000000011110000 (0x00F0) - * ACK subtype: 0b0000000011010000 (0x00D0) - * CTS subtype: 0b0000000011000000 (0x00C0) - * bits that matter: ^^^ (0x00E0) - * value of those: 0b0000000011000000 (0x00C0) - */ - if ((fc & cpu_to_le16(0x00E0)) == cpu_to_le16(0x00C0)) - hdrlen = 10; - else - hdrlen = 16; - } -out: - return hdrlen; -} -EXPORT_SYMBOL(ieee80211_hdrlen); - -unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb) -{ - const struct ieee80211_hdr *hdr = - (const struct ieee80211_hdr *)skb->data; - unsigned int hdrlen; - - if (unlikely(skb->len < 10)) - return 0; - hdrlen = ieee80211_hdrlen(hdr->frame_control); - if (unlikely(hdrlen > skb->len)) - return 0; - return hdrlen; -} -EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb); - -static int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr) -{ - int ae = meshhdr->flags & MESH_FLAGS_AE; - /* 7.1.3.5a.2 */ - switch (ae) { - case 0: - return 6; - case MESH_FLAGS_AE_A4: - return 12; - case MESH_FLAGS_AE_A5_A6: - return 18; - case (MESH_FLAGS_AE_A4 | MESH_FLAGS_AE_A5_A6): - return 24; - default: - return 6; - } -} - -int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, - enum nl80211_iftype iftype) -{ - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; - u16 hdrlen, ethertype; - u8 *payload; - u8 dst[ETH_ALEN]; - u8 src[ETH_ALEN] __aligned(2); - - if (unlikely(!ieee80211_is_data_present(hdr->frame_control))) - return -1; - - hdrlen = ieee80211_hdrlen(hdr->frame_control); - - /* convert IEEE 802.11 header + possible LLC headers into Ethernet - * header - * IEEE 802.11 address fields: - * ToDS FromDS Addr1 Addr2 Addr3 Addr4 - * 0 0 DA SA BSSID n/a - * 0 1 DA BSSID SA n/a - * 1 0 BSSID SA DA n/a - * 1 1 RA TA DA SA - */ - memcpy(dst, ieee80211_get_DA(hdr), ETH_ALEN); - memcpy(src, ieee80211_get_SA(hdr), ETH_ALEN); - - switch (hdr->frame_control & - cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) { - case cpu_to_le16(IEEE80211_FCTL_TODS): - if (unlikely(iftype != NL80211_IFTYPE_AP && - iftype != NL80211_IFTYPE_AP_VLAN && - iftype != NL80211_IFTYPE_P2P_GO)) - return -1; - break; - case cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS): - if (unlikely(iftype != NL80211_IFTYPE_WDS && - iftype != NL80211_IFTYPE_MESH_POINT && - iftype != NL80211_IFTYPE_AP_VLAN && - iftype != NL80211_IFTYPE_STATION)) - return -1; - if (iftype == NL80211_IFTYPE_MESH_POINT) { - struct ieee80211s_hdr *meshdr = - (struct ieee80211s_hdr *) (skb->data + hdrlen); - /* make sure meshdr->flags is on the linear part */ - if (!pskb_may_pull(skb, hdrlen + 1)) - return -1; - if (meshdr->flags & MESH_FLAGS_AE_A5_A6) { - skb_copy_bits(skb, hdrlen + - offsetof(struct ieee80211s_hdr, eaddr1), - dst, ETH_ALEN); - skb_copy_bits(skb, hdrlen + - offsetof(struct ieee80211s_hdr, eaddr2), - src, ETH_ALEN); - } - hdrlen += ieee80211_get_mesh_hdrlen(meshdr); - } - break; - case cpu_to_le16(IEEE80211_FCTL_FROMDS): - if ((iftype != NL80211_IFTYPE_STATION && - iftype != NL80211_IFTYPE_P2P_CLIENT && - iftype != NL80211_IFTYPE_MESH_POINT) || - (is_multicast_ether_addr(dst) && - !compare_ether_addr(src, addr))) - return -1; - if (iftype == NL80211_IFTYPE_MESH_POINT) { - struct ieee80211s_hdr *meshdr = - (struct ieee80211s_hdr *) (skb->data + hdrlen); - /* make sure meshdr->flags is on the linear part */ - if (!pskb_may_pull(skb, hdrlen + 1)) - return -1; - if (meshdr->flags & MESH_FLAGS_AE_A4) - skb_copy_bits(skb, hdrlen + - offsetof(struct ieee80211s_hdr, eaddr1), - src, ETH_ALEN); - hdrlen += ieee80211_get_mesh_hdrlen(meshdr); - } - break; - case cpu_to_le16(0): // [PLATA] only ADHOC and STATION can have toDS and fromDS to 0. The OCB activated forces it to be so...no change needed here as long as we are STA or ADHOC - if (iftype != NL80211_IFTYPE_ADHOC && - iftype != NL80211_IFTYPE_STATION) - return -1; - break; - } - - if (!pskb_may_pull(skb, hdrlen + 8)) - return -1; - - payload = skb->data + hdrlen; - ethertype = (payload[6] << 8) | payload[7]; - - if (likely((compare_ether_addr(payload, rfc1042_header) == 0 && - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || - compare_ether_addr(payload, bridge_tunnel_header) == 0)) { - /* remove RFC1042 or Bridge-Tunnel encapsulation and - * replace EtherType */ - skb_pull(skb, hdrlen + 6); - memcpy(skb_push(skb, ETH_ALEN), src, ETH_ALEN); - memcpy(skb_push(skb, ETH_ALEN), dst, ETH_ALEN); - } else { - struct ethhdr *ehdr; - __be16 len; - - skb_pull(skb, hdrlen); - len = htons(skb->len); - ehdr = (struct ethhdr *) skb_push(skb, sizeof(struct ethhdr)); - memcpy(ehdr->h_dest, dst, ETH_ALEN); - memcpy(ehdr->h_source, src, ETH_ALEN); - ehdr->h_proto = len; - } - return 0; -} -EXPORT_SYMBOL(ieee80211_data_to_8023); - -int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, - enum nl80211_iftype iftype, u8 *bssid, bool qos) -{ - struct ieee80211_hdr hdr; - u16 hdrlen, ethertype; - __le16 fc; - const u8 *encaps_data; - int encaps_len, skip_header_bytes; - int nh_pos, h_pos; - int head_need; - - if (unlikely(skb->len < ETH_HLEN)) - return -EINVAL; - - nh_pos = skb_network_header(skb) - skb->data; - h_pos = skb_transport_header(skb) - skb->data; - - /* convert Ethernet header to proper 802.11 header (based on - * operation mode) */ - ethertype = (skb->data[12] << 8) | skb->data[13]; - fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); - - switch (iftype) { - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_P2P_GO: - fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); - /* DA BSSID SA */ - memcpy(hdr.addr1, skb->data, ETH_ALEN); - memcpy(hdr.addr2, addr, ETH_ALEN); - memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); - hdrlen = 24; - break; - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_P2P_CLIENT: - fc |= cpu_to_le16(IEEE80211_FCTL_TODS); - /* BSSID SA DA */ - memcpy(hdr.addr1, bssid, ETH_ALEN); - memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); - memcpy(hdr.addr3, skb->data, ETH_ALEN); - hdrlen = 24; - break; - case NL80211_IFTYPE_ADHOC: - /* DA SA BSSID */ - memcpy(hdr.addr1, skb->data, ETH_ALEN); - memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); - memcpy(hdr.addr3, bssid, ETH_ALEN); - hdrlen = 24; - break; - default: - return -EOPNOTSUPP; - } - - if (qos) { - fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA); - hdrlen += 2; - } - - hdr.frame_control = fc; - hdr.duration_id = 0; - hdr.seq_ctrl = 0; - - skip_header_bytes = ETH_HLEN; - if (ethertype == ETH_P_AARP || ethertype == ETH_P_IPX) { - encaps_data = bridge_tunnel_header; - encaps_len = sizeof(bridge_tunnel_header); - skip_header_bytes -= 2; - } else if (ethertype > 0x600) { - encaps_data = rfc1042_header; - encaps_len = sizeof(rfc1042_header); - skip_header_bytes -= 2; - } else { - encaps_data = NULL; - encaps_len = 0; - } - - skb_pull(skb, skip_header_bytes); - nh_pos -= skip_header_bytes; - h_pos -= skip_header_bytes; - - head_need = hdrlen + encaps_len - skb_headroom(skb); - - if (head_need > 0 || skb_cloned(skb)) { - head_need = max(head_need, 0); - if (head_need) - skb_orphan(skb); - - if (pskb_expand_head(skb, head_need, 0, GFP_ATOMIC)) - return -ENOMEM; - - skb->truesize += head_need; - } - - if (encaps_data) { - memcpy(skb_push(skb, encaps_len), encaps_data, encaps_len); - nh_pos += encaps_len; - h_pos += encaps_len; - } - - memcpy(skb_push(skb, hdrlen), &hdr, hdrlen); - - nh_pos += hdrlen; - h_pos += hdrlen; - - /* Update skb pointers to various headers since this modified frame - * is going to go through Linux networking code that may potentially - * need things like pointer to IP header. */ - skb_set_mac_header(skb, 0); - skb_set_network_header(skb, nh_pos); - skb_set_transport_header(skb, h_pos); - - return 0; -} -EXPORT_SYMBOL(ieee80211_data_from_8023); - - -void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, - const u8 *addr, enum nl80211_iftype iftype, - const unsigned int extra_headroom, - bool has_80211_header) -{ - struct sk_buff *frame = NULL; - u16 ethertype; - u8 *payload; - const struct ethhdr *eth; - int remaining, err; - u8 dst[ETH_ALEN], src[ETH_ALEN]; - - if (has_80211_header) { - err = ieee80211_data_to_8023(skb, addr, iftype); - if (err) - goto out; - - /* skip the wrapping header */ - eth = (struct ethhdr *) skb_pull(skb, sizeof(struct ethhdr)); - if (!eth) - goto out; - } else { - eth = (struct ethhdr *) skb->data; - } - - while (skb != frame) { - u8 padding; - __be16 len = eth->h_proto; - unsigned int subframe_len = sizeof(struct ethhdr) + ntohs(len); - - remaining = skb->len; - memcpy(dst, eth->h_dest, ETH_ALEN); - memcpy(src, eth->h_source, ETH_ALEN); - - padding = (4 - subframe_len) & 0x3; - /* the last MSDU has no padding */ - if (subframe_len > remaining) - goto purge; - - skb_pull(skb, sizeof(struct ethhdr)); - /* reuse skb for the last subframe */ - if (remaining <= subframe_len + padding) - frame = skb; - else { - unsigned int hlen = ALIGN(extra_headroom, 4); - /* - * Allocate and reserve two bytes more for payload - * alignment since sizeof(struct ethhdr) is 14. - */ - frame = dev_alloc_skb(hlen + subframe_len + 2); - if (!frame) - goto purge; - - skb_reserve(frame, hlen + sizeof(struct ethhdr) + 2); - memcpy(skb_put(frame, ntohs(len)), skb->data, - ntohs(len)); - - eth = (struct ethhdr *)skb_pull(skb, ntohs(len) + - padding); - if (!eth) { - dev_kfree_skb(frame); - goto purge; - } - } - - skb_reset_network_header(frame); - frame->dev = skb->dev; - frame->priority = skb->priority; - - payload = frame->data; - ethertype = (payload[6] << 8) | payload[7]; - - if (likely((compare_ether_addr(payload, rfc1042_header) == 0 && - ethertype != ETH_P_AARP && ethertype != ETH_P_IPX) || - compare_ether_addr(payload, - bridge_tunnel_header) == 0)) { - /* remove RFC1042 or Bridge-Tunnel - * encapsulation and replace EtherType */ - skb_pull(frame, 6); - memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN); - memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN); - } else { - memcpy(skb_push(frame, sizeof(__be16)), &len, - sizeof(__be16)); - memcpy(skb_push(frame, ETH_ALEN), src, ETH_ALEN); - memcpy(skb_push(frame, ETH_ALEN), dst, ETH_ALEN); - } - __skb_queue_tail(list, frame); - } - - return; - - purge: - __skb_queue_purge(list); - out: - dev_kfree_skb(skb); -} -EXPORT_SYMBOL(ieee80211_amsdu_to_8023s); - -/* Given a data frame determine the 802.1p/1d tag to use. */ -unsigned int cfg80211_classify8021d(struct sk_buff *skb) -{ - unsigned int dscp; - - /* skb->priority values from 256->263 are magic values to - * directly indicate a specific 802.1d priority. This is used - * to allow 802.1d priority to be passed directly in from VLAN - * tags, etc. - */ - if (skb->priority >= 256 && skb->priority <= 263) - return skb->priority - 256; - - switch (skb->protocol) { - case htons(ETH_P_IP): - dscp = ipv4_get_dsfield(ip_hdr(skb)) & 0xfc; - break; - case htons(ETH_P_IPV6): - dscp = ipv6_get_dsfield(ipv6_hdr(skb)) & 0xfc; - break; - default: - return 0; - } - - return dscp >> 5; -} -EXPORT_SYMBOL(cfg80211_classify8021d); - -const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie) -{ - u8 *end, *pos; - - pos = bss->information_elements; - if (pos == NULL) - return NULL; - end = pos + bss->len_information_elements; - - while (pos + 1 < end) { - if (pos + 2 + pos[1] > end) - break; - if (pos[0] == ie) - return pos; - pos += 2 + pos[1]; - } - - return NULL; -} -EXPORT_SYMBOL(ieee80211_bss_get_ie); - -void cfg80211_upload_connect_keys(struct wireless_dev *wdev) -{ - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct net_device *dev = wdev->netdev; - int i; - - if (!wdev->connect_keys) - return; - - for (i = 0; i < 6; i++) { - if (!wdev->connect_keys->params[i].cipher) - continue; - if (rdev->ops->add_key(wdev->wiphy, dev, i, false, NULL, - &wdev->connect_keys->params[i])) { - netdev_err(dev, "failed to set key %d\n", i); - continue; - } - if (wdev->connect_keys->def == i) - if (rdev->ops->set_default_key(wdev->wiphy, dev, - i, true, true)) { - netdev_err(dev, "failed to set defkey %d\n", i); - continue; - } - if (wdev->connect_keys->defmgmt == i) - if (rdev->ops->set_default_mgmt_key(wdev->wiphy, dev, i)) - netdev_err(dev, "failed to set mgtdef %d\n", i); - } - - kfree(wdev->connect_keys); - wdev->connect_keys = NULL; -} - -static void cfg80211_process_wdev_events(struct wireless_dev *wdev) -{ - struct cfg80211_event *ev; - unsigned long flags; - const u8 *bssid = NULL; - - spin_lock_irqsave(&wdev->event_lock, flags); - while (!list_empty(&wdev->event_list)) { - ev = list_first_entry(&wdev->event_list, - struct cfg80211_event, list); - list_del(&ev->list); - spin_unlock_irqrestore(&wdev->event_lock, flags); - - wdev_lock(wdev); - switch (ev->type) { - case EVENT_CONNECT_RESULT: - if (!is_zero_ether_addr(ev->cr.bssid)) - bssid = ev->cr.bssid; - __cfg80211_connect_result( - wdev->netdev, bssid, - ev->cr.req_ie, ev->cr.req_ie_len, - ev->cr.resp_ie, ev->cr.resp_ie_len, - ev->cr.status, - ev->cr.status == WLAN_STATUS_SUCCESS, - NULL); - break; - case EVENT_ROAMED: - __cfg80211_roamed(wdev, ev->rm.bss, ev->rm.req_ie, - ev->rm.req_ie_len, ev->rm.resp_ie, - ev->rm.resp_ie_len); - break; - case EVENT_DISCONNECTED: - __cfg80211_disconnected(wdev->netdev, - ev->dc.ie, ev->dc.ie_len, - ev->dc.reason, true); - break; - case EVENT_IBSS_JOINED: - __cfg80211_ibss_joined(wdev->netdev, ev->ij.bssid); - break; - } - wdev_unlock(wdev); - - kfree(ev); - - spin_lock_irqsave(&wdev->event_lock, flags); - } - spin_unlock_irqrestore(&wdev->event_lock, flags); -} - -void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev) -{ - struct wireless_dev *wdev; - - ASSERT_RTNL(); - ASSERT_RDEV_LOCK(rdev); - - mutex_lock(&rdev->devlist_mtx); - - list_for_each_entry(wdev, &rdev->netdev_list, list) - cfg80211_process_wdev_events(wdev); - - mutex_unlock(&rdev->devlist_mtx); -} - -int cfg80211_change_iface(struct cfg80211_registered_device *rdev, - struct net_device *dev, enum nl80211_iftype ntype, - u32 *flags, struct vif_params *params) -{ - int err; - enum nl80211_iftype otype = dev->ieee80211_ptr->iftype; - - ASSERT_RDEV_LOCK(rdev); - - /* don't support changing VLANs, you just re-create them */ - if (otype == NL80211_IFTYPE_AP_VLAN) - return -EOPNOTSUPP; - - if (!rdev->ops->change_virtual_intf || - !(rdev->wiphy.interface_modes & (1 << ntype))) - return -EOPNOTSUPP; - - /* if it's part of a bridge, reject changing type to station/ibss */ - if (br_port_exists(dev) && - (ntype == NL80211_IFTYPE_ADHOC || - ntype == NL80211_IFTYPE_STATION || - ntype == NL80211_IFTYPE_P2P_CLIENT)) - return -EBUSY; - - if (ntype != otype) { - err = cfg80211_can_change_interface(rdev, dev->ieee80211_ptr, - ntype); - if (err) - return err; - - dev->ieee80211_ptr->use_4addr = false; - dev->ieee80211_ptr->mesh_id_up_len = 0; - - switch (otype) { - case NL80211_IFTYPE_ADHOC: - cfg80211_leave_ibss(rdev, dev, false); - break; - case NL80211_IFTYPE_STATION: - case NL80211_IFTYPE_P2P_CLIENT: - cfg80211_disconnect(rdev, dev, - WLAN_REASON_DEAUTH_LEAVING, true); - break; - case NL80211_IFTYPE_MESH_POINT: - /* mesh should be handled? */ - break; - default: - break; - } - - cfg80211_process_rdev_events(rdev); - } - - err = rdev->ops->change_virtual_intf(&rdev->wiphy, dev, - ntype, flags, params); - - WARN_ON(!err && dev->ieee80211_ptr->iftype != ntype); - - if (!err && params && params->use_4addr != -1) - dev->ieee80211_ptr->use_4addr = params->use_4addr; - - if (!err) { - dev->priv_flags &= ~IFF_DONT_BRIDGE; - switch (ntype) { - case NL80211_IFTYPE_STATION: - if (dev->ieee80211_ptr->use_4addr) - break; - /* fall through */ - case NL80211_IFTYPE_P2P_CLIENT: - case NL80211_IFTYPE_ADHOC: - dev->priv_flags |= IFF_DONT_BRIDGE; - break; - case NL80211_IFTYPE_P2P_GO: - case NL80211_IFTYPE_AP: - case NL80211_IFTYPE_AP_VLAN: - case NL80211_IFTYPE_WDS: - case NL80211_IFTYPE_MESH_POINT: - /* bridging OK */ - break; - case NL80211_IFTYPE_MONITOR: - /* monitor can't bridge anyway */ - break; - case NL80211_IFTYPE_UNSPECIFIED: - case NUM_NL80211_IFTYPES: - /* not happening */ - break; - } - } - - return err; -} - -u16 cfg80211_calculate_bitrate(struct rate_info *rate) -{ - int modulation, streams, bitrate; - - if (!(rate->flags & RATE_INFO_FLAGS_MCS)) - return rate->legacy; - - /* the formula below does only work for MCS values smaller than 32 */ - if (rate->mcs >= 32) - return 0; - - modulation = rate->mcs & 7; - streams = (rate->mcs >> 3) + 1; - - bitrate = (rate->flags & RATE_INFO_FLAGS_40_MHZ_WIDTH) ? - 13500000 : 6500000; - - if (modulation < 4) - bitrate *= (modulation + 1); - else if (modulation == 4) - bitrate *= (modulation + 2); - else - bitrate *= (modulation + 3); - - bitrate *= streams; - - if (rate->flags & RATE_INFO_FLAGS_SHORT_GI) - bitrate = (bitrate / 9) * 10; - - /* do NOT round down here */ - return (bitrate + 50000) / 100000; -} -EXPORT_SYMBOL(cfg80211_calculate_bitrate); - -int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev, - u32 beacon_int) -{ - struct wireless_dev *wdev; - int res = 0; - - if (!beacon_int) - return -EINVAL; - - mutex_lock(&rdev->devlist_mtx); - - list_for_each_entry(wdev, &rdev->netdev_list, list) { - if (!wdev->beacon_interval) - continue; - if (wdev->beacon_interval != beacon_int) { - res = -EINVAL; - break; - } - } - - mutex_unlock(&rdev->devlist_mtx); - - return res; -} - -int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev, - enum nl80211_iftype iftype) -{ - struct wireless_dev *wdev_iter; - int num[NUM_NL80211_IFTYPES]; - int total = 1; - int i, j; - - ASSERT_RTNL(); - - /* Always allow software iftypes */ - if (rdev->wiphy.software_iftypes & BIT(iftype)) - return 0; - - /* - * Drivers will gradually all set this flag, until all - * have it we only enforce for those that set it. - */ - if (!(rdev->wiphy.flags & WIPHY_FLAG_ENFORCE_COMBINATIONS)) - return 0; - - memset(num, 0, sizeof(num)); - - num[iftype] = 1; - - mutex_lock(&rdev->devlist_mtx); - list_for_each_entry(wdev_iter, &rdev->netdev_list, list) { - if (wdev_iter == wdev) - continue; - if (!netif_running(wdev_iter->netdev)) - continue; - - if (rdev->wiphy.software_iftypes & BIT(wdev_iter->iftype)) - continue; - - num[wdev_iter->iftype]++; - total++; - } - mutex_unlock(&rdev->devlist_mtx); - - for (i = 0; i < rdev->wiphy.n_iface_combinations; i++) { - const struct ieee80211_iface_combination *c; - struct ieee80211_iface_limit *limits; - - c = &rdev->wiphy.iface_combinations[i]; - - limits = kmemdup(c->limits, sizeof(limits[0]) * c->n_limits, - GFP_KERNEL); - if (!limits) - return -ENOMEM; - if (total > c->max_interfaces) - goto cont; - - for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { - if (rdev->wiphy.software_iftypes & BIT(iftype)) - continue; - for (j = 0; j < c->n_limits; j++) { - if (!(limits[j].types & iftype)) - continue; - if (limits[j].max < num[iftype]) - goto cont; - limits[j].max -= num[iftype]; - } - } - /* yay, it fits */ - kfree(limits); - return 0; - cont: - kfree(limits); - } - - return -EBUSY; -} - -int ieee80211_get_ratemask(struct ieee80211_supported_band *sband, - const u8 *rates, unsigned int n_rates, - u32 *mask) -{ - int i, j; - - if (!sband) - return -EINVAL; - - if (n_rates == 0 || n_rates > NL80211_MAX_SUPP_RATES) - return -EINVAL; - - *mask = 0; - - for (i = 0; i < n_rates; i++) { - int rate = (rates[i] & 0x7f) * 5; - bool found = false; - - for (j = 0; j < sband->n_bitrates; j++) { - if (sband->bitrates[j].bitrate == rate) { - found = true; - *mask |= BIT(j); - break; - } - } - if (!found) - return -EINVAL; - } - - /* - * mask must have at least one bit set here since we - * didn't accept a 0-length rates array nor allowed - * entries in the array that didn't exist - */ - - return 0; -} - -/* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ -/* Ethernet-II snap header (RFC1042 for most EtherTypes) */ -const unsigned char rfc1042_header[] __aligned(2) = - { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; -EXPORT_SYMBOL(rfc1042_header); - -/* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ -const unsigned char bridge_tunnel_header[] __aligned(2) = - { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; -EXPORT_SYMBOL(bridge_tunnel_header); diff --git a/openairITS/mac/DOT11/net/wireless/wext-compat.c b/openairITS/mac/DOT11/net/wireless/wext-compat.c deleted file mode 100644 index 3c24eb97e9d..00000000000 --- a/openairITS/mac/DOT11/net/wireless/wext-compat.c +++ /dev/null @@ -1,1531 +0,0 @@ -/* - * cfg80211 - wext compat code - * - * This is temporary code until all wireless functionality is migrated - * into cfg80211, when that happens all the exports here go away and - * we directly assign the wireless handlers of wireless interfaces. - * - * Copyright 2008-2009 Johannes Berg <johannes@sipsolutions.net> - */ - -#include <linux/export.h> -#include <linux/wireless.h> -#include <linux/nl80211.h> -#include <linux/if_arp.h> -#include <linux/etherdevice.h> -#include <linux/slab.h> -#include <net/iw_handler.h> -#include <net/cfg80211.h> -#include <net/cfg80211-wext.h> -#include "wext-compat.h" -#include "core.h" - -int cfg80211_wext_giwname(struct net_device *dev, - struct iw_request_info *info, - char *name, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct ieee80211_supported_band *sband; - bool is_ht = false, is_a = false, is_b = false, is_g = false; - - if (!wdev) - return -EOPNOTSUPP; - - sband = wdev->wiphy->bands[IEEE80211_BAND_5GHZ]; - if (sband) { - is_a = true; - is_ht |= sband->ht_cap.ht_supported; - } - - sband = wdev->wiphy->bands[IEEE80211_BAND_2GHZ]; - if (sband) { - int i; - /* Check for mandatory rates */ - for (i = 0; i < sband->n_bitrates; i++) { - if (sband->bitrates[i].bitrate == 10) - is_b = true; - if (sband->bitrates[i].bitrate == 60) - is_g = true; - } - is_ht |= sband->ht_cap.ht_supported; - } - - strcpy(name, "IEEE 802.11"); - if (is_a) - strcat(name, "a"); - if (is_b) - strcat(name, "b"); - if (is_g) - strcat(name, "g"); - if (is_ht) - strcat(name, "n"); - - return 0; -} -EXPORT_SYMBOL_GPL(cfg80211_wext_giwname); - -int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, - u32 *mode, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev; - struct vif_params vifparams; - enum nl80211_iftype type; - int ret; - - rdev = wiphy_to_dev(wdev->wiphy); - - switch (*mode) { - case IW_MODE_INFRA: - type = NL80211_IFTYPE_STATION; - break; - case IW_MODE_ADHOC: - type = NL80211_IFTYPE_ADHOC; - break; - case IW_MODE_REPEAT: - type = NL80211_IFTYPE_WDS; - break; - case IW_MODE_MONITOR: - type = NL80211_IFTYPE_MONITOR; - break; - default: - return -EINVAL; - } - - if (type == wdev->iftype) - return 0; - - memset(&vifparams, 0, sizeof(vifparams)); - - cfg80211_lock_rdev(rdev); - ret = cfg80211_change_iface(rdev, dev, type, NULL, &vifparams); - cfg80211_unlock_rdev(rdev); - - return ret; -} -EXPORT_SYMBOL_GPL(cfg80211_wext_siwmode); - -int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, - u32 *mode, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - if (!wdev) - return -EOPNOTSUPP; - - switch (wdev->iftype) { - case NL80211_IFTYPE_AP: - *mode = IW_MODE_MASTER; - break; - case NL80211_IFTYPE_STATION: - *mode = IW_MODE_INFRA; - break; - case NL80211_IFTYPE_ADHOC: - *mode = IW_MODE_ADHOC; - break; - case NL80211_IFTYPE_MONITOR: - *mode = IW_MODE_MONITOR; - break; - case NL80211_IFTYPE_WDS: - *mode = IW_MODE_REPEAT; - break; - case NL80211_IFTYPE_AP_VLAN: - *mode = IW_MODE_SECOND; /* FIXME */ - break; - default: - *mode = IW_MODE_AUTO; - break; - } - return 0; -} -EXPORT_SYMBOL_GPL(cfg80211_wext_giwmode); - - -int cfg80211_wext_giwrange(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct iw_range *range = (struct iw_range *) extra; - enum ieee80211_band band; - int i, c = 0; - - if (!wdev) - return -EOPNOTSUPP; - - data->length = sizeof(struct iw_range); - memset(range, 0, sizeof(struct iw_range)); - - range->we_version_compiled = WIRELESS_EXT; - range->we_version_source = 21; - range->retry_capa = IW_RETRY_LIMIT; - range->retry_flags = IW_RETRY_LIMIT; - range->min_retry = 0; - range->max_retry = 255; - range->min_rts = 0; - range->max_rts = 2347; - range->min_frag = 256; - range->max_frag = 2346; - - range->max_encoding_tokens = 4; - - range->max_qual.updated = IW_QUAL_NOISE_INVALID; - - switch (wdev->wiphy->signal_type) { - case CFG80211_SIGNAL_TYPE_NONE: - break; - case CFG80211_SIGNAL_TYPE_MBM: - range->max_qual.level = -110; - range->max_qual.qual = 70; - range->avg_qual.qual = 35; - range->max_qual.updated |= IW_QUAL_DBM; - range->max_qual.updated |= IW_QUAL_QUAL_UPDATED; - range->max_qual.updated |= IW_QUAL_LEVEL_UPDATED; - break; - case CFG80211_SIGNAL_TYPE_UNSPEC: - range->max_qual.level = 100; - range->max_qual.qual = 100; - range->avg_qual.qual = 50; - range->max_qual.updated |= IW_QUAL_QUAL_UPDATED; - range->max_qual.updated |= IW_QUAL_LEVEL_UPDATED; - break; - } - - range->avg_qual.level = range->max_qual.level / 2; - range->avg_qual.noise = range->max_qual.noise / 2; - range->avg_qual.updated = range->max_qual.updated; - - for (i = 0; i < wdev->wiphy->n_cipher_suites; i++) { - switch (wdev->wiphy->cipher_suites[i]) { - case WLAN_CIPHER_SUITE_TKIP: - range->enc_capa |= (IW_ENC_CAPA_CIPHER_TKIP | - IW_ENC_CAPA_WPA); - break; - - case WLAN_CIPHER_SUITE_CCMP: - range->enc_capa |= (IW_ENC_CAPA_CIPHER_CCMP | - IW_ENC_CAPA_WPA2); - break; - - case WLAN_CIPHER_SUITE_WEP40: - range->encoding_size[range->num_encoding_sizes++] = - WLAN_KEY_LEN_WEP40; - break; - - case WLAN_CIPHER_SUITE_WEP104: - range->encoding_size[range->num_encoding_sizes++] = - WLAN_KEY_LEN_WEP104; - break; - } - } - - for (band = 0; band < IEEE80211_NUM_BANDS; band ++) { - struct ieee80211_supported_band *sband; - - sband = wdev->wiphy->bands[band]; - - if (!sband) - continue; - - for (i = 0; i < sband->n_channels && c < IW_MAX_FREQUENCIES; i++) { - struct ieee80211_channel *chan = &sband->channels[i]; - - if (!(chan->flags & IEEE80211_CHAN_DISABLED)) { - range->freq[c].i = - ieee80211_frequency_to_channel( - chan->center_freq); - range->freq[c].m = chan->center_freq; - range->freq[c].e = 6; - c++; - } - } - } - range->num_channels = c; - range->num_frequency = c; - - IW_EVENT_CAPA_SET_KERNEL(range->event_capa); - IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); - IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); - - if (wdev->wiphy->max_scan_ssids > 0) - range->scan_capa |= IW_SCAN_CAPA_ESSID; - - return 0; -} -EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange); - - -/** - * cfg80211_wext_freq - get wext frequency for non-"auto" - * @wiphy: the wiphy - * @freq: the wext freq encoding - * - * Returns a frequency, or a negative error code, or 0 for auto. - */ -int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq) -{ - /* - * Parse frequency - return 0 for auto and - * -EINVAL for impossible things. - */ - if (freq->e == 0) { - enum ieee80211_band band = IEEE80211_BAND_2GHZ; - if (freq->m < 0) - return 0; - if (freq->m > 14) - band = IEEE80211_BAND_5GHZ; - return ieee80211_channel_to_frequency(freq->m, band); - } else { - int i, div = 1000000; - for (i = 0; i < freq->e; i++) - div /= 10; - if (div <= 0) - return -EINVAL; - return freq->m / div; - } -} - -int cfg80211_wext_siwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - u32 orts = wdev->wiphy->rts_threshold; - int err; - - if (rts->disabled || !rts->fixed) - wdev->wiphy->rts_threshold = (u32) -1; - else if (rts->value < 0) - return -EINVAL; - else - wdev->wiphy->rts_threshold = rts->value; - - err = rdev->ops->set_wiphy_params(wdev->wiphy, - WIPHY_PARAM_RTS_THRESHOLD); - if (err) - wdev->wiphy->rts_threshold = orts; - - return err; -} -EXPORT_SYMBOL_GPL(cfg80211_wext_siwrts); - -int cfg80211_wext_giwrts(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rts, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - rts->value = wdev->wiphy->rts_threshold; - rts->disabled = rts->value == (u32) -1; - rts->fixed = 1; - - return 0; -} -EXPORT_SYMBOL_GPL(cfg80211_wext_giwrts); - -int cfg80211_wext_siwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *frag, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - u32 ofrag = wdev->wiphy->frag_threshold; - int err; - - if (frag->disabled || !frag->fixed) - wdev->wiphy->frag_threshold = (u32) -1; - else if (frag->value < 256) - return -EINVAL; - else { - /* Fragment length must be even, so strip LSB. */ - wdev->wiphy->frag_threshold = frag->value & ~0x1; - } - - err = rdev->ops->set_wiphy_params(wdev->wiphy, - WIPHY_PARAM_FRAG_THRESHOLD); - if (err) - wdev->wiphy->frag_threshold = ofrag; - - return err; -} -EXPORT_SYMBOL_GPL(cfg80211_wext_siwfrag); - -int cfg80211_wext_giwfrag(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *frag, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - frag->value = wdev->wiphy->frag_threshold; - frag->disabled = frag->value == (u32) -1; - frag->fixed = 1; - - return 0; -} -EXPORT_SYMBOL_GPL(cfg80211_wext_giwfrag); - -static int cfg80211_wext_siwretry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *retry, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - u32 changed = 0; - u8 olong = wdev->wiphy->retry_long; - u8 oshort = wdev->wiphy->retry_short; - int err; - - if (retry->disabled || - (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) - return -EINVAL; - - if (retry->flags & IW_RETRY_LONG) { - wdev->wiphy->retry_long = retry->value; - changed |= WIPHY_PARAM_RETRY_LONG; - } else if (retry->flags & IW_RETRY_SHORT) { - wdev->wiphy->retry_short = retry->value; - changed |= WIPHY_PARAM_RETRY_SHORT; - } else { - wdev->wiphy->retry_short = retry->value; - wdev->wiphy->retry_long = retry->value; - changed |= WIPHY_PARAM_RETRY_LONG; - changed |= WIPHY_PARAM_RETRY_SHORT; - } - - if (!changed) - return 0; - - err = rdev->ops->set_wiphy_params(wdev->wiphy, changed); - if (err) { - wdev->wiphy->retry_short = oshort; - wdev->wiphy->retry_long = olong; - } - - return err; -} - -int cfg80211_wext_giwretry(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *retry, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - retry->disabled = 0; - - if (retry->flags == 0 || (retry->flags & IW_RETRY_SHORT)) { - /* - * First return short value, iwconfig will ask long value - * later if needed - */ - retry->flags |= IW_RETRY_LIMIT; - retry->value = wdev->wiphy->retry_short; - if (wdev->wiphy->retry_long != wdev->wiphy->retry_short) - retry->flags |= IW_RETRY_LONG; - - return 0; - } - - if (retry->flags & IW_RETRY_LONG) { - retry->flags = IW_RETRY_LIMIT | IW_RETRY_LONG; - retry->value = wdev->wiphy->retry_long; - } - - return 0; -} -EXPORT_SYMBOL_GPL(cfg80211_wext_giwretry); - -static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev, - struct net_device *dev, bool pairwise, - const u8 *addr, bool remove, bool tx_key, - int idx, struct key_params *params) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int err, i; - bool rejoin = false; - - if (pairwise && !addr) - return -EINVAL; - - if (!wdev->wext.keys) { - wdev->wext.keys = kzalloc(sizeof(*wdev->wext.keys), - GFP_KERNEL); - if (!wdev->wext.keys) - return -ENOMEM; - for (i = 0; i < 6; i++) - wdev->wext.keys->params[i].key = - wdev->wext.keys->data[i]; - } - - if (wdev->iftype != NL80211_IFTYPE_ADHOC && - wdev->iftype != NL80211_IFTYPE_STATION) - return -EOPNOTSUPP; - - if (params->cipher == WLAN_CIPHER_SUITE_AES_CMAC) { - if (!wdev->current_bss) - return -ENOLINK; - - if (!rdev->ops->set_default_mgmt_key) - return -EOPNOTSUPP; - - if (idx < 4 || idx > 5) - return -EINVAL; - } else if (idx < 0 || idx > 3) - return -EINVAL; - - if (remove) { - err = 0; - if (wdev->current_bss) { - /* - * If removing the current TX key, we will need to - * join a new IBSS without the privacy bit clear. - */ - if (idx == wdev->wext.default_key && - wdev->iftype == NL80211_IFTYPE_ADHOC) { - __cfg80211_leave_ibss(rdev, wdev->netdev, true); - rejoin = true; - } - - if (!pairwise && addr && - !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) - err = -ENOENT; - else - err = rdev->ops->del_key(&rdev->wiphy, dev, idx, - pairwise, addr); - } - wdev->wext.connect.privacy = false; - /* - * Applications using wireless extensions expect to be - * able to delete keys that don't exist, so allow that. - */ - if (err == -ENOENT) - err = 0; - if (!err) { - if (!addr) { - wdev->wext.keys->params[idx].key_len = 0; - wdev->wext.keys->params[idx].cipher = 0; - } - if (idx == wdev->wext.default_key) - wdev->wext.default_key = -1; - else if (idx == wdev->wext.default_mgmt_key) - wdev->wext.default_mgmt_key = -1; - } - - if (!err && rejoin) - err = cfg80211_ibss_wext_join(rdev, wdev); - - return err; - } - - if (addr) - tx_key = false; - - if (cfg80211_validate_key_settings(rdev, params, idx, pairwise, addr)) - return -EINVAL; - - err = 0; - if (wdev->current_bss) - err = rdev->ops->add_key(&rdev->wiphy, dev, idx, - pairwise, addr, params); - if (err) - return err; - - if (!addr) { - wdev->wext.keys->params[idx] = *params; - memcpy(wdev->wext.keys->data[idx], - params->key, params->key_len); - wdev->wext.keys->params[idx].key = - wdev->wext.keys->data[idx]; - } - - if ((params->cipher == WLAN_CIPHER_SUITE_WEP40 || - params->cipher == WLAN_CIPHER_SUITE_WEP104) && - (tx_key || (!addr && wdev->wext.default_key == -1))) { - if (wdev->current_bss) { - /* - * If we are getting a new TX key from not having - * had one before we need to join a new IBSS with - * the privacy bit set. - */ - if (wdev->iftype == NL80211_IFTYPE_ADHOC && - wdev->wext.default_key == -1) { - __cfg80211_leave_ibss(rdev, wdev->netdev, true); - rejoin = true; - } - err = rdev->ops->set_default_key(&rdev->wiphy, dev, - idx, true, true); - } - if (!err) { - wdev->wext.default_key = idx; - if (rejoin) - err = cfg80211_ibss_wext_join(rdev, wdev); - } - return err; - } - - if (params->cipher == WLAN_CIPHER_SUITE_AES_CMAC && - (tx_key || (!addr && wdev->wext.default_mgmt_key == -1))) { - if (wdev->current_bss) - err = rdev->ops->set_default_mgmt_key(&rdev->wiphy, - dev, idx); - if (!err) - wdev->wext.default_mgmt_key = idx; - return err; - } - - return 0; -} - -static int cfg80211_set_encryption(struct cfg80211_registered_device *rdev, - struct net_device *dev, bool pairwise, - const u8 *addr, bool remove, bool tx_key, - int idx, struct key_params *params) -{ - int err; - - /* devlist mutex needed for possible IBSS re-join */ - mutex_lock(&rdev->devlist_mtx); - wdev_lock(dev->ieee80211_ptr); - err = __cfg80211_set_encryption(rdev, dev, pairwise, addr, - remove, tx_key, idx, params); - wdev_unlock(dev->ieee80211_ptr); - mutex_unlock(&rdev->devlist_mtx); - - return err; -} - -static int cfg80211_wext_siwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *keybuf) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - int idx, err; - bool remove = false; - struct key_params params; - - if (wdev->iftype != NL80211_IFTYPE_STATION && - wdev->iftype != NL80211_IFTYPE_ADHOC) - return -EOPNOTSUPP; - - /* no use -- only MFP (set_default_mgmt_key) is optional */ - if (!rdev->ops->del_key || - !rdev->ops->add_key || - !rdev->ops->set_default_key) - return -EOPNOTSUPP; - - idx = erq->flags & IW_ENCODE_INDEX; - if (idx == 0) { - idx = wdev->wext.default_key; - if (idx < 0) - idx = 0; - } else if (idx < 1 || idx > 4) - return -EINVAL; - else - idx--; - - if (erq->flags & IW_ENCODE_DISABLED) - remove = true; - else if (erq->length == 0) { - /* No key data - just set the default TX key index */ - err = 0; - wdev_lock(wdev); - if (wdev->current_bss) - err = rdev->ops->set_default_key(&rdev->wiphy, dev, - idx, true, true); - if (!err) - wdev->wext.default_key = idx; - wdev_unlock(wdev); - return err; - } - - memset(¶ms, 0, sizeof(params)); - params.key = keybuf; - params.key_len = erq->length; - if (erq->length == 5) - params.cipher = WLAN_CIPHER_SUITE_WEP40; - else if (erq->length == 13) - params.cipher = WLAN_CIPHER_SUITE_WEP104; - else if (!remove) - return -EINVAL; - - return cfg80211_set_encryption(rdev, dev, false, NULL, remove, - wdev->wext.default_key == -1, - idx, ¶ms); -} - -static int cfg80211_wext_siwencodeext(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; - const u8 *addr; - int idx; - bool remove = false; - struct key_params params; - u32 cipher; - - if (wdev->iftype != NL80211_IFTYPE_STATION && - wdev->iftype != NL80211_IFTYPE_ADHOC) - return -EOPNOTSUPP; - - /* no use -- only MFP (set_default_mgmt_key) is optional */ - if (!rdev->ops->del_key || - !rdev->ops->add_key || - !rdev->ops->set_default_key) - return -EOPNOTSUPP; - - switch (ext->alg) { - case IW_ENCODE_ALG_NONE: - remove = true; - cipher = 0; - break; - case IW_ENCODE_ALG_WEP: - if (ext->key_len == 5) - cipher = WLAN_CIPHER_SUITE_WEP40; - else if (ext->key_len == 13) - cipher = WLAN_CIPHER_SUITE_WEP104; - else - return -EINVAL; - break; - case IW_ENCODE_ALG_TKIP: - cipher = WLAN_CIPHER_SUITE_TKIP; - break; - case IW_ENCODE_ALG_CCMP: - cipher = WLAN_CIPHER_SUITE_CCMP; - break; - case IW_ENCODE_ALG_AES_CMAC: - cipher = WLAN_CIPHER_SUITE_AES_CMAC; - break; - default: - return -EOPNOTSUPP; - } - - if (erq->flags & IW_ENCODE_DISABLED) - remove = true; - - idx = erq->flags & IW_ENCODE_INDEX; - if (cipher == WLAN_CIPHER_SUITE_AES_CMAC) { - if (idx < 4 || idx > 5) { - idx = wdev->wext.default_mgmt_key; - if (idx < 0) - return -EINVAL; - } else - idx--; - } else { - if (idx < 1 || idx > 4) { - idx = wdev->wext.default_key; - if (idx < 0) - return -EINVAL; - } else - idx--; - } - - addr = ext->addr.sa_data; - if (is_broadcast_ether_addr(addr)) - addr = NULL; - - memset(¶ms, 0, sizeof(params)); - params.key = ext->key; - params.key_len = ext->key_len; - params.cipher = cipher; - - if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { - params.seq = ext->rx_seq; - params.seq_len = 6; - } - - return cfg80211_set_encryption( - rdev, dev, - !(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY), - addr, remove, - ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY, - idx, ¶ms); -} - -static int cfg80211_wext_giwencode(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *erq, char *keybuf) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - int idx; - - if (wdev->iftype != NL80211_IFTYPE_STATION && - wdev->iftype != NL80211_IFTYPE_ADHOC) - return -EOPNOTSUPP; - - idx = erq->flags & IW_ENCODE_INDEX; - if (idx == 0) { - idx = wdev->wext.default_key; - if (idx < 0) - idx = 0; - } else if (idx < 1 || idx > 4) - return -EINVAL; - else - idx--; - - erq->flags = idx + 1; - - if (!wdev->wext.keys || !wdev->wext.keys->params[idx].cipher) { - erq->flags |= IW_ENCODE_DISABLED; - erq->length = 0; - return 0; - } - - erq->length = min_t(size_t, erq->length, - wdev->wext.keys->params[idx].key_len); - memcpy(keybuf, wdev->wext.keys->params[idx].key, erq->length); - erq->flags |= IW_ENCODE_ENABLED; - - return 0; -} - -static int cfg80211_wext_siwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *wextfreq, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - int freq, err; - - switch (wdev->iftype) { - case NL80211_IFTYPE_STATION: - return cfg80211_mgd_wext_siwfreq(dev, info, wextfreq, extra); - case NL80211_IFTYPE_ADHOC: - return cfg80211_ibss_wext_siwfreq(dev, info, wextfreq, extra); - case NL80211_IFTYPE_MONITOR: - case NL80211_IFTYPE_WDS: - case NL80211_IFTYPE_MESH_POINT: - freq = cfg80211_wext_freq(wdev->wiphy, wextfreq); - if (freq < 0) - return freq; - if (freq == 0) - return -EINVAL; - mutex_lock(&rdev->devlist_mtx); - wdev_lock(wdev); - err = cfg80211_set_freq(rdev, wdev, freq, NL80211_CHAN_NO_HT); - wdev_unlock(wdev); - mutex_unlock(&rdev->devlist_mtx); - return err; - default: - return -EOPNOTSUPP; - } -} - -static int cfg80211_wext_giwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct ieee80211_channel *chan; - - switch (wdev->iftype) { - case NL80211_IFTYPE_STATION: - return cfg80211_mgd_wext_giwfreq(dev, info, freq, extra); - case NL80211_IFTYPE_ADHOC: - return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra); - case NL80211_IFTYPE_MONITOR: - if (!rdev->ops->get_channel) - return -EINVAL; - - chan = rdev->ops->get_channel(wdev->wiphy); - if (!chan) - return -EINVAL; - freq->m = chan->center_freq; - freq->e = 6; - return 0; - default: - if (!wdev->channel) - return -EINVAL; - freq->m = wdev->channel->center_freq; - freq->e = 6; - return 0; - } -} - -static int cfg80211_wext_siwtxpower(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *data, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - enum nl80211_tx_power_setting type; - int dbm = 0; - - if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) - return -EINVAL; - if (data->txpower.flags & IW_TXPOW_RANGE) - return -EINVAL; - - if (!rdev->ops->set_tx_power) - return -EOPNOTSUPP; - - /* only change when not disabling */ - if (!data->txpower.disabled) { - rfkill_set_sw_state(rdev->rfkill, false); - - if (data->txpower.fixed) { - /* - * wext doesn't support negative values, see - * below where it's for automatic - */ - if (data->txpower.value < 0) - return -EINVAL; - dbm = data->txpower.value; - type = NL80211_TX_POWER_FIXED; - /* TODO: do regulatory check! */ - } else { - /* - * Automatic power level setting, max being the value - * passed in from userland. - */ - if (data->txpower.value < 0) { - type = NL80211_TX_POWER_AUTOMATIC; - } else { - dbm = data->txpower.value; - type = NL80211_TX_POWER_LIMITED; - } - } - } else { - rfkill_set_sw_state(rdev->rfkill, true); - schedule_work(&rdev->rfkill_sync); - return 0; - } - - return rdev->ops->set_tx_power(wdev->wiphy, type, DBM_TO_MBM(dbm)); -} - -static int cfg80211_wext_giwtxpower(struct net_device *dev, - struct iw_request_info *info, - union iwreq_data *data, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - int err, val; - - if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) - return -EINVAL; - if (data->txpower.flags & IW_TXPOW_RANGE) - return -EINVAL; - - if (!rdev->ops->get_tx_power) - return -EOPNOTSUPP; - - err = rdev->ops->get_tx_power(wdev->wiphy, &val); - if (err) - return err; - - /* well... oh well */ - data->txpower.fixed = 1; - data->txpower.disabled = rfkill_blocked(rdev->rfkill); - data->txpower.value = val; - data->txpower.flags = IW_TXPOW_DBM; - - return 0; -} - -static int cfg80211_set_auth_alg(struct wireless_dev *wdev, - s32 auth_alg) -{ - int nr_alg = 0; - - if (!auth_alg) - return -EINVAL; - - if (auth_alg & ~(IW_AUTH_ALG_OPEN_SYSTEM | - IW_AUTH_ALG_SHARED_KEY | - IW_AUTH_ALG_LEAP)) - return -EINVAL; - - if (auth_alg & IW_AUTH_ALG_OPEN_SYSTEM) { - nr_alg++; - wdev->wext.connect.auth_type = NL80211_AUTHTYPE_OPEN_SYSTEM; - } - - if (auth_alg & IW_AUTH_ALG_SHARED_KEY) { - nr_alg++; - wdev->wext.connect.auth_type = NL80211_AUTHTYPE_SHARED_KEY; - } - - if (auth_alg & IW_AUTH_ALG_LEAP) { - nr_alg++; - wdev->wext.connect.auth_type = NL80211_AUTHTYPE_NETWORK_EAP; - } - - if (nr_alg > 1) - wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; - - return 0; -} - -static int cfg80211_set_wpa_version(struct wireless_dev *wdev, u32 wpa_versions) -{ - if (wpa_versions & ~(IW_AUTH_WPA_VERSION_WPA | - IW_AUTH_WPA_VERSION_WPA2| - IW_AUTH_WPA_VERSION_DISABLED)) - return -EINVAL; - - if ((wpa_versions & IW_AUTH_WPA_VERSION_DISABLED) && - (wpa_versions & (IW_AUTH_WPA_VERSION_WPA| - IW_AUTH_WPA_VERSION_WPA2))) - return -EINVAL; - - if (wpa_versions & IW_AUTH_WPA_VERSION_DISABLED) - wdev->wext.connect.crypto.wpa_versions &= - ~(NL80211_WPA_VERSION_1|NL80211_WPA_VERSION_2); - - if (wpa_versions & IW_AUTH_WPA_VERSION_WPA) - wdev->wext.connect.crypto.wpa_versions |= - NL80211_WPA_VERSION_1; - - if (wpa_versions & IW_AUTH_WPA_VERSION_WPA2) - wdev->wext.connect.crypto.wpa_versions |= - NL80211_WPA_VERSION_2; - - return 0; -} - -static int cfg80211_set_cipher_group(struct wireless_dev *wdev, u32 cipher) -{ - if (cipher & IW_AUTH_CIPHER_WEP40) - wdev->wext.connect.crypto.cipher_group = - WLAN_CIPHER_SUITE_WEP40; - else if (cipher & IW_AUTH_CIPHER_WEP104) - wdev->wext.connect.crypto.cipher_group = - WLAN_CIPHER_SUITE_WEP104; - else if (cipher & IW_AUTH_CIPHER_TKIP) - wdev->wext.connect.crypto.cipher_group = - WLAN_CIPHER_SUITE_TKIP; - else if (cipher & IW_AUTH_CIPHER_CCMP) - wdev->wext.connect.crypto.cipher_group = - WLAN_CIPHER_SUITE_CCMP; - else if (cipher & IW_AUTH_CIPHER_AES_CMAC) - wdev->wext.connect.crypto.cipher_group = - WLAN_CIPHER_SUITE_AES_CMAC; - else if (cipher & IW_AUTH_CIPHER_NONE) - wdev->wext.connect.crypto.cipher_group = 0; - else - return -EINVAL; - - return 0; -} - -static int cfg80211_set_cipher_pairwise(struct wireless_dev *wdev, u32 cipher) -{ - int nr_ciphers = 0; - u32 *ciphers_pairwise = wdev->wext.connect.crypto.ciphers_pairwise; - - if (cipher & IW_AUTH_CIPHER_WEP40) { - ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_WEP40; - nr_ciphers++; - } - - if (cipher & IW_AUTH_CIPHER_WEP104) { - ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_WEP104; - nr_ciphers++; - } - - if (cipher & IW_AUTH_CIPHER_TKIP) { - ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_TKIP; - nr_ciphers++; - } - - if (cipher & IW_AUTH_CIPHER_CCMP) { - ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_CCMP; - nr_ciphers++; - } - - if (cipher & IW_AUTH_CIPHER_AES_CMAC) { - ciphers_pairwise[nr_ciphers] = WLAN_CIPHER_SUITE_AES_CMAC; - nr_ciphers++; - } - - BUILD_BUG_ON(NL80211_MAX_NR_CIPHER_SUITES < 5); - - wdev->wext.connect.crypto.n_ciphers_pairwise = nr_ciphers; - - return 0; -} - - -static int cfg80211_set_key_mgt(struct wireless_dev *wdev, u32 key_mgt) -{ - int nr_akm_suites = 0; - - if (key_mgt & ~(IW_AUTH_KEY_MGMT_802_1X | - IW_AUTH_KEY_MGMT_PSK)) - return -EINVAL; - - if (key_mgt & IW_AUTH_KEY_MGMT_802_1X) { - wdev->wext.connect.crypto.akm_suites[nr_akm_suites] = - WLAN_AKM_SUITE_8021X; - nr_akm_suites++; - } - - if (key_mgt & IW_AUTH_KEY_MGMT_PSK) { - wdev->wext.connect.crypto.akm_suites[nr_akm_suites] = - WLAN_AKM_SUITE_PSK; - nr_akm_suites++; - } - - wdev->wext.connect.crypto.n_akm_suites = nr_akm_suites; - - return 0; -} - -static int cfg80211_wext_siwauth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *data, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - if (wdev->iftype != NL80211_IFTYPE_STATION) - return -EOPNOTSUPP; - - switch (data->flags & IW_AUTH_INDEX) { - case IW_AUTH_PRIVACY_INVOKED: - wdev->wext.connect.privacy = data->value; - return 0; - case IW_AUTH_WPA_VERSION: - return cfg80211_set_wpa_version(wdev, data->value); - case IW_AUTH_CIPHER_GROUP: - return cfg80211_set_cipher_group(wdev, data->value); - case IW_AUTH_KEY_MGMT: - return cfg80211_set_key_mgt(wdev, data->value); - case IW_AUTH_CIPHER_PAIRWISE: - return cfg80211_set_cipher_pairwise(wdev, data->value); - case IW_AUTH_80211_AUTH_ALG: - return cfg80211_set_auth_alg(wdev, data->value); - case IW_AUTH_WPA_ENABLED: - case IW_AUTH_RX_UNENCRYPTED_EAPOL: - case IW_AUTH_DROP_UNENCRYPTED: - case IW_AUTH_MFP: - return 0; - default: - return -EOPNOTSUPP; - } -} - -static int cfg80211_wext_giwauth(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *data, char *extra) -{ - /* XXX: what do we need? */ - - return -EOPNOTSUPP; -} - -static int cfg80211_wext_siwpower(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - bool ps = wdev->ps; - int timeout = wdev->ps_timeout; - int err; - - if (wdev->iftype != NL80211_IFTYPE_STATION) - return -EINVAL; - - if (!rdev->ops->set_power_mgmt) - return -EOPNOTSUPP; - - if (wrq->disabled) { - ps = false; - } else { - switch (wrq->flags & IW_POWER_MODE) { - case IW_POWER_ON: /* If not specified */ - case IW_POWER_MODE: /* If set all mask */ - case IW_POWER_ALL_R: /* If explicitely state all */ - ps = true; - break; - default: /* Otherwise we ignore */ - return -EINVAL; - } - - if (wrq->flags & ~(IW_POWER_MODE | IW_POWER_TIMEOUT)) - return -EINVAL; - - if (wrq->flags & IW_POWER_TIMEOUT) - timeout = wrq->value / 1000; - } - - err = rdev->ops->set_power_mgmt(wdev->wiphy, dev, ps, timeout); - if (err) - return err; - - wdev->ps = ps; - wdev->ps_timeout = timeout; - - return 0; - -} - -static int cfg80211_wext_giwpower(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *wrq, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - wrq->disabled = !wdev->ps; - - return 0; -} - -static int cfg80211_wds_wext_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *addr, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - int err; - - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_WDS)) - return -EINVAL; - - if (addr->sa_family != ARPHRD_ETHER) - return -EINVAL; - - if (netif_running(dev)) - return -EBUSY; - - if (!rdev->ops->set_wds_peer) - return -EOPNOTSUPP; - - err = rdev->ops->set_wds_peer(wdev->wiphy, dev, (u8 *) &addr->sa_data); - if (err) - return err; - - memcpy(&wdev->wext.bssid, (u8 *) &addr->sa_data, ETH_ALEN); - - return 0; -} - -static int cfg80211_wds_wext_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *addr, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_WDS)) - return -EINVAL; - - addr->sa_family = ARPHRD_ETHER; - memcpy(&addr->sa_data, wdev->wext.bssid, ETH_ALEN); - - return 0; -} - -static int cfg80211_wext_siwrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rate, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct cfg80211_bitrate_mask mask; - u32 fixed, maxrate; - struct ieee80211_supported_band *sband; - int band, ridx; - bool match = false; - - if (!rdev->ops->set_bitrate_mask) - return -EOPNOTSUPP; - - memset(&mask, 0, sizeof(mask)); - fixed = 0; - maxrate = (u32)-1; - - if (rate->value < 0) { - /* nothing */ - } else if (rate->fixed) { - fixed = rate->value / 100000; - } else { - maxrate = rate->value / 100000; - } - - for (band = 0; band < IEEE80211_NUM_BANDS; band++) { - sband = wdev->wiphy->bands[band]; - if (sband == NULL) - continue; - for (ridx = 0; ridx < sband->n_bitrates; ridx++) { - struct ieee80211_rate *srate = &sband->bitrates[ridx]; - if (fixed == srate->bitrate) { - mask.control[band].legacy = 1 << ridx; - match = true; - break; - } - if (srate->bitrate <= maxrate) { - mask.control[band].legacy |= 1 << ridx; - match = true; - } - } - } - - if (!match) - return -EINVAL; - - return rdev->ops->set_bitrate_mask(wdev->wiphy, dev, NULL, &mask); -} - -static int cfg80211_wext_giwrate(struct net_device *dev, - struct iw_request_info *info, - struct iw_param *rate, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - /* we are under RTNL - globally locked - so can use a static struct */ - static struct station_info sinfo; - u8 addr[ETH_ALEN]; - int err; - - if (wdev->iftype != NL80211_IFTYPE_STATION) - return -EOPNOTSUPP; - - if (!rdev->ops->get_station) - return -EOPNOTSUPP; - - err = 0; - wdev_lock(wdev); - if (wdev->current_bss) - memcpy(addr, wdev->current_bss->pub.bssid, ETH_ALEN); - else - err = -EOPNOTSUPP; - wdev_unlock(wdev); - if (err) - return err; - - err = rdev->ops->get_station(&rdev->wiphy, dev, addr, &sinfo); - if (err) - return err; - - if (!(sinfo.filled & STATION_INFO_TX_BITRATE)) - return -EOPNOTSUPP; - - rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate); - - return 0; -} - -/* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */ -static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - /* we are under RTNL - globally locked - so can use static structs */ - static struct iw_statistics wstats; - static struct station_info sinfo; - u8 bssid[ETH_ALEN]; - - if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) - return NULL; - - if (!rdev->ops->get_station) - return NULL; - - /* Grab BSSID of current BSS, if any */ - wdev_lock(wdev); - if (!wdev->current_bss) { - wdev_unlock(wdev); - return NULL; - } - memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN); - wdev_unlock(wdev); - - if (rdev->ops->get_station(&rdev->wiphy, dev, bssid, &sinfo)) - return NULL; - - memset(&wstats, 0, sizeof(wstats)); - - switch (rdev->wiphy.signal_type) { - case CFG80211_SIGNAL_TYPE_MBM: - if (sinfo.filled & STATION_INFO_SIGNAL) { - int sig = sinfo.signal; - wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED; - wstats.qual.updated |= IW_QUAL_QUAL_UPDATED; - wstats.qual.updated |= IW_QUAL_DBM; - wstats.qual.level = sig; - if (sig < -110) - sig = -110; - else if (sig > -40) - sig = -40; - wstats.qual.qual = sig + 110; - break; - } - case CFG80211_SIGNAL_TYPE_UNSPEC: - if (sinfo.filled & STATION_INFO_SIGNAL) { - wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED; - wstats.qual.updated |= IW_QUAL_QUAL_UPDATED; - wstats.qual.level = sinfo.signal; - wstats.qual.qual = sinfo.signal; - break; - } - default: - wstats.qual.updated |= IW_QUAL_LEVEL_INVALID; - wstats.qual.updated |= IW_QUAL_QUAL_INVALID; - } - - wstats.qual.updated |= IW_QUAL_NOISE_INVALID; - if (sinfo.filled & STATION_INFO_RX_DROP_MISC) - wstats.discard.misc = sinfo.rx_dropped_misc; - if (sinfo.filled & STATION_INFO_TX_FAILED) - wstats.discard.retries = sinfo.tx_failed; - - return &wstats; -} - -static int cfg80211_wext_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - switch (wdev->iftype) { - case NL80211_IFTYPE_ADHOC: - return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra); - case NL80211_IFTYPE_STATION: - return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra); - case NL80211_IFTYPE_WDS: - return cfg80211_wds_wext_siwap(dev, info, ap_addr, extra); - default: - return -EOPNOTSUPP; - } -} - -static int cfg80211_wext_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - switch (wdev->iftype) { - case NL80211_IFTYPE_ADHOC: - return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra); - case NL80211_IFTYPE_STATION: - return cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra); - case NL80211_IFTYPE_WDS: - return cfg80211_wds_wext_giwap(dev, info, ap_addr, extra); - default: - return -EOPNOTSUPP; - } -} - -static int cfg80211_wext_siwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - switch (wdev->iftype) { - case NL80211_IFTYPE_ADHOC: - return cfg80211_ibss_wext_siwessid(dev, info, data, ssid); - case NL80211_IFTYPE_STATION: - return cfg80211_mgd_wext_siwessid(dev, info, data, ssid); - default: - return -EOPNOTSUPP; - } -} - -static int cfg80211_wext_giwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - data->flags = 0; - data->length = 0; - - switch (wdev->iftype) { - case NL80211_IFTYPE_ADHOC: - return cfg80211_ibss_wext_giwessid(dev, info, data, ssid); - case NL80211_IFTYPE_STATION: - return cfg80211_mgd_wext_giwessid(dev, info, data, ssid); - default: - return -EOPNOTSUPP; - } -} - -static int cfg80211_wext_siwpmksa(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct cfg80211_pmksa cfg_pmksa; - struct iw_pmksa *pmksa = (struct iw_pmksa *)extra; - - memset(&cfg_pmksa, 0, sizeof(struct cfg80211_pmksa)); - - if (wdev->iftype != NL80211_IFTYPE_STATION) - return -EINVAL; - - cfg_pmksa.bssid = pmksa->bssid.sa_data; - cfg_pmksa.pmkid = pmksa->pmkid; - - switch (pmksa->cmd) { - case IW_PMKSA_ADD: - if (!rdev->ops->set_pmksa) - return -EOPNOTSUPP; - - return rdev->ops->set_pmksa(&rdev->wiphy, dev, &cfg_pmksa); - - case IW_PMKSA_REMOVE: - if (!rdev->ops->del_pmksa) - return -EOPNOTSUPP; - - return rdev->ops->del_pmksa(&rdev->wiphy, dev, &cfg_pmksa); - - case IW_PMKSA_FLUSH: - if (!rdev->ops->flush_pmksa) - return -EOPNOTSUPP; - - return rdev->ops->flush_pmksa(&rdev->wiphy, dev); - - default: - return -EOPNOTSUPP; - } -} - -static const iw_handler cfg80211_handlers[] = { - [IW_IOCTL_IDX(SIOCGIWNAME)] = (iw_handler) cfg80211_wext_giwname, - [IW_IOCTL_IDX(SIOCSIWFREQ)] = (iw_handler) cfg80211_wext_siwfreq, - [IW_IOCTL_IDX(SIOCGIWFREQ)] = (iw_handler) cfg80211_wext_giwfreq, - [IW_IOCTL_IDX(SIOCSIWMODE)] = (iw_handler) cfg80211_wext_siwmode, - [IW_IOCTL_IDX(SIOCGIWMODE)] = (iw_handler) cfg80211_wext_giwmode, - [IW_IOCTL_IDX(SIOCGIWRANGE)] = (iw_handler) cfg80211_wext_giwrange, - [IW_IOCTL_IDX(SIOCSIWAP)] = (iw_handler) cfg80211_wext_siwap, - [IW_IOCTL_IDX(SIOCGIWAP)] = (iw_handler) cfg80211_wext_giwap, - [IW_IOCTL_IDX(SIOCSIWMLME)] = (iw_handler) cfg80211_wext_siwmlme, - [IW_IOCTL_IDX(SIOCSIWSCAN)] = (iw_handler) cfg80211_wext_siwscan, - [IW_IOCTL_IDX(SIOCGIWSCAN)] = (iw_handler) cfg80211_wext_giwscan, - [IW_IOCTL_IDX(SIOCSIWESSID)] = (iw_handler) cfg80211_wext_siwessid, - [IW_IOCTL_IDX(SIOCGIWESSID)] = (iw_handler) cfg80211_wext_giwessid, - [IW_IOCTL_IDX(SIOCSIWRATE)] = (iw_handler) cfg80211_wext_siwrate, - [IW_IOCTL_IDX(SIOCGIWRATE)] = (iw_handler) cfg80211_wext_giwrate, - [IW_IOCTL_IDX(SIOCSIWRTS)] = (iw_handler) cfg80211_wext_siwrts, - [IW_IOCTL_IDX(SIOCGIWRTS)] = (iw_handler) cfg80211_wext_giwrts, - [IW_IOCTL_IDX(SIOCSIWFRAG)] = (iw_handler) cfg80211_wext_siwfrag, - [IW_IOCTL_IDX(SIOCGIWFRAG)] = (iw_handler) cfg80211_wext_giwfrag, - [IW_IOCTL_IDX(SIOCSIWTXPOW)] = (iw_handler) cfg80211_wext_siwtxpower, - [IW_IOCTL_IDX(SIOCGIWTXPOW)] = (iw_handler) cfg80211_wext_giwtxpower, - [IW_IOCTL_IDX(SIOCSIWRETRY)] = (iw_handler) cfg80211_wext_siwretry, - [IW_IOCTL_IDX(SIOCGIWRETRY)] = (iw_handler) cfg80211_wext_giwretry, - [IW_IOCTL_IDX(SIOCSIWENCODE)] = (iw_handler) cfg80211_wext_siwencode, - [IW_IOCTL_IDX(SIOCGIWENCODE)] = (iw_handler) cfg80211_wext_giwencode, - [IW_IOCTL_IDX(SIOCSIWPOWER)] = (iw_handler) cfg80211_wext_siwpower, - [IW_IOCTL_IDX(SIOCGIWPOWER)] = (iw_handler) cfg80211_wext_giwpower, - [IW_IOCTL_IDX(SIOCSIWGENIE)] = (iw_handler) cfg80211_wext_siwgenie, - [IW_IOCTL_IDX(SIOCSIWAUTH)] = (iw_handler) cfg80211_wext_siwauth, - [IW_IOCTL_IDX(SIOCGIWAUTH)] = (iw_handler) cfg80211_wext_giwauth, - [IW_IOCTL_IDX(SIOCSIWENCODEEXT)]= (iw_handler) cfg80211_wext_siwencodeext, - [IW_IOCTL_IDX(SIOCSIWPMKSA)] = (iw_handler) cfg80211_wext_siwpmksa, -}; - -const struct iw_handler_def cfg80211_wext_handler = { - .num_standard = ARRAY_SIZE(cfg80211_handlers), - .standard = cfg80211_handlers, - .get_wireless_stats = cfg80211_wireless_stats, -}; diff --git a/openairITS/mac/DOT11/net/wireless/wext-compat.h b/openairITS/mac/DOT11/net/wireless/wext-compat.h deleted file mode 100644 index 5d766b0118e..00000000000 --- a/openairITS/mac/DOT11/net/wireless/wext-compat.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __WEXT_COMPAT -#define __WEXT_COMPAT - -#include <net/iw_handler.h> -#include <linux/wireless.h> - -int cfg80211_ibss_wext_siwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra); -int cfg80211_ibss_wext_giwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra); -int cfg80211_ibss_wext_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra); -int cfg80211_ibss_wext_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra); -int cfg80211_ibss_wext_siwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid); -int cfg80211_ibss_wext_giwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid); - -int cfg80211_mgd_wext_siwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra); -int cfg80211_mgd_wext_giwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra); -int cfg80211_mgd_wext_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra); -int cfg80211_mgd_wext_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra); -int cfg80211_mgd_wext_siwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid); -int cfg80211_mgd_wext_giwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid); - -int cfg80211_wext_siwmlme(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra); -int cfg80211_wext_siwgenie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra); - - -int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq); - - -extern const struct iw_handler_def cfg80211_wext_handler; -#endif /* __WEXT_COMPAT */ diff --git a/openairITS/mac/DOT11/net/wireless/wext-core.c b/openairITS/mac/DOT11/net/wireless/wext-core.c deleted file mode 100644 index 85a6ff0219b..00000000000 --- a/openairITS/mac/DOT11/net/wireless/wext-core.c +++ /dev/null @@ -1,1125 +0,0 @@ -/* - * This file implement the Wireless Extensions core API. - * - * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> - * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. - * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> - * - * (As all part of the Linux kernel, this file is GPL) - */ -#include <linux/kernel.h> -#include <linux/netdevice.h> -#include <linux/rtnetlink.h> -#include <linux/slab.h> -#include <linux/wireless.h> -#include <linux/uaccess.h> -#include <linux/export.h> -#include <net/cfg80211.h> -#include <net/iw_handler.h> -#include <net/netlink.h> -#include <net/wext.h> -#include <net/net_namespace.h> - -typedef int (*wext_ioctl_func)(struct net_device *, struct iwreq *, - unsigned int, struct iw_request_info *, - iw_handler); - - -/* - * Meta-data about all the standard Wireless Extension request we - * know about. - */ -static const struct iw_ioctl_description standard_ioctl[] = { - [IW_IOCTL_IDX(SIOCSIWCOMMIT)] = { - .header_type = IW_HEADER_TYPE_NULL, - }, - [IW_IOCTL_IDX(SIOCGIWNAME)] = { - .header_type = IW_HEADER_TYPE_CHAR, - .flags = IW_DESCR_FLAG_DUMP, - }, - [IW_IOCTL_IDX(SIOCSIWNWID)] = { - .header_type = IW_HEADER_TYPE_PARAM, - .flags = IW_DESCR_FLAG_EVENT, - }, - [IW_IOCTL_IDX(SIOCGIWNWID)] = { - .header_type = IW_HEADER_TYPE_PARAM, - .flags = IW_DESCR_FLAG_DUMP, - }, - [IW_IOCTL_IDX(SIOCSIWFREQ)] = { - .header_type = IW_HEADER_TYPE_FREQ, - .flags = IW_DESCR_FLAG_EVENT, - }, - [IW_IOCTL_IDX(SIOCGIWFREQ)] = { - .header_type = IW_HEADER_TYPE_FREQ, - .flags = IW_DESCR_FLAG_DUMP, - }, - [IW_IOCTL_IDX(SIOCSIWMODE)] = { - .header_type = IW_HEADER_TYPE_UINT, - .flags = IW_DESCR_FLAG_EVENT, - }, - [IW_IOCTL_IDX(SIOCGIWMODE)] = { - .header_type = IW_HEADER_TYPE_UINT, - .flags = IW_DESCR_FLAG_DUMP, - }, - [IW_IOCTL_IDX(SIOCSIWSENS)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCGIWSENS)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCSIWRANGE)] = { - .header_type = IW_HEADER_TYPE_NULL, - }, - [IW_IOCTL_IDX(SIOCGIWRANGE)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = sizeof(struct iw_range), - .flags = IW_DESCR_FLAG_DUMP, - }, - [IW_IOCTL_IDX(SIOCSIWPRIV)] = { - .header_type = IW_HEADER_TYPE_NULL, - }, - [IW_IOCTL_IDX(SIOCGIWPRIV)] = { /* (handled directly by us) */ - .header_type = IW_HEADER_TYPE_POINT, - .token_size = sizeof(struct iw_priv_args), - .max_tokens = 16, - .flags = IW_DESCR_FLAG_NOMAX, - }, - [IW_IOCTL_IDX(SIOCSIWSTATS)] = { - .header_type = IW_HEADER_TYPE_NULL, - }, - [IW_IOCTL_IDX(SIOCGIWSTATS)] = { /* (handled directly by us) */ - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = sizeof(struct iw_statistics), - .flags = IW_DESCR_FLAG_DUMP, - }, - [IW_IOCTL_IDX(SIOCSIWSPY)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = sizeof(struct sockaddr), - .max_tokens = IW_MAX_SPY, - }, - [IW_IOCTL_IDX(SIOCGIWSPY)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = sizeof(struct sockaddr) + - sizeof(struct iw_quality), - .max_tokens = IW_MAX_SPY, - }, - [IW_IOCTL_IDX(SIOCSIWTHRSPY)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = sizeof(struct iw_thrspy), - .min_tokens = 1, - .max_tokens = 1, - }, - [IW_IOCTL_IDX(SIOCGIWTHRSPY)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = sizeof(struct iw_thrspy), - .min_tokens = 1, - .max_tokens = 1, - }, - [IW_IOCTL_IDX(SIOCSIWAP)] = { - .header_type = IW_HEADER_TYPE_ADDR, - }, - [IW_IOCTL_IDX(SIOCGIWAP)] = { - .header_type = IW_HEADER_TYPE_ADDR, - .flags = IW_DESCR_FLAG_DUMP, - }, - [IW_IOCTL_IDX(SIOCSIWMLME)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .min_tokens = sizeof(struct iw_mlme), - .max_tokens = sizeof(struct iw_mlme), - }, - [IW_IOCTL_IDX(SIOCGIWAPLIST)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = sizeof(struct sockaddr) + - sizeof(struct iw_quality), - .max_tokens = IW_MAX_AP, - .flags = IW_DESCR_FLAG_NOMAX, - }, - [IW_IOCTL_IDX(SIOCSIWSCAN)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .min_tokens = 0, - .max_tokens = sizeof(struct iw_scan_req), - }, - [IW_IOCTL_IDX(SIOCGIWSCAN)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_SCAN_MAX_DATA, - .flags = IW_DESCR_FLAG_NOMAX, - }, - [IW_IOCTL_IDX(SIOCSIWESSID)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ESSID_MAX_SIZE, - .flags = IW_DESCR_FLAG_EVENT, - }, - [IW_IOCTL_IDX(SIOCGIWESSID)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ESSID_MAX_SIZE, - .flags = IW_DESCR_FLAG_DUMP, - }, - [IW_IOCTL_IDX(SIOCSIWNICKN)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ESSID_MAX_SIZE, - }, - [IW_IOCTL_IDX(SIOCGIWNICKN)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ESSID_MAX_SIZE, - }, - [IW_IOCTL_IDX(SIOCSIWRATE)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCGIWRATE)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCSIWRTS)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCGIWRTS)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCSIWFRAG)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCGIWFRAG)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCSIWTXPOW)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCGIWTXPOW)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCSIWRETRY)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCGIWRETRY)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCSIWENCODE)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ENCODING_TOKEN_MAX, - .flags = IW_DESCR_FLAG_EVENT | IW_DESCR_FLAG_RESTRICT, - }, - [IW_IOCTL_IDX(SIOCGIWENCODE)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_ENCODING_TOKEN_MAX, - .flags = IW_DESCR_FLAG_DUMP | IW_DESCR_FLAG_RESTRICT, - }, - [IW_IOCTL_IDX(SIOCSIWPOWER)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCGIWPOWER)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCSIWGENIE)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_GENERIC_IE_MAX, - }, - [IW_IOCTL_IDX(SIOCGIWGENIE)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_GENERIC_IE_MAX, - }, - [IW_IOCTL_IDX(SIOCSIWAUTH)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCGIWAUTH)] = { - .header_type = IW_HEADER_TYPE_PARAM, - }, - [IW_IOCTL_IDX(SIOCSIWENCODEEXT)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .min_tokens = sizeof(struct iw_encode_ext), - .max_tokens = sizeof(struct iw_encode_ext) + - IW_ENCODING_TOKEN_MAX, - }, - [IW_IOCTL_IDX(SIOCGIWENCODEEXT)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .min_tokens = sizeof(struct iw_encode_ext), - .max_tokens = sizeof(struct iw_encode_ext) + - IW_ENCODING_TOKEN_MAX, - }, - [IW_IOCTL_IDX(SIOCSIWPMKSA)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .min_tokens = sizeof(struct iw_pmksa), - .max_tokens = sizeof(struct iw_pmksa), - }, -}; -static const unsigned standard_ioctl_num = ARRAY_SIZE(standard_ioctl); - -/* - * Meta-data about all the additional standard Wireless Extension events - * we know about. - */ -static const struct iw_ioctl_description standard_event[] = { - [IW_EVENT_IDX(IWEVTXDROP)] = { - .header_type = IW_HEADER_TYPE_ADDR, - }, - [IW_EVENT_IDX(IWEVQUAL)] = { - .header_type = IW_HEADER_TYPE_QUAL, - }, - [IW_EVENT_IDX(IWEVCUSTOM)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_CUSTOM_MAX, - }, - [IW_EVENT_IDX(IWEVREGISTERED)] = { - .header_type = IW_HEADER_TYPE_ADDR, - }, - [IW_EVENT_IDX(IWEVEXPIRED)] = { - .header_type = IW_HEADER_TYPE_ADDR, - }, - [IW_EVENT_IDX(IWEVGENIE)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_GENERIC_IE_MAX, - }, - [IW_EVENT_IDX(IWEVMICHAELMICFAILURE)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = sizeof(struct iw_michaelmicfailure), - }, - [IW_EVENT_IDX(IWEVASSOCREQIE)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_GENERIC_IE_MAX, - }, - [IW_EVENT_IDX(IWEVASSOCRESPIE)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = IW_GENERIC_IE_MAX, - }, - [IW_EVENT_IDX(IWEVPMKIDCAND)] = { - .header_type = IW_HEADER_TYPE_POINT, - .token_size = 1, - .max_tokens = sizeof(struct iw_pmkid_cand), - }, -}; -static const unsigned standard_event_num = ARRAY_SIZE(standard_event); - -/* Size (in bytes) of various events */ -static const int event_type_size[] = { - IW_EV_LCP_LEN, /* IW_HEADER_TYPE_NULL */ - 0, - IW_EV_CHAR_LEN, /* IW_HEADER_TYPE_CHAR */ - 0, - IW_EV_UINT_LEN, /* IW_HEADER_TYPE_UINT */ - IW_EV_FREQ_LEN, /* IW_HEADER_TYPE_FREQ */ - IW_EV_ADDR_LEN, /* IW_HEADER_TYPE_ADDR */ - 0, - IW_EV_POINT_LEN, /* Without variable payload */ - IW_EV_PARAM_LEN, /* IW_HEADER_TYPE_PARAM */ - IW_EV_QUAL_LEN, /* IW_HEADER_TYPE_QUAL */ -}; - -#ifdef CONFIG_COMPAT -static const int compat_event_type_size[] = { - IW_EV_COMPAT_LCP_LEN, /* IW_HEADER_TYPE_NULL */ - 0, - IW_EV_COMPAT_CHAR_LEN, /* IW_HEADER_TYPE_CHAR */ - 0, - IW_EV_COMPAT_UINT_LEN, /* IW_HEADER_TYPE_UINT */ - IW_EV_COMPAT_FREQ_LEN, /* IW_HEADER_TYPE_FREQ */ - IW_EV_COMPAT_ADDR_LEN, /* IW_HEADER_TYPE_ADDR */ - 0, - IW_EV_COMPAT_POINT_LEN, /* Without variable payload */ - IW_EV_COMPAT_PARAM_LEN, /* IW_HEADER_TYPE_PARAM */ - IW_EV_COMPAT_QUAL_LEN, /* IW_HEADER_TYPE_QUAL */ -}; -#endif - - -/* IW event code */ - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) -static int __net_init wext_pernet_init(struct net *net) -{ - skb_queue_head_init(&net->wext_nlevents); - return 0; -} - -static void __net_exit wext_pernet_exit(struct net *net) -{ - skb_queue_purge(&net->wext_nlevents); -} - -static struct pernet_operations wext_pernet_ops = { - .init = wext_pernet_init, - .exit = wext_pernet_exit, -}; - -static int __init wireless_nlevent_init(void) -{ - return register_pernet_subsys(&wext_pernet_ops); -} - -subsys_initcall(wireless_nlevent_init); - -/* Process events generated by the wireless layer or the driver. */ -static void wireless_nlevent_process(struct work_struct *work) -{ - struct sk_buff *skb; - struct net *net; - - rtnl_lock(); - - for_each_net(net) { - while ((skb = skb_dequeue(&net->wext_nlevents))) - rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, - GFP_KERNEL); - } - - rtnl_unlock(); -} - -static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process); - -#else -/* Older kernels get the old way of doing stuff*/ -static struct sk_buff_head wireless_nlevent_queue; - -static int __init wireless_nlevent_init(void) -{ - skb_queue_head_init(&wireless_nlevent_queue); - return 0; -} - -subsys_initcall(wireless_nlevent_init); - -static void wireless_nlevent_process(unsigned long data) -{ - struct sk_buff *skb; - while ((skb = skb_dequeue(&wireless_nlevent_queue))) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) - rtnl_notify(skb, &init_net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); -#else - rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); -#endif -} - -static DECLARE_TASKLET(wireless_nlevent_tasklet, wireless_nlevent_process, 0); - -#endif - -static struct nlmsghdr *rtnetlink_ifinfo_prep(struct net_device *dev, - struct sk_buff *skb) -{ - struct ifinfomsg *r; - struct nlmsghdr *nlh; - - nlh = nlmsg_put(skb, 0, 0, RTM_NEWLINK, sizeof(*r), 0); - if (!nlh) - return NULL; - - r = nlmsg_data(nlh); - r->ifi_family = AF_UNSPEC; - r->__ifi_pad = 0; - r->ifi_type = dev->type; - r->ifi_index = dev->ifindex; - r->ifi_flags = dev_get_flags(dev); - r->ifi_change = 0; /* Wireless changes don't affect those flags */ - - NLA_PUT_STRING(skb, IFLA_IFNAME, dev->name); - - return nlh; - nla_put_failure: - nlmsg_cancel(skb, nlh); - return NULL; -} - - -/* - * Main event dispatcher. Called from other parts and drivers. - * Send the event on the appropriate channels. - * May be called from interrupt context. - */ -void wireless_send_event(struct net_device * dev, - unsigned int cmd, - union iwreq_data * wrqu, - const char * extra) -{ - const struct iw_ioctl_description * descr = NULL; - int extra_len = 0; - struct iw_event *event; /* Mallocated whole event */ - int event_len; /* Its size */ - int hdr_len; /* Size of the event header */ - int wrqu_off = 0; /* Offset in wrqu */ - /* Don't "optimise" the following variable, it will crash */ - unsigned cmd_index; /* *MUST* be unsigned */ - struct sk_buff *skb; - struct nlmsghdr *nlh; - struct nlattr *nla; -#ifdef CONFIG_COMPAT - struct __compat_iw_event *compat_event; - struct compat_iw_point compat_wrqu; - struct sk_buff *compskb; -#endif - - /* - * Nothing in the kernel sends scan events with data, be safe. - * This is necessary because we cannot fix up scan event data - * for compat, due to being contained in 'extra', but normally - * applications are required to retrieve the scan data anyway - * and no data is included in the event, this codifies that - * practice. - */ - if (WARN_ON(cmd == SIOCGIWSCAN && extra)) - extra = NULL; - - /* Get the description of the Event */ - if (cmd <= SIOCIWLAST) { - cmd_index = IW_IOCTL_IDX(cmd); - if (cmd_index < standard_ioctl_num) - descr = &(standard_ioctl[cmd_index]); - } else { - cmd_index = IW_EVENT_IDX(cmd); - if (cmd_index < standard_event_num) - descr = &(standard_event[cmd_index]); - } - /* Don't accept unknown events */ - if (descr == NULL) { - /* Note : we don't return an error to the driver, because - * the driver would not know what to do about it. It can't - * return an error to the user, because the event is not - * initiated by a user request. - * The best the driver could do is to log an error message. - * We will do it ourselves instead... - */ - netdev_err(dev, "(WE) : Invalid/Unknown Wireless Event (0x%04X)\n", - cmd); - return; - } - - /* Check extra parameters and set extra_len */ - if (descr->header_type == IW_HEADER_TYPE_POINT) { - /* Check if number of token fits within bounds */ - if (wrqu->data.length > descr->max_tokens) { - netdev_err(dev, "(WE) : Wireless Event too big (%d)\n", - wrqu->data.length); - return; - } - if (wrqu->data.length < descr->min_tokens) { - netdev_err(dev, "(WE) : Wireless Event too small (%d)\n", - wrqu->data.length); - return; - } - /* Calculate extra_len - extra is NULL for restricted events */ - if (extra != NULL) - extra_len = wrqu->data.length * descr->token_size; - /* Always at an offset in wrqu */ - wrqu_off = IW_EV_POINT_OFF; - } - - /* Total length of the event */ - hdr_len = event_type_size[descr->header_type]; - event_len = hdr_len + extra_len; - - /* - * The problem for 64/32 bit. - * - * On 64-bit, a regular event is laid out as follows: - * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | - * | event.len | event.cmd | p a d d i n g | - * | wrqu data ... (with the correct size) | - * - * This padding exists because we manipulate event->u, - * and 'event' is not packed. - * - * An iw_point event is laid out like this instead: - * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | - * | event.len | event.cmd | p a d d i n g | - * | iwpnt.len | iwpnt.flg | p a d d i n g | - * | extra data ... - * - * The second padding exists because struct iw_point is extended, - * but this depends on the platform... - * - * On 32-bit, all the padding shouldn't be there. - */ - - skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); - if (!skb) - return; - - /* Send via the RtNetlink event channel */ - nlh = rtnetlink_ifinfo_prep(dev, skb); - if (WARN_ON(!nlh)) { - kfree_skb(skb); - return; - } - - /* Add the wireless events in the netlink packet */ - nla = nla_reserve(skb, IFLA_WIRELESS, event_len); - if (!nla) { - kfree_skb(skb); - return; - } - event = nla_data(nla); - - /* Fill event - first clear to avoid data leaking */ - memset(event, 0, hdr_len); - event->len = event_len; - event->cmd = cmd; - memcpy(&event->u, ((char *) wrqu) + wrqu_off, hdr_len - IW_EV_LCP_LEN); - if (extra_len) - memcpy(((char *) event) + hdr_len, extra, extra_len); - - nlmsg_end(skb, nlh); -#ifdef CONFIG_COMPAT - hdr_len = compat_event_type_size[descr->header_type]; - event_len = hdr_len + extra_len; - - compskb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); - if (!compskb) { - kfree_skb(skb); - return; - } - - /* Send via the RtNetlink event channel */ - nlh = rtnetlink_ifinfo_prep(dev, compskb); - if (WARN_ON(!nlh)) { - kfree_skb(skb); - kfree_skb(compskb); - return; - } - - /* Add the wireless events in the netlink packet */ - nla = nla_reserve(compskb, IFLA_WIRELESS, event_len); - if (!nla) { - kfree_skb(skb); - kfree_skb(compskb); - return; - } - compat_event = nla_data(nla); - - compat_event->len = event_len; - compat_event->cmd = cmd; - if (descr->header_type == IW_HEADER_TYPE_POINT) { - compat_wrqu.length = wrqu->data.length; - compat_wrqu.flags = wrqu->data.flags; - memcpy(&compat_event->pointer, - ((char *) &compat_wrqu) + IW_EV_COMPAT_POINT_OFF, - hdr_len - IW_EV_COMPAT_LCP_LEN); - if (extra_len) - memcpy(((char *) compat_event) + hdr_len, - extra, extra_len); - } else { - /* extra_len must be zero, so no if (extra) needed */ - memcpy(&compat_event->pointer, wrqu, - hdr_len - IW_EV_COMPAT_LCP_LEN); - } - - nlmsg_end(compskb, nlh); - - skb_shinfo(skb)->frag_list = compskb; -#endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) - skb_queue_tail(&dev_net(dev)->wext_nlevents, skb); - schedule_work(&wireless_nlevent_work); -#else - skb_queue_tail(&wireless_nlevent_queue, skb); - tasklet_schedule(&wireless_nlevent_tasklet); -#endif -} -EXPORT_SYMBOL(wireless_send_event); - - - -/* IW handlers */ - -struct iw_statistics *get_wireless_stats(struct net_device *dev) -{ -#ifdef CONFIG_WIRELESS_EXT - if ((dev->wireless_handlers != NULL) && - (dev->wireless_handlers->get_wireless_stats != NULL)) - return dev->wireless_handlers->get_wireless_stats(dev); -#endif - -#ifdef CONFIG_CFG80211_WEXT - if (dev->ieee80211_ptr && - dev->ieee80211_ptr->wiphy && - dev->ieee80211_ptr->wiphy->wext && - dev->ieee80211_ptr->wiphy->wext->get_wireless_stats) - return dev->ieee80211_ptr->wiphy->wext->get_wireless_stats(dev); -#endif - - /* not found */ - return NULL; -} - -static int iw_handler_get_iwstats(struct net_device * dev, - struct iw_request_info * info, - union iwreq_data * wrqu, - char * extra) -{ - /* Get stats from the driver */ - struct iw_statistics *stats; - - stats = get_wireless_stats(dev); - if (stats) { - /* Copy statistics to extra */ - memcpy(extra, stats, sizeof(struct iw_statistics)); - wrqu->data.length = sizeof(struct iw_statistics); - - /* Check if we need to clear the updated flag */ - if (wrqu->data.flags != 0) - stats->qual.updated &= ~IW_QUAL_ALL_UPDATED; - return 0; - } else - return -EOPNOTSUPP; -} - -static iw_handler get_handler(struct net_device *dev, unsigned int cmd) -{ - /* Don't "optimise" the following variable, it will crash */ - unsigned int index; /* *MUST* be unsigned */ - const struct iw_handler_def *handlers = NULL; - -#ifdef CONFIG_CFG80211_WEXT - if (dev->ieee80211_ptr && dev->ieee80211_ptr->wiphy) - handlers = dev->ieee80211_ptr->wiphy->wext; -#endif -#ifdef CONFIG_WIRELESS_EXT - if (dev->wireless_handlers) - handlers = dev->wireless_handlers; -#endif - - if (!handlers) - return NULL; - - /* Try as a standard command */ - index = IW_IOCTL_IDX(cmd); - if (index < handlers->num_standard) - return handlers->standard[index]; - -#ifdef CONFIG_WEXT_PRIV - /* Try as a private command */ - index = cmd - SIOCIWFIRSTPRIV; - if (index < handlers->num_private) - return handlers->private[index]; -#endif - - /* Not found */ - return NULL; -} - -static int ioctl_standard_iw_point(struct iw_point *iwp, unsigned int cmd, - const struct iw_ioctl_description *descr, - iw_handler handler, struct net_device *dev, - struct iw_request_info *info) -{ - int err, extra_size, user_length = 0, essid_compat = 0; - char *extra; - - /* Calculate space needed by arguments. Always allocate - * for max space. - */ - extra_size = descr->max_tokens * descr->token_size; - - /* Check need for ESSID compatibility for WE < 21 */ - switch (cmd) { - case SIOCSIWESSID: - case SIOCGIWESSID: - case SIOCSIWNICKN: - case SIOCGIWNICKN: - if (iwp->length == descr->max_tokens + 1) - essid_compat = 1; - else if (IW_IS_SET(cmd) && (iwp->length != 0)) { - char essid[IW_ESSID_MAX_SIZE + 1]; - unsigned int len; - len = iwp->length * descr->token_size; - - if (len > IW_ESSID_MAX_SIZE) - return -EFAULT; - - err = copy_from_user(essid, iwp->pointer, len); - if (err) - return -EFAULT; - - if (essid[iwp->length - 1] == '\0') - essid_compat = 1; - } - break; - default: - break; - } - - iwp->length -= essid_compat; - - /* Check what user space is giving us */ - if (IW_IS_SET(cmd)) { - /* Check NULL pointer */ - if (!iwp->pointer && iwp->length != 0) - return -EFAULT; - /* Check if number of token fits within bounds */ - if (iwp->length > descr->max_tokens) - return -E2BIG; - if (iwp->length < descr->min_tokens) - return -EINVAL; - } else { - /* Check NULL pointer */ - if (!iwp->pointer) - return -EFAULT; - /* Save user space buffer size for checking */ - user_length = iwp->length; - - /* Don't check if user_length > max to allow forward - * compatibility. The test user_length < min is - * implied by the test at the end. - */ - - /* Support for very large requests */ - if ((descr->flags & IW_DESCR_FLAG_NOMAX) && - (user_length > descr->max_tokens)) { - /* Allow userspace to GET more than max so - * we can support any size GET requests. - * There is still a limit : -ENOMEM. - */ - extra_size = user_length * descr->token_size; - - /* Note : user_length is originally a __u16, - * and token_size is controlled by us, - * so extra_size won't get negative and - * won't overflow... - */ - } - } - - /* kzalloc() ensures NULL-termination for essid_compat. */ - extra = kzalloc(extra_size, GFP_KERNEL); - if (!extra) - return -ENOMEM; - - /* If it is a SET, get all the extra data in here */ - if (IW_IS_SET(cmd) && (iwp->length != 0)) { - if (copy_from_user(extra, iwp->pointer, - iwp->length * - descr->token_size)) { - err = -EFAULT; - goto out; - } - - if (cmd == SIOCSIWENCODEEXT) { - struct iw_encode_ext *ee = (void *) extra; - - if (iwp->length < sizeof(*ee) + ee->key_len) { - err = -EFAULT; - goto out; - } - } - } - - if (IW_IS_GET(cmd) && !(descr->flags & IW_DESCR_FLAG_NOMAX)) { - /* - * If this is a GET, but not NOMAX, it means that the extra - * data is not bounded by userspace, but by max_tokens. Thus - * set the length to max_tokens. This matches the extra data - * allocation. - * The driver should fill it with the number of tokens it - * provided, and it may check iwp->length rather than having - * knowledge of max_tokens. If the driver doesn't change the - * iwp->length, this ioctl just copies back max_token tokens - * filled with zeroes. Hopefully the driver isn't claiming - * them to be valid data. - */ - iwp->length = descr->max_tokens; - } - - err = handler(dev, info, (union iwreq_data *) iwp, extra); - - iwp->length += essid_compat; - - /* If we have something to return to the user */ - if (!err && IW_IS_GET(cmd)) { - /* Check if there is enough buffer up there */ - if (user_length < iwp->length) { - err = -E2BIG; - goto out; - } - - if (copy_to_user(iwp->pointer, extra, - iwp->length * - descr->token_size)) { - err = -EFAULT; - goto out; - } - } - - /* Generate an event to notify listeners of the change */ - if ((descr->flags & IW_DESCR_FLAG_EVENT) && - ((err == 0) || (err == -EIWCOMMIT))) { - union iwreq_data *data = (union iwreq_data *) iwp; - - if (descr->flags & IW_DESCR_FLAG_RESTRICT) - /* If the event is restricted, don't - * export the payload. - */ - wireless_send_event(dev, cmd, data, NULL); - else - wireless_send_event(dev, cmd, data, extra); - } - -out: - kfree(extra); - return err; -} - -/* - * Call the commit handler in the driver - * (if exist and if conditions are right) - * - * Note : our current commit strategy is currently pretty dumb, - * but we will be able to improve on that... - * The goal is to try to agreagate as many changes as possible - * before doing the commit. Drivers that will define a commit handler - * are usually those that need a reset after changing parameters, so - * we want to minimise the number of reset. - * A cool idea is to use a timer : at each "set" command, we re-set the - * timer, when the timer eventually fires, we call the driver. - * Hopefully, more on that later. - * - * Also, I'm waiting to see how many people will complain about the - * netif_running(dev) test. I'm open on that one... - * Hopefully, the driver will remember to do a commit in "open()" ;-) - */ -int call_commit_handler(struct net_device *dev) -{ -#ifdef CONFIG_WIRELESS_EXT - if ((netif_running(dev)) && - (dev->wireless_handlers->standard[0] != NULL)) - /* Call the commit handler on the driver */ - return dev->wireless_handlers->standard[0](dev, NULL, - NULL, NULL); - else - return 0; /* Command completed successfully */ -#else - /* cfg80211 has no commit */ - return 0; -#endif -} - -/* - * Main IOCTl dispatcher. - * Check the type of IOCTL and call the appropriate wrapper... - */ -static int wireless_process_ioctl(struct net *net, struct ifreq *ifr, - unsigned int cmd, - struct iw_request_info *info, - wext_ioctl_func standard, - wext_ioctl_func private) -{ - struct iwreq *iwr = (struct iwreq *) ifr; - struct net_device *dev; - iw_handler handler; - - /* Permissions are already checked in dev_ioctl() before calling us. - * The copy_to/from_user() of ifr is also dealt with in there */ - - /* Make sure the device exist */ - if ((dev = __dev_get_by_name(net, ifr->ifr_name)) == NULL) - return -ENODEV; - - /* A bunch of special cases, then the generic case... - * Note that 'cmd' is already filtered in dev_ioctl() with - * (cmd >= SIOCIWFIRST && cmd <= SIOCIWLAST) */ - if (cmd == SIOCGIWSTATS) - return standard(dev, iwr, cmd, info, - &iw_handler_get_iwstats); - -#ifdef CONFIG_WEXT_PRIV - if (cmd == SIOCGIWPRIV && dev->wireless_handlers) - return standard(dev, iwr, cmd, info, - iw_handler_get_private); -#endif - - /* Basic check */ - if (!netif_device_present(dev)) - return -ENODEV; - - /* New driver API : try to find the handler */ - handler = get_handler(dev, cmd); - if (handler) { - /* Standard and private are not the same */ - if (cmd < SIOCIWFIRSTPRIV) - return standard(dev, iwr, cmd, info, handler); - else if (private) - return private(dev, iwr, cmd, info, handler); - } - /* Old driver API : call driver ioctl handler */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - if (dev->netdev_ops->ndo_do_ioctl) - return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); -#else - if (dev->do_ioctl) - return dev->do_ioctl(dev, ifr, cmd); -#endif - return -EOPNOTSUPP; -} - -/* If command is `set a parameter', or `get the encoding parameters', - * check if the user has the right to do it. - */ -static int wext_permission_check(unsigned int cmd) -{ - if ((IW_IS_SET(cmd) || cmd == SIOCGIWENCODE || - cmd == SIOCGIWENCODEEXT) && - !capable(CAP_NET_ADMIN)) - return -EPERM; - - return 0; -} - -/* entry point from dev ioctl */ -static int wext_ioctl_dispatch(struct net *net, struct ifreq *ifr, - unsigned int cmd, struct iw_request_info *info, - wext_ioctl_func standard, - wext_ioctl_func private) -{ - int ret = wext_permission_check(cmd); - - if (ret) - return ret; - - dev_load(net, ifr->ifr_name); - rtnl_lock(); - ret = wireless_process_ioctl(net, ifr, cmd, info, standard, private); - rtnl_unlock(); - - return ret; -} - -/* - * Wrapper to call a standard Wireless Extension handler. - * We do various checks and also take care of moving data between - * user space and kernel space. - */ -static int ioctl_standard_call(struct net_device * dev, - struct iwreq *iwr, - unsigned int cmd, - struct iw_request_info *info, - iw_handler handler) -{ - const struct iw_ioctl_description * descr; - int ret = -EINVAL; - - /* Get the description of the IOCTL */ - if (IW_IOCTL_IDX(cmd) >= standard_ioctl_num) - return -EOPNOTSUPP; - descr = &(standard_ioctl[IW_IOCTL_IDX(cmd)]); - - /* Check if we have a pointer to user space data or not */ - if (descr->header_type != IW_HEADER_TYPE_POINT) { - - /* No extra arguments. Trivial to handle */ - ret = handler(dev, info, &(iwr->u), NULL); - - /* Generate an event to notify listeners of the change */ - if ((descr->flags & IW_DESCR_FLAG_EVENT) && - ((ret == 0) || (ret == -EIWCOMMIT))) - wireless_send_event(dev, cmd, &(iwr->u), NULL); - } else { - ret = ioctl_standard_iw_point(&iwr->u.data, cmd, descr, - handler, dev, info); - } - - /* Call commit handler if needed and defined */ - if (ret == -EIWCOMMIT) - ret = call_commit_handler(dev); - - /* Here, we will generate the appropriate event if needed */ - - return ret; -} - - -int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, - void __user *arg) -{ - struct iw_request_info info = { .cmd = cmd, .flags = 0 }; - int ret; - - ret = wext_ioctl_dispatch(net, ifr, cmd, &info, - ioctl_standard_call, - ioctl_private_call); - if (ret >= 0 && - IW_IS_GET(cmd) && - copy_to_user(arg, ifr, sizeof(struct iwreq))) - return -EFAULT; - - return ret; -} - -#ifdef CONFIG_COMPAT -static int compat_standard_call(struct net_device *dev, - struct iwreq *iwr, - unsigned int cmd, - struct iw_request_info *info, - iw_handler handler) -{ - const struct iw_ioctl_description *descr; - struct compat_iw_point *iwp_compat; - struct iw_point iwp; - int err; - - descr = standard_ioctl + IW_IOCTL_IDX(cmd); - - if (descr->header_type != IW_HEADER_TYPE_POINT) - return ioctl_standard_call(dev, iwr, cmd, info, handler); - - iwp_compat = (struct compat_iw_point *) &iwr->u.data; - iwp.pointer = compat_ptr(iwp_compat->pointer); - iwp.length = iwp_compat->length; - iwp.flags = iwp_compat->flags; - - err = ioctl_standard_iw_point(&iwp, cmd, descr, handler, dev, info); - - iwp_compat->pointer = ptr_to_compat(iwp.pointer); - iwp_compat->length = iwp.length; - iwp_compat->flags = iwp.flags; - - return err; -} - -int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, - unsigned long arg) -{ - void __user *argp = (void __user *)arg; - struct iw_request_info info; - struct iwreq iwr; - char *colon; - int ret; - - if (copy_from_user(&iwr, argp, sizeof(struct iwreq))) - return -EFAULT; - - iwr.ifr_name[IFNAMSIZ-1] = 0; - colon = strchr(iwr.ifr_name, ':'); - if (colon) - *colon = 0; - - info.cmd = cmd; - info.flags = IW_REQUEST_FLAG_COMPAT; - - ret = wext_ioctl_dispatch(net, (struct ifreq *) &iwr, cmd, &info, - compat_standard_call, - compat_private_call); - - if (ret >= 0 && - IW_IS_GET(cmd) && - copy_to_user(argp, &iwr, sizeof(struct iwreq))) - return -EFAULT; - - return ret; -} -#endif diff --git a/openairITS/mac/DOT11/net/wireless/wext-priv.c b/openairITS/mac/DOT11/net/wireless/wext-priv.c deleted file mode 100644 index 674d426a9d2..00000000000 --- a/openairITS/mac/DOT11/net/wireless/wext-priv.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * This file implement the Wireless Extensions priv API. - * - * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> - * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. - * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> - * - * (As all part of the Linux kernel, this file is GPL) - */ -#include <linux/slab.h> -#include <linux/wireless.h> -#include <linux/netdevice.h> -#include <net/iw_handler.h> -#include <net/wext.h> - -int iw_handler_get_private(struct net_device * dev, - struct iw_request_info * info, - union iwreq_data * wrqu, - char * extra) -{ - /* Check if the driver has something to export */ - if ((dev->wireless_handlers->num_private_args == 0) || - (dev->wireless_handlers->private_args == NULL)) - return -EOPNOTSUPP; - - /* Check if there is enough buffer up there */ - if (wrqu->data.length < dev->wireless_handlers->num_private_args) { - /* User space can't know in advance how large the buffer - * needs to be. Give it a hint, so that we can support - * any size buffer we want somewhat efficiently... */ - wrqu->data.length = dev->wireless_handlers->num_private_args; - return -E2BIG; - } - - /* Set the number of available ioctls. */ - wrqu->data.length = dev->wireless_handlers->num_private_args; - - /* Copy structure to the user buffer. */ - memcpy(extra, dev->wireless_handlers->private_args, - sizeof(struct iw_priv_args) * wrqu->data.length); - - return 0; -} - -/* Size (in bytes) of the various private data types */ -static const char iw_priv_type_size[] = { - 0, /* IW_PRIV_TYPE_NONE */ - 1, /* IW_PRIV_TYPE_BYTE */ - 1, /* IW_PRIV_TYPE_CHAR */ - 0, /* Not defined */ - sizeof(__u32), /* IW_PRIV_TYPE_INT */ - sizeof(struct iw_freq), /* IW_PRIV_TYPE_FLOAT */ - sizeof(struct sockaddr), /* IW_PRIV_TYPE_ADDR */ - 0, /* Not defined */ -}; - -static int get_priv_size(__u16 args) -{ - int num = args & IW_PRIV_SIZE_MASK; - int type = (args & IW_PRIV_TYPE_MASK) >> 12; - - return num * iw_priv_type_size[type]; -} - -static int adjust_priv_size(__u16 args, struct iw_point *iwp) -{ - int num = iwp->length; - int max = args & IW_PRIV_SIZE_MASK; - int type = (args & IW_PRIV_TYPE_MASK) >> 12; - - /* Make sure the driver doesn't goof up */ - if (max < num) - num = max; - - return num * iw_priv_type_size[type]; -} - -/* - * Wrapper to call a private Wireless Extension handler. - * We do various checks and also take care of moving data between - * user space and kernel space. - * It's not as nice and slimline as the standard wrapper. The cause - * is struct iw_priv_args, which was not really designed for the - * job we are going here. - * - * IMPORTANT : This function prevent to set and get data on the same - * IOCTL and enforce the SET/GET convention. Not doing it would be - * far too hairy... - * If you need to set and get data at the same time, please don't use - * a iw_handler but process it in your ioctl handler (i.e. use the - * old driver API). - */ -static int get_priv_descr_and_size(struct net_device *dev, unsigned int cmd, - const struct iw_priv_args **descrp) -{ - const struct iw_priv_args *descr; - int i, extra_size; - - descr = NULL; - for (i = 0; i < dev->wireless_handlers->num_private_args; i++) { - if (cmd == dev->wireless_handlers->private_args[i].cmd) { - descr = &dev->wireless_handlers->private_args[i]; - break; - } - } - - extra_size = 0; - if (descr) { - if (IW_IS_SET(cmd)) { - int offset = 0; /* For sub-ioctls */ - /* Check for sub-ioctl handler */ - if (descr->name[0] == '\0') - /* Reserve one int for sub-ioctl index */ - offset = sizeof(__u32); - - /* Size of set arguments */ - extra_size = get_priv_size(descr->set_args); - - /* Does it fits in iwr ? */ - if ((descr->set_args & IW_PRIV_SIZE_FIXED) && - ((extra_size + offset) <= IFNAMSIZ)) - extra_size = 0; - } else { - /* Size of get arguments */ - extra_size = get_priv_size(descr->get_args); - - /* Does it fits in iwr ? */ - if ((descr->get_args & IW_PRIV_SIZE_FIXED) && - (extra_size <= IFNAMSIZ)) - extra_size = 0; - } - } - *descrp = descr; - return extra_size; -} - -static int ioctl_private_iw_point(struct iw_point *iwp, unsigned int cmd, - const struct iw_priv_args *descr, - iw_handler handler, struct net_device *dev, - struct iw_request_info *info, int extra_size) -{ - char *extra; - int err; - - /* Check what user space is giving us */ - if (IW_IS_SET(cmd)) { - if (!iwp->pointer && iwp->length != 0) - return -EFAULT; - - if (iwp->length > (descr->set_args & IW_PRIV_SIZE_MASK)) - return -E2BIG; - } else if (!iwp->pointer) - return -EFAULT; - - extra = kzalloc(extra_size, GFP_KERNEL); - if (!extra) - return -ENOMEM; - - /* If it is a SET, get all the extra data in here */ - if (IW_IS_SET(cmd) && (iwp->length != 0)) { - if (copy_from_user(extra, iwp->pointer, extra_size)) { - err = -EFAULT; - goto out; - } - } - - /* Call the handler */ - err = handler(dev, info, (union iwreq_data *) iwp, extra); - - /* If we have something to return to the user */ - if (!err && IW_IS_GET(cmd)) { - /* Adjust for the actual length if it's variable, - * avoid leaking kernel bits outside. - */ - if (!(descr->get_args & IW_PRIV_SIZE_FIXED)) - extra_size = adjust_priv_size(descr->get_args, iwp); - - if (copy_to_user(iwp->pointer, extra, extra_size)) - err = -EFAULT; - } - -out: - kfree(extra); - return err; -} - -int ioctl_private_call(struct net_device *dev, struct iwreq *iwr, - unsigned int cmd, struct iw_request_info *info, - iw_handler handler) -{ - int extra_size = 0, ret = -EINVAL; - const struct iw_priv_args *descr; - - extra_size = get_priv_descr_and_size(dev, cmd, &descr); - - /* Check if we have a pointer to user space data or not. */ - if (extra_size == 0) { - /* No extra arguments. Trivial to handle */ - ret = handler(dev, info, &(iwr->u), (char *) &(iwr->u)); - } else { - ret = ioctl_private_iw_point(&iwr->u.data, cmd, descr, - handler, dev, info, extra_size); - } - - /* Call commit handler if needed and defined */ - if (ret == -EIWCOMMIT) - ret = call_commit_handler(dev); - - return ret; -} - -#ifdef CONFIG_COMPAT -int compat_private_call(struct net_device *dev, struct iwreq *iwr, - unsigned int cmd, struct iw_request_info *info, - iw_handler handler) -{ - const struct iw_priv_args *descr; - int ret, extra_size; - - extra_size = get_priv_descr_and_size(dev, cmd, &descr); - - /* Check if we have a pointer to user space data or not. */ - if (extra_size == 0) { - /* No extra arguments. Trivial to handle */ - ret = handler(dev, info, &(iwr->u), (char *) &(iwr->u)); - } else { - struct compat_iw_point *iwp_compat; - struct iw_point iwp; - - iwp_compat = (struct compat_iw_point *) &iwr->u.data; - iwp.pointer = compat_ptr(iwp_compat->pointer); - iwp.length = iwp_compat->length; - iwp.flags = iwp_compat->flags; - - ret = ioctl_private_iw_point(&iwp, cmd, descr, - handler, dev, info, extra_size); - - iwp_compat->pointer = ptr_to_compat(iwp.pointer); - iwp_compat->length = iwp.length; - iwp_compat->flags = iwp.flags; - } - - /* Call commit handler if needed and defined */ - if (ret == -EIWCOMMIT) - ret = call_commit_handler(dev); - - return ret; -} -#endif diff --git a/openairITS/mac/DOT11/net/wireless/wext-proc.c b/openairITS/mac/DOT11/net/wireless/wext-proc.c deleted file mode 100644 index f2fbfa6ff19..00000000000 --- a/openairITS/mac/DOT11/net/wireless/wext-proc.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * This file implement the Wireless Extensions proc API. - * - * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> - * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. - * - * (As all part of the Linux kernel, this file is GPL) - */ - -/* - * The /proc/net/wireless file is a human readable user-space interface - * exporting various wireless specific statistics from the wireless devices. - * This is the most popular part of the Wireless Extensions ;-) - * - * This interface is a pure clone of /proc/net/dev (in net/core/dev.c). - * The content of the file is basically the content of "struct iw_statistics". - */ - -#include <linux/module.h> -#include <linux/proc_fs.h> -#include <linux/seq_file.h> -#include <linux/wireless.h> -#include <linux/netdevice.h> -#include <linux/rtnetlink.h> -#include <net/iw_handler.h> -#include <net/wext.h> - - -static void wireless_seq_printf_stats(struct seq_file *seq, - struct net_device *dev) -{ - /* Get stats from the driver */ - struct iw_statistics *stats = get_wireless_stats(dev); - static struct iw_statistics nullstats = {}; - - /* show device if it's wireless regardless of current stats */ - if (!stats) { -#ifdef CONFIG_WIRELESS_EXT - if (dev->wireless_handlers) - stats = &nullstats; -#endif -#ifdef CONFIG_CFG80211 - if (dev->ieee80211_ptr) - stats = &nullstats; -#endif - } - - if (stats) { - seq_printf(seq, "%6s: %04x %3d%c %3d%c %3d%c %6d %6d %6d " - "%6d %6d %6d\n", - dev->name, stats->status, stats->qual.qual, - stats->qual.updated & IW_QUAL_QUAL_UPDATED - ? '.' : ' ', - ((__s32) stats->qual.level) - - ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0), - stats->qual.updated & IW_QUAL_LEVEL_UPDATED - ? '.' : ' ', - ((__s32) stats->qual.noise) - - ((stats->qual.updated & IW_QUAL_DBM) ? 0x100 : 0), - stats->qual.updated & IW_QUAL_NOISE_UPDATED - ? '.' : ' ', - stats->discard.nwid, stats->discard.code, - stats->discard.fragment, stats->discard.retries, - stats->discard.misc, stats->miss.beacon); - - if (stats != &nullstats) - stats->qual.updated &= ~IW_QUAL_ALL_UPDATED; - } -} - -/* ---------------------------------------------------------------- */ -/* - * Print info for /proc/net/wireless (print all entries) - */ -static int wireless_dev_seq_show(struct seq_file *seq, void *v) -{ - might_sleep(); - - if (v == SEQ_START_TOKEN) - seq_printf(seq, "Inter-| sta-| Quality | Discarded " - "packets | Missed | WE\n" - " face | tus | link level noise | nwid " - "crypt frag retry misc | beacon | %d\n", - WIRELESS_EXT); - else - wireless_seq_printf_stats(seq, v); - return 0; -} - -static void *wireless_dev_seq_start(struct seq_file *seq, loff_t *pos) -{ - struct net *net = seq_file_net(seq); - loff_t off; - struct net_device *dev; - - rtnl_lock(); - if (!*pos) - return SEQ_START_TOKEN; - - off = 1; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) - for_each_netdev(net, dev) -#else - for_each_netdev(net) -#endif - if (off++ == *pos) - return dev; - return NULL; -} - -static void *wireless_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) -{ - struct net *net = seq_file_net(seq); - - ++*pos; - - return v == SEQ_START_TOKEN ? - first_net_device(net) : next_net_device(v); -} - -static void wireless_dev_seq_stop(struct seq_file *seq, void *v) -{ - rtnl_unlock(); -} - -static const struct seq_operations wireless_seq_ops = { - .start = wireless_dev_seq_start, - .next = wireless_dev_seq_next, - .stop = wireless_dev_seq_stop, - .show = wireless_dev_seq_show, -}; - -static int seq_open_wireless(struct inode *inode, struct file *file) -{ - return seq_open_net(inode, file, &wireless_seq_ops, - sizeof(struct seq_net_private)); -} - -static const struct file_operations wireless_seq_fops = { - .owner = THIS_MODULE, - .open = seq_open_wireless, - .read = seq_read, - .llseek = seq_lseek, - .release = seq_release_net, -}; - -int __net_init wext_proc_init(struct net *net) -{ - /* Create /proc/net/wireless entry */ - if (!proc_net_fops_create(net, "wireless", S_IRUGO, &wireless_seq_fops)) - return -ENOMEM; - - return 0; -} - -void __net_exit wext_proc_exit(struct net *net) -{ - proc_net_remove(net, "wireless"); -} diff --git a/openairITS/mac/DOT11/net/wireless/wext-sme.c b/openairITS/mac/DOT11/net/wireless/wext-sme.c deleted file mode 100644 index 7c01c2f3b6c..00000000000 --- a/openairITS/mac/DOT11/net/wireless/wext-sme.c +++ /dev/null @@ -1,408 +0,0 @@ -/* - * cfg80211 wext compat for managed mode. - * - * Copyright 2009 Johannes Berg <johannes@sipsolutions.net> - * Copyright (C) 2009 Intel Corporation. All rights reserved. - */ - -#include <linux/export.h> -#include <linux/etherdevice.h> -#include <linux/if_arp.h> -#include <linux/slab.h> -#include <net/cfg80211.h> -#include <net/cfg80211-wext.h> -#include "wext-compat.h" -#include "nl80211.h" - -int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, - struct wireless_dev *wdev) -{ - struct cfg80211_cached_keys *ck = NULL; - const u8 *prev_bssid = NULL; - int err, i; - - ASSERT_RDEV_LOCK(rdev); - ASSERT_WDEV_LOCK(wdev); - - if (!netif_running(wdev->netdev)) - return 0; - - wdev->wext.connect.ie = wdev->wext.ie; - wdev->wext.connect.ie_len = wdev->wext.ie_len; - - /* Use default background scan period */ - wdev->wext.connect.bg_scan_period = -1; - - if (wdev->wext.keys) { - wdev->wext.keys->def = wdev->wext.default_key; - wdev->wext.keys->defmgmt = wdev->wext.default_mgmt_key; - if (wdev->wext.default_key != -1) - wdev->wext.connect.privacy = true; - } - - if (!wdev->wext.connect.ssid_len) - return 0; - - if (wdev->wext.keys) { - ck = kmemdup(wdev->wext.keys, sizeof(*ck), GFP_KERNEL); - if (!ck) - return -ENOMEM; - for (i = 0; i < 6; i++) - ck->params[i].key = ck->data[i]; - } - - if (wdev->wext.prev_bssid_valid) - prev_bssid = wdev->wext.prev_bssid; - - err = __cfg80211_connect(rdev, wdev->netdev, - &wdev->wext.connect, ck, prev_bssid); - if (err) - kfree(ck); - - return err; -} - -int cfg80211_mgd_wext_siwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *wextfreq, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - struct ieee80211_channel *chan = NULL; - int err, freq; - - /* call only for station! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) - return -EINVAL; - - freq = cfg80211_wext_freq(wdev->wiphy, wextfreq); - if (freq < 0) - return freq; - - if (freq) { - chan = ieee80211_get_channel(wdev->wiphy, freq); - if (!chan) - return -EINVAL; - if (chan->flags & IEEE80211_CHAN_DISABLED) - return -EINVAL; - } - - cfg80211_lock_rdev(rdev); - mutex_lock(&rdev->devlist_mtx); - wdev_lock(wdev); - - if (wdev->sme_state != CFG80211_SME_IDLE) { - bool event = true; - - if (wdev->wext.connect.channel == chan) { - err = 0; - goto out; - } - - /* if SSID set, we'll try right again, avoid event */ - if (wdev->wext.connect.ssid_len) - event = false; - err = __cfg80211_disconnect(rdev, dev, - WLAN_REASON_DEAUTH_LEAVING, event); - if (err) - goto out; - } - - - wdev->wext.connect.channel = chan; - - /* SSID is not set, we just want to switch channel */ - if (chan && !wdev->wext.connect.ssid_len) { - err = cfg80211_set_freq(rdev, wdev, freq, NL80211_CHAN_NO_HT); - goto out; - } - - err = cfg80211_mgd_wext_connect(rdev, wdev); - out: - wdev_unlock(wdev); - mutex_unlock(&rdev->devlist_mtx); - cfg80211_unlock_rdev(rdev); - return err; -} - -int cfg80211_mgd_wext_giwfreq(struct net_device *dev, - struct iw_request_info *info, - struct iw_freq *freq, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct ieee80211_channel *chan = NULL; - - /* call only for station! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) - return -EINVAL; - - wdev_lock(wdev); - if (wdev->current_bss) - chan = wdev->current_bss->pub.channel; - else if (wdev->wext.connect.channel) - chan = wdev->wext.connect.channel; - wdev_unlock(wdev); - - if (chan) { - freq->m = chan->center_freq; - freq->e = 6; - return 0; - } - - /* no channel if not joining */ - return -EINVAL; -} - -int cfg80211_mgd_wext_siwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - size_t len = data->length; - int err; - - /* call only for station! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) - return -EINVAL; - - if (!data->flags) - len = 0; - - /* iwconfig uses nul termination in SSID.. */ - if (len > 0 && ssid[len - 1] == '\0') - len--; - - cfg80211_lock_rdev(rdev); - mutex_lock(&rdev->devlist_mtx); - wdev_lock(wdev); - - err = 0; - - if (wdev->sme_state != CFG80211_SME_IDLE) { - bool event = true; - - if (wdev->wext.connect.ssid && len && - len == wdev->wext.connect.ssid_len && - memcmp(wdev->wext.connect.ssid, ssid, len) == 0) - goto out; - - /* if SSID set now, we'll try to connect, avoid event */ - if (len) - event = false; - err = __cfg80211_disconnect(rdev, dev, - WLAN_REASON_DEAUTH_LEAVING, event); - if (err) - goto out; - } - - wdev->wext.prev_bssid_valid = false; - wdev->wext.connect.ssid = wdev->wext.ssid; - memcpy(wdev->wext.ssid, ssid, len); - wdev->wext.connect.ssid_len = len; - - wdev->wext.connect.crypto.control_port = false; - wdev->wext.connect.crypto.control_port_ethertype = - cpu_to_be16(ETH_P_PAE); - - err = cfg80211_mgd_wext_connect(rdev, wdev); - out: - wdev_unlock(wdev); - mutex_unlock(&rdev->devlist_mtx); - cfg80211_unlock_rdev(rdev); - return err; -} - -int cfg80211_mgd_wext_giwessid(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *ssid) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - /* call only for station! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) - return -EINVAL; - - data->flags = 0; - - wdev_lock(wdev); - if (wdev->current_bss) { - const u8 *ie = ieee80211_bss_get_ie(&wdev->current_bss->pub, - WLAN_EID_SSID); - if (ie) { - data->flags = 1; - data->length = ie[1]; - memcpy(ssid, ie + 2, data->length); - } - } else if (wdev->wext.connect.ssid && wdev->wext.connect.ssid_len) { - data->flags = 1; - data->length = wdev->wext.connect.ssid_len; - memcpy(ssid, wdev->wext.connect.ssid, data->length); - } - wdev_unlock(wdev); - - return 0; -} - -int cfg80211_mgd_wext_siwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - u8 *bssid = ap_addr->sa_data; - int err; - - /* call only for station! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) - return -EINVAL; - - if (ap_addr->sa_family != ARPHRD_ETHER) - return -EINVAL; - - /* automatic mode */ - if (is_zero_ether_addr(bssid) || is_broadcast_ether_addr(bssid)) - bssid = NULL; - - cfg80211_lock_rdev(rdev); - mutex_lock(&rdev->devlist_mtx); - wdev_lock(wdev); - - if (wdev->sme_state != CFG80211_SME_IDLE) { - err = 0; - /* both automatic */ - if (!bssid && !wdev->wext.connect.bssid) - goto out; - - /* fixed already - and no change */ - if (wdev->wext.connect.bssid && bssid && - compare_ether_addr(bssid, wdev->wext.connect.bssid) == 0) - goto out; - - err = __cfg80211_disconnect(rdev, dev, - WLAN_REASON_DEAUTH_LEAVING, false); - if (err) - goto out; - } - - if (bssid) { - memcpy(wdev->wext.bssid, bssid, ETH_ALEN); - wdev->wext.connect.bssid = wdev->wext.bssid; - } else - wdev->wext.connect.bssid = NULL; - - err = cfg80211_mgd_wext_connect(rdev, wdev); - out: - wdev_unlock(wdev); - mutex_unlock(&rdev->devlist_mtx); - cfg80211_unlock_rdev(rdev); - return err; -} - -int cfg80211_mgd_wext_giwap(struct net_device *dev, - struct iw_request_info *info, - struct sockaddr *ap_addr, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - - /* call only for station! */ - if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION)) - return -EINVAL; - - ap_addr->sa_family = ARPHRD_ETHER; - - wdev_lock(wdev); - if (wdev->current_bss) - memcpy(ap_addr->sa_data, wdev->current_bss->pub.bssid, ETH_ALEN); - else - memset(ap_addr->sa_data, 0, ETH_ALEN); - wdev_unlock(wdev); - - return 0; -} - -int cfg80211_wext_siwgenie(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); - u8 *ie = extra; - int ie_len = data->length, err; - - if (wdev->iftype != NL80211_IFTYPE_STATION) - return -EOPNOTSUPP; - - if (!ie_len) - ie = NULL; - - wdev_lock(wdev); - - /* no change */ - err = 0; - if (wdev->wext.ie_len == ie_len && - memcmp(wdev->wext.ie, ie, ie_len) == 0) - goto out; - - if (ie_len) { - ie = kmemdup(extra, ie_len, GFP_KERNEL); - if (!ie) { - err = -ENOMEM; - goto out; - } - } else - ie = NULL; - - kfree(wdev->wext.ie); - wdev->wext.ie = ie; - wdev->wext.ie_len = ie_len; - - if (wdev->sme_state != CFG80211_SME_IDLE) { - err = __cfg80211_disconnect(rdev, dev, - WLAN_REASON_DEAUTH_LEAVING, false); - if (err) - goto out; - } - - /* userspace better not think we'll reconnect */ - err = 0; - out: - wdev_unlock(wdev); - return err; -} - -int cfg80211_wext_siwmlme(struct net_device *dev, - struct iw_request_info *info, - struct iw_point *data, char *extra) -{ - struct wireless_dev *wdev = dev->ieee80211_ptr; - struct iw_mlme *mlme = (struct iw_mlme *)extra; - struct cfg80211_registered_device *rdev; - int err; - - if (!wdev) - return -EOPNOTSUPP; - - rdev = wiphy_to_dev(wdev->wiphy); - - if (wdev->iftype != NL80211_IFTYPE_STATION) - return -EINVAL; - - if (mlme->addr.sa_family != ARPHRD_ETHER) - return -EINVAL; - - wdev_lock(wdev); - switch (mlme->cmd) { - case IW_MLME_DEAUTH: - case IW_MLME_DISASSOC: - err = __cfg80211_disconnect(rdev, dev, mlme->reason_code, - true); - break; - default: - err = -EOPNOTSUPP; - break; - } - wdev_unlock(wdev); - - return err; -} diff --git a/openairITS/mac/DOT11/net/wireless/wext-spy.c b/openairITS/mac/DOT11/net/wireless/wext-spy.c deleted file mode 100644 index 5d643a548fe..00000000000 --- a/openairITS/mac/DOT11/net/wireless/wext-spy.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * This file implement the Wireless Extensions spy API. - * - * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> - * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. - * - * (As all part of the Linux kernel, this file is GPL) - */ - -#include <linux/wireless.h> -#include <linux/netdevice.h> -#include <linux/etherdevice.h> -#include <linux/export.h> -#include <net/iw_handler.h> -#include <net/arp.h> -#include <net/wext.h> - -static inline struct iw_spy_data *get_spydata(struct net_device *dev) -{ - /* This is the new way */ - if (dev->wireless_data) - return dev->wireless_data->spy_data; - return NULL; -} - -int iw_handler_set_spy(struct net_device * dev, - struct iw_request_info * info, - union iwreq_data * wrqu, - char * extra) -{ - struct iw_spy_data * spydata = get_spydata(dev); - struct sockaddr * address = (struct sockaddr *) extra; - - /* Make sure driver is not buggy or using the old API */ - if (!spydata) - return -EOPNOTSUPP; - - /* Disable spy collection while we copy the addresses. - * While we copy addresses, any call to wireless_spy_update() - * will NOP. This is OK, as anyway the addresses are changing. */ - spydata->spy_number = 0; - - /* We want to operate without locking, because wireless_spy_update() - * most likely will happen in the interrupt handler, and therefore - * have its own locking constraints and needs performance. - * The rtnl_lock() make sure we don't race with the other iw_handlers. - * This make sure wireless_spy_update() "see" that the spy list - * is temporarily disabled. */ - smp_wmb(); - - /* Are there are addresses to copy? */ - if (wrqu->data.length > 0) { - int i; - - /* Copy addresses */ - for (i = 0; i < wrqu->data.length; i++) - memcpy(spydata->spy_address[i], address[i].sa_data, - ETH_ALEN); - /* Reset stats */ - memset(spydata->spy_stat, 0, - sizeof(struct iw_quality) * IW_MAX_SPY); - } - - /* Make sure above is updated before re-enabling */ - smp_wmb(); - - /* Enable addresses */ - spydata->spy_number = wrqu->data.length; - - return 0; -} -EXPORT_SYMBOL(iw_handler_set_spy); - -int iw_handler_get_spy(struct net_device * dev, - struct iw_request_info * info, - union iwreq_data * wrqu, - char * extra) -{ - struct iw_spy_data * spydata = get_spydata(dev); - struct sockaddr * address = (struct sockaddr *) extra; - int i; - - /* Make sure driver is not buggy or using the old API */ - if (!spydata) - return -EOPNOTSUPP; - - wrqu->data.length = spydata->spy_number; - - /* Copy addresses. */ - for (i = 0; i < spydata->spy_number; i++) { - memcpy(address[i].sa_data, spydata->spy_address[i], ETH_ALEN); - address[i].sa_family = AF_UNIX; - } - /* Copy stats to the user buffer (just after). */ - if (spydata->spy_number > 0) - memcpy(extra + (sizeof(struct sockaddr) *spydata->spy_number), - spydata->spy_stat, - sizeof(struct iw_quality) * spydata->spy_number); - /* Reset updated flags. */ - for (i = 0; i < spydata->spy_number; i++) - spydata->spy_stat[i].updated &= ~IW_QUAL_ALL_UPDATED; - return 0; -} -EXPORT_SYMBOL(iw_handler_get_spy); - -/*------------------------------------------------------------------*/ -/* - * Standard Wireless Handler : set spy threshold - */ -int iw_handler_set_thrspy(struct net_device * dev, - struct iw_request_info *info, - union iwreq_data * wrqu, - char * extra) -{ - struct iw_spy_data * spydata = get_spydata(dev); - struct iw_thrspy * threshold = (struct iw_thrspy *) extra; - - /* Make sure driver is not buggy or using the old API */ - if (!spydata) - return -EOPNOTSUPP; - - /* Just do it */ - memcpy(&(spydata->spy_thr_low), &(threshold->low), - 2 * sizeof(struct iw_quality)); - - /* Clear flag */ - memset(spydata->spy_thr_under, '\0', sizeof(spydata->spy_thr_under)); - - return 0; -} -EXPORT_SYMBOL(iw_handler_set_thrspy); - -/*------------------------------------------------------------------*/ -/* - * Standard Wireless Handler : get spy threshold - */ -int iw_handler_get_thrspy(struct net_device * dev, - struct iw_request_info *info, - union iwreq_data * wrqu, - char * extra) -{ - struct iw_spy_data * spydata = get_spydata(dev); - struct iw_thrspy * threshold = (struct iw_thrspy *) extra; - - /* Make sure driver is not buggy or using the old API */ - if (!spydata) - return -EOPNOTSUPP; - - /* Just do it */ - memcpy(&(threshold->low), &(spydata->spy_thr_low), - 2 * sizeof(struct iw_quality)); - - return 0; -} -EXPORT_SYMBOL(iw_handler_get_thrspy); - -/*------------------------------------------------------------------*/ -/* - * Prepare and send a Spy Threshold event - */ -static void iw_send_thrspy_event(struct net_device * dev, - struct iw_spy_data * spydata, - unsigned char * address, - struct iw_quality * wstats) -{ - union iwreq_data wrqu; - struct iw_thrspy threshold; - - /* Init */ - wrqu.data.length = 1; - wrqu.data.flags = 0; - /* Copy address */ - memcpy(threshold.addr.sa_data, address, ETH_ALEN); - threshold.addr.sa_family = ARPHRD_ETHER; - /* Copy stats */ - memcpy(&(threshold.qual), wstats, sizeof(struct iw_quality)); - /* Copy also thresholds */ - memcpy(&(threshold.low), &(spydata->spy_thr_low), - 2 * sizeof(struct iw_quality)); - - /* Send event to user space */ - wireless_send_event(dev, SIOCGIWTHRSPY, &wrqu, (char *) &threshold); -} - -/* ---------------------------------------------------------------- */ -/* - * Call for the driver to update the spy data. - * For now, the spy data is a simple array. As the size of the array is - * small, this is good enough. If we wanted to support larger number of - * spy addresses, we should use something more efficient... - */ -void wireless_spy_update(struct net_device * dev, - unsigned char * address, - struct iw_quality * wstats) -{ - struct iw_spy_data * spydata = get_spydata(dev); - int i; - int match = -1; - - /* Make sure driver is not buggy or using the old API */ - if (!spydata) - return; - - /* Update all records that match */ - for (i = 0; i < spydata->spy_number; i++) - if (!compare_ether_addr(address, spydata->spy_address[i])) { - memcpy(&(spydata->spy_stat[i]), wstats, - sizeof(struct iw_quality)); - match = i; - } - - /* Generate an event if we cross the spy threshold. - * To avoid event storms, we have a simple hysteresis : we generate - * event only when we go under the low threshold or above the - * high threshold. */ - if (match >= 0) { - if (spydata->spy_thr_under[match]) { - if (wstats->level > spydata->spy_thr_high.level) { - spydata->spy_thr_under[match] = 0; - iw_send_thrspy_event(dev, spydata, - address, wstats); - } - } else { - if (wstats->level < spydata->spy_thr_low.level) { - spydata->spy_thr_under[match] = 1; - iw_send_thrspy_event(dev, spydata, - address, wstats); - } - } - } -} -EXPORT_SYMBOL(wireless_spy_update); diff --git a/openairITS/mac/DOT11/scripts/admin-clean.sh b/openairITS/mac/DOT11/scripts/admin-clean.sh deleted file mode 100755 index 81398f2a28f..00000000000 --- a/openairITS/mac/DOT11/scripts/admin-clean.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -if [ -d net ] ; then - make clean -fi -rm -rf net -rm -rf drivers -rm -rf include -rm -rf compat -rm -rf udev -rm -f master-tag -rm -f compat_base_tree -rm -f compat_base_tree_version -rm -f compat_version -rm -f code-metrics.txt -echo "Cleaned wireless-bt-compat-2.6" diff --git a/openairITS/mac/DOT11/scripts/admin-refresh.sh b/openairITS/mac/DOT11/scripts/admin-refresh.sh deleted file mode 100755 index caf63e06c17..00000000000 --- a/openairITS/mac/DOT11/scripts/admin-refresh.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash -./scripts/admin-clean.sh $@ -./scripts/admin-update.sh $@ diff --git a/openairITS/mac/DOT11/scripts/admin-update.sh b/openairITS/mac/DOT11/scripts/admin-update.sh deleted file mode 100755 index ee89d312316..00000000000 --- a/openairITS/mac/DOT11/scripts/admin-update.sh +++ /dev/null @@ -1,647 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright 2007, 2008, 2010 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> -# -# Use this to update compat-wireless-2.6 to the latest -# wireless-testing.git tree you have. -# -# Usage: you should have the latest pull of wireless-2.6.git -# git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git -# We assume you have it on your ~/devel/wireless-testing/ directory. If you do, -# just run this script from the compat-wireless-2.6 directory. -# You can specify where your GIT_TREE is by doing: -# -# export GIT_TREE=/home/mcgrof/wireless-testing/ -# -# for example -# -GIT_URL="git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git" -GIT_COMPAT_URL="git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/compat.git" - -INCLUDE_NET_BT="hci_core.h l2cap.h bluetooth.h rfcomm.h hci.h mgmt.h smp.h" -NET_BT_DIRS="bluetooth bluetooth/bnep bluetooth/cmtp bluetooth/rfcomm bluetooth/hidp" - -INCLUDE_LINUX="ieee80211.h nl80211.h" -INCLUDE_LINUX="$INCLUDE_LINUX pci_ids.h eeprom_93cx6.h" -INCLUDE_LINUX="$INCLUDE_LINUX ath9k_platform.h" -INCLUDE_LINUX="$INCLUDE_LINUX wl12xx.h" - -# For rndis_wext -INCLUDE_LINUX_USB="usbnet.h rndis_host.h" - -INCLUDE_LINUX_SPI="libertas_spi.h" - -# The good new yummy stuff -INCLUDE_NET="cfg80211.h ieee80211_radiotap.h cfg80211-wext.h" -INCLUDE_NET="$INCLUDE_NET mac80211.h lib80211.h regulatory.h" - -# Pretty colors -GREEN="\033[01;32m" -YELLOW="\033[01;33m" -NORMAL="\033[00m" -BLUE="\033[34m" -RED="\033[31m" -PURPLE="\033[35m" -CYAN="\033[36m" -UNDERLINE="\033[02m" - -NET_DIRS="wireless mac80211 rfkill" -CODE_METRICS=code-metrics.txt - -usage() { - printf "Usage: $0 [ refresh] [ --help | -h | -s | -n | -p | -c ]\n" - - printf "${GREEN}%10s${NORMAL} - will update your all your patch offsets using quilt\n" "refresh" - printf "${GREEN}%10s${NORMAL} - get and apply pending-stable/ fixes purging old files there\n" "-s" - printf "${GREEN}%10s${NORMAL} - apply the patches linux-next-cherry-picks directory\n" "-n" - printf "${GREEN}%10s${NORMAL} - apply the patches on the linux-next-pending directory\n" "-p" - printf "${GREEN}%10s${NORMAL} - apply the patches on the crap directory\n" "-c" -} - -brag_backport() { - COMPAT_FILES_CODE=$(find ./ -type f -name \*.[ch] | egrep "^./compat/|include/linux/compat" | - xargs wc -l | tail -1 | awk '{print $1}') - let COMPAT_ALL_CHANGES=$2+$COMPAT_FILES_CODE - printf "${GREEN}%10s${NORMAL} - backport code changes\n" $2 - printf "${GREEN}%10s${NORMAL} - backport code additions\n" $3 - printf "${GREEN}%10s${NORMAL} - backport code deletions\n" $4 - printf "${GREEN}%10s${NORMAL} - backport from compat module\n" $COMPAT_FILES_CODE - printf "${GREEN}%10s${NORMAL} - total backport code\n" $COMPAT_ALL_CHANGES - printf "${RED}%10s${NORMAL} - %% of code consists of backport work\n" \ - $(perl -e 'printf("%.4f", 100 * '$COMPAT_ALL_CHANGES' / '$1');') -} - -nag_pending_stable() { - printf "${YELLOW}%10s${NORMAL} - Code changes brought in from pending-stable\n" $2 - printf "${YELLOW}%10s${NORMAL} - Code additions brought in from pending-stable\n" $3 - printf "${YELLOW}%10s${NORMAL} - Code deletions brought in from pending-stable\n" $4 - printf "${RED}%10s${NORMAL} - %% of code being cherry picked from pending-stable\n" $(perl -e 'printf("%.4f", 100 * '$2' / '$1');') -} - -nag_next_cherry_pick() { - printf "${YELLOW}%10s${NORMAL} - Code changes brought in from linux-next\n" $2 - printf "${YELLOW}%10s${NORMAL} - Code additions brought in from linux-next\n" $3 - printf "${YELLOW}%10s${NORMAL} - Code deletions brought in from linux-next\n" $4 - printf "${RED}%10s${NORMAL} - %% of code being cherry picked from linux-next\n" $(perl -e 'printf("%.4f", 100 * '$2' / '$1');') -} - -nag_pending() { - printf "${YELLOW}%10s${NORMAL} - Code changes posted but not yet merged\n" $2 - printf "${YELLOW}%10s${NORMAL} - Code additions posted but not yet merged\n" $3 - printf "${YELLOW}%10s${NORMAL} - Code deletions posted but not yet merged\n" $4 - printf "${RED}%10s${NORMAL} - %% of code not yet merged\n" $(perl -e 'printf("%.4f", 100 * '$2' / '$1');') -} - -nag_crap() { - printf "${RED}%10s${NORMAL} - Crap changes not yet posted\n" $2 - printf "${RED}%10s${NORMAL} - Crap additions not yet posted\n" $3 - printf "${RED}%10s${NORMAL} - Crap deletions not yet posted\n" $4 - printf "${RED}%10s${NORMAL} - %% of crap code\n" $(perl -e 'printf("%.4f", 100 * '$2' / '$1');') -} - -nagometer() { - CHANGES=0 - - ORIG_CODE=$2 - ADD=$(grep -Hc ^+ $1/*.patch| awk -F":" 'BEGIN {sum=0} {sum += $2} END { print sum}') - DEL=$(grep -Hc ^- $1/*.patch| awk -F":" 'BEGIN {sum=0} {sum += $2} END { print sum}') - # Total code is irrelevant unless you take into account each part, - # easier to just compare against the original code. - # let TOTAL_CODE=$ORIG_CODE+$ADD-$DEL - - let CHANGES=$ADD+$DEL - - case $1 in - "patches") - brag_backport $ORIG_CODE $CHANGES $ADD $DEL - ;; - "pending-stable") - nag_pending_stable $ORIG_CODE $CHANGES $ADD $DEL - ;; - "linux-next-cherry-picks") - nag_next_cherry_pick $ORIG_CODE $CHANGES $ADD $DEL - ;; - "linux-next-pending") - nag_pending $ORIG_CODE $CHANGES $ADD $DEL - ;; - "crap") - nag_crap $ORIG_CODE $CHANGES $ADD $DEL - ;; - *) - ;; - esac - -} - -EXTRA_PATCHES="patches" -REFRESH="n" -GET_STABLE_PENDING="n" -POSTFIX_RELEASE_TAG="" -if [ $# -ge 1 ]; then - if [ $# -gt 4 ]; then - usage $0 - exit - fi - if [[ $1 = "-h" || $1 = "--help" ]]; then - usage $0 - exit - fi - while [ $# -ne 0 ]; do - if [[ "$1" = "-s" ]]; then - GET_STABLE_PENDING="y" - EXTRA_PATCHES="${EXTRA_PATCHES} pending-stable" - EXTRA_PATCHES="${EXTRA_PATCHES} pending-stable/backports/" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}s" - shift; continue; - fi - if [[ "$1" = "-n" ]]; then - EXTRA_PATCHES="${EXTRA_PATCHES} linux-next-cherry-picks" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}n" - shift; continue; - fi - if [[ "$1" = "-p" ]]; then - EXTRA_PATCHES="${EXTRA_PATCHES} linux-next-pending" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}p" - shift; continue; - fi - if [[ "$1" = "-c" ]]; then - EXTRA_PATCHES="${EXTRA_PATCHES} crap" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}c" - shift; continue; - fi - if [[ "$1" = "refresh" ]]; then - REFRESH="y" - shift; continue; - fi - - echo "Unexpected argument passed: $1" - usage $0 - exit - done - -fi - -# User exported this variable -if [ -z $GIT_TREE ]; then - GIT_TREE="/home/$USER/linux-next/" - if [ ! -d $GIT_TREE ]; then - echo "Please tell me where your linux-next git tree is." - echo "You can do this by exporting its location as follows:" - echo - echo " export GIT_TREE=/home/$USER/linux-next/" - echo - echo "If you do not have one you can clone the repository:" - echo " git clone $GIT_URL" - exit 1 - fi -else - echo "You said to use git tree at: $GIT_TREE for linux-next" -fi - -if [ -z $GIT_COMPAT_TREE ]; then - GIT_COMPAT_TREE="/home/$USER/compat/" - if [ ! -d $GIT_COMPAT_TREE ]; then - echo "Please tell me where your compat git tree is." - echo "You can do this by exporting its location as follows:" - echo - echo " export GIT_COMPAT_TREE=/home/$USER/compat/" - echo - echo "If you do not have one you can clone the repository:" - echo " git clone $GIT_COMPAT_URL" - exit 1 - fi -else - echo "You said to use git tree at: $GIT_COMPAT_TREE for compat" -fi - -# Drivers that have their own directory -DRIVERS="drivers/net/wireless/ath" -DRIVERS="$DRIVERS drivers/net/wireless/ath/carl9170" -DRIVERS="$DRIVERS drivers/net/wireless/ath/ath5k" -DRIVERS="$DRIVERS drivers/net/wireless/ath/ath6kl" -DRIVERS="$DRIVERS drivers/net/wireless/ath/ath9k" -DRIVERS="$DRIVERS drivers/ssb" -DRIVERS="$DRIVERS drivers/bcma" -DRIVERS="$DRIVERS drivers/net/wireless/b43" -DRIVERS="$DRIVERS drivers/net/wireless/b43legacy" -DRIVERS="$DRIVERS drivers/net/wireless/brcm80211" -DRIVERS="$DRIVERS drivers/net/wireless/brcm80211/brcmfmac" -DRIVERS="$DRIVERS drivers/net/wireless/brcm80211/brcmsmac" -DRIVERS="$DRIVERS drivers/net/wireless/brcm80211/brcmsmac/phy" -DRIVERS="$DRIVERS drivers/net/wireless/brcm80211/brcmutil" -DRIVERS="$DRIVERS drivers/net/wireless/brcm80211/include" -DRIVERS="$DRIVERS drivers/net/wireless/iwlegacy" -DRIVERS="$DRIVERS drivers/net/wireless/iwlwifi" -DRIVERS="$DRIVERS drivers/net/wireless/rt2x00" -DRIVERS="$DRIVERS drivers/net/wireless/zd1211rw" -DRIVERS="$DRIVERS drivers/net/wireless/libertas" -DRIVERS="$DRIVERS drivers/net/wireless/p54" -DRIVERS="$DRIVERS drivers/net/wireless/rtl818x" -DRIVERS="$DRIVERS drivers/net/wireless/rtl818x/rtl8180" -DRIVERS="$DRIVERS drivers/net/wireless/rtl818x/rtl8187" -DRIVERS="$DRIVERS drivers/net/wireless/rtlwifi" -DRIVERS="$DRIVERS drivers/net/wireless/rtlwifi/rtl8192c" -DRIVERS="$DRIVERS drivers/net/wireless/rtlwifi/rtl8192ce" -DRIVERS="$DRIVERS drivers/net/wireless/rtlwifi/rtl8192cu" -DRIVERS="$DRIVERS drivers/net/wireless/rtlwifi/rtl8192se" -DRIVERS="$DRIVERS drivers/net/wireless/rtlwifi/rtl8192de" -DRIVERS="$DRIVERS drivers/net/wireless/libertas_tf" -DRIVERS="$DRIVERS drivers/net/wireless/ipw2x00" -DRIVERS="$DRIVERS drivers/net/wireless/wl12xx" -DRIVERS="$DRIVERS drivers/net/wireless/wl1251" -DRIVERS="$DRIVERS drivers/net/wireless/iwmc3200wifi" -DRIVERS="$DRIVERS drivers/net/wireless/orinoco" -DRIVERS="$DRIVERS drivers/net/wireless/mwifiex" - -# Staging drivers -STAGING_DRIVERS="" - -# Ethernet drivers -DRIVERS="$DRIVERS drivers/net/ethernet/atheros" -DRIVERS="$DRIVERS drivers/net/ethernet/atheros/atl1c" -DRIVERS="$DRIVERS drivers/net/ethernet/atheros/atl1e" -DRIVERS="$DRIVERS drivers/net/ethernet/atheros/atlx" -DRIVERS="$DRIVERS drivers/net/ethernet/atheros/alx" - -# Bluetooth drivers -DRIVERS_BT="drivers/bluetooth" - -# Drivers that belong the the wireless directory -DRIVER_FILES="adm8211.c adm8211.h" -DRIVER_FILES="$DRIVER_FILES rndis_wlan.c" -DRIVER_FILES="$DRIVER_FILES mac80211_hwsim.c mac80211_hwsim.h" -DRIVER_FILES="$DRIVER_FILES at76c50x-usb.c at76c50x-usb.h" -DRIVER_FILES="$DRIVER_FILES mwl8k.c" - -rm -rf drivers/ - -mkdir -p include/linux/ include/net/ include/linux/usb \ - include/linux/unaligned \ - include/linux/spi \ - include/trace \ - include/pcmcia \ - include/crypto \ - net/mac80211/ net/wireless/ \ - net/rfkill/ \ - drivers/ssb/ \ - drivers/bcma/ \ - drivers/net/usb/ \ - drivers/net/wireless/ \ - drivers/net/ethernet/atheros \ - drivers/net/ethernet/broadcom -mkdir -p include/net/bluetooth/ - -# include/linux -DIR="include/linux" -for i in $INCLUDE_LINUX; do - echo "Copying $GIT_TREE/$DIR/$i" - cp "$GIT_TREE/$DIR/$i" $DIR/ -done - -cp -a $GIT_TREE/include/linux/ssb include/linux/ -cp -a $GIT_TREE/include/linux/bcma include/linux/ -cp -a $GIT_TREE/include/linux/rfkill.h include/linux/rfkill_backport.h - -# include/net -DIR="include/net" -for i in $INCLUDE_NET; do - echo "Copying $GIT_TREE/$DIR/$i" - cp "$GIT_TREE/$DIR/$i" $DIR/ -done - -DIR="include/net/bluetooth" -for i in $INCLUDE_NET_BT; do - echo "Copying $GIT_TREE/$DIR/$i" - cp $GIT_TREE/$DIR/$i $DIR/ -done - -DIR="include/linux/usb" -for i in $INCLUDE_LINUX_USB; do - echo "Copying $GIT_TREE/$DIR/$i" - cp $GIT_TREE/$DIR/$i $DIR/ -done - -DIR="include/linux/spi" -for i in $INCLUDE_LINUX_SPI; do - echo "Copying $GIT_TREE/$DIR/$i" - cp $GIT_TREE/$DIR/$i $DIR/ -done - -# net/wireless and net/mac80211 -for i in $NET_DIRS; do - echo "Copying $GIT_TREE/net/$i/*.[ch]" - cp $GIT_TREE/net/$i/*.[ch] net/$i/ - cp $GIT_TREE/net/$i/Makefile net/$i/ - rm -f net/$i/*.mod.c -done - -cp $GIT_TREE/MAINTAINERS ./ - -# Copy files needed for statically compiled regulatory rules database -cp $GIT_TREE/net/wireless/db.txt net/wireless/ -cp $GIT_TREE/net/wireless/genregdb.awk net/wireless/ - -# net/bluetooth -for i in $NET_BT_DIRS; do - mkdir -p net/$i - echo "Copying $GIT_TREE/net/$i/*.[ch]" - cp $GIT_TREE/net/$i/*.[ch] net/$i/ - cp $GIT_TREE/net/$i/Makefile net/$i/ - rm -f net/$i/*.mod.c -done - -# Drivers in their own directory -for i in $DRIVERS; do - mkdir -p $i - - # -print -quit will just print once, so we don't burden - # this script with searching for further files if one is - # found - FILES_FOUND=$(find $GIT_TREE/$i/ -maxdepth 1 -type f -name \*.[ch] -print -quit | wc -l) - if [ $FILES_FOUND -eq 1 ]; then - echo "Copying $GIT_TREE/$i/*.[ch]" - cp $GIT_TREE/$i/*.[ch] $i/ - fi - if [ -f $GIT_TREE/$i/Makefile ]; then - cp $GIT_TREE/$i/Makefile $i/ - fi - if [ -f $GIT_TREE/$i/Kconfig ]; then - cp $GIT_TREE/$i/Kconfig $i/ - fi - rm -f $i/*.mod.c -done - -# Staging drivers in their own directory -rm -rf drivers/staging/ -mkdir -p drivers/staging/ -for i in $STAGING_DRIVERS; do - if [ ! -d $GIT_TREE/$i ]; then - continue - fi - rm -rf $i - echo -e "Copying ${RED}STAGING${NORMAL} $GIT_TREE/$i/*.[ch]" - # staging drivers tend to have their own subdirs... - cp -a $GIT_TREE/$i drivers/staging/ - rm -f $i/*.mod.c -done - -for i in $DRIVERS_BT; do - mkdir -p $i - echo "Copying $GIT_TREE/$i/*.[ch]" - cp $GIT_TREE/$i/*.[ch] $i/ - cp $GIT_TREE/$i/Makefile $i/ - rm -f $i/*.mod.c -done - -# For rndis_wlan, we need a new rndis_host.ko, cdc_ether.ko and usbnet.ko -RNDIS_REQS="Makefile rndis_host.c cdc_ether.c usbnet.c" -DIR="drivers/net/usb" -for i in $RNDIS_REQS; do - echo "Copying $GIT_TREE/$DIR/$i" - cp $GIT_TREE/$DIR/$i $DIR/ -done - -DIR="drivers/net/ethernet/broadcom" -echo > $DIR/Makefile -cp $GIT_TREE/$DIR/b44.[ch] $DIR -# Not yet -echo "obj-\$(CONFIG_B44) += b44.o" >> $DIR/Makefile - -# Misc -mkdir -p drivers/misc/eeprom/ -cp $GIT_TREE/drivers/misc/eeprom/eeprom_93cx6.c drivers/misc/eeprom/ -cp $GIT_TREE/drivers/misc/eeprom/Makefile drivers/misc/eeprom/ - -DIR="drivers/net/wireless" -# Drivers part of the wireless directory -for i in $DRIVER_FILES; do - cp $GIT_TREE/$DIR/$i $DIR/ -done - -# Top level wireless driver Makefile -cp $GIT_TREE/$DIR/Makefile $DIR - -# Compat stuff -COMPAT="compat" -mkdir -p $COMPAT -echo "Copying $GIT_COMPAT_TREE/ files..." -cp $GIT_COMPAT_TREE/compat/*.c $COMPAT/ -cp $GIT_COMPAT_TREE/compat/Makefile $COMPAT/ -cp -a $GIT_COMPAT_TREE/udev . -cp -a $GIT_COMPAT_TREE/scripts $COMPAT/ -cp -a $GIT_COMPAT_TREE/include/linux/* include/linux/ -cp -a $GIT_COMPAT_TREE/include/net/* include/net/ -cp -a $GIT_COMPAT_TREE/include/trace/* include/trace/ -cp -a $GIT_COMPAT_TREE/include/pcmcia/* include/pcmcia/ -cp -a $GIT_COMPAT_TREE/include/crypto/* include/crypto/ -rm -f $COMPAT/*.mod.c - -# files we suck in for compat-wireless -export WSTABLE=" - net/wireless/ - net/wireless/ - net/mac80211/ - net/rfkill/ - drivers/net/wireless/ - net/bluetooth/ - drivers/bluetooth/ - drivers/net/atl1c/ - drivers/net/atl1e/ - drivers/net/atlx/ - include/linux/nl80211.h - include/linux/rfkill.h - include/net/cfg80211.h - include/net/mac80211.h - include/net/regulatory.h - include/net/cfg80211.h" - -# Stable pending, if -n was passed -if [[ "$GET_STABLE_PENDING" = y ]]; then - - if [ -z $NEXT_TREE ]; then - NEXT_TREE="/home/$USER/linux-next/" - if [ ! -d $NEXT_TREE ]; then - echo "Please tell me where your linux-next git tree is." - echo "You can do this by exporting its location as follows:" - echo - echo " export NEXT_TREE=/home/$USER/linux-next/" - echo - echo "If you do not have one you can clone the repository:" - echo " git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git" - exit 1 - fi - else - echo "You said to use git tree at: $NEXT_TREE for linux-next" - fi - - LAST_DIR=$PWD - cd $GIT_TREE - if [ -f localversion* ]; then - echo -e "You should be using a stable tree to use the -s option" - exit 1 - fi - - # we now assume you are using a stable tree - cd $GIT_TREE - LAST_STABLE_UPDATE=$(git describe --abbrev=0) - cd $NEXT_TREE - PENDING_STABLE_DIR="pending-stable/" - - rm -rf $PENDING_STABLE_DIR - - git tag -l | grep $LAST_STABLE_UPDATE 2>&1 > /dev/null - if [[ $? -ne 0 ]]; then - echo -e "${BLUE}Tag $LAST_STABLE_UPDATE not found on $NEXT_TREE tree: bailing out${NORMAL}" - exit 1 - fi - echo -e "${GREEN}Generating stable cherry picks... ${NORMAL}" - echo -e "\nUsing command on directory $PWD:" - echo -e "\ngit format-patch --grep=\"stable@kernel.org\" -o $PENDING_STABLE_DIR ${LAST_STABLE_UPDATE}.. $WSTABLE" - git format-patch --grep="stable@kernel.org" -o $PENDING_STABLE_DIR ${LAST_STABLE_UPDATE}.. $WSTABLE - if [ ! -d ${LAST_DIR}/${PENDING_STABLE_DIR} ]; then - echo -e "Assumption that ${LAST_DIR}/${PENDING_STABLE_DIR} directory exists failed" - exit 1 - fi - echo -e "${GREEN}Purging old stable cherry picks... ${NORMAL}" - rm -f ${LAST_DIR}/${PENDING_STABLE_DIR}/*.patch - cp ${PENDING_STABLE_DIR}/*.patch ${LAST_DIR}/${PENDING_STABLE_DIR}/ - if [ -f ${LAST_DIR}/${PENDING_STABLE_DIR}/.ignore ]; then - for i in $(cat ${LAST_DIR}/${PENDING_STABLE_DIR}/.ignore) ; do - echo -e "Skipping $i from generated stable patches..." - rm -f ${LAST_DIR}/${PENDING_STABLE_DIR}/*$i* - done - fi - echo -e "${GREEN}Updated stable cherry picks, review with git diff and update hunks with ./scripts/admin-update.sh -s refresh${NORMAL}" - cd $LAST_DIR -fi - -# Refresh patches using quilt -patchRefresh() { - if [ -d patches.orig ] ; then - rm -rf .pc patches/series - else - mkdir patches.orig - fi - - export QUILT_PATCHES=$1 - - mv -u $1/* patches.orig/ - - for i in patches.orig/*.patch; do - if [ ! -f "$i" ]; then - echo -e "${RED}No patches found in $1${NORMAL}" - break; - fi - echo -e "${GREEN}Refresh backport patch${NORMAL}: ${BLUE}$i${NORMAL}" - quilt import $i - quilt push -f - RET=$? - if [[ $RET -ne 0 ]]; then - echo -e "${RED}Refreshing $i failed${NORMAL}, update it" - echo -e "use ${CYAN}quilt edit [filename]${NORMAL} to apply the failed part manually" - echo -e "use ${CYAN}quilt refresh${NORMAL} after the files are corrected and rerun this script" - cp patches.orig/README $1/README - exit $RET - fi - QUILT_DIFF_OPTS="-p" quilt refresh -p ab --no-index --no-timestamp - done - quilt pop -a - - cp patches.orig/README $1/README - rm -rf patches.orig .pc $1/series -} - -ORIG_CODE=$(find ./ -type f -name \*.[ch] | - egrep -v "^./compat/|include/linux/compat" | - xargs wc -l | tail -1 | awk '{print $1}') -printf "\n${CYAN}compat-wireless code metrics${NORMAL}\n\n" > $CODE_METRICS -printf "${PURPLE}%10s${NORMAL} - Total upstream lines of code being pulled\n" $ORIG_CODE >> $CODE_METRICS - -for dir in $EXTRA_PATCHES; do - LAST_ELEM=$dir -done - -for dir in $EXTRA_PATCHES; do - if [[ ! -d $dir ]]; then - echo -e "${RED}Patches: $dir empty, skipping...${NORMAL}\n" - continue - fi - if [[ $LAST_ELEM = $dir && "$REFRESH" = y ]]; then - patchRefresh $dir - fi - - FOUND=$(find $dir/ -maxdepth 1 -name \*.patch | wc -l) - if [ $FOUND -eq 0 ]; then - continue - fi - for i in $dir/*.patch; do - echo -e "${GREEN}Applying backport patch${NORMAL}: ${BLUE}$i${NORMAL}" - patch -p1 -N -t < $i - RET=$? - if [[ $RET -ne 0 ]]; then - echo -e "${RED}Patching $i failed${NORMAL}, update it" - exit $RET - fi - done - nagometer $dir $ORIG_CODE >> $CODE_METRICS -done - -DIR="$PWD" -cd $GIT_TREE -GIT_DESCRIBE=$(git describe) -GIT_BRANCH=$(git branch --no-color |sed -n 's/^\* //p') -GIT_BRANCH=${GIT_BRANCH:-master} -GIT_REMOTE=$(git config branch.${GIT_BRANCH}.remote) -GIT_REMOTE=${GIT_REMOTE:-origin} -GIT_REMOTE_URL=$(git config remote.${GIT_REMOTE}.url) -GIT_REMOTE_URL=${GIT_REMOTE_URL:-unknown} -echo -e "${GREEN}Updated${NORMAL} from local tree: ${BLUE}${GIT_TREE}${NORMAL}" -echo -e "Origin remote URL: ${CYAN}${GIT_REMOTE_URL}${NORMAL}" -cd $DIR -if [ -d ./.git ]; then - if [[ ${POSTFIX_RELEASE_TAG} != "" ]]; then - echo -e "$(git describe)-${POSTFIX_RELEASE_TAG}" > compat_version - else - echo -e "$(git describe)" > compat_version - fi - - cd $GIT_TREE - TREE_NAME=${GIT_REMOTE_URL##*/} - - echo $TREE_NAME > $DIR/compat_base_tree - echo $GIT_DESCRIBE > $DIR/compat_base_tree_version - - case $TREE_NAME in - "wireless-testing.git") # John's wireless-testing - # We override the compat_base_tree_version for wireless-testing - # as john keeps the Linus' tags and does not write a tag for his - # tree himself so git describe would yield a v2.6.3x.y-etc but - # what is more useful is just the wireless-testing master tag - MASTER_TAG=$(git tag -l| grep master | tail -1) - echo $MASTER_TAG > $DIR/compat_base_tree_version - echo -e "This is a ${RED}wireless-testing.git${NORMAL} compat-wireless release" - ;; - "linux-next.git") # The linux-next integration testing tree - MASTER_TAG=$(git tag -l| grep next | tail -1) - echo $MASTER_TAG > $DIR/master-tag - echo -e "This is a ${RED}linux-next.git${NORMAL} compat-wireless release" - ;; - "linux-stable.git") # Greg's all stable tree - echo -e "This is a ${GREEN}linux-stable.git${NORMAL} compat-wireless release" - ;; - "linux-2.6.git") # Linus' 2.6 tree - echo -e "This is a ${GREEN}linux-2.6.git${NORMAL} compat-wireless release" - ;; - *) - ;; - esac - - cd $DIR - echo -e "\nBase tree: ${GREEN}$(cat compat_base_tree)${NORMAL}" >> $CODE_METRICS - echo -e "Base tree version: ${PURPLE}$(cat compat_base_tree_version)${NORMAL}" >> $CODE_METRICS - echo -e "compat-wireless release: ${YELLOW}$(cat compat_version)${NORMAL}" >> $CODE_METRICS - - cat $CODE_METRICS -fi - -./scripts/driver-select restore diff --git a/openairITS/mac/DOT11/scripts/alx-enable b/openairITS/mac/DOT11/scripts/alx-enable deleted file mode 100755 index e04a7621d5c..00000000000 --- a/openairITS/mac/DOT11/scripts/alx-enable +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# -# Copyright 2012 Luis R. Rodriguez <mcgrof@frijolero.org> -# -# Makes sure either alx (new) or atl1c (old) -# is enabled to be used. This allows us to choose any driver without -# blacklisting each other. - -. /usr/lib/compat-wireless/modlib.sh - -if [[ $UID -ne 0 ]]; then - echo "Run with root privileges" - exit -fi - -ALX_NEW="alx" -ALX_OLD="atl1c" - -# Appended to module file at the end when we want to ignore one -USAGE="Usage: $0 [ $ALX_NEW | $ALX_OLD ]" - -function enable_alx { - module_disable $ALX_OLD - for i in $ALX_NEW; do - module_enable $i - done -} - -# Default behavior: disables the old atl1c driver and enables alx -if [ $# -eq 0 ]; then - enable_alx - exit -elif [ $# -ne 1 ]; then - echo "$USAGE" - exit -fi - -MODULE=$1 -if [ "$MODULE" == "atl1c" ]; then - module_disable $ALX_NEW - module_enable $ALX_OLD -elif [ "$MODULE" == "alx" ]; then - enable_alx -else - echo "$USAGE" - exit -fi diff --git a/openairITS/mac/DOT11/scripts/athenable b/openairITS/mac/DOT11/scripts/athenable deleted file mode 100755 index c9b67a0ab23..00000000000 --- a/openairITS/mac/DOT11/scripts/athenable +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# -# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> -# -# Makes sure either ath5k or MadWifi are ready to be used. This allows -# us to choose any driver without blacklisting each other. - -. /usr/lib/compat-wireless/modlib.sh - -if [[ $UID -ne 0 ]]; then - echo "Run with root privileges" - exit -fi - -ATH5K="ath5k" -ATH9K="ath9k" -MADWIFI="ath_pci" -# Appended to module file at the end when we want to ignore one -IGNORE_SUFFIX=".ignore" -USAGE="Usage: $0 [ ath5k | madwifi ]" - -# Default behavior: disables any MadWifi driver present and makes sure -# ath5k is enabled -if [ $# -eq 0 ]; then - module_disable $MADWIFI - module_enable $ATH5K - module_enable $ATH9K - exit -elif [ $# -ne 1 ]; then - echo "$USAGE" - exit -fi - -MODULE=$1 -if [ "$MODULE" == "ath5k" ]; then - module_disable $MADWIFI - module_enable $ATH5K - module_enable $ATH9K -elif [ "$MODULE" == "madwifi" ]; then - module_disable $ATH5K - module_disable $ATH9K - module_enable $MADWIFI -else - echo "$USAGE" - exit -fi diff --git a/openairITS/mac/DOT11/scripts/athload b/openairITS/mac/DOT11/scripts/athload deleted file mode 100755 index 01b3072d114..00000000000 --- a/openairITS/mac/DOT11/scripts/athload +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> -# -# Loads ath5k or madwifi - -. /usr/lib/compat-wireless/modlib.sh - -if [[ $UID -ne 0 ]]; then - echo "Run with root privileges" - exit -fi - - -USAGE="Usage: $0 [ ath5k | madwifi ]" - -# Default behavior: unload MadWifi and load ath5k -if [ $# -eq 0 ]; then - athenable ath5k - exit -elif [ $# -ne 1 ]; then - echo "$USAGE" - exit -fi - -MODULE=$1 -if [ "$MODULE" == "ath5k" ]; then - madwifi-unload - athenable ath5k - modprobe ath5k - CHECK=`modprobe -l ath5k` - if [ ! -z $CHECK ]; then - echo "ath5k loaded successfully" - fi - modprobe ath9k - CHECK=`modprobe -l ath9k` - if [ ! -z $CHECK ]; then - echo "ath9k loaded successfully" - fi -elif [ "$MODULE" == "madwifi" ]; then - CHECK=`modprobe -l ath5k` - if [ ! -z $CHECK ]; then - echo "ath5k currently loaded, going to try to unload the module..." - modprobe -r --ignore-remove ath5k - fi - athenable madwifi - # MadWifi may be loaded, but it doesn't mean devices - # currently available were picked up - madwifi-unload 2>&1 > /dev/null - modprobe ath_pci - CHECK=`modprobe -l ath_pci` - if [ ! -z $CHECK ]; then - echo "MadWifi loaded successfully!" - fi -else - echo "$USAGE" - exit -fi diff --git a/openairITS/mac/DOT11/scripts/b43enable b/openairITS/mac/DOT11/scripts/b43enable deleted file mode 100755 index b0b9851fc8c..00000000000 --- a/openairITS/mac/DOT11/scripts/b43enable +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -# -# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> -# -# Makes sure either b43, b43legacy (new mac80211 drivers) or bcm43xx -# is enabled to be used. This allows us to choose any driver without -# blacklisting each other. - -. /usr/lib/compat-wireless/modlib.sh - -if [[ $UID -ne 0 ]]; then - echo "Run with root privileges" - exit -fi - -B43S="b43 b43legacy" -B43_OLD="bcm43xx" -B43_PROP="wl" - -# Appended to module file at the end when we want to ignore one -USAGE="Usage: $0 [ b43 | bcm43xx | wl ]" - -function enable_b43 { - module_disable $B43_OLD - module_disable $B43_PROP - for i in $B43S; do - module_enable $i - done -} - -# Default behavior: disables the old bcm43xx driver and enables b43 -# and b43legacy -if [ $# -eq 0 ]; then - enable_b43 - exit -elif [ $# -ne 1 ]; then - echo "$USAGE" - exit -fi - -MODULE=$1 -if [ "$MODULE" == "bcm43xx" ]; then - for i in $B43S; do - module_disable $i - done - module_disable $B43_PROP - module_enable $B43_OLD -elif [ "$MODULE" == "wl" ]; then - for i in $B43S; do - module_disable $i - done - module_disable $B43_OLD - module_enable $B43_PROP -elif [ "$MODULE" == "b43" ]; then - enable_b43 -else - echo "$USAGE" - exit -fi diff --git a/openairITS/mac/DOT11/scripts/b43load b/openairITS/mac/DOT11/scripts/b43load deleted file mode 100755 index 5114ffa47a0..00000000000 --- a/openairITS/mac/DOT11/scripts/b43load +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> -# -# Loads new broadcom drivers (b43 and b43legacy) or the old ones (bcm43xx) - -. /usr/lib/compat-wireless/modlib.sh - -if [[ $UID -ne 0 ]]; then - echo "Run with root privileges" - exit -fi - - -USAGE="Usage: $0 [ b43 | bcm43xx ]" - -# Default behavior: unload bcm43xx and load b43 and b43legacy -if [ $# -eq 0 ]; then - 1=b43 -elif [ $# -ne 1 ]; then - echo "$USAGE" - exit -fi - -MODULE=$1 -if [ "$MODULE" == "b43" ]; then - grep bcm43xx /proc/modules 2>&1 > /dev/null - if [ $? -eq 0 ]; then - echo Unloading $i... - modprobe -r --ignore-remove bcm43xx - fi - # Enables both b43 and b43legacy - b43enable b43 - modprobe b43 - modprobe b43legacy - CHECK=`modprobe -l b43` - if [ ! -z $CHECK ]; then - echo "b43 loaded successfully" - fi - CHECK=`modprobe -l b43legacy` - if [ ! -z $CHECK ]; then - echo "b43legacy loaded successfully" - fi -elif [ "$MODULE" == "bcm43xx" ]; then - CHECK=`modprobe -l b43` - if [ ! -z $CHECK ]; then - echo "b43 currently loaded, going to try to unload the module..." - modprobe -r --ignore-remove b43 - fi - CHECK=`modprobe -l b43legacy` - if [ ! -z $CHECK ]; then - echo "b43legacy currently loaded, going to try to unload the module..." - modprobe -r --ignore-remove b43legacy - fi - b43enable bcm43xx - # bcm43xx may be loaded already lets remove them first - modprobe -r --ignore-remov bcm43xx 2>&1 > /dev/null - modprobe bcm43xx - CHECK=`modprobe -l bcm43xx` - if [ ! -z $CHECK ]; then - echo "bcm43xx loaded successfully!" - fi -else - echo "$USAGE" - exit -fi diff --git a/openairITS/mac/DOT11/scripts/btunload.sh b/openairITS/mac/DOT11/scripts/btunload.sh deleted file mode 100755 index cc56613851c..00000000000 --- a/openairITS/mac/DOT11/scripts/btunload.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -MODULES="$MODULES ath3k bcm203x bluecard_cs bnep bpa10x bt3c_cs btmrvl btmrvl_sdio btsdio" -MODULES="$MODULES btusb btuart_cs cmtp dtl1_cs hidp hci_vhci hci_uart rfcomm sco bluetooth l2cap" -echo Stoping bluetooth service.. -/etc/init.d/bluetooth stop -/etc/init.d/bluetooth status - -for i in $MODULES; do - grep ^$i /proc/modules 2>&1 > /dev/null - if [ $? -eq 0 ]; then - echo Unloading $i... - modprobe -r --ignore-remove $i - fi -done diff --git a/openairITS/mac/DOT11/scripts/check_config.sh b/openairITS/mac/DOT11/scripts/check_config.sh deleted file mode 100755 index 1a084427610..00000000000 --- a/openairITS/mac/DOT11/scripts/check_config.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash -# This script checks the compat-wireless configuration file and if changes were made -# regenerates the compat_autoconf header. - -# These variables are expected to be exported: -#COMPAT_CONFIG=".config" -#COMPAT_CONFIG_CW="config" -#CONFIG_CHECK=".${COMPAT_CONFIG}.md5" -#COMPAT_AUTOCONF="include/linux/compat_autoconf.h" - -function gen_compat_autoconf { - echo "./scripts/gen-compat-autoconf.sh $COMPAT_CONFIG $COMPAT_CONFIG_CW > $COMPAT_AUTOCONF" - ./scripts/gen-compat-autoconf.sh $COMPAT_CONFIG $COMPAT_CONFIG_CW > $COMPAT_AUTOCONF - md5sum $COMPAT_CONFIG $COMPAT_CONFIG_CW > $CONFIG_CHECK -} - -which md5sum 2>&1 > /dev/null -if [ $? -ne 0 ]; then - echo "md5sum required to detect changes on config file" - exit -1 -fi - -if [ ! -f $CONFIG_CHECK ]; then - gen_compat_autoconf - exit -fi - -md5sum -c $CONFIG_CHECK 2> /dev/null 1>/dev/null - -if [ $? -ne 0 ]; then - echo "Changes to compat-wireless's configuration was detected, regenerating autoconf..." - gen_compat_autoconf -fi - diff --git a/openairITS/mac/DOT11/scripts/check_depmod b/openairITS/mac/DOT11/scripts/check_depmod deleted file mode 100755 index f127a6a6676..00000000000 --- a/openairITS/mac/DOT11/scripts/check_depmod +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash -# Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com> -# -# Ensures your distribution likes to prefer updates/ over the kernel/ -# search updates built-in - -# Seems Mandriva has an $DEPMOD_DIR but it doesn't have any files, -# so lets deal with those distributions. -DEPMOD_CONF="/etc/depmod.conf" -DEPMOD_CONF_TMP="$DEPMOD_CONF.compat-wireless.old" -DEPMOD_DIR="/etc/depmod.d/" -COMPAT_DEPMOD_FILE=compat-wireless.conf -GREP_REGEX_UPDATES="^[[:space:]]*search.*[[:space:]]updates\([[:space:]]\|$\)" -GREP_REGEX_SEARCH="^[[:space:]]*search[[:space:]].\+$" -DEPMOD_CMD="depmod" - -function add_compat_depmod_conf { - echo "NOTE: Your distribution lacks an $DEPMOD_DIR directory with " - echo "updates/ directory being prioritized for modules, we're adding " - echo "one for you." - mkdir -p $DEPMOD_DIR - FIRST_FILE=$(ls $DEPMOD_DIR|head -1) - [ -n "$FIRST_FILE" ] && while [[ $FIRST_FILE < $COMPAT_DEPMOD_FILE ]]; do - COMPAT_DEPMOD_FILE="0$COMPAT_DEPMOD_FILE" - done - echo "search updates" > $DEPMOD_DIR/$COMPAT_DEPMOD_FILE -} - -function add_global_depmod_conf { - echo "NOTE: Your distribution lacks updates/ directory being" - echo "prioritized for modules, we're adding it to $DEPMOD_CONF." - rm -f $DEPMOD_CONF_TMP - [ -f $DEPMOD_CONF ] && cp -f $DEPMOD_CONF $DEPMOD_CONF_TMP - echo "search updates" > $DEPMOD_CONF - [ -f $DEPMOD_CONF_TMP ] && cat $DEPMOD_CONF_TMP >> $DEPMOD_CONF -} - -function depmod_updates_ok { - echo "depmod will prefer updates/ over kernel/ -- OK!" -} - -function add_depmod_conf { - if [ -f "$DEPMOD_CONF" ]; then - add_global_depmod_conf - else - DEPMOD_VERSION=$($DEPMOD_CMD --version | cut -d" " -f2 | sed "s/\.//") - if [[ $DEPMOD_VERSION -gt 36 ]]; then - add_compat_depmod_conf - else - add_global_depmod_conf - fi - fi -} - -# ============================================================================= -# === MAIN ==================================================================== -# ============================================================================= - -GREP_FILES="" -[ -f $DEPMOD_CONF ] && GREP_FILES="$DEPMOD_CONF" -if [ -d $DEPMOD_DIR ]; then - DEPMOD_FILE_COUNT=$(ls $DEPMOD_DIR | wc -l) - [[ $DEPMOD_FILE_COUNT -gt 0 ]] && GREP_FILES="$GREP_FILES $DEPMOD_DIR/*" -fi - -if [ -n "$GREP_FILES" ]; then - grep -q "$GREP_REGEX_SEARCH" $GREP_FILES - if [[ $? -eq 0 ]]; then - grep -q "$GREP_REGEX_UPDATES" $GREP_FILES - if [[ $? -eq 0 ]]; then - depmod_updates_ok - else - add_depmod_conf - fi - else - depmod_updates_ok - fi -else - depmod_updates_ok -fi - -exit 0 - diff --git a/openairITS/mac/DOT11/scripts/compress_modules b/openairITS/mac/DOT11/scripts/compress_modules deleted file mode 100755 index cf2a76cd5fd..00000000000 --- a/openairITS/mac/DOT11/scripts/compress_modules +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# To be used by distributions using compressed modules - -COMPRESSION_FOUND="n" -COUNT=0; - -for i in $(modprobe -l mac80211); do - let COUNT=$COUNT+1 - i=${i##*/} - if [ "$i" = "mac80211.ko.gz" ]; then - COMPRESSION_FOUND="y" - continue - fi -done - -if [ $COUNT -gt 2 ]; then - echo "More than two mac80211 modules are detected, please report this." - exit -fi - -if [ $COMPRESSION_FOUND = "n" ]; then - exit -fi - -DIRS="$KLIB/$KMODDIR/net/mac80211/" -# This handles both drivers/net/ and drivers/net/wireless/ -DIRS="$DIRS $KLIB/$KMODDIR/net/" -DIRS="$DIRS $KLIB/$KMODDIR/drivers/ssb/" -DIRS="$DIRS $KLIB/$KMODDIR/drivers/net/usb/" -DIRS="$DIRS $KLIB/$KMODDIR/drivers/net/wireless/" -DIRS="$DIRS $KLIB/$KMODDIR/drivers/misc/eeprom/" - -for i in $DIRS; do - if [ ! -d $i ]; then - continue; - fi - for driver in $(find $i -type f -name *.ko); do - gzip -9 $driver - done -done diff --git a/openairITS/mac/DOT11/scripts/driver-select b/openairITS/mac/DOT11/scripts/driver-select deleted file mode 100755 index c8aff636cde..00000000000 --- a/openairITS/mac/DOT11/scripts/driver-select +++ /dev/null @@ -1,499 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com> -# -# This script allows you to select your compat-wireless driver and -# reduce compilation time. - -COMPAT_CONFIG_CW="config.mk" -DRIVERS_MAKEFILE="drivers/net/wireless/Makefile" -ATH_MAKEFILE="drivers/net/wireless/ath/Makefile" -ATH9K_MAKEFILE="drivers/net/wireless/ath/ath9k/Makefile" -BRCM80211_MAKEFILE="drivers/net/wireless/brcm80211/Makefile" -RT2X00_MAKEFILE="drivers/net/wireless/rt2x00/Makefile" -NET_WIRELESS_MAKEFILE="net/wireless/Makefile" -EEPROM_MAKEFILE="drivers/misc/eeprom/Makefile" -DRIVERS_NET_ATHEROS="drivers/net/ethernet/atheros/Makefile" -DRIVERS_NET_BROADCOM="drivers/net/ethernet/broadcom/Makefile" -DRIVERS_NET_USB_MAKEFILE="drivers/net/usb/Makefile" -SSB_MAKEFILE="drivers/ssb/Makefile" -BCMA_MAKEFILE="drivers/bcma/Makefile" - -# used to backup files from foo to foo.${BACKUP_EXT} -# If you change this also modify restore_compat() and -# restore_file() below I couldn't find a way to use -# the $BACKUP_EXT there. -BACKUP_EXT="bk" - -# Pretty colors -GREEN="\033[01;32m" -YELLOW="\033[01;33m" -NORMAL="\033[00m" -BLUE="\033[34m" -RED="\033[31m" -PURPLE="\033[35m" -CYAN="\033[36m" -UNDERLINE="\033[02m" - -SUPPORTED_80211_DRIVERS="ath5k ath9k ath9k_ap ath9k_htc carl9170 ath6kl b43 zd1211rw rt2x00 wl1251 wl12xx brcmsmac brcmfmac" - -# b43 needs some more work for driver-select, the SSB stuff, plus -# what if you update b44 but not b43? It will bust. -SUPPORTED_ETH_DRIVERS="atl1 atl2 atl1e atl1c alx" - -function usage { - echo -e "${GREEN}Usage${NORMAL}: ${BOLD}$0${NORMAL} [ ${PURPLE}<driver-name>${NORMAL} | ${CYAN}<driver-group-name>${NORMAL} | ${GREEN}restore${NORMAL} ]" - - # These should match the switch below. - echo -e "Supported 802.11 drivers:" - for i in $SUPPORTED_80211_DRIVERS; do - echo -e "\t${PURPLE}${i}${NORMAL}" - done - - echo - echo -e "Supported Ethernet drivers:" - for i in $SUPPORTED_ETH_DRIVERS; do - echo -e "\t${PURPLE}${i}${NORMAL}" - done - - # These should match the switch below. - echo -e "\nSupported group drivers:" - echo -e "\t${CYAN}atheros${NORMAL} < ${PURPLE} ath5k ath9k carl9170 zd1211rw ath6kl ${NORMAL}>" - echo -e "\t${CYAN}ath${NORMAL} < ${PURPLE} ath5k ath9k carl9170 ath6kl ${NORMAL}>" - echo -e "\t${CYAN}brcm80211${NORMAL} < ${PURPLE} brcmsmac brcmfmac ${NORMAL}>" - echo -e "\t${CYAN}intel${NORMAL} < ${PURPLE} iwlwifi, iwlegacy ${NORMAL}>" - echo -e "\t${CYAN}rtl818x${NORMAL} < ${PURPLE} rtl8180 rtl8187 ${NORMAL}>" - echo -e "\t${CYAN}rtlwifi${NORMAL} < ${PURPLE} rtl8192ce ${NORMAL}>" - echo -e "\t${CYAN}ti${NORMAL} < ${PURPLE} wl1251 wl12xx (SPI and SDIO)${NORMAL}>" - - echo -e "\nSupported group drivers: Bluetooth & Ethernet:" - echo -e "\t${CYAN}atlxx${NORMAL} < ${PURPLE} atl1 atl2 atl1e alx${NORMAL}>" - echo -e "\t${CYAN}bt${NORMAL} < ${PURPLE} Linux bluetooth drivers ${NORMAL}>" - - echo -e "Restoring compat-wireless:" - echo -e "\t${GREEN}restore${NORMAL}: you can use this option to restore compat-wireless to the original state" -} - -function backup_file { - if [ -f $1.${BACKUP_EXT} ]; then - echo -e "Backup exists: ${CYAN}${1}.${BACKUP_EXT}${NORMAL}" - return - fi - echo -e "Backing up makefile: ${CYAN}${1}.${BACKUP_EXT}${NORMAL}" - cp $1 $1.bk -} - -function disable_makefile -{ - backup_file $1 - echo > $1 -} - -function select_driver -{ - backup_file $DRIVERS_MAKEFILE - perl -i -ne 'print if /'$1'\)/ ' $DRIVERS_MAKEFILE -} - -function select_drivers -{ - backup_file $DRIVERS_MAKEFILE - CONFIGS="" - COUNT=0 - for i in $@; do - if [[ "$CONFIGS" = "" ]]; then - CONFIGS="$i" - else - CONFIGS="${CONFIGS}|$i" - fi - done - egrep "$CONFIGS" $DRIVERS_MAKEFILE > ${DRIVERS_MAKEFILE}.tmp - mv ${DRIVERS_MAKEFILE}.tmp ${DRIVERS_MAKEFILE} -} - -function disable_lib80211 -{ - backup_file $NET_WIRELESS_MAKEFILE - perl -i -ne 'print if ! /LIB80211/ ' $NET_WIRELESS_MAKEFILE -} - -function disable_b44 { - backup_file $DRIVERS_NET_BROADCOM - perl -i -ne 'print if ! /CONFIG_B44/ ' $DRIVERS_NET_BROADCOM -} - -function disable_ssb -{ - disable_makefile ${SSB_MAKEFILE} - perl -i -ne 'print if ! /drivers\/ssb\//' Makefile -} - -function disable_bcma -{ - disable_makefile ${BCMA_MAKEFILE} - perl -i -ne 'print if ! /drivers\/bcma\//' Makefile -} - -function disable_rfkill -{ - backup_file Makefile - perl -i -ne 'print if ! /CONFIG_COMPAT_RFKILL/' Makefile -} - -function disable_eeprom -{ - disable_makefile ${EEPROM_MAKEFILE} - perl -i -ne 'print if ! /drivers\/misc\/eeprom\//' Makefile -} - -function disable_usbnet -{ - disable_makefile ${DRIVERS_NET_USB_MAKEFILE} - perl -i -ne 'print if ! /drivers\/net\/usb\//' Makefile -} - -function disable_usbnet { - perl -i -ne 'print if ! /CONFIG_COMPAT_NET_USB_MODULES/' Makefile -} - -function disable_ethernet { - perl -i -ne 'print if ! /CONFIG_COMPAT_NETWORK_MODULES/' Makefile -} - -function disable_var_03 { - perl -i -ne 'print if ! /CONFIG_COMPAT_VAR_MODULES/' Makefile -} - -function disable_bt { - perl -i -ne 'print if ! /CONFIG_COMPAT_BLUETOOTH/' Makefile -} - -function disable_80211 { - perl -i -ne 'print if ! /CONFIG_COMPAT_WIRELESS/' Makefile -} - -function disable_bt_usb_ethernet { - backup_file Makefile - disable_usbnet - disable_ethernet - disable_bt - disable_update-initramfs -} - -function disable_bt_usb_ethernet_var { - backup_file Makefile - disable_bt_usb_ethernet - disable_var_03 -} - -function enable_only_ethernet { - backup_file Makefile - backup_file $DRIVERS_NET_BROADCOM - backup_file $DRIVERS_NET_ATHEROS - disable_staging - disable_usbnet - disable_var_03 - disable_bt - # rfkill may be needed if you enable b44 as you may have b43 - disable_rfkill - disable_80211 -} - -function disable_var { - disable_ssb - disable_bcma - disable_usbnet - disable_eeprom - disable_update-initramfs -} - -function disable_var_01 { - disable_lib80211 - disable_var -} - -function disable_var_02 { - #var_01 with eeprom not disabled - disable_lib80211 - disable_ssb - disable_bcma - disable_usbnet - disable_update-initramfs -} - -function disable_staging { - backup_file Makefile - perl -i -ne 'print if ! /CONFIG_COMPAT_STAGING/ ' Makefile -} - -function disable_update-initramfs -{ - backup_file Makefile - perl -i -ne 'print if ! /update-initramfs/' Makefile -} - -function select_ath_driver -{ - backup_file $ATH_MAKEFILE - perl -i -ne 'print if /'$1'/ || /CONFIG_ATH_/ || /ath-objs/ || /regd.o/ || /hw.o/ || /key.o/' $ATH_MAKEFILE - disable_var_01 -} - -function select_ath9k_driver -{ - select_ath_driver CONFIG_ATH9K_HW - # In the future here we'll add stuff to disable ath9k_htc -} - -function select_ath9k_driver_ap -{ - select_ath9k_driver - backup_file $COMPAT_CONFIG_CW - perl -i -ne 'print if ! /CONFIG_COMPAT_ATH9K_RATE_CONTROL/ ' $COMPAT_CONFIG_CW -} - -function select_brcm80211_driver -{ - backup_file $BRCM80211_MAKEFILE - perl -i -ne 'print if /'$1'/ || /CONFIG_BRCMUTIL/ ' $BRCM80211_MAKEFILE -} - -function restore_file { - #ORIG=$(shell ${1%%.${BACKUP_EXT}}) - ORIG=${1%%.bk} - cp $1 $ORIG - rm -f $1 - echo -e "Restored makefile: ${CYAN}${ORIG}${NORMAL} (and removed backup)" -} - -function restore_compat { - #FILES=$(find ./ -type f -name *.$BACKUP_EXT) - FILES=$(find ./ -type f -name *.bk) - for i in $FILES; do - restore_file $i - done -} - -if [ $# -ne 1 ]; then - usage - exit -fi - -if [ ! -f compat_version ]; then - echo "Must run $0 from the compat-wireless top level directory" - exit -fi - -if [[ ! -f built-in.o ]]; then - if [[ "$1" != "restore" ]]; then - echo -e "${PURPLE}Processing new driver-select request...${NORMAL}" - fi -fi - -# Always backup the top level Makefile, unless restoring -if [[ "$1" != "restore" ]]; then - backup_file Makefile -fi - -# If a user selects a new driver make sure we clean up for them -# first and also restore the backup makefiles then. Otherwise -# we'll be trying to leave drivers on Makefiles which are not -# already there from a previous run. -if [ -f built-in.o ]; then - echo -e "${PURPLE}Old build found, going to clean this up first...${NORMAL}" - make clean - echo -e "${PURPLE}Restoring Makefiles...${NORMAL}" - ./$0 restore -fi - -case $1 in - restore) - restore_compat - ;; -# Group drivers - atheros) - select_drivers CONFIG_ATH_COMMON \ - CONFIG_COMPAT_ZD1211RW - disable_staging - disable_bt_usb_ethernet_var - disable_var_01 - ;; - ath) - disable_bt_usb_ethernet_var - select_drivers CONFIG_ATH_COMMON - disable_var_01 - ;; - intel) - select_drivers CONFIG_IWLWIFI \ - CONFIG_IWLEGACY \ - CONFIG_IPW - disable_staging - disable_var - disable_bt - disable_ethernet - disable_usbnet - ;; - iwlwifi) - select_driver CONFIG_IWLWIFI - disable_staging - disable_var_01 - disable_bt - disable_ethernet - disable_usbnet - ;; - iwlegacy) - select_driver CONFIG_IWLEGACY - disable_staging - disable_var_01 - disable_bt - disable_ethernet - disable_usbnet - ;; - rtl818x) - select_drivers CONFIG_RTL8180 CONFIG_RTL8187 - disable_staging - disable_bt_usb_ethernet - disable_ssb - disable_bcma - disable_lib80211 - ;; - rtlwifi) - select_drivers CONFIG_RTL8192CE CONFIG_RTLWIFI - disable_staging - disable_bt_usb_ethernet_var - disable_lib80211 - ;; - ti) - select_drivers CONFIG_WL1251 \ - CONFIG_WL12XX - disable_staging - disable_var_01 - ;; - brcm80211) - disable_staging - disable_bt_usb_ethernet_var - select_drivers CONFIG_BRCMUTIL \ - CONFIG_BRCMFMAC \ - CONFIG_BRCMSMAC - ;; -# Singular modules - ath5k) - disable_staging - disable_bt_usb_ethernet_var - select_driver CONFIG_ATH_COMMON - select_ath_driver CONFIG_ATH5K - #patch -p1 < enable-older-kernels/enable-2.6.23.patch - ;; - ath9k) - disable_staging - disable_bt_usb_ethernet_var - select_driver CONFIG_ATH_COMMON - select_ath9k_driver - ;; - ath9k_ap) - disable_staging - disable_bt_usb_ethernet_var - select_driver CONFIG_ATH_COMMON - select_ath9k_driver_ap - ;; - carl9170) - disable_staging - disable_bt_usb_ethernet_var - select_driver CONFIG_ATH_COMMON - select_ath_driver CONFIG_CARL9170 - ;; - ath9k_htc) - disable_staging - disable_bt_usb_ethernet_var - select_driver CONFIG_ATH_COMMON - select_ath9k_driver - ;; - ath6kl) - disable_staging - disable_bt_usb_ethernet_var - select_driver CONFIG_ATH_COMMON - select_ath_driver CONFIG_ATH6KL - ;; - brcmsmac) - disable_staging - disable_bt_usb_ethernet_var - select_drivers CONFIG_BRCMSMAC - select_brcm80211_driver CONFIG_BRCMSMAC CONFIG_BRCMUTIL - ;; - brcmfmac) - disable_staging - disable_bt_usb_ethernet_var - select_drivers CONFIG_BRCMFMAC - select_brcm80211_driver CONFIG_BRCMFMAC CONFIG_BRCMUTIL - ;; - zd1211rw) - select_driver CONFIG_COMPAT_ZD1211RW - disable_staging - disable_var_01 - ;; - b43) - disable_staging - disable_bt_usb_ethernet - disable_eeprom - disable_lib80211 - select_driver CONFIG_B43 - ;; - rt2x00) - select_driver CONFIG_RT2X00 - disable_staging - disable_bt_usb_ethernet - disable_var_02 - ;; - wl1251) - select_drivers CONFIG_WL1251 - disable_staging - disable_var_01 - ;; - wl12xx) - select_drivers CONFIG_WL12XX - disable_staging - disable_var_01 - ;; -# Ethernet and Bluetooth drivers - atl1) - enable_only_ethernet - disable_b44 - echo -e "obj-\$(CONFIG_ATL1) += atlx/" > $DRIVERS_NET_ATHEROS - ;; - atl2) - enable_only_ethernet - disable_b44 - echo -e "obj-\$(CONFIG_ATL2) += atlx/" > $DRIVERS_NET_ATHEROS - ;; - atl1e) - enable_only_ethernet - disable_b44 - echo -e "obj-\$(CONFIG_ATL1E) += atl1e/" > $DRIVERS_NET_ATHEROS - ;; - atl1c) - enable_only_ethernet - disable_b44 - echo -e "obj-\$(CONFIG_ATL1C) += atl1c/" > $DRIVERS_NET_ATHEROS - ;; - alx) - enable_only_ethernet - disable_b44 - echo -e "obj-\$(CONFIG_ALX) += alx/" > $DRIVERS_NET_ATHEROS - ;; - atlxx) - select_drivers CONFIG_ATL1 CONFIG_ATL2 CONFIG_ATL1E CONFIG_ALX - enable_only_ethernet - disable_b44 - disable_update-initramfs - ;; - bt) - select_driver CONFIG_BT - disable_var - disable_ethernet - disable_staging - disable_80211 - ;; - *) - echo "Unsupported driver" - exit - ;; -esac diff --git a/openairITS/mac/DOT11/scripts/gen-compat-autoconf.sh b/openairITS/mac/DOT11/scripts/gen-compat-autoconf.sh deleted file mode 100755 index c7bdd38d0b1..00000000000 --- a/openairITS/mac/DOT11/scripts/gen-compat-autoconf.sh +++ /dev/null @@ -1,204 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> -# -# Use this to parse a small .config equivalent looking file to generate -# our own autoconf.h. This file has defines for each config option -# just like the kernels include/linux/autoconf.h -# -# XXX: consider using scripts/kconfig/confdata.c instead. -# On the downside this would require the user to have libc though. - -# This indicates which is the oldest kernel we support -# Update this if you are adding support for older kernels. -OLDEST_KERNEL_SUPPORTED="2.6.24" -COMPAT_RELEASE="compat_version" -KERNEL_RELEASE="compat_base_tree_version" -MULT_DEP_FILE=".compat_pivot_dep" - -if [ $# -ne 2 ]; then - echo "Usage $0 <generic-compat-config-file> <compat-wireless-config-file>" - exit -fi - -COMPAT_CONFIG_1="$1" -COMPAT_CONFIG_2="$2" - -if [[ ! -f $COMPAT_CONFIG_1 || ! -f $COMPAT_CONFIG_2 ]]; then - echo "File $COMPAT_CONFIG_1 and $COMPAT_CONFIG_2 files must be present" - exit -fi - -if [ ! -f $COMPAT_RELEASE -o ! -f $KERNEL_RELEASE ]; then - echo "Error: $COMPAT_RELEASE or $KERNEL_RELEASE file is missing" - exit -fi - -CREL=$(cat $COMPAT_RELEASE | tail -1) -KREL=$(cat $KERNEL_RELEASE | tail -1) -DATE=$(date) - -# Defines a CONFIG_ option if not defined yet, this helps respect -# linux/autoconf.h -function define_config { - VAR=$1 - VALUE=$2 - case $VALUE in - n) # Try to undefine it - echo "#undef $VAR" - ;; - y) - echo "#ifndef $VAR" - echo "#define $VAR 1" - echo "#endif /* $VAR */ " - ;; - m) - echo "#ifndef $VAR" - echo "#define $VAR 1" - echo "#endif /* $VAR */ " - ;; - *) # Assume string - # XXX: add better checks to make sure what was on - # the right was indeed a string - echo "#ifndef $VAR" - echo "#define $VAR \"$VALUE\"" - echo "#endif /* $VAR */ " - ;; - esac -} - -# This deals with core compat-wireless kernel requirements. -function define_config_req { - VAR=$1 - echo "#ifndef $VAR" - echo -n "#error Compat-wireless requirement: $VAR must be enabled " - echo "in your kernel" - echo "#endif /* $VAR */" -} - -# This handles modules which have dependencies from the kernel -# which compat-wireless isn't providing yet either because -# the dependency is not available as kernel module or -# the module simply isn't provided by compat-wireless. -function define_config_dep { - VAR=$1 - VALUE=$2 - DEP=$3 - WARN_VAR="COMPAT_WARN_$VAR" - echo "#ifdef $DEP" - define_config $VAR $VALUE - echo "#else" - # XXX: figure out a way to warn only once - # define only once in case user tried to enable config option - # twice in config.mk - echo "#ifndef $WARN_VAR" - # Lets skip these for now.. they might be too annoying - #echo "#warning Skipping $VAR as $DEP was needed... " - #echo "#warning This just means $VAR won't be built and is not fatal." - echo "#define $WARN_VAR" - echo "#endif /* $VAR */" - echo "#endif /* $WARN_VAR */" -} - -# This handles options which have *multiple* dependencies from the kernel -function define_config_multiple_deps { - VAR=$1 - VALUE=$2 - DEP_ARRAY=$3 - - # First, put all ifdefs - for i in $(cat $MULT_DEP_FILE); do - echo "#ifdef $i" - done - - # Now put our option in the middle - define_config $VAR $VALUE - - # Now close all ifdefs - # First, put all ifdefs - for i in $(cat $MULT_DEP_FILE); do - echo "#endif" - done - -} - -function kernel_version_req { - VERSION=$(echo $1 | sed -e 's/\./,/g') - echo "#if (LINUX_VERSION_CODE < KERNEL_VERSION($VERSION))" - echo "#error Compat-wireless requirement: Linux >= $VERSION" - echo "#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION($VERSION) */ " -} - -cat <<EOF -#ifndef COMPAT_AUTOCONF_INCLUDED -#define COMPAT_AUTOCONF_INCLUDED -/* - * Automatically generated C config: don't edit - * $DATE - * compat-wireless-2.6: $CREL - * linux-2.6: $KREL - */ -#define COMPAT_RELEASE "$CREL" -#define COMPAT_KERNEL_RELEASE "$KREL" -EOF - -# Checks user is compiling against a kernel we support -kernel_version_req $OLDEST_KERNEL_SUPPORTED - -# For each CONFIG_FOO=x option -for i in $(egrep -h '^export CONFIG_|^ifdef CONFIG_|^ifndef CONFIG_|^endif #CONFIG_|^else #CONFIG_' $COMPAT_CONFIG_1 $COMPAT_CONFIG_2 | \ - sed 's/export //' | \ - sed 's/ /+/'); do - case $i in - 'ifdef+CONFIG_'* ) - echo "#$i" | sed -e 's/+/ /' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(3,\2,0))/' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,\2))/' -e 's/\(ifdef CONFIG_COMPAT_RHEL_\)\([0-9]*\)_\([0-9]*\)/if (defined(RHEL_MAJOR) \&\& RHEL_MAJOR == \2 \&\& RHEL_MINOR >= \3)/' -e 's/\(#ifdef \)\(CONFIG_[^:space:]*\)/#if defined(\2) || defined(\2_MODULE)/' - continue - ;; - 'ifndef+CONFIG_'* ) - echo "#$i" | sed -e 's/+/ /' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,\2,0))/' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,\2))/' -e 's/\(ifndef CONFIG_COMPAT_RHEL_\)\([0-9]*\)_\([0-9]*\)/if (!defined(RHEL_MAJOR) || RHEL_MAJOR != \2 || RHEL_MINOR < \3)/' -e 's/\(#ifndef \)\(CONFIG_[^:space:]*\)/#if !defined(\2) \&\& !defined(\2_MODULE)/' - continue - ;; - 'else+#CONFIG_'* | 'endif+#CONFIG_'* ) - echo "#$i */" |sed -e 's/+#/ \/* /g' - continue - ;; - CONFIG_* ) - # Get the element on the left of the "=" - VAR=$(echo $i | cut -d"=" -f 1) - # Get the element on the right of the "=" - VALUE=$(echo $i | cut -d"=" -f 2) - - # Handle core kernel module depenencies here. - case $VAR in - # ignore this, we have a special hanlder for this at the botttom - # instead. We still need to keep this in config.mk to let Makefiles - # know its enabled so just ignore it here. - CONFIG_MAC80211_QOS) - continue - ;; - esac - # Any other module which can *definitely* be built as a module goes here - define_config $VAR $VALUE - continue - ;; - esac -done - -# Deal with special cases. CONFIG_MAC80211_QOS is such a case. -# We handle this specially for different kernels we support. -if [ -f $KLIB_BUILD/Makefile ]; then - MAJORLEVEL=$(make -C $KLIB_BUILD kernelversion | sed -n 's/^\([0-9]\)\..*/\1/p') - SUBLEVEL=$(make -C $KLIB_BUILD kernelversion | sed -n 's/^\(2\.6\|[3-9]\)\.\([0-9]\+\).*/\2/p') - if [ $MAJORLEVEL -eq 2 -a $SUBLEVEL -le 22 ]; then - define_config CONFIG_MAC80211_QOS y - else # kernel >= 2.6.23 - # CONFIG_MAC80211_QOS on these kernels requires - # CONFIG_NET_SCHED and CONFIG_NETDEVICES_MULTIQUEUE - rm -f $MULT_DEP_FILE - echo CONFIG_NET_SCHED >> $MULT_DEP_FILE - echo CONFIG_NETDEVICES_MULTIQUEUE >> $MULT_DEP_FILE - define_config_multiple_deps CONFIG_MAC80211_QOS y $ALL_DEPS - rm -f $MULT_DEP_FILE - fi -fi -echo "#endif /* COMPAT_AUTOCONF_INCLUDED */" diff --git a/openairITS/mac/DOT11/scripts/gen-stable-release.sh b/openairITS/mac/DOT11/scripts/gen-stable-release.sh deleted file mode 100755 index 9764730a425..00000000000 --- a/openairITS/mac/DOT11/scripts/gen-stable-release.sh +++ /dev/null @@ -1,184 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com> -# -# You can use this to make stable compat-wireless releases -# -# The assumption is you have the linux-2.6-allstable git tree on your $HOME -# git://git.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-allstable.git -# -# Local branches will be created based on the remote linux-2.6.X.y branches. -# If your branch already exists we will nuke it for you to avoid rebasing. -# -# If no kernel is specified we use the latest rc-release, which will be on the -# remove master branch. Your master branch should be clean. - -# Pretty colors -GREEN="\033[01;32m" -YELLOW="\033[01;33m" -NORMAL="\033[00m" -BLUE="\033[34m" -RED="\033[31m" -PURPLE="\033[35m" -CYAN="\033[36m" -UNDERLINE="\033[02m" - -# Note that this tree may not have the latest RC stuff, so you should also add -# Linus' tree as a remote and fetch those objects if you want to make an RC -# release instead. -ALL_STABLE_TREE="linux-stable" -STAGING=/tmp/staging/compat-wireless/ - -function usage() -{ - echo -e "Usage: ${GREEN}$1${NORMAL} ${BLUE}[ -n | -p | -c | -f | -i ]${NORMAL} ${CYAN}[ linux-2.6.X.y ]${NORMAL}" - echo - echo Examples usages: - echo - echo -e "${PURPLE}${1}${NORMAL}" - echo -e "${PURPLE}${1} ${CYAN}linux-2.6.29.y${NORMAL}" - echo -e "${PURPLE}${1} ${CYAN}linux-2.6.30.y${NORMAL}" - echo - echo -e "If no kernel is specified we try to make a release based on the latest RC kernel." - echo -en "If a kernel release is specified ${CYAN}X${NORMAL} is the next stable release " - echo -en "as ${CYAN}35${NORMAL} in ${CYAN}2.6.35.y${NORMAL}\n" - exit -} - -UPDATE_ARGS="" -POSTFIX_RELEASE_TAG="-" - -export GIT_TREE=$HOME/$ALL_STABLE_TREE -COMPAT_WIRELESS_DIR=$(pwd) -COMPAT_WIRELESS_BRANCH=$(git branch | grep \* | awk '{print $2}') - -cd $GIT_TREE -# --abbrev=0 on branch should work but I guess it doesn't on some releases -EXISTING_BRANCH=$(git branch | grep \* | awk '{print $2}') - -# target branch we want to use from hpa's tree, by default -# this respects the existing branch on the target kernel. -# You can override the target branch by specifying an argument -# to this script. -TARGET_BRANCH="$EXISTING_BRANCH" - -# By default we will not do a git fetch and reset of the branch, -# use -f if you want to force an update, this will delete all -# of your local patches so be careful. -FORCE_UPDATE="no" - -while [ $# -ne 0 ]; do - if [[ "$1" = "-s" ]]; then - UPDATE_ARGS="${UPDATE_ARGS} $1 refresh" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}s" - shift; continue; - fi - if [[ "$1" = "-n" ]]; then - UPDATE_ARGS="${UPDATE_ARGS} $1" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}n" - shift; continue; - fi - if [[ "$1" = "-p" ]]; then - UPDATE_ARGS="${UPDATE_ARGS} $1" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}p" - shift; continue; - fi - if [[ "$1" = "-c" ]]; then - UPDATE_ARGS="${UPDATE_ARGS} $1" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}c" - shift; continue; - fi - if [[ "$1" = "-f" ]]; then - FORCE_UPDATE="yes" - shift; continue; - fi - - if [[ $(expr "$1" : '^linux-') -eq 6 ]]; then - TARGET_BRANCH="$1" - shift; continue; - fi - - echo -e "Unexpected argument passed: ${RED}${1}${NORMAL}" - usage $0 - exit -done - -function check_for_updates() -{ - case $TARGET_BRANCH in - "master") # Preparing a new stable compat-wireless release based on an RC kernel - git checkout -f - git fetch - git reset --hard origin - ;; - *) # Based on a stable 2.6.x.y release, lets just move to the target branch - # we'll only ask for object updates if and only if you asked us to with -f, - # otherwise we eat up whatever you already have on your existing branch. - git checkout -f - git fetch - git branch -D $TARGET_BRANCH - git checkout -b $TARGET_BRANCH origin/$TARGET_BRANCH - ;; - esac -} - -# We will not update your linux-2.6-allstable git tree by default. You can force -# an update by two methods: -# -# a) Specifying a different target branch -# b) Specifying the -f flag to this script -if [[ "$FORCE_UPDATE" = "yes" || "$TARGET_BRANCH" != "$EXISTING_BRANCH" ]]; then - check_for_updates -else - echo -e "Skipping $ALL_STABLE_TREE git tree update checks for branch: $TARGET_BRANCH" -fi - -echo "On $ALL_STABLE_TREE: $TARGET_BRANCH" - -# At this point your linux-2.6-allstable tree should be up to date -# with the target kernel you want to use. Lets now make sure you are -# on matching compat-wireless branch. - -# This is a super hack, but let me know if you figure out a cleaner way -TARGET_KERNEL_RELEASE=$(make VERSION="linux-3" SUBLEVEL="" EXTRAVERSION=".y" kernelversion) - -if [[ $COMPAT_WIRELESS_BRANCH != $TARGET_KERNEL_RELEASE ]]; then - echo -e "You are on the compat-wireless ${GREEN}${COMPAT_WIRELESS_BRANCH}${NORMAL} but are " - echo -en "on the ${RED}${TARGET_KERNEL_RELEASE}${NORMAL} branch... " - echo -e "try changing to that first." - exit -fi - - -cd $COMPAT_WIRELESS_DIR -RELEASE=$(git describe --abbrev=0 | sed -e 's/v//g') -if [[ $POSTFIX_RELEASE_TAG != "-" ]]; then - RELEASE="${RELEASE}${POSTFIX_RELEASE_TAG}" -fi -RELEASE_TAR="$RELEASE.tar.bz2" - -rm -rf $STAGING -mkdir -p $STAGING -cp -a $COMPAT_WIRELESS_DIR $STAGING/$RELEASE -cd $STAGING/$RELEASE - -./scripts/admin-update.sh $UPDATE_ARGS -rm -rf $STAGING/$RELEASE/.git - -# Remove any gunk -echo -echo "Cleaning up the release ..." -make clean 2>&1 > /dev/null -find ./ -type f -name *.orig | xargs rm -f -find ./ -type f -name *.rej | xargs rm -f - -cd $STAGING/ - -echo "Creating $RELEASE_TAR ..." -tar -jcf $RELEASE_TAR $RELEASE/ - -echo -echo "Compat-wireles release: $RELEASE" -echo "Size: $(du -h $RELEASE_TAR)" -echo "sha1sum: $(sha1sum $RELEASE_TAR)" -echo -echo "Release: ${STAGING}$RELEASE_TAR" diff --git a/openairITS/mac/DOT11/scripts/iwl-enable b/openairITS/mac/DOT11/scripts/iwl-enable deleted file mode 100755 index b18fdc2b4a7..00000000000 --- a/openairITS/mac/DOT11/scripts/iwl-enable +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# -# Copyright 2007 Luis R. Rodriguez <lrodriguez@atheros.com> -# -# Makes sure either iwlagn (new) or iwl4965 (old) -# is enabled to be used. This allows us to choose any driver without -# blacklisting each other. - -. /usr/lib/compat-wireless/modlib.sh - -if [[ $UID -ne 0 ]]; then - echo "Run with root privileges" - exit -fi - -IWL_NEW="iwlagn" -IWL_OLD="iwl4965" - -# Appended to module file at the end when we want to ignore one -USAGE="Usage: $0 [ $IWL_NEW | $IWL_OLD | iwlwifi ]" - -function enable_iwlwifi { - for i in $IWL_OLD $IWL_NEW; do - module_disable $i - done - module_enable iwlwifi -} - -function enable_iwlagn { - module_disable $IWL_OLD - for i in $IWL_NEW; do - module_enable $i - done -} - -# Default behavior: disables the old iwl4965 driver and enables iwlagn -if [ $# -eq 0 ]; then - enable_iwlagn - exit -elif [ $# -ne 1 ]; then - echo "$USAGE" - exit -fi - -MODULE=$1 -if [ "$MODULE" == "iwl4965" ]; then - module_disable $IWL_NEW - module_enable $IWL_OLD -elif [ "$MODULE" == "iwlagn" ]; then - enable_iwlagn -elif [ "$MODULE" == "iwlwifi" ]; then - enable_iwlwifi -else - echo "$USAGE" - exit -fi diff --git a/openairITS/mac/DOT11/scripts/iwl-load b/openairITS/mac/DOT11/scripts/iwl-load deleted file mode 100755 index 96b6d891826..00000000000 --- a/openairITS/mac/DOT11/scripts/iwl-load +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash -# Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com> -# -# Loads new Intel iwl (iwlagn) or the old ones (iwl4965) - -. /usr/lib/compat-wireless/modlib.sh - -IWL_OLD="iwl4965" -IWL_NEW="iwlagn" - -if [[ $UID -ne 0 ]]; then - echo "Run with root privileges" - exit -fi - - -USAGE="Usage: $0 [ iwlagn | iwl4965 ]" - -# Default behavior: unload iwl4965 and load iwlagn -if [ $# -eq 0 ]; then - 1=iwlagn -elif [ $# -ne 1 ]; then - echo "$USAGE" - exit -fi - -MODULE=$1 -if [ "$MODULE" == "iwlagn" ]; then - grep iwl4965 /proc/modules 2>&1 > /dev/null - if [ $? -eq 0 ]; then - echo Unloading $i... - modprobe -r --ignore-remove iwl4965 - fi - # Enables both b43 and b43legacy - iwl-enable iwlagn - modprobe iwlagn - CHECK=`modprobe -l iwlagn` - if [ ! -z $CHECK ]; then - echo "iwlagn loaded successfully" - fi -elif [ "$MODULE" == "iwl4965" ]; then - CHECK=`modprobe -l iwlagn` - if [ ! -z $CHECK ]; then - echo "iwlagn currently loaded, going to try to unload the module..." - modprobe -r --ignore-remove iwlagn - fi - iwl-enable iwl4965 - # iwl4965 may be loaded already lets remove it first - modprobe -r --ignore-remov iwl4965 2>&1 > /dev/null - modprobe iwl4965 - CHECK=`modprobe -l iwl4965` - if [ ! -z $CHECK ]; then - echo "iwl4965 loaded successfully!" - fi -else - echo "$USAGE" - exit -fi diff --git a/openairITS/mac/DOT11/scripts/madwifi-unload b/openairITS/mac/DOT11/scripts/madwifi-unload deleted file mode 100755 index 0cde2865f3c..00000000000 --- a/openairITS/mac/DOT11/scripts/madwifi-unload +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# Copyright 2006 Kel Modderman <kelrin@tpg.com.au> -# -# Taken from madwifi scripts. This unloads madwifi - -: ${PATTERN='\(ath_.*\|wlan_.*\|wlan\)$'} -: ${MAX_TRIES=10} - -test "`id -u`" = 0 || { - echo "ERROR: You must be root to run this script" >&2 - exit 1 -} - -test -r /proc/modules || { - echo "ERROR: Cannot read /proc/modules" >&2 - exit 1 -} - -tries="$MAX_TRIES" -while test "$tries" != "0"; do - skipped=0 - IFS=' -' - for line in `cat /proc/modules`; do - IFS=' ' - set x $line - name="$2" - size="$3" - use_count="$4" - use_name="$5" - state="$6" - expr "$name" : "$PATTERN" >/dev/null || continue - - # Compatibility for Linux 2.4.x - test -z "$state" && { use_name="-"; state="Live"; } - - if test "$state" != "Live" || test "$use_count" != "0" || \ - test "$use_name" != "-"; then - # Don't skip unload in the last run - if test "$tries" != "1"; then - skipped=1 - continue - fi - fi - - echo "Unloading \"$name\"" - sync # to be safe - /sbin/rmmod "$name" || { - echo "ERROR: cannot unload module \"$name\"" >&2 - exit 1 - } - sync # to be even safer - done - test "$skipped" = "0" && break - tries=$(($tries - 1)) -done - -exit 0 diff --git a/openairITS/mac/DOT11/scripts/modlib.sh b/openairITS/mac/DOT11/scripts/modlib.sh deleted file mode 100755 index d839a37e3f3..00000000000 --- a/openairITS/mac/DOT11/scripts/modlib.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# Copyright 2007 Luis R. Rodriguez <mcgrof@winlab.rutgers.edu> -# -# You can use these to enable/disable modules without blacklisting them - -# Make sure our imporant paths are included -PATH=$PATH:/usr/sbin:/sbin - -# Appended to module file at the end when we want to ignore one -IGNORE_SUFFIX=".ignore" -VER=`uname -r` - -# If 'module' is found, its renamed to 'module.ignore' -function module_disable { - # Basic check to see if this is a module available for loading - MODULE_CHECK=`modprobe -l $1` - if [ -z $MODULE_CHECK ]; then - echo "Module $1 not detected -- this is fine" - return - fi - MODULE=$1 - MODULE_KO=${MODULE}.ko - # In case there are more than one of these modules. This can - # happen, for example if your distribution provides one and you have - # compiled one in yourself later. - MODULE_COUNT=`find /lib/modules/$VER/ -name $MODULE_KO | wc -l` - ALL_MODULES=`find /lib/modules/$VER/ -name $MODULE_KO` - COUNT=1 - CHECK=`modprobe -l $MODULE` - for i in $ALL_MODULES; do - if [[ $MODULE_COUNT -gt 1 ]]; then - if [[ $COUNT -eq 1 ]]; then - echo -en "$MODULE_COUNT $MODULE modules found " - echo -e "we'll disable all of them" - fi - echo -en "Disabling $MODULE ($COUNT) ..." - else - echo -en "Disabling $MODULE ..." - fi - mv -f $i ${i}${IGNORE_SUFFIX} - depmod -a - CHECK_AGAIN=`modprobe -l $MODULE` - if [ "$CHECK" != "$CHECK_AGAIN" ]; then - echo -e "\t[OK]\tModule disabled:" - echo "$CHECK" - else - echo -e "[ERROR]\tModule is still being detected:" - echo "$CHECK" - fi - let COUNT=$COUNT+1 - done -} - -# If 'module.ignore' is found, rename it back to 'module' -function module_enable { - MODULE=$1 - MODULE_KO=${MODULE}.ko - IGNORED_MODULE=${MODULE_KO}${IGNORE_SUFFIX} - # In case there are more than one of these modules. This can - # happen, for example if your distribution provides one and you have - # compiled one in yourself later. - ALL_MODULES=`find /lib/modules/$VER/ -name $IGNORED_MODULE` - for i in $ALL_MODULES; do - echo -en "Enabling $MODULE ..." - DIR=`dirname $i` - mv $i $DIR/$MODULE_KO - depmod -a - CHECK=`modprobe -l $MODULE` - if [ "$DIR/$MODULE_KO" != $CHECK ]; then - if [ -z $CHECK ]; then - echo -e "\t[ERROR]\tModule could not be enabled" - else - echo -en "\t[OK]\tModule renamed but another " - echo "module file is being preferred" - echo -e "Renamed module:\t\t$DIR/$MODULE_KO" - echo -e "Preferred module:\t$CHECK" - fi - else - echo -e "\t[OK]\tModule enabled: " - echo "$DIR/$MODULE_KO" - fi - # Lets only do this for the first module found - break - done -} - diff --git a/openairITS/mac/DOT11/scripts/skip-colors b/openairITS/mac/DOT11/scripts/skip-colors deleted file mode 100755 index 71238082b62..00000000000 --- a/openairITS/mac/DOT11/scripts/skip-colors +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -perl -pe 's|(\e)\[(\d+)(;*)(\d*)(\w)||g' diff --git a/openairITS/mac/DOT11/scripts/unload.sh b/openairITS/mac/DOT11/scripts/unload.sh deleted file mode 100755 index fc7261dda60..00000000000 --- a/openairITS/mac/DOT11/scripts/unload.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -# The old stack drivers and the mac80211 rc80211_simple modules -# which is no longer on recent kernels (its internal) -OLD_MODULES="iwlwifi_mac80211 rc80211_simple zd1211rw-mac80211" -OLD_MODULES="$OLD_MODULES ieee80211_crypt_tkip ieee80211_crypt_ccmp" -OLD_MODULES="$OLD_MODULES ieee80211softmac ieee80211_crypt ieee80211" -OLD_MODULES="$OLD_MODULES bcm43xx rndis_wext iwl4965" -MODULES="$OLD_MODULES" -MODULES="$MODULES ipw2100 ipw2200 libipw" -MODULES="$MODULES wl1251 wl12xx iwmc3200wifi" -MODULES="$MODULES libertas_cs usb8xxx libertas libertas_sdio libertas_spi" -MODULES="$MODULES libertas_tf libertas_tf_usb" -MODULES="$MODULES adm8211 zd1211rw" -MODULES="$MODULES orinoco_cs orinoco_nortel orinoco_pci orinoco_plx" -MODULES="$MODULES orinoco_tld orinoco_usb spectrum_cs orinoco" -MODULES="$MODULES b43 b44 b43legacy brcm80211 ssb" -MODULES="$MODULES iwl3945 iwlwifi iwlagn iwlcore" -MODULES="$MODULES ath9k ath9k_htc ath9k_common ath9k_hw " -MODULES="$MODULES ath5k ath ath6kl ar9170usb carl9170" -MODULES="$MODULES p54pci p54usb p54spi p54common" -MODULES="$MODULES rt2400pci rt2500pci rt61pci" -MODULES="$MODULES rt2500usb rt73usb" -MODULES="$MODULES rt2800usb rt2800pci rt2800lib" -MODULES="$MODULES rt2x00usb rt2x00pci rt2x00lib" -MODULES="$MODULES rtl8180 rtl8187 rtl8192ce rtlwifi" -MODULES="$MODULES mwl8k mac80211_hwsim" -MODULES="$MODULES at76c50x_usb at76_usb" -MODULES="$MODULES rndis_wlan rndis_host cdc_ether usbnet" -# eeprom_93cx6 is used by rt2x00 (rt61pci, rt2500pci, rt2400pci) -# and Realtek drivers ( rtl8187, rtl8180) -MODULES="$MODULES eeprom_93cx6" -MODULES="$MODULES lib80211_crypt_ccmp lib80211_crypt_tkip lib80211_crypt_wep" -MODULES="$MODULES mac80211 cfg80211 lib80211" -MODULES="$MODULES compat" -# Bluetooth modules -MODULES="$MODULES ath3k bcm203x bluecard_cs bnep bpa10x bt3c_cs btmrvl btmrvl_sdio btsdio" -MODULES="$MODULES btusb btuart_cs cmtp dtl1_cs hidp hci_vhci hci_uart rfcomm sco bluetooth l2cap" -MODULES="$MODULES atl1 atl2 atl1e atl1c alx" -echo Stoping bluetooth service.. -/etc/init.d/bluetooth stop -/etc/init.d/bluetooth status -MADWIFI_MODULES="ath_pci ath_rate_sample wlan_scan_sta wlan ath_hal" -IPW3945D="/sbin/ipw3945d-`uname -r`" - -if [ -f $IPW3945D ]; then - $IPW3945D --isrunning - if [ ! $? ]; then - echo -n "Detected ipw3945 daemon loaded we're going to " - echo "shut the daemon down now and remove the module." - modprobe -r --ignore-remove ipw3945 - fi -fi - -grep ath_pci /proc/modules 2>&1 > /dev/null -if [ $? -eq 0 ]; then - echo "MadWifi driver is loaded, going to try to unload it..." - ./scripts/madwifi-unload -fi - -for i in $MODULES; do - grep ^$i /proc/modules 2>&1 > /dev/null - if [ $? -eq 0 ]; then - echo Unloading $i... - modprobe -r --ignore-remove $i - fi -done diff --git a/openairITS/mac/DOT11/scripts/update-initramfs b/openairITS/mac/DOT11/scripts/update-initramfs deleted file mode 100755 index 1905f116d22..00000000000 --- a/openairITS/mac/DOT11/scripts/update-initramfs +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright 2009 Luis R. Rodriguez <mcgrof@gmail.com> -# -# Since we provide ssb, the Ethernet module b44 some people may -# rely on it to netboot, so update the initrafms for each -# distribution. -# -# Note that in the future people may want to wireless-boot -# so this will help with that as well. - -LSB_RED_ID=$(/usr/bin/lsb_release -i -s) - -KLIB=/lib/modules/$(uname -r)/build -ver=$(echo $KLIB | awk -F "/lib/modules/" '{print $2}' | awk -F"/" '{print $1}') -dir=/boot/ - -case $LSB_RED_ID in -"Ubuntu") - echo "Updating Ubuntu's initramfs for $ver under $dir ..." - mkinitramfs -o $dir/initrd.img-$ver $ver - echo "Will now run update-grub to ensure grub will find the new initramfs ..." - update-grub - ;; -*) - echo "Warning:" - echo "You may or may not need to update your initframfs, you should if" - echo "any of the modules installed are part of your initramfs. To add" - echo "support for your distribution to do this automatically send a" - echo "patch against $0. If your distribution does not require this" - echo "send a patch against the '/usr/bin/lsb_release -i -s': $LSB_RED_ID" - echo "tag for your distribution to avoid this warning." - ;; -esac diff --git a/openairITS/mac/DOT11/scripts/wlunload.sh b/openairITS/mac/DOT11/scripts/wlunload.sh deleted file mode 100755 index c6c6af94f63..00000000000 --- a/openairITS/mac/DOT11/scripts/wlunload.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -# The old stack drivers and the mac80211 rc80211_simple modules -# which is no longer on recent kernels (its internal) -OLD_MODULES="iwlwifi_mac80211 rc80211_simple zd1211rw-mac80211" -OLD_MODULES="$OLD_MODULES ieee80211_crypt_tkip ieee80211_crypt_ccmp" -OLD_MODULES="$OLD_MODULES ieee80211softmac ieee80211_crypt ieee80211" -OLD_MODULES="$OLD_MODULES bcm43xx rndis_wext iwl4965" -MODULES="$OLD_MODULES" -MODULES="$MODULES ipw2100 ipw2200 libipw" -MODULES="$MODULES wl1251 wl12xx iwmc3200wifi" -MODULES="$MODULES libertas_cs usb8xxx libertas libertas_sdio libertas_spi" -MODULES="$MODULES libertas_tf libertas_tf_usb" -MODULES="$MODULES adm8211 zd1211rw" -MODULES="$MODULES orinoco_cs orinoco_nortel orinoco_pci orinoco_plx" -MODULES="$MODULES orinoco_tld orinoco_usb spectrum_cs orinoco" -MODULES="$MODULES b43 b44 b43legacy brcm80211 ssb" -MODULES="$MODULES iwl3945 iwlwifi iwlagn iwlcore" -MODULES="$MODULES ath9k ath9k_htc ath9k_common ath9k_hw " -MODULES="$MODULES ath5k ath ath6kl ar9170usb carl9170" -MODULES="$MODULES p54pci p54usb p54spi p54common" -MODULES="$MODULES rt2400pci rt2500pci rt61pci" -MODULES="$MODULES rt2500usb rt73usb" -MODULES="$MODULES rt2800usb rt2800lib" -MODULES="$MODULES rt2x00usb rt2x00lib" -MODULES="$MODULES rtl8180 rtl8187 rtl8192ce rtlwifi" -MODULES="$MODULES mwl8k mac80211_hwsim" -MODULES="$MODULES at76c50x_usb at76_usb" -MODULES="$MODULES rndis_wlan rndis_host cdc_ether usbnet" -# eeprom_93cx6 is used by rt2x00 (rt61pci, rt2500pci, rt2400pci) -# and Realtek drivers ( rtl8187, rtl8180) -MODULES="$MODULES eeprom_93cx6" -MODULES="$MODULES lib80211_crypt_ccmp lib80211_crypt_tkip lib80211_crypt_wep" -MODULES="$MODULES mac80211 cfg80211 lib80211" -MADWIFI_MODULES="ath_pci ath_rate_sample wlan_scan_sta wlan ath_hal" -IPW3945D="/sbin/ipw3945d-`uname -r`" - -if [ -f $IPW3945D ]; then - $IPW3945D --isrunning - if [ ! $? ]; then - echo -n "Detected ipw3945 daemon loaded we're going to " - echo "shut the daemon down now and remove the module." - modprobe -r --ignore-remove ipw3945 - fi -fi - -grep ath_pci /proc/modules 2>&1 > /dev/null -if [ $? -eq 0 ]; then - echo "MadWifi driver is loaded, going to try to unload it..." - ./scripts/madwifi-unload -fi - -for i in $MODULES; do - grep ^$i /proc/modules 2>&1 > /dev/null - if [ $? -eq 0 ]; then - echo Unloading $i... - modprobe -r --ignore-remove $i - fi -done diff --git a/openairITS/phy/DOT11/Makefile.inc b/openairITS/phy/DOT11/Makefile.inc deleted file mode 100644 index 765d26afd07..00000000000 --- a/openairITS/phy/DOT11/Makefile.inc +++ /dev/null @@ -1,17 +0,0 @@ -TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/CODING/ccoding_byte.o -TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/CODING/crc_byte.o -TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/CODING/viterbi.o -TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/fft.o -TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/log2_approx.o -TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/cmult_sv.o -TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/cmult_vv.o -TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/cadd_vv.o -TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/signal_energy.o -TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/dB_routines.o -TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/file_output.o -PHY_OBJS += $(OPENAIRITS_DIR)/phy/DOT11/phy_tx_start.o -PHY_OBJS += $(OPENAIRITS_DIR)/phy/DOT11/scrambler.o -PHY_OBJS += $(OPENAIRITS_DIR)/phy/DOT11/interleaver.o -PHY_OBJS += $(OPENAIRITS_DIR)/phy/DOT11/crc32.o -PHY_OBJS += $(OPENAIRITS_DIR)/phy/DOT11/initial_sync.o -PHY_OBJS += $(OPENAIRITS_DIR)/phy/DOT11/data_detection.o diff --git a/openairITS/phy/DOT11/STS_LTS_F.h b/openairITS/phy/DOT11/STS_LTS_F.h deleted file mode 100644 index 251eaf0e0ba..00000000000 --- a/openairITS/phy/DOT11/STS_LTS_F.h +++ /dev/null @@ -1,3 +0,0 @@ -int16_t STS_LTS_F[2048] __attribute__((aligned(16))) = {-604,209,-209,-604,-882,-154,154,-882,2537,503,-503,2537,-423,-1433,1433,-423,-1018,59,-59,-1018,1579,1738,-1738,1579,2827,-3086,3086,2827,-7050,839,-839,-7050,10430,2125,-2125,10430,-8268,-4194,4194,-8268,5395,1743,-1743,5395,-1428,1746,-1746,-1428,656,-4477,4477,656,1911,2308,-2308,1911,-4295,976,-976,-4295,9376,-4035,4035,9376,-10258,2284,-2284,-10258,8875,246,-246,8875,-2094,-3251,3251,-2094,-1620,1725,-1725,-1620,3716,-182,182,3716,1206,-2575,2575,1206,-4673,885,-885,-4673,9480,-325,325,9480,-7708,-2311,2311,-7708,7931,-71,71,7931,-3545,-411,411,-3545,4657,-2573,2573,4657,1190,-1728,1728,1190,-1137,-703,703,-1137,12527,-3979,3979,12527,-2887,-14086,14086,-2887,-5161,-16458,16458,-5161,-25788,3034,-3034,-25788,1948,12084,-12084,1948,1012,-2059,2059,1012,-7029,13,-13,-7029,-526,7094,-7094,-526,4707,-2656,2656,4707,-10536,124,-124,-10536,8084,5445,-5445,8084,-6475,-2760,2760,-6475,3073,422,-422,3073,-3763,4070,-4070,-3763,1992,-2226,2226,1992,620,392,-392,620,-6696,2820,-2820,-6696,10020,-1189,1189,10020,-10258,-172,172,-10258,6048,1918,-1918,6048,-2312,-15,15,-2312,472,-1199,1199,472,-690,1532,-1532,-690,-55,857,-857,-55,3558,-2432,2432,3558,-7549,1613,-1613,-7549,10306,1103,-1103,10306,-7917,-3668,3668,-7917,4955,1897,-1897,4955,101,576,-576,101,785,-5409,5409,785,1982,2036,-2036,1982,2334,-1335,1335,2334,12182,-17563,17563,12182,-24469,-13379,13379,-24469,-10655,5034,-5034,-10655,-7052,9138,-9138,-7052,950,1097,-1097,950,-4517,1430,-1430,-4517,-3580,4923,-4923,-3580,3513,205,-205,3513,-9394,1268,-1268,-9394,6576,4083,-4083,6576,-8470,-536,536,-8470,4005,1797,-1797,4005,-4867,3265,-3265,-4867,-341,-778,778,-341,1376,2546,-2546,1376,-7779,2079,-2079,-7779,7806,-338,338,7806,-10258,3161,-3161,-10258,5283,671,-671,5283,-4180,727,-727,-4180,-1524,3437,-3437,-1524,323,-630,630,323,-1805,2149,-2149,-1805,-4765,3400,-3400,-4765,6776,-1507,1507,6776,-12799,3563,-3563,-12799,7815,3395,-3395,7815,-5215,-1779,1779,-5215,-5187,4707,-4707,-5187,2001,4466,-4466,2001,-1889,-1454,1454,-1889,-13988,6177,-6177,-13988,4626,16826,-16826,4626,3953,14451,-14451,3953,23583,-1368,1368,23583,-839,-8836,8836,-839,-1073,187,-187,-1073,4459,814,-814,4459,791,-3092,3092,791,-3674,941,-941,-3674,7994,-235,235,7994,-9216,-721,721,-9216,8860,1344,-1344,8860,-5218,-1472,1472,-5218,264,1175,-1175,264,2687,1314,-1314,2687,-1946,-2332,2332,-1946,-3235,2709,-2709,-3235,7618,923,-923,7618,-10258,-2521,2521,-10258,7889,3690,-3690,7889,-5756,363,-363,-5756,2049,-1941,1941,2049,-943,3959,-3959,-943,-3330,-118,118,-3330,5458,-650,650,5458,-9665,3516,-3516,-9665,7671,-296,296,7671,-7263,1288,-1288,-7263,1737,2545,-2545,1737,-2536,11,-11,-2536,-2204,4353,-4353,-2204,-1458,1365,-1365,-1458,-4595,1553,-1553,-4595,-11454,18254,-18254,-11454,23261,15476,-15476,23261,8698,-5168,5168,8698,8000,-6607,6607,8000,-2492,-349,349,-2492,2968,-1785,1785,2968,3566,-810,810,3566,-4408,-567,567,-4408,8282,-1682,1682,8282,-8485,1083,-1083,-8485,9087,-440,440,9087,-4701,-2132,2132,-4701,23,2273,-2273,23,3756,-156,156,3756,-1683,-2690,2690,-1683,-3859,3124,-3124,-3859,9190,135,-135,9190,-10258,-2995,2995,-10258,7191,3559,-3559,7191,-4083,417,-417,-4083,2014,-2780,2780,2014,-1580,3399,-3399,-1580,-1957,818,-818,-1957,5726,-1944,1944,5726,-10164,2555,-2555,-10164,8250,1538,-1538,8250,-6211,-468,468,-6211,1516,1151,-1151,1516,-3729,2773,-2773,-3729,829,2129,-2129,829,-1137,-472,472,-1137,-11814,5246,-5246,-11814,4640,15529,-15529,4640,3953,13287,-13287,3953,25435,-651,651,25435,-959,-9841,9841,-959,564,-2691,2691,564,3921,3268,-3268,3921,495,-4443,4443,495,4206,-2827,2827,4206,-6729,3450,-3450,-6729,11359,-2651,2651,11359,-7598,-2469,2469,-7598,3805,2558,-2558,3805,999,-1084,1084,999,-166,-2002,2002,-166,343,1138,-1138,343,-1581,687,-687,-1581,6924,-1795,1795,6924,-10258,-195,195,-10258,10178,2466,-2466,10178,-5689,-1989,1989,-5689,1189,-860,860,1189,1370,3776,-3776,1370,-2795,-2397,2397,-2795,4518,-508,508,4518,-7967,4142,-4142,-7967,8827,-2569,2569,8827,-8020,939,-939,-8020,2490,3357,-3357,2490,-552,-1939,1939,-552,-2910,3799,-3799,-2910,-1459,1624,-1624,-1459,-1901,556,-556,-1901,-12365,17422,-17422,-12365,23261,14666,-14666,23261,11339,-4531,4531,11339,6827,-8126,8126,6827,-1117,-2293,2293,-1117,3600,882,-882,3600,2523,-3538,3538,2523,2648,-3231,3231,2648,-5092,2878,-2878,-5092,12133,-3175,3175,12133,-8952,-3136,3136,-8952,5357,3612,-3612,5357,2707,-3370,3370,2707,-2414,-2252,2252,-2414,725,3152,-3152,725,6106,-3231,3231,6106,-7589,-1090,1090,-7589,9050,1828,-1828,9050,-5796,-2471,2471,-5796,5183,-171,171,5183,-1877,214,-214,-1877,989,-1242,1242,989,2165,213,-213,2165,-1508,-1106,1106,-1508,1594,32,-32,1594,1119,99,-99,1119,-618,-1772,1772,-618,1064,896,-896,1064,764,-226,226,764,282,-1764,1764,282,156,1097,-1097,156,865,-420,420,865,845,-1335,1335,845,-604,686,-686,-604,1118,-282,282,1118,997,-835,835,997,-902,-38,38,-902,1204,146,-146,1204,895,-515,515,895,-709,-700,700,-709,949,627,-627,949,779,-415,415,779,-229,-1042,1042,-229,404,884,-884,404,802,-401,401,802,255,-1022,1022,255,-202,766,-766,-202,945,-290,290,945,543,-787,787,543,-604,324,-324,-604,1054,7,-7,1054,611,-545,545,611,-653,-226,226,-653,955,416,-416,955,578,-424,424,578,-389,-638,638,-389,592,744,-744,592,596,-405,405,596,2,-773,773,2,70,809,-809,70,728,-361,361,728,313,-662,662,313,-395,552,-552,-395,898,-169,169,898,436,-459,459,436,-604,88,-88,-604,948,186,-186,948,411,-326,326,411,-490,-367,367,-490,753,579,-579,753,379,-321,321,379,-158,-612,612,-158,319,812,-812,319,461,-366,366,461,189,-582,582,189,-195,739,-739,-195,662,-315,315,662,372,-375,375,372,-558,368,-368,-558,855,-63,63,855,346,-175,175,346,-604,-128,128,-604,859,351,-351,859,220,-127,127,220,-332,-503,503,-332,566,748,-748,566,172,-239,239,172,81,-578,578,81,40,900,-900,40,320,-365,365,320,387,-353,353,387,-496,680,-680,-496,622,-310,310,622,407,-7,7,407,-765,156,-156,-765,880,36,-36,880,150,202,-202,150,-604,-408,408,-604,850,595,-595,850,-179,91,-91,-179,-77,-677,677,-77,399,1107,-1107,399,-287,-324,324,-287,510,-415,415,510,-385,1253,-1253,-385,77,-833,833,77,688,384,-384,688,-1188,833,-833,-1188,1106,-1136,1136,1106,-221,1489,-1489,-221,-1596,-113,113,-1596,4108,-1018,1018,4108,-7233,2546,-2546,-7233,9050,-1293,1293,9050,-8577,-475,475,-8577,4423,3256,-3256,4423,144,-2272,2272,144,-3085,278,-278,-3085,486,3522,-3522,486,3964,-2643,2643,3964,-9017,919,-919,-9017,8574,3488,-3488,8574,-7333,-2086,2086,-7333,3367,1195,-1195,3367,-4334,3504,-3504,-4334,609,54,-54,609,233,1055,-1055,233,-12351,4603,-4603,-12351,5290,13436,-13436,5290,3953,15827,-15827,3953,25988,-2482,2482,25988,350,-11701,11701,350,-1777,319,-319,-1777,7073,679,-679,7073,2268,-6075,6075,2268,-4342,223,-223,-4342,10055,590,-590,10055,-6933,-4262,4262,-6933,8229,415,-415,8229,-4293,-221,221,-4293,4570,-2943,2943,4570,858,724,-724,858,-2300,-1467,1467,-2300,7339,-1592,1592,7339,-6754,896,-896,-6754,9050,-2823,2823,9050,-5867,-197,197,-5867,5299,754,-754,5299,510,-3939,3939,510,-1023,993,-993,-1023,2427,318,-318,2427,4476,-4635,4635,4476,-7542,1663,-1663,-7542,12290,-218,218,12290,-6789,-5105,5105,-6789,4507,1638,-1638,4507,2533,-691,691,2533,1530,-6353,6353,1530,1458,1007,-1007,1458,5086,-1794,1794,5086,12351,-18623,18623,12351,-24469,-15046,15046,-24469,-8270,5669,-5669,-8270,-7108,7393,-7393,-7108,1779,-625,625,1779,-3249,2791,-2791,-3249,-3130,2358,-2358,-3130,4935,-916,916,4935,-9574,2469,-2469,-9574,8236,1193,-1193,8236,-7147,-758,758,-7147,2745,1847,-1847,2745,-1793,1055,-1055,-1793,115,-426,426,115,63,840,-840,63,-3905,1639,-1639,-3905,7029,-287,287,7029,-10258,-178,178,-10258,8464,2646,-2646,8464,-5822,-566,566,-5822,1264,-687,687,1264,290,3571,-3571,290,-3192,-1160,1160,-3192,4627,-287,287,4627,-8529,3851,-3851,-8529,8236,-1638,1638,8236,-7872,1180,-1180,-7872,2257,3135,-3135,2257,-1187,-1374,1374,-1187,-2744,4069,-4069,-2744,-1533,1488,-1488,-1533,-2421,806,-806,-2421,-12231,17705,-17705,-12231,23261,14559,-14559,23261,11015,-4462,4462,11015,6896,-7902,7902,6896,-1049,-2419,2419,-1049,3441,905,-905,3441,2572,-3468,3468,2572,2802,-3373,3373,2802,-5201,2901,-2901,-5201,12297,-3299,3299,12297,-8738,-3259,3259,-8738,5196,3548,-3548,5196,3144,-3595,3595,3144,-2225,-2365,2365,-2225,533,2816,-2816,533,6875,-3309,3309,6875,-7520,-1322,1322,-7520,9050,1027,-1027,9050,-4907,-2067,2067,-4907,5151,-793,793,5151,-1142,-1164,1164,-1142,1193,-57,57,1193,2306,-1157,1157,2306,2050,-3077,3077,2050,-4784,2123,-2123,-4784,12420,-2360,2360,12420,-9558,-4415,4415,-9558,6803,3776,-3776,6803,4158,-4055,4055,4158,-2348,-5895,5895,-2348,2319,4427,-4427,2319,12951,-6490,6490,12951,-3740,-17783,17783,-3740,-5161,-11138,11138,-5161,-23767,46,-46,-23767,2414,8928,-8928,2414,-2292,2889,-2889,-2292,-2327,-2970,2970,-2327,788,4470,-4470,788,-5236,1549,-1549,-5236,7612,-2556,2556,7612,-10539,3408,-3408,-10539,7968,421,-421,7968,-3850,-1815,1815,-3850,-1291,2778,-2778,-1291,2846,-348,348,2846,-854,-1312,1312,-854,-3993,2455,-2455,-3993,8686,-894,894,8686,-10258,-1203,1203,-10258,8579,2544,-2544,8579,-4094,-1482,1482,-4094,979,-1374,1374,979,1246,2992,-2992,1246,-1130,-2297,2297,-1130,3814,-1633,1633,3814,-6488,3548,-3548,-6488,10990,-3330,3330,10990,-8841,-2003,2003,-8841,5107,3903,-3903,5107,3733,-4450,4450,3733,-2883,-3303,3303,-2883,1379,3875,-3875,1379,12859,-6204,6204,12859,-5326,-15690,15690,-5326,-5161,-11637,11637,-5161,-23995,864,-864,-23995,248,10079,-10079,248,-1613,3100,-3100,-1613,-2918,-1910,1910,-2918,-1354,4504,-4504,-1354,-4485,2905,-2905,-4485,6662,-1528,1528,6662,-11978,2363,-2363,-11978,7883,3081,-3081,7883,-5002,-950,950,-5002,-1004,801,-801,-1004,288,3523,-3523,288,-2051,-526,526,-2051,2107,-310,310,2107,-7715,3935,-3935,-7715,9050,-194,194,9050,-9792,-943,943,-9792,3693,4016,-4016,3693,-1068,337,-337,-1068,-2129,-1253,1253,-2129,-66,3656,-3656,-66,-3028,1402,-1402,-3028,5284,-1549,1549,5284,-11887,3048,-3048,-11887,9709,3250,-3250,9709,-7086,-2124,2124,-7086,-2602,2672,-2672,-2602,1779,6407,-6407,1779,-3992,-3045,3045,-3992,-5145,3730,-3730,-5145,-9832,20329,-20329,-9832,23261,11092,-11092,23261,7643,-2945,2945,7643,8129,-4960,4960,8129,192,-4721,4721,192,91,1022,-1022,91,2749,-286,286,2749,4652,-4554,4554,4652,-7985,1894,-1894,-7985,11358,-124,124,11358,-6648,-3389,3389,-6648,3298,1848,-1848,3298,1104,-810,810,1104,-162,-1462,1462,-162,-387,871,-871,-387,3928,-1318,1318,3928,-5773,642,-642,-5773,9050,-793,793,9050,-8392,-1162,1162,-8392,6193,2241,-2241,6193,-328,-2569,2569,-328,-2382,-349,349,-2382,2134,2865,-2865,2134,3602,-3773,3773,3602,-8028,702,-702,-8028,10365,2468,-2468,10365,-7292,-3923,3923,-7292,4225,1393,-1393,4225,-1014,1433,-1433,-1014,738,-2958,2958,738,691,1260,-1260,691,-1191,379,-379,-1191,2449,-1266,1266,2449}; - -int16_t LTS_F[256] __attribute__((aligned(16))) = {0,0,0,0,1,0,0,1,-1,0,0,-1,-1,0,0,-1,1,0,0,1,1,0,0,1,-1,0,0,-1,1,0,0,1,-1,0,0,-1,1,0,0,1,-1,0,0,-1,-1,0,0,-1,-1,0,0,-1,-1,0,0,-1,-1,0,0,-1,1,0,0,1,1,0,0,1,-1,0,0,-1,-1,0,0,-1,1,0,0,1,-1,0,0,-1,1,0,0,1,-1,0,0,-1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,-1,0,0,-1,-1,0,0,-1,1,0,0,1,1,0,0,1,-1,0,0,-1,1,0,0,1,-1,0,0,-1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,-1,0,0,-1,-1,0,0,-1,1,0,0,1,1,0,0,1,-1,0,0,-1,1,0,0,1,-1,0,0,-1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1}; diff --git a/openairITS/phy/DOT11/commonvars.h b/openairITS/phy/DOT11/commonvars.h deleted file mode 100644 index 866e70e8288..00000000000 --- a/openairITS/phy/DOT11/commonvars.h +++ /dev/null @@ -1 +0,0 @@ -int nibbles_per_symbol[8] = {6,9,12,18,24,36,36,54}; diff --git a/openairITS/phy/DOT11/crc32.c b/openairITS/phy/DOT11/crc32.c deleted file mode 100644 index 2a927999dc7..00000000000 --- a/openairITS/phy/DOT11/crc32.c +++ /dev/null @@ -1,29 +0,0 @@ -#include <stdint.h> - - -uint32_t crc32_table[256]; - -void init_crc32() { - - uint32_t i,j; - uint32_t crc; - - for (i=0;i<256;i++) { - crc=i; - for (j=0;j<8;j++) { - crc = (crc>>1); - if ((crc&1) > 0) - crc ^= 0xedb88320; - } - crc32_table[i]=crc; - } -} - -void crc32(uint8_t *data,uint32_t *crc,int len) { - - int i; - - for (i=0;i<len;i++) - *crc = (*crc>>8)^crc32_table[(*crc^data[i])&0xff]; - -} diff --git a/openairITS/phy/DOT11/data_detection.c b/openairITS/phy/DOT11/data_detection.c deleted file mode 100644 index 7c1e3cfb558..00000000000 --- a/openairITS/phy/DOT11/data_detection.c +++ /dev/null @@ -1,505 +0,0 @@ -#include "defs.h" -#include <stdint.h> -#include "PHY/TOOLS/defs.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#ifdef EXECTIME -#ifdef RTAI -#include <rtai_lxrt.h> -#include <rtai_sem.h> -#include <rtai_msg.h> -#else -#include <time.h> -#endif -#endif - -#define TWO_OVER_SQRT_10 20724 -#define FOUR_OVER_SQRT_42 20225 -#define TWO_OVER_SQRT_42 10112 - -extern int16_t twiddle_fft64[63*4*2]; -extern int16_t twiddle_ifft64[63*4*2]; - -extern uint16_t rev64[64]; -extern int Ndbps[8]; -extern int Ncbps[8]; - -//#define DEBUG_DATA 1 - -extern int16_t chest[256] __attribute__((aligned(16))); -extern int interleaver_bpsk[48]; -extern int interleaver_qpsk[48]; -extern int interleaver_16qam[48]; -extern int interleaver_64qam[48]; - -extern uint8_t scrambler[127*8]; - -#ifdef EXECTIME -#ifdef RTAI -RTIME dd_t1=0,dd_t2=0,dd_t3=0,dd_t4=0; -#else -long dd_t1=0,dd_t2=0,dd_t3=0,dd_t4=0; -#endif -#endif -int dd_trials=0; - -#ifdef RTAI -extern unsigned int *DAQ_MBOX; -#endif - -int16_t Pseq_rx[127] = { 1, 1, 1, 1,-1,-1,-1, 1,-1,-1,-1,-1, 1, 1,-1, 1, - -1,-1, 1, 1,-1, 1, 1,-1, 1, 1, 1, 1, 1, 1,-1, 1, - 1, 1,-1, 1, 1,-1,-1, 1, 1, 1,-1, 1,-1,-1,-1, 1, - -1, 1,-1,-1, 1,-1,-1, 1, 1, 1, 1, 1,-1,-1, 1, 1, - -1,-1, 1,-1, 1,-1, 1, 1,-1,-1,-1, 1, 1,-1,-1,-1, - -1, 1,-1,-1, 1,-1, 1, 1, 1, 1,-1, 1,-1, 1,-1, 1, - -1,-1,-1,-1,-1, 1,-1, 1, 1,-1, 1,-1, 1, 1, 1,-1, - -1, 1,-1,-1,-1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1}; - -int32_t rxDATA_F_comp_aggreg2[48*1024]; -int32_t rxDATA_F_comp_aggreg3[48*1024]; - -#ifdef EXECTIME -void print_dd_stats() { - - if (dd_trials>0) - printf("Data detection : Trials %d, dd_t1 (64pt FFT) %d ns, dd_t2 %d ns (Ch Comp.), dd_t3 %d ns (Deinter), dd_t4 %d ns (Viterbi)\n",dd_trials, - (int)dd_t1/dd_trials,(int)dd_t2/dd_trials,(int)dd_t3/dd_trials,(int)dd_t4/dd_trials); - dd_trials=0; - dd_t1=0; - dd_t2=0; - dd_t3=0; - dd_t4=0; -} -#endif - -int data_detection(RX_VECTOR_t *rxv,uint8_t *data_ind,uint32_t* rx_data,int frame_length,int rx_offset,int log2_maxh,int (*wait(int,int))) { - - uint32_t pilot1,pilot2,pilot3,pilot4; - - int16_t rxDATA_F[128*2] __attribute__((aligned(16))); - uint32_t rxDATA_F_comp[64*2] __attribute__((aligned(16))); - uint32_t rxDATA_F_comp2[48] __attribute__((aligned(16))); - uint32_t rxDATA_F_comp3[48] __attribute__((aligned(16))); - - int8_t rxDATA_llr[384] __attribute__((aligned(16))); - int8_t rxDATA_llr2[432] __attribute__((aligned(16))); - int16_t rxDATA_F_mag[48]; - int16_t rxDATA_F_mag2[48]; - int8_t *llr_ptr; - int i,j,k,k2,tmp,pos; - int *interleaver; - int dlen,dlen_symb; - int s,sprime; - uint32_t crc_rx; - char fname[30],vname[30]; - int32_t scale; - int ret; - int32_t cfo_re32,cfo_im32; - int32_t cfo_Q15; - int rx_offset2; - -#ifdef RTAI - int mbox_off = 0,old_mbox; -#endif -#ifdef EXECTIME -#ifdef RTAI - RTIME tin,tout; -#else - struct timespec tin,tout; -#endif -#endif - - // loop over all symbols - dlen = 32+16+6+(rxv->sdu_length<<3); // data length is 32-bits CRC + sdu + 16 service + 6 tail - dlen_symb = dlen/Ndbps[rxv->rate]; - if ((dlen%Ndbps[rxv->rate])>0) - dlen_symb++; -#ifdef RTAI - old_mbox = ((unsigned int *)DAQ_MBOX)[0]; -#endif - for (s=0,sprime=1;s<dlen_symb;s++,sprime++,rx_offset+=80) { -#ifdef DEBUG_DATA - printf("DATA symbol %d, rx_offset %d\n",s,rx_offset); -#endif - // synchronize to HW if needed -#ifdef RTAI - rx_offset2=rx_offset+1024; - if (rx_offset2 > frame_length) - rx_offset2 -= frame_length; - - if (old_mbox > ((unsigned int *)DAQ_MBOX)[0]) - mbox_off = 150; - // printf("dd: s %d (%d), old_mbox %d, new_mbox %d\n", - // s,rx_offset,old_mbox,((unsigned int *)DAQ_MBOX)[0]); - old_mbox = ((unsigned int *)DAQ_MBOX)[0]; - - while (((unsigned int *)DAQ_MBOX)[0]+mbox_off < (rx_offset2>>9) ) { - // printf("sleeping\n"); - rt_sleep(nano2count(66666)); - } -#endif - -#ifdef EXECTIME - dd_trials++; -#endif - - if (rx_offset>frame_length) { - rx_offset -= frame_length; -#ifdef RTAI - mbox_off = 0; -#endif - } - // index for pilot symbol lookup - if (sprime==127) - sprime=0; - - if ((rx_offset+80) > frame_length) - memcpy((void *)(rx_data+frame_length), - (void *)rx_data, - 2*sizeof(int16_t)*(rx_offset+80-frame_length)); - - -#ifdef EXECTIME -#ifdef RTAI - tin=rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - fft((int16_t *)(rx_data+rx_offset+16), /// complex input - rxDATA_F, /// complex output - &twiddle_fft64[0], /// complex twiddle factors - rev64, /// bit reversed permutation vector - 6, /// log2(FFT_SIZE) - 3, /// scale (energy normalized for 64-point) - 0); /// 0 means 64-bit complex interleaved format else complex-multiply ready repeated format -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - dd_t1 += (tout-tin); - tin=rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - dd_t1 += (tout.tv_nsec-tin.tv_nsec); - - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - - // log2_maxh=7; - mult_cpx_vector_norep_unprepared_conjx2(rxDATA_F,(int16_t*)chest,(int16_t*)rxDATA_F_comp,64,log2_maxh); -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - dd_t2 += (tout-tin); - tin=rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - dd_t2 += (tout.tv_nsec-tin.tv_nsec); - - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - - if ((s==0)&&((rxv->rate>>1)>1)) { // Compute channel magnitude for first symbol when 16QAM or 64QAM - for (i=0;i<5;i++) - rxDATA_F_mag[i] = (int16_t)((((int32_t)chest[(38+i)<<2]*(int32_t)chest[(38+i)<<2]) + ((int32_t)chest[1+((38+i)<<2)]*(int32_t)chest[1+((38+i)<<2)]))>>log2_maxh); - for (;i<18;i++) - rxDATA_F_mag[i] = (int16_t)((((int32_t)chest[(38+1+i)<<2]*(int32_t)chest[(38+1+i)<<2] + (int32_t)chest[1+((38+1+i)<<2)]*(int32_t)chest[1+((38+1+i)<<2)]))>>log2_maxh); - - for (;i<24;i++) - rxDATA_F_mag[i] = (int16_t)((((int32_t)chest[(38+2+i)<<2]*(int32_t)chest[(38+2+i)<<2] + (int32_t)chest[1+((38+2+i)<<2)]*(int32_t)chest[1+((38+2+i)<<2)]))>>log2_maxh); - // +ve portion - for (;i<30;i++) - rxDATA_F_mag[i] = (int16_t)((((int32_t)chest[(-24+1+i)<<2]*(int32_t)chest[(-24+1+i)<<2] + (int32_t)chest[1+((-24+1+i)<<2)]*(int32_t)chest[1+((-24+1+i)<<2)]))>>log2_maxh); - - for (;i<43;i++) - rxDATA_F_mag[i] = (int16_t)((((int32_t)chest[(-24+2+i)<<2]*(int32_t)chest[(-24+2+i)<<2] + (int32_t)chest[1+((-24+2+i)<<2)]*(int32_t)chest[1+((-24+2+i)<<2)]))>>log2_maxh); - - for (;i<48;i++) - rxDATA_F_mag[i] = (int16_t)((((int32_t)chest[(-24+3+i)<<2]*(int32_t)chest[(-24+3+i)<<2] + (int32_t)chest[1+((-24+3+i)<<2)]*(int32_t)chest[1+((-24+3+i)<<2)]))>>log2_maxh); - - if ((rxv->rate>>1) == 2) - scale = TWO_OVER_SQRT_10; - else - scale = FOUR_OVER_SQRT_42; - - for (i=0;i<48;i++) { - // printf("mag[%d] = %d\n",i,rxDATA_F_mag[i]); - rxDATA_F_mag[i] = (int16_t)((rxDATA_F_mag[i]*scale)>>15); - } - if ((rxv->rate>>1) == 3) - for (i=0;i<48;i++) - rxDATA_F_mag2[i] = (int16_t)((rxDATA_F_mag[i]*TWO_OVER_SQRT_42)>>15); - } - - // extract 48 statistics and 4 pilot symbols - // -ve portion - for (i=0;i<5;i++) - rxDATA_F_comp2[i] = rxDATA_F_comp[(38+i)]; - pilot1 = ((uint32_t*)rxDATA_F)[(38+5)<<1]; - - for (;i<18;i++) - rxDATA_F_comp2[i] = rxDATA_F_comp[(38+1+i)]; - pilot2 = ((uint32_t*)rxDATA_F)[(38+19)<<1]; - - for (;i<24;i++) - rxDATA_F_comp2[i] = rxDATA_F_comp[(38+2+i)]; - - // +ve portion - for (;i<30;i++) - rxDATA_F_comp2[i] = rxDATA_F_comp[(-24+1+i)]; - pilot3 = ((uint32_t*)rxDATA_F)[(6+1)<<1]; - for (;i<43;i++) - rxDATA_F_comp2[i] = rxDATA_F_comp[(-24+2+i)]; - pilot4 = ((uint32_t*)rxDATA_F)[(19+2)<<1];((int16_t *)&pilot4)[0]=-((int16_t *)&pilot4)[0];((int16_t *)&pilot4)[1]=-((int16_t *)&pilot4)[1]; - for (;i<48;i++) - rxDATA_F_comp2[i] = rxDATA_F_comp[(-24+3+i)]; - - - - - // CFO compensation - - cfo_re32 = ((((int16_t *)&pilot1)[0]*(int32_t)chest[(38+5)<<2]) + - (((int16_t *)&pilot1)[1]*(int32_t)chest[1+((38+5)<<2)]))>>2; - cfo_im32 = (((((int16_t *)&pilot1)[1]*(int32_t)chest[(38+5)<<2]) - - (((int16_t *)&pilot1)[0]*(int32_t)chest[1+((38+5)<<2)])))>>2; - - - cfo_re32 += (((((int16_t *)&pilot2)[0]*(int32_t)chest[(38+19)<<2]) + - (((int16_t *)&pilot2)[1]*(int32_t)chest[1+((38+19)<<2)])))>>2; - cfo_im32 += (((((int16_t *)&pilot2)[1]*(int32_t)chest[(38+19)<<2]) - - (((int16_t *)&pilot2)[0]*(int32_t)chest[1+((38+19)<<2)])))>>2; - - cfo_re32 += (((((int16_t *)&pilot3)[0]*(int32_t)chest[(6+1)<<2]) + - (((int16_t *)&pilot3)[1]*(int32_t)chest[1+((6+1)<<2)])))>>2; - cfo_im32 += (((((int16_t *)&pilot3)[1]*(int32_t)chest[(6+1)<<2]) - - (((int16_t *)&pilot3)[0]*(int32_t)chest[1+((6+1)<<2)])))>>2; - - cfo_re32 += (((((int16_t *)&pilot4)[0]*(int32_t)chest[(19+2)<<2]) + - (((int16_t *)&pilot4)[1]*(int32_t)chest[1+((19+2)<<2)])))>>2; - cfo_im32 += (((((int16_t *)&pilot4)[1]*(int32_t)chest[(19+2)<<2]) - - (((int16_t *)&pilot4)[0]*(int32_t)chest[1+((19+2)<<2)])))>>2; - - ((int16_t*)&cfo_Q15)[0] = (int16_t)(cfo_re32>>((log2_maxh)))*Pseq_rx[sprime]; - ((int16_t*)&cfo_Q15)[1] = -(int16_t)(cfo_im32>>((log2_maxh)))*Pseq_rx[sprime]; -#ifdef DEBUG_DATA - printf("dd: s %d, p=[%d+(%d)*j , %d+(%d)*j , %d+(%d)*j , %d+(%d)*j] * ch =[%d+(%d)*j , %d+(%d)*j , %d+(%d)*j , %d+(%d)*j] => cfo_Q15 (%d,%d), CFO32 (%d,%d)\n",s, - ((int16_t *)&pilot1)[0]*Pseq_rx[sprime],((int16_t *)&pilot1)[1]*Pseq_rx[sprime], - ((int16_t *)&pilot2)[0]*Pseq_rx[sprime],((int16_t *)&pilot2)[1]*Pseq_rx[sprime], - ((int16_t *)&pilot3)[0]*Pseq_rx[sprime],((int16_t *)&pilot3)[1]*Pseq_rx[sprime], - ((int16_t *)&pilot4)[0]*Pseq_rx[sprime],((int16_t *)&pilot4)[1]*Pseq_rx[sprime], - chest[(38+5)<<2],chest[1+((38+5)<<2)], - chest[(38+19)<<2],chest[1+((38+19)<<2)], - chest[(6+1)<<2],chest[1+((6+1)<<2)], - chest[(19+2)<<2],chest[1+((19+2)<<2)], - ((int16_t*)&cfo_Q15)[0],((int16_t*)&cfo_Q15)[1], - cfo_re32,cfo_im32); -#endif - - rotate_cpx_vector_norep(rxDATA_F_comp2,&cfo_Q15,rxDATA_F_comp3,48,log2_maxh>>1); - -#ifdef DEBUG_DATA - if (s==0) - write_output("rxDATA_F_mag.m","rxDAT_mag",rxDATA_F_mag,48,1,0); - sprintf(fname,"rxDATA_F%d.m",s); - sprintf(vname,"rxDAT_F_%d",s); - write_output(fname,vname, rxDATA_F,128,2,1); - write_output("rxDATA_F_comp.m","rxDAT_F_comp", rxDATA_F_comp,64,1,1); - sprintf(fname,"rxDATA_F_comp2_%d.m",s); - sprintf(vname,"rxDAT_F_comp2_%d",s); - write_output(fname,vname, rxDATA_F_comp2,48,1,1); - sprintf(fname,"rxDATA_F_comp3_%d.m",s); - sprintf(vname,"rxDAT_F_comp3_%d",s); - write_output(fname,vname, rxDATA_F_comp3,48,1,1); -#endif - // LLR Computation - - for (i=0;i<48;i++) { - rxDATA_F_comp_aggreg3[(48*s) + i] = rxDATA_F_comp3[i]; - rxDATA_F_comp_aggreg2[(48*s) + i] = rxDATA_F_comp2[i]; - } - - switch (rxv->rate>>1) { - case 0: // BPSK - llr_ptr = rxDATA_llr; - memset(rxDATA_llr,0,48); - for (k=0;k<48;k++) { - pos = interleaver_bpsk[k]; - tmp = ((int16_t*)rxDATA_F_comp3)[pos<<1]>>4; - if (tmp<-8) - rxDATA_llr[k] = -8; - else if (tmp>7) - rxDATA_llr[k] = 7; - else - rxDATA_llr[k] = (int8_t)tmp; - - // printf("rxDATA_coded %d(%d) : %d\n",k,pos,rxDATA_llr[k]); - } - if (rxv->rate==1) { // rate 3/4, so add zeros for punctured bits - llr_ptr = rxDATA_llr2; - memset(rxDATA_llr2,0,72); - for (k=0,k2=0;k<48;k++,k2++) { - rxDATA_llr2[k2] = rxDATA_llr[k]; - if ((k&3) == 2) - k2+=2; - } - } - break; - case 1: // QPSK - llr_ptr = rxDATA_llr; - memset(rxDATA_llr,0,96); - for (k=0;k<96;k++) { - pos = interleaver_qpsk[k]; - tmp = ((int16_t*)rxDATA_F_comp3)[pos]>>4; - - if (tmp<-8) - rxDATA_llr[k] = -8; - else if (tmp>7) - rxDATA_llr[k] = 7; - else - rxDATA_llr[k] = (int8_t)tmp; - } - if (rxv->rate==3) { // rate 3/4, so add zeros for punctured bits - llr_ptr = rxDATA_llr2; - memset(rxDATA_llr2,0,144); - for (k=0,k2=0;k<96;k++,k2++) { - rxDATA_llr2[k2] = rxDATA_llr[k]; - if ((k&3) == 2) - k2+=2; - } - } - break; - case 2: // 16QAM - llr_ptr = rxDATA_llr; - memset(rxDATA_llr,0,192); - for (k=0;k<192;k++) { - pos = interleaver_16qam[k]; - // printf("k %d, pos %d\n",k,pos); - if ((pos&1)==1) { - tmp = ((int16_t*)rxDATA_F_comp2)[pos>>1]>>4; - // printf("pos (msb) %d : %d\n",pos>>1,tmp); - } - else { - tmp = ((int16_t*)rxDATA_F_comp2)[pos>>1]; - tmp = (tmp<0)? tmp : -tmp; - tmp = (tmp + rxDATA_F_mag[pos>>2])>>4; - // printf("pos (lsb) %d : rxDATA_F_mag[%d] %d : %d (%d)\n",pos>>1,pos>>2,rxDATA_F_mag[pos>>2],tmp,((int16_t*)rxDATA_F_comp2)[pos>>1]); - } - - if (tmp<-8) - rxDATA_llr[k] = -8; - else if (tmp>7) - rxDATA_llr[k] = 7; - else - rxDATA_llr[k] = (int8_t)tmp; - /* - if (tmp<-128) - rxDATA_llr[k] = -128; - else if (tmp>127) - rxDATA_llr[k] = 127; - else - rxDATA_llr[k] = (int8_t)tmp; - */ - } - if (rxv->rate==5) { // rate 3/4, so add zeros for punctured bits - llr_ptr = rxDATA_llr2; - memset(rxDATA_llr2,0,288); - for (k=0,k2=0;k<192;k++,k2++) { - rxDATA_llr2[k2] = rxDATA_llr[k]; - if ((k&3) == 2) - k2+=2; - } - } -#ifdef DEBUG_DATA - sprintf(fname,"rxDATA_llr_%d.m",s); - sprintf(vname,"rxDAT_llr_%d",s); - write_output(fname,vname, rxDATA_llr,192,1,4); -#endif - break; - case 3: // 64QAM - return(0==1); - break; - } - /* - printf("LLRs:"); - for (i=0;i<48;i++) - printf("%d,",llr_ptr[i]); - - printf("viterbi s %d/%d\n",s,dlen_symb-1); - */ -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - dd_t3 += (tout-tin); - tin=rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - dd_t3 += (tout.tv_nsec-tin.tv_nsec); - - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - - if (s < (dlen_symb-1)) - phy_viterbi_dot11_sse2(llr_ptr,data_ind,Ndbps[rxv->rate],s*Ndbps[rxv->rate],0); - else { - phy_viterbi_dot11_sse2(llr_ptr,data_ind,Ndbps[rxv->rate],s*Ndbps[rxv->rate],1); - - // scramble data - // printf("DATA %x.%x.",data_ind[0],data_ind[1]); - data_ind[0] ^= scrambler[0]; // service byte 0 - data_ind[1] ^= scrambler[1]; // service byte 1 - - j=2; - for (i=0;i<(rxv->sdu_length+4);i++,j++) { // sdu+crc - // printf("%x.",data_ind[i+2]); - if (j==(127*8)) - j=0; - data_ind[i+2]^=scrambler[j]; - - } - // printf("\n"); - - crc_rx = 0xffffffff; - crc32(data_ind,&crc_rx,2+rxv->sdu_length); -#ifdef DEBUG_DATA - printf("Received CRC %x.%x.%x.%x (%x), computed %x\n", - data_ind[2+rxv->sdu_length], - data_ind[2+rxv->sdu_length+1], - data_ind[2+rxv->sdu_length+2], - data_ind[2+rxv->sdu_length+3], - *(uint32_t*)&data_ind[2+rxv->sdu_length], - crc_rx); - - printf("SDU length %d\n",rxv->sdu_length); - for (i=0;i<rxv->sdu_length;i++) { - if ((i&15) == 0) - printf("\n %04x : %02x",i,data_ind[2+i]); - else - printf(".%02x",data_ind[2+i]); - } - printf("\n"); -#endif - } -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - dd_t4 += (tout-tin); - tin=rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - dd_t4 += (tout.tv_nsec-tin.tv_nsec); -#endif -#endif - } - - - - - return(*(uint32_t*)&data_ind[2+rxv->sdu_length] == crc_rx); - -} diff --git a/openairITS/phy/DOT11/defs.h b/openairITS/phy/DOT11/defs.h deleted file mode 100644 index 3bcb474d883..00000000000 --- a/openairITS/phy/DOT11/defs.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef __DOT11DEFS_H__ -#define __DOT11DEFS_H__ - -#include <stdint.h> - -#define MAX_SDU_SIZE 4095 -#define AMP 1024 - -#define ONE_OVER_SQRT_2 23170 -#define ONE_OVER_SQRT_10 10362 -#define ONE_OVER_SQRT_42 7150 - -typedef enum { - BPSK_1_2=0, - BPSK_3_4=1, - QPSK_1_2=2, - QPSK_3_4=3, - QAM16_1_2=4, - QAM16_3_4=5, - QAM64_1_2=6, - QAM64_3_4=7 -} RATE_t; - - -typedef struct { - int sdu_length; - RATE_t rate; - int service; -} TX_VECTOR_t; - -typedef enum { - BUSY = 0, - IDLE = 1 -} CHANNEL_STATUS_t; - -typedef TX_VECTOR_t RX_VECTOR_t; - -int phy_tx_start(TX_VECTOR_t *tx_vector,uint32_t *tx_frame,uint32_t next_TXop_offset,int frame_length,uint8_t *data_ind); -int phy_tx_start_bot(TX_VECTOR_t *tx_vector,int16_t *output_ptr,uint32_t next_TXop_offset,int frame_length,uint8_t *data_ind); - -CHANNEL_STATUS_t initial_sync(RX_VECTOR_t **rx_vector,int *rx_offset,int *log2_maxh,uint32_t *rx_frame,int rx_frame_length,int initial_sample_offset,int one_shot); -int data_detection(RX_VECTOR_t *rxv,uint8_t *data_ind,uint32_t* rx_data,int frame_length,int rx_offset,int log2_maxh,int (*wait(int,int))); - -void print_is_stats(void); -void print_dd_stats(void); -#endif diff --git a/openairITS/phy/DOT11/generate_STSLTS_corr.m b/openairITS/phy/DOT11/generate_STSLTS_corr.m deleted file mode 100644 index 6e5ebf2e9d9..00000000000 --- a/openairITS/phy/DOT11/generate_STSLTS_corr.m +++ /dev/null @@ -1,61 +0,0 @@ -nSubcarriers = 48; % Number of data subcarriers -nPilots = 4; % Number of pilot subcarriers -nPointsFFT = 64; % Number of FFT points -nGuardSamples = nPointsFFT/4; % Samples in the guard interval - -shortseq = (1.472) * complex(1,1)* ... - [0, 0, 1, 0, 0, 0,-1, 0, 0, 0, 1, 0, 0, 0,-1, 0, 0, 0,-1, 0, 0, 0, 1, 0, 0, 0, ... - 0, 0, 0, 0,-1, 0, 0, 0,-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0]; -X=zeros(nPointsFFT,1); % Empty input to the IFFT -% Map subcarriers -X(39:64) = shortseq(1:26); % Map subcarriers -26 to -1 -X(1) = shortseq(27); % Map DC subcarrier (not really necessary) -X(2:27) = shortseq(28:53); % Map subcarriers 1 to 26 -% IFFT and scale -x=sqrt(nPointsFFT)*ifft(X,nPointsFFT); % IFFT -% Repeat for 2.5 times -short_preamble=[x;x;x(1:32)]; - -longseq = [1, 1,-1,-1, 1, 1,-1, 1,-1, 1, 1, 1, 1, 1, 1,-1,-1, 1, 1,-1, 1,-1, 1, 1, 1, 1, ... - 0, 1,-1,-1, 1, 1,-1, 1,-1, 1,-1,-1,-1,-1,-1, 1, 1,-1,-1, 1,-1, 1,-1, 1, 1, 1, 1]; -X=zeros(nPointsFFT,1); % Empty input to the IFFT -% Map subcarriers -X(39:64) = longseq(1:26); % Map subcarriers -26 to -1 -X(1) = longseq(27); % Map DC subcarrier (not really necessary) -X(2:27) = longseq(28:53); % Map subcarriers 1 to 26 -% IFFT and scale -x=sqrt(nPointsFFT)*ifft(X,nPointsFFT); % IFFT -% Cyclic prefix using block-diagonal matrix T (note: double length!) -I=eye(2*nPointsFFT); % Identitity matrix used to construct T -T=[I(2*nPointsFFT-2*nGuardSamples+1:end,:);I]; % Matrix for cyclic prefix insertion -% Prepend the prefix once to two copies of the sequence -long_preamble=T*[x;x]; - - -STS_LTS = [short_preamble.' long_preamble.']; - -STS_LTS_F = fft(STS_LTS,512); - -STS_LTS_2 = floor(32767*STS_LTS_F/sqrt(512*9)); - -STS_LTS_3 = zeros(2048,1); - -STS_LTS_3(1:4:end) = real(STS_LTS_2); -STS_LTS_3(2:4:end) = imag(STS_LTS_2); -STS_LTS_3(3:4:end) = -imag(STS_LTS_2); -STS_LTS_3(4:4:end) = real(STS_LTS_2); - -fd = fopen("STS_LTS_F.h","w"); -fprintf(fd,"int16_t STS_LTS_F[2048] __attribute__((aligned(16))) = {"); -fprintf(fd,"%d,",STS_LTS_3(1:(end-1))); -fprintf(fd,"%d};\n\n",STS_LTS_3(end)); - - -X2 = zeros(256,1); -X2(1:4:end) = X; -X2(4:4:end) = X; -fprintf(fd,"int16_t LTS_F[256] __attribute__((aligned(16))) = {"); -fprintf(fd,"%d,",X2(1:(end-1))); -fprintf(fd,"%d};\n",X2(end)); - -fclose(fd); diff --git a/openairITS/phy/DOT11/initial_sync.c b/openairITS/phy/DOT11/initial_sync.c deleted file mode 100644 index bbc59e8b7d5..00000000000 --- a/openairITS/phy/DOT11/initial_sync.c +++ /dev/null @@ -1,506 +0,0 @@ -#ifdef EXECTIME -#ifdef RTAI -#include <rtai_lxrt.h> -#include <rtai_sem.h> -#include <rtai_msg.h> -#else -#include <time.h> -#endif -#endif - -#include "defs.h" -#include <stdint.h> -#include "STS_LTS_F.h" -#include "PHY/TOOLS/defs.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "PHY/TOOLS/twiddle512.h" -#include "PHY/TOOLS/twiddle64.h" - -#define CA_THRESHOLD 40 - -//extern int16_t twiddle_fft64[63*4*2]; -//extern int16_t twiddle_ifft64[63*4*2]; - -uint16_t rev512[512]; -extern uint16_t rev64[64]; -int init_rev=0; - -int rate2ind[16] = {0,0,0,0,0,0,0,0,6,4,2,0,7,5,3,1}; - -//#define DEBUG_SYNC 1 - -//#define EXECTIME 1 - -RX_VECTOR_t rxv; -int16_t chest[256] __attribute__((aligned(16))); -extern int interleaver_bpsk[48]; -int16_t signalF[512*2*2]; -int16_t corrT[1024*2] __attribute__((aligned(16))); -int16_t corrF[1024*2] __attribute__((aligned(16))); -int16_t rxLTS_F[128*2] __attribute__((aligned(16))); -int16_t rxSIGNAL_F[128*2] __attribute__((aligned(16))); -uint32_t rxSIGNAL_F_comp[64*2] __attribute__((aligned(16))); -uint32_t rxSIGNAL_F_comp2[48] __attribute__((aligned(16))); -uint32_t rxSIGNAL_F_comp3[48] __attribute__((aligned(16))); -int8_t rxSIGNAL_llr[48] __attribute__((aligned(16))); -int mag,max_mag; - -#ifdef EXECTIME -#ifdef RTAI -RTIME is_t1=0,is_t2=0,is_t3=0,is_t4=0,is_t5,is_t6,is_t7,is_t8,is_t9; -extern unsigned int *DAQ_MBOX; -unsigned int is_mbox1,is_mbox2; -#else -long is_t1=0,is_t2=0,is_t3=0,is_t4=0,is_t5,is_t6,is_t7,is_t8,is_t9; -#endif -int init_synch_trials=0; -int signal_trials=0; - -void print_is_stats() { - - if (init_synch_trials>0) { - printf("Initial sync stats (STSLTS Corr) : Trials %d, is_t1 (512pt FFT) %d ns, is_t2 %d ns (STSLTS Corr), is_t3 %d ns (512pt IFFT), is_t4 %d ns (Peak Search/Detection)\n",init_synch_trials, - (int)is_t1/init_synch_trials,(int)is_t2/init_synch_trials,(int)is_t3/init_synch_trials,(int)is_t4/init_synch_trials); -#ifdef RTAI - printf("is_mbox1 (STS) %f (%f us)\n", - (10.0*is_mbox1/init_synch_trials)/10.0, - (666*is_mbox1/init_synch_trials)/10.0); -#endif - } - - if (signal_trials>0) { - printf("Initial sync stats (SIGNAL) : Trials %d, is_t5 (LTS FFT) %d ns, is_t6 (LTS Est.) %d ns, is_t7 (SIGNAL FFT) %d ns, is_t8 (SIGNAL Comp. + Deinter) %d ns, is_t9 (SIGNAL Viterbi) %d ns\n",signal_trials, - (int)is_t5/signal_trials,(int)is_t6/signal_trials,(int)is_t7/signal_trials,(int)is_t8/signal_trials,(int)is_t9/signal_trials); -#ifdef RTAI - printf("is_mbox2 (STS+SIGNAL) %f (%f us)\n", - (10.0*is_mbox2/signal_trials)/10.0, - (666*is_mbox2/signal_trials)/10.0); -#endif - } - init_synch_trials=0; - signal_trials=0; - is_t1=0; - is_t2=0; - is_t3=0; - is_t4=0; - is_t5=0; - is_t6=0; - is_t7=0; - is_t8=0; - is_t9=0; -#ifdef RTAI - is_mbox1=0; - is_mbox2=0; -#endif -} -#endif - -int is_sleeping_cnt=0; -CHANNEL_STATUS_t initial_sync(RX_VECTOR_t **rx_vector, - int *rx_offset, - int *log2_maxh, - uint32_t *rx_frame, - int rx_frame_length, - int initial_sample_offset, - int one_shot) { - - int32_t energy,peak_energy,mean_energy; - int n,i,i2,j,j2,k,peak_pos,found_sync=0,LTS2_pos,SIGNAL_pos,offset; - uint32_t pilot1,pilot2,pilot3,pilot4; - int16_t tmp; - int pos; - int32_t cfo_re32,cfo_im32; - int32_t cfo_Q15; - - uint8_t signal_sdu[3] __attribute__((aligned(16))); - - int signal_parity; -#ifdef EXECTIME -#ifdef RTAI - RTIME tin,tout; - unsigned int mboxin,mboxout; -#else - struct timespec tin,tout; -#endif -#endif - int ret; - // int32_t m[640]; - // int16_t re,im; - - if (init_rev == 0) - init_fft(512,9,rev512); - - // Check for start of PLCP in buffer (scan over 640 sample span) - - peak_energy = 0; - peak_pos = 0; - // m[0] = 0; - - // for (n=0;n<640;n+=160) { - // for (j=n;j<n+160;j++) { - // re = ((int16_t *)(rx_frame+rx_frame_pos+j))[0]; - // im = ((int16_t *)(rx_frame+rx_frame_pos+j))[1]; - // m[j+1] = ((3*m[j])>>2) + (((int32_t)re*re + (int32_t)im*im)>>2); -#ifdef DEBUG_SYNC - // printf("j %d (%d) : m[j] %d,m[j-10] %d, re %d, im %d, abs %d\n",j,rx_frame_pos,m[j],m[j-10],re,im,(int32_t)re*re + (int32_t)im*im); -#endif - // if ((j>20) && (m[j] > (m[j-10]<<3))) { - n = initial_sample_offset - (initial_sample_offset&3); - if ((n+640)>rx_frame_length) - memcpy((void*)rx_frame+rx_frame_length,(void*)rx_frame,(n+640-rx_frame_length)<<2); -#ifdef EXECTIME -#ifdef RTAI - tin=rt_get_time_ns(); - mboxin = ((unsigned int *)DAQ_MBOX)[0]; -#else - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - - // ensure 64-bit alignment on FFT input - // if ((j&1) == 0) - // offset=6; - // else - // offset=5; - - fft((int16_t *)(rx_frame+n), /// complex input - signalF, /// complex output - &twiddle_fft512[0], /// complex twiddle factors - rev512, /// bit reversed permutation vector - 9, /// log2(FFT_SIZE) - 4, /// scale (energy normalized for 64-point) - 0); /// 0 means 64-bit complex interleaved format else complex-multiply ready repeated format -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - is_t1 += (tout-tin); - tin=rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - is_t1 += (tout.tv_nsec-tin.tv_nsec); - - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - mult_cpx_vector(signalF,STS_LTS_F,corrF,512,15); - -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - is_t2 += (tout-tin); - tin=rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - is_t2 += (tout.tv_nsec-tin.tv_nsec); - - - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - - fft(corrF, /// complex input - corrT, /// complex output - &twiddle_ifft512[0], /// complex twiddle factors - rev512, /// bit reversed permutation vector - 9, /// log2(FFT_SIZE) - 5, /// scale (energy normalized for 64-point) - 1); /// 0 means 64-bit complex interleaved format else complex-multiply ready repeated format - -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - is_t3 += (tout-tin); - tin=rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - is_t3 += (tout.tv_nsec-tin.tv_nsec); - - - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - - // look for peak and compare to average output - mean_energy = 0; - peak_energy = 0; - for (i2=0,j2=0;i2<512;i2++,j2+=4) { - energy = corrT[j2]*corrT[j2] + corrT[j2+1]*corrT[j2+1]; - if (energy > peak_energy) { - peak_energy = energy; - peak_pos = n+i2; - if ((peak_pos&1)==1) - peak_pos--; // ensure peak_pos is 64-bit aligned - } - mean_energy += energy; - } - - mean_energy -= peak_energy; - mean_energy>>=9; -#ifdef DEBUG_SYNC - if (mean_energy>0) - printf("n %d: mean energy %d/%d dB, peak_energy %d/%d dB, ratio %d, pos %d\n",n,mean_energy,dB_fixed(mean_energy),peak_energy,dB_fixed(peak_energy),peak_energy/mean_energy,peak_pos); - else - printf("n %d: mean energy %d\n",n,mean_energy); - // for (j2=n;j2<=j;j2++) - // printf("m[%d] %d\n",j2,m[j2]); -#endif - -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - is_t4 += (tout-tin); - tin=rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - is_t4+=(tout.tv_nsec-tin.tv_nsec); -#endif - init_synch_trials++; -#endif -#ifdef EXECTIME -#ifdef RTAI - mboxout = ((unsigned int *)DAQ_MBOX)[0]; - if (mboxout < mboxin) - is_mbox1 += ((150+mboxout)-mboxin); - else - is_mbox1 += (mboxout-mboxin); -#endif -#endif - - if ((dB_fixed(mean_energy) > 10) && (peak_energy>(50*mean_energy))) { -#ifdef DEBUG_SYNC - write_output("STSLTScorr.m","STSLTScorrT", corrT,512,2,1); -#endif - // *rx_vector = &rxv; - *rx_vector = NULL; - - // now try to estimate channel and decode SIGNAL field - LTS2_pos = peak_pos + 240; -#ifdef EXECTIME -#ifdef RTAI - tin=rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - fft((int16_t *)(rx_frame+16+LTS2_pos), /// complex input - rxLTS_F, /// complex output - &twiddle_fft64[0], /// complex twiddle factors - rev64, /// bit reversed permutation vector - 6, /// log2(FFT_SIZE) - 3, /// scale (energy normalized for 64-point) - 0); /// 0 means 64-bit complex interleaved format else complex-multiply ready repeated format -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - is_t5 += (tout-tin); - tin = rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - is_t5+=(tout.tv_nsec-tin.tv_nsec); - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - mult_cpx_vector(rxLTS_F,LTS_F,chest,64,0); - -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - is_t6 += (tout-tin); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - is_t6+=(tout.tv_nsec-tin.tv_nsec); -#endif -#endif - -#ifdef DEBUG_SYNC - write_output("rxLTS.m","rLTS", rx_frame+16+LTS2_pos,64,1,1); - write_output("rxLTS_F.m","rLTS_F", rxLTS_F,256,1,1); - write_output("chest.m","ch", chest,128,1,1); -#endif - -#ifdef EXECTIME -#ifdef RTAI - tin = rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - - SIGNAL_pos = LTS2_pos + 80; - fft((int16_t *)(rx_frame+16+SIGNAL_pos), /// complex input - rxSIGNAL_F, /// complex output - &twiddle_fft64[0], /// complex twiddle factors - rev64, /// bit reversed permutation vector - 6, /// log2(FFT_SIZE) - 3, /// scale (energy normalized for 64-point) - 0); /// 0 means 64-bit complex interleaved format else complex-multiply ready repeated format - max_mag=0; - for (i=0;i<256;i+=4) { - mag = (int32_t)chest[i]*chest[i] + (int32_t)chest[i+1]*chest[i+1]; - if (mag > max_mag) - max_mag = mag; - } - *log2_maxh = log2_approx(max_mag)/2; - - - mult_cpx_vector_norep_unprepared_conjx2(rxSIGNAL_F,chest,(int16_t*)rxSIGNAL_F_comp,64,*log2_maxh); -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - is_t7 += (tout-tin); - tin = rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - is_t7+=(tout.tv_nsec-tin.tv_nsec); - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - // extract 48 statistics and 4 pilot symbols - // -ve portion - for (i=0;i<5;i++) - rxSIGNAL_F_comp2[i] = rxSIGNAL_F_comp[(38+i)]; - pilot1 = ((uint32_t*)rxSIGNAL_F)[(38+5)<<1]; - - for (;i<18;i++) - rxSIGNAL_F_comp2[i] = rxSIGNAL_F_comp[(38+1+i)]; - pilot2 = ((uint32_t*)rxSIGNAL_F)[(38+19)<<1]; - - for (;i<24;i++) - rxSIGNAL_F_comp2[i] = rxSIGNAL_F_comp[(38+2+i)]; - - // +ve portion - for (;i<30;i++) - rxSIGNAL_F_comp2[i] = rxSIGNAL_F_comp[(-24+1+i)]; - pilot3 = ((uint32_t*)rxSIGNAL_F)[(6+1)<<1]; - for (;i<43;i++) - rxSIGNAL_F_comp2[i] = rxSIGNAL_F_comp[(-24+2+i)]; - pilot4 = ((uint32_t*)rxSIGNAL_F)[(19+2)<<1];((int16_t *)&pilot4)[0]=-((int16_t *)&pilot4)[0];((int16_t *)&pilot4)[1]=-((int16_t *)&pilot4)[1]; - for (;i<48;i++) - rxSIGNAL_F_comp2[i] = rxSIGNAL_F_comp[(-24+3+i)]; - - // CFO compensation - cfo_re32 = ((((int16_t *)&pilot1)[0]*(int32_t)chest[(38+5)<<2]) + - (((int16_t *)&pilot1)[1]*(int32_t)chest[1+((38+5)<<2)])); - cfo_im32 = -((((int16_t *)&pilot1)[1]*(int32_t)chest[(38+5)<<2]) + - (((int16_t *)&pilot1)[0]*(int32_t)chest[1+((38+5)<<2)])); - - cfo_re32 += (((((int16_t *)&pilot2)[0]*(int32_t)chest[(38+19)<<2]) + - (((int16_t *)&pilot2)[1]*(int32_t)chest[1+((38+19)<<2)]))); - cfo_im32 += (-((((int16_t *)&pilot2)[1]*(int32_t)chest[(38+19)<<2]) + - (((int16_t *)&pilot2)[0]*(int32_t)chest[1+((38+19)<<2)]))); - - cfo_re32 += (((((int16_t *)&pilot3)[0]*(int32_t)chest[(6+1)<<2]) + - (((int16_t *)&pilot3)[1]*(int32_t)chest[1+((6+1)<<2)]))); - cfo_im32 += (-((((int16_t *)&pilot3)[1]*(int32_t)chest[(6+1)<<2]) + - (((int16_t *)&pilot3)[0]*(int32_t)chest[1+((6+1)<<2)]))); - - cfo_re32 += (((((int16_t *)&pilot4)[0]*(int32_t)chest[(19+2)<<2]) + - (((int16_t *)&pilot4)[1]*(int32_t)chest[1+((19+2)<<2)]))); - cfo_im32 += (-((((int16_t *)&pilot4)[1]*(int32_t)chest[(19+2)<<2]) + - (((int16_t *)&pilot4)[0]*(int32_t)chest[1+((19+2)<<2)]))); - - ((int16_t*)&cfo_Q15)[0] = (int16_t)(cfo_re32>>(2+*log2_maxh)); - ((int16_t*)&cfo_Q15)[1] = (int16_t)(cfo_im32>>(2+*log2_maxh)); -#ifdef DEBUG_SYNC - printf("is: p=[%d+(%d)*j , %d+(%d)*j , %d+(%d)*j , %d+(%d)*j] * ch =[%d+(%d)*j , %d+(%d)*j , %d+(%d)*j , %d+(%d)*j] => cfo_Q15 (%d,%d), CFO32 (%d,%d)\n", - ((int16_t *)&pilot1)[0],((int16_t *)&pilot1)[1], - ((int16_t *)&pilot2)[0],((int16_t *)&pilot2)[1], - ((int16_t *)&pilot3)[0],((int16_t *)&pilot3)[1], - ((int16_t *)&pilot4)[0],((int16_t *)&pilot4)[1], - chest[(38+5)<<2],chest[1+((38+5)<<2)], - chest[(38+19)<<2],chest[1+((38+19)<<2)], - chest[(6+1)<<2],chest[1+((6+1)<<2)], - chest[(19+2)<<2],chest[1+((19+2)<<2)], - ((int16_t*)&cfo_Q15)[0],((int16_t*)&cfo_Q15)[1], - cfo_re32,cfo_im32); -#endif - - rotate_cpx_vector_norep(rxSIGNAL_F_comp2,&cfo_Q15,rxSIGNAL_F_comp3,48,*log2_maxh>>1); - -#ifdef DEBUG_SYNC - write_output("rxSIGNAL_F.m","rxSIG_F", rxSIGNAL_F,128,2,1); - write_output("rxSIGNAL_F_comp.m","rxSIG_F_comp", rxSIGNAL_F_comp,64,1,1); - write_output("rxSIGNAL_F_comp2.m","rxSIG_F_comp2", rxSIGNAL_F_comp2,48,1,1); -#endif - - // CFO compensation - - // now deinterleave SIGNAL - for (k=0;k<48;k++) { - // printf("interleaver_bpsk[%d] = %d\n",k,interleaver_bpsk[k]); - tmp = ((int16_t*)rxSIGNAL_F_comp3)[k<<1]>>4; - pos = interleaver_bpsk[k]; - if (tmp<-8) - rxSIGNAL_llr[pos] = -8; - else if (tmp>7) - rxSIGNAL_llr[pos] = 7; - else - rxSIGNAL_llr[pos] = (int8_t)tmp; - // rxSIGNAL_llr[k] = (tmp > 7) ? 7 : ((tmp < -8) ? -8 : (int8_t)tmp); - } -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - is_t8 += (tout-tin); - tin = rt_get_time_ns(); -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - is_t8+=(tout.tv_nsec-tin.tv_nsec); - ret=clock_gettime(CLOCK_REALTIME,&tin); -#endif -#endif - // Viterbi decoding - signal_sdu[0]=0; - signal_sdu[1]=0; - signal_sdu[2]=0; - - phy_viterbi_dot11_sse2(rxSIGNAL_llr,signal_sdu,24,0,1); - - // check parity and reconstruct RX_VECTOR - signal_parity = 0; - for (i=0;i<8;i++) { - signal_parity += ((signal_sdu[0]&(1<<i))>0)? 1 : 0; - signal_parity += ((signal_sdu[1]&(1<<i))>0)? 1 : 0; - signal_parity += ((signal_sdu[2]&(1<<i))>0)? 1 : 0; - } - - if ((signal_parity&1) == 0) { - rxv.rate = rate2ind[signal_sdu[0]&0xF]; - rxv.sdu_length = signal_sdu[0] >> 5; - rxv.sdu_length += signal_sdu[1] << 3; - rxv.sdu_length += (signal_sdu[2]&1) << 11; - *rx_vector = &rxv; - *rx_offset = peak_pos+400; - } -#ifdef EXECTIME -#ifdef RTAI - tout=rt_get_time_ns(); - is_t9 += (tout-tin); - - mboxout = ((unsigned int *)DAQ_MBOX)[0]; - if (mboxout < mboxin) - is_mbox2 += ((150+mboxout)-mboxin); - else - is_mbox2 += (mboxout-mboxin); - -#else - ret=clock_gettime(CLOCK_REALTIME,&tout); - is_t9+=(tout.tv_nsec-tin.tv_nsec); -#endif - signal_trials++; -#endif -#ifdef DEBUG_SYNC - printf("Decoded RX_VECTOR: %x,%x,%x\n", - // ((uint8_t *)&rxv)[0],((uint8_t *)&rxv)[1],((uint8_t *)&rxv)[2]); - signal_sdu[0],signal_sdu[1],signal_sdu[2]); - - write_output("rxSIGNAL_llr.m","rxSIG_llr", rxSIGNAL_llr,48,1,4); -#endif - - return(BUSY); - } - - return(IDLE); -} diff --git a/openairITS/phy/DOT11/interleaver.c b/openairITS/phy/DOT11/interleaver.c deleted file mode 100644 index 3bc7d6e21f7..00000000000 --- a/openairITS/phy/DOT11/interleaver.c +++ /dev/null @@ -1,36 +0,0 @@ -#include <stdint.h> - -int interleaver_bpsk[48]; -int interleaver_qpsk[96]; -int interleaver_16qam[192]; -int interleaver_64qam[288]; - -extern int Ncbps[8]; - -void init_interleavers() { - - int i,j,k; - - // BPSK - for (k=0;k<48;k++) { - i=(3*(k&15)) + (k>>4); - interleaver_bpsk[k] = i; - } - // QPSK - for (k=0;k<96;k++) { - i=(6*(k&15)) + (k>>4); - interleaver_qpsk[k] = i; - } - // 16QAM - for (k=0;k<192;k++) { - i=(12*(k&15)) + (k>>4); - j=((i>>1)<<1) + ((i + 192 - (i/12))&1); - interleaver_16qam[k] = j; - } - // 64QAM - for (k=0;k<288;k++) { - i=(18*(k&15)) + (k>>4); - j=((i/3)*3) + ((i + 288 - (i/12))&1); - interleaver_64qam[k] = j; - } -} diff --git a/openairITS/phy/DOT11/phy_tx_start.c b/openairITS/phy/DOT11/phy_tx_start.c deleted file mode 100644 index 419ca408b1e..00000000000 --- a/openairITS/phy/DOT11/phy_tx_start.c +++ /dev/null @@ -1,467 +0,0 @@ -#include <stdlib.h> -#include <stdio.h> -#include <assert.h> -#include <stdint.h> -#include <string.h> -#include "defs.h" -#include "txvars.h" -#include "PHY/CODING/defs.h" -#include "PHY/TOOLS/defs.h" - -//#define DEBUG_TX - -int ratemap[8] = {11,15,10,14,9,13,8,12}; -int rateparity[8] = {1,0,0,1,0,1,1,0}; -int Ndbps[8] = {24,36,48,72,96,144,192,216}; // CodeRate*48*ModOrder -int Ncbps[8] = {48,48,96,96,192,192,288,288}; -int puncturing[8] = {0,1,0,1,0,1,2,1}; - -int16_t BPSK[2] = {-AMP,AMP}; -int16_t QPSK[2] = {-((AMP*ONE_OVER_SQRT_2)>>15),+((AMP*ONE_OVER_SQRT_2)>>15)}; - -int16_t QAM16[4] = {-((AMP*3*ONE_OVER_SQRT_10)>>15), //00 - -((AMP*1*ONE_OVER_SQRT_10)>>15), //01 - ((AMP*3*ONE_OVER_SQRT_10)>>15), //10 - ((AMP*1*ONE_OVER_SQRT_10)>>15)}; //11 - -int16_t QAM64[8] = {-((AMP*7*ONE_OVER_SQRT_42)>>15), //000 - -((AMP*5*ONE_OVER_SQRT_42)>>15), //001 - -((AMP*1*ONE_OVER_SQRT_42)>>15), //010 - -((AMP*3*ONE_OVER_SQRT_42)>>15), //011 - ((AMP*7*ONE_OVER_SQRT_42)>>15), //100 - ((AMP*5*ONE_OVER_SQRT_42)>>15), //101 - ((AMP*1*ONE_OVER_SQRT_42)>>15), //110 - ((AMP*3*ONE_OVER_SQRT_42)>>15)}; //111 - -extern uint16_t rev64[64]; -extern int16_t twiddle_ifft64[63*4*2]; -extern uint8_t scrambler[127*8]; -extern int interleaver_bpsk[48]; -extern int interleaver_qpsk[96]; -extern int interleaver_16qam[192]; -extern int interleaver_64qam[288]; - - - - -uint8_t data_coded[65632]; //65632 = (4095 byte SDU + 4 byte CRC + 2 byte service + 1 byte tail)*8 bits/byte * 2 coded bits per bit -uint8_t data_ind2[4095]; - -int phy_tx_start_bot(TX_VECTOR_t *tx_vector,int16_t *output_ptr,uint32_t tx_offset,int frame_length,uint8_t *data_ind) { - - uint8_t signal[3]; - int rate_bits; - int signal_bits[24]; - - uint8_t signal_coded[48]; - int16_t signal_interleaved[48]; - uint8_t*dc; - int data_interleaved[288]; - int16_t dataF[128] __attribute__((aligned(16))); - int signal_parity=0; - int16_t signalF[128] __attribute__((aligned(16))); - int i,j,k; // z,p - int16_t tmp_t[64*2*2]; - uint32_t *crc; - int dlen,dlen_symb; - int *interleaver; - int s,sprime; - int16_t *output_ptr2; - int tx_offset2; - int overlap=0; - - memset(signal_bits,0,24*sizeof(int)); - memset(signalF,0,64*2*sizeof(int16_t)); - memset(dataF,0,64*2*sizeof(int16_t)); - - assert(((unsigned int)tx_vector->rate)<8); - - rate_bits = ratemap[(int)tx_vector->rate]; - signal_parity = rateparity[(int)tx_vector->rate]; - - assert(tx_vector->sdu_length<=4095); - assert(tx_vector->rate<=7); - - - for (i=0;i<12;i++) - signal_parity += ((tx_vector->sdu_length&(1<<i))>0) ? 1:0; - signal_parity&=1; -#ifdef DEBUG_TX - printf("SIGNAL parity %d (rate parity %d, rate_bits %d)\n",signal_parity,rateparity[(int)tx_vector->rate],rate_bits); -#endif - signal[0] = (rate_bits&0xF)+((tx_vector->sdu_length&0x7)<<5); // first byte has 4 rate bits, 1-bit zero-padding, 3 LSB of sdu_length - signal[1] = ((tx_vector->sdu_length>>3)&0xFF); // second byte has bits 10:3 of sdu_length - signal[2] = ((tx_vector->sdu_length>>11)&1) + (signal_parity<<1); -#ifdef DEBUG_TX - printf("Transmitted TX_VECTOR: %x,%x,%x\n", - signal[0],signal[1],signal[2]); -#endif - ccodedot11_encode(3,signal,signal_coded,0); - -#ifdef DEBUG_TX - printf("SIGNAL (coded) : "); - for (i=0;i<48;i++) - printf("%d ",signal_coded[i]); - printf("\n"); -#endif - - // frequency interleaving - for (i=0;i<48;i++) { - signal_interleaved[i] = AMP*((signal_coded[interleaver_bpsk[i]]<<1)-1); - } -#ifdef DEBUG_TX - printf("SIGNAL (interleaved) : "); - for (i=0;i<48;i++) - printf("%d ",signal_interleaved[i]); - printf("\n"); -#endif - // -ve portion - for (i=0;i<5;i++) - signalF[(38+i)<<1]=signal_interleaved[i]; - signalF[(38+5)<<1]=AMP; - for (;i<18;i++) - signalF[(38+1+i)<<1]=signal_interleaved[i]; - signalF[(38+19)<<1]=AMP; - for (;i<24;i++) - signalF[(38+2+i)<<1]=signal_interleaved[i]; - - // +ve portion - for (;i<30;i++) - signalF[(-24+1+i)<<1]=signal_interleaved[i]; - signalF[(6+1)<<1]=AMP; - for (;i<43;i++) - signalF[(-24+2+i)<<1]=signal_interleaved[i]; - signalF[(19+2)<<1]=-AMP; - for (;i<48;i++) - signalF[(-24+3+i)<<1]=signal_interleaved[i]; -#ifdef DEBUG_TX - printf("SIGNAL (TX) :"); - for (i=0;i<64;i++) - printf("%d ",signalF[i<<1]); - printf("\n"); -#endif - - - fft(signalF, /// complex input - tmp_t, /// complex output - &twiddle_ifft64[0], /// complex twiddle factors - rev64, /// bit reversed permutation vector - 6, /// log2(FFT_SIZE) - 3, /// scale (energy normalized for 64-point) - 0); /// 0 means 64-bit complex interleaved format else complex-multiply ready repeated format - - // copy STS_LTS to start of packet - - tx_offset2 = (tx_offset<<1); - overlap=0; - if ((tx_offset2 + 640) > (frame_length<<1)) - overlap = 1; - output_ptr2 = &output_ptr[tx_offset2]; - -#ifdef EXMIMO - for (i=0;i<320;i++) { - output_ptr2[(i<<1)] = ((int16_t *)STS_LTS_t)[i<<1]<<2; - output_ptr2[1+(i<<1)] = ((int16_t *)STS_LTS_t)[1+(i<<1)]<<2; - } -#else - memcpy(output_ptr2,STS_LTS_t,640*sizeof(int16_t)); - -#endif - - if (overlap == 1) - memcpy((void*)output_ptr, - (void*)&output_ptr[frame_length<<1], - (tx_offset2 + 640 - (frame_length<<1))<<1); - - // position of SIGNAL - tx_offset2 = (tx_offset<<1) + 640; - - overlap=0; - if (tx_offset2 > (frame_length<<1)) - tx_offset2-=frame_length; - else if ((tx_offset2 + 160) > (frame_length<<1)) - overlap = 1; - - output_ptr2 = &output_ptr[tx_offset2]; - - // cyclic extension and output scaling - for (i=0,j=48;i<80;i++,j++) { - if (j==64) - j=0; - // printf("j %d : %d,%d\n",j,tmp_t[j<<2],tmp_t[1+(j<<2)]); -#ifdef EXMIMO - output_ptr2[(i<<1)] = tmp_t[j<<2]<<2; // RE component - output_ptr2[1+(i<<1)] = tmp_t[1+(j<<2)]<<2; // IM component -#else - output_ptr2[(i<<1)] = tmp_t[j<<2]; // RE component - output_ptr2[1+(i<<1)] = tmp_t[1+(j<<2)]; // IM component -#endif - } - if (overlap == 1) { - memcpy((void*)output_ptr, - (void*)&output_ptr[frame_length<<1], - (tx_offset2 + 160 - (frame_length<<1))<<1); - } - - - // now do data portion - crc = (uint32_t*)&data_ind[tx_vector->sdu_length+2]; - *crc = 0xffffffff; - crc32(data_ind,crc,tx_vector->sdu_length+2); - - dlen = 32+16+6+(tx_vector->sdu_length<<3); // data length is 32-bits CRC + sdu + 16 service + 6 tail - dlen_symb = dlen/Ndbps[tx_vector->rate]; - if ((dlen%Ndbps[tx_vector->rate])>0) - dlen_symb++; - -#ifdef DEBUG_TX - printf("Number of symbols in data portion : %d for %d bytes, CRC %x\n",dlen_symb,tx_vector->sdu_length,*crc); -#endif - // scramble data - - data_ind2[0] = scrambler[0]; // service byte 0 - data_ind2[1] = scrambler[1]; // service byte 1 - // printf("DATA (%x)%x.(%x)%x.",data_ind[0]^scrambler[0],data_ind[0],data_ind[1]^scrambler[1],data_ind[1]); - j=2; - for (i=0;i<tx_vector->sdu_length+4;i++,j++) { // sdu+crc - if (j==(127*8)) - j=0; - // printf("(%x)",data_ind[i+2]); - data_ind2[i+2]=data_ind[i+2]^scrambler[j]; - // printf("%x.",data_ind[i+2]); - - } - // printf("\n"); - data_ind2[tx_vector->sdu_length+2+4] = 0; // tail (2 extra which are used filled later) - // encode with conv. code - ccodedot11_encode(tx_vector->sdu_length+2+4+1, // 4 for CRC, 2 for service, 1 for tail - data_ind2, - data_coded, - puncturing[tx_vector->rate]); - -#ifdef DEBUG_TX - printf("DATA (coded) : \n"); - for (i=0;i<48*3;i++) { - printf("%d ",data_coded[i]); - if ((i%48) == 47) - printf("\n"); - } - printf("\n"); -#endif - - // interleaving - switch(tx_vector->rate>>1) { - case 0: - interleaver=interleaver_bpsk; - break; - case 1: - interleaver=interleaver_qpsk; - break; - case 2: - interleaver=interleaver_16qam; - break; - case 3: - interleaver=interleaver_64qam; - break; - } - - dc = data_coded; - for (s=0,sprime=1;s<dlen_symb;s++,dc+=Ncbps[tx_vector->rate],sprime++) { - - // index for pilot symbol lookup - if (sprime==127) - sprime=0; - - for (k=0;k<Ncbps[tx_vector->rate];k++) { -#ifdef DEBUG_TX - if (s==0) - printf("interleaver k %d, j %d (%d) \n",k,interleaver[k],dc[k]); -#endif - data_interleaved[interleaver[k]] = dc[k]; - } - - switch (tx_vector->rate>>1) { - case 0: // BPSK - // -ve portion - for (i=0;i<5;i++) - dataF[(38+i)<<1]=BPSK[data_interleaved[i]&1]; - dataF[(38+5)<<1]=Pseq[sprime]; // Pilot 1 - for (;i<18;i++) - dataF[(38+1+i)<<1]=BPSK[data_interleaved[i]&1]; - dataF[(38+19)<<1]=Pseq[sprime]; // Pilot 2 - for (;i<24;i++) - dataF[(38+2+i)<<1]=BPSK[data_interleaved[i]&1]; - - // +ve portion - for (;i<30;i++) - dataF[(-24+1+i)<<1]=BPSK[data_interleaved[i]&1]; - dataF[(6+1)<<1]=Pseq[sprime]; // Pilot 3 - for (;i<43;i++) - dataF[(-24+2+i)<<1]=BPSK[data_interleaved[i]&1]; - dataF[(19+2)<<1]=-Pseq[sprime]; // Pilot 4 - for (;i<48;i++) - dataF[(-24+3+i)<<1]=BPSK[data_interleaved[i]&1]; - - break; - - case 1: // QPSK - // -ve portion - for (i=0;i<5;i++) { - dataF[(38+i)<<1] = QPSK[data_interleaved[i<<1]]; - dataF[1+((38+i)<<1)] = QPSK[data_interleaved[1+(i<<1)]]; - } - dataF[(38+5)<<1]=Pseq[sprime]; - for (;i<18;i++) { - dataF[(38+1+i)<<1] = QPSK[data_interleaved[i<<1]]; - dataF[1+((38+1+i)<<1)] = QPSK[data_interleaved[1+(i<<1)]]; - } - dataF[(38+19)<<1]=Pseq[sprime]; - for (;i<24;i++) { - dataF[(38+2+i)<<1] = QPSK[data_interleaved[i<<1]]; - dataF[1+((38+2+i)<<1)] = QPSK[data_interleaved[1+(i<<1)]]; - } - // +ve portion - for (;i<30;i++) { - dataF[(-24+1+i)<<1]=QPSK[data_interleaved[i<<1]]; - dataF[1+((-24+1+i)<<1)]=QPSK[data_interleaved[1+(i<<1)]]; - } - dataF[(6+1)<<1]=Pseq[sprime]; - for (;i<43;i++) { - dataF[(-24+2+i)<<1]=QPSK[data_interleaved[i<<1]]; - dataF[1+((-24+2+i)<<1)]=QPSK[data_interleaved[1+(i<<1)]]; - } - dataF[(19+2)<<1]=-Pseq[sprime]; - for (;i<48;i++) { - dataF[(-24+3+i)<<1]=QPSK[data_interleaved[i<<1]]; - dataF[1+((-24+3+i)<<1)]=QPSK[data_interleaved[1+(i<<1)]]; - } - break; - case 2: // 16QAM - // -ve portion - for (i=0;i<5;i++) { - dataF[(38+i)<<1] = QAM16[data_interleaved[i<<2] + (data_interleaved[1+(i<<2)]<<1)]; - dataF[1+((38+i)<<1)] = QAM16[data_interleaved[2+(i<<2)] + (data_interleaved[3+(i<<2)]<<1)]; - } - dataF[(38+5)<<1]=Pseq[sprime]; - for (;i<18;i++) { - dataF[(38+1+i)<<1] = QAM16[data_interleaved[i<<2] + (data_interleaved[1+(i<<2)]<<1)]; - dataF[1+((38+1+i)<<1)] = QAM16[data_interleaved[2+(i<<2)] + (data_interleaved[3+(i<<2)]<<1)]; - } - dataF[(38+19)<<1]=Pseq[sprime]; - for (;i<24;i++) { - dataF[(38+2+i)<<1] = QAM16[data_interleaved[i<<2] + (data_interleaved[1+(i<<2)]<<1)]; - dataF[1+((38+2+i)<<1)] = QAM16[data_interleaved[2+(i<<2)] + (data_interleaved[3+(i<<2)]<<1)]; - } - // +ve portion - for (;i<30;i++) { - dataF[(-24+1+i)<<1] = QAM16[data_interleaved[i<<2] + (data_interleaved[1+(i<<2)]<<1)]; - dataF[1+((-24+1+i)<<1)] = QAM16[data_interleaved[2+(i<<2)] + (data_interleaved[3+(i<<2)]<<1)]; - } - dataF[(6+1)<<1]=Pseq[sprime]; - for (;i<43;i++) { - dataF[(-24+2+i)<<1] = QAM16[data_interleaved[i<<2] + (data_interleaved[1+(i<<2)]<<1)]; - dataF[1+((-24+2+i)<<1)] = QAM16[data_interleaved[2+(i<<2)] + (data_interleaved[3+(i<<2)]<<1)]; - } - dataF[(19+2)<<1]=-Pseq[sprime]; - for (;i<48;i++) { - dataF[(-24+3+i)<<1] = QAM16[data_interleaved[i<<2] + (data_interleaved[1+(i<<2)]<<1)]; - dataF[1+((-24+3+i)<<1)] = QAM16[data_interleaved[2+(i<<2)] + (data_interleaved[3+(i<<2)]<<1)]; - } - - break; - - case 3: // 64QAM - // -ve portion - for (i=0;i<5;i++) { - dataF[(38+i)<<1] = QAM64[data_interleaved[i<<3] + (data_interleaved[1+(i<<3)]<<1) + (data_interleaved[2+(i<<3)]<<2)]; - dataF[1+((38+i)<<1)] = QAM64[data_interleaved[3+(i<<3)] + (data_interleaved[4+(i<<3)]<<1) + (data_interleaved[5+(i<<3)]<<1)]; - } - dataF[(38+5)<<1]=Pseq[sprime]; - for (;i<18;i++) { - dataF[(38+1+i)<<1] = QAM64[data_interleaved[i<<3] + (data_interleaved[1+(i<<3)]<<1) + (data_interleaved[2+(i<<3)]<<2)]; - dataF[1+((38+1+i)<<1)] = QAM64[data_interleaved[3+(i<<3)] + (data_interleaved[4+(i<<3)]<<1) + (data_interleaved[5+(i<<3)]<<1)]; - } - dataF[(38+19)<<1]=Pseq[sprime]; - for (;i<24;i++) { - dataF[(38+2+i)<<1] = QAM64[data_interleaved[i<<3] + (data_interleaved[1+(i<<3)]<<1) + (data_interleaved[2+(i<<3)]<<2)]; - dataF[1+((38+2+i)<<1)] = QAM64[data_interleaved[3+(i<<3)] + (data_interleaved[4+(i<<3)]<<1) + (data_interleaved[5+(i<<3)]<<1)]; - } - // +ve portion - for (;i<30;i++) { - dataF[(-24+1+i)<<1] = QAM64[data_interleaved[i<<3] + (data_interleaved[1+(i<<3)]<<1) + (data_interleaved[2+(i<<3)]<<2)]; - dataF[1+((-24+1+i)<<1)] = QAM64[data_interleaved[3+(i<<3)] + (data_interleaved[4+(i<<3)]<<1) + (data_interleaved[5+(i<<3)]<<1)]; - } - dataF[(6+1)<<1]=Pseq[sprime]; - for (;i<43;i++) { - dataF[(-24+2+i)<<1] = QAM64[data_interleaved[i<<3] + (data_interleaved[1+(i<<3)]<<1) + (data_interleaved[2+(i<<3)]<<2)]; - dataF[1+((-24+2+i)<<1)] = QAM64[data_interleaved[3+(i<<3)] + (data_interleaved[4+(i<<3)]<<1) + (data_interleaved[5+(i<<3)]<<1)]; - } - dataF[(19+2)<<1]=-Pseq[sprime]; - for (;i<48;i++) { - dataF[(-24+3+i)<<1] = QAM64[data_interleaved[i<<3] + (data_interleaved[1+(i<<3)]<<1) + (data_interleaved[2+(i<<3)]<<2)]; - dataF[1+((-24+3+i)<<1)] = QAM64[data_interleaved[3+(i<<3)] + (data_interleaved[4+(i<<3)]<<1) + (data_interleaved[5+(i<<3)]<<1)]; - } - - break; - default: - break; - } - - -#ifdef DEBUG_TX - if (s<12) { - for (i=0;i<64;i++) - printf("s %d, k %d: (%d,%d)\n",s,i,dataF[i<<1],dataF[1+(i<<1)]); - } -#endif - - fft(dataF, /// complex input - tmp_t, /// complex output - &twiddle_ifft64[0], /// complex twiddle factors - rev64, /// bit reversed permutation vector - 6, /// log2(FFT_SIZE) - 3, /// scale (energy normalized for 64-point) - 0); /// 0 means 64-bit complex interleaved format else complex-multiply ready repeated format - - // cyclic extension and output scaling - tx_offset2 += 160; - - overlap=0; - if (tx_offset2 >= (frame_length<<1)) - tx_offset2 -= (frame_length<<1); - else if ((tx_offset2 + 160) > (frame_length<<1)) - overlap = 1; - - output_ptr2 = &output_ptr[tx_offset2]; - for (i=0,j=48;i<80;i++,j++) { - if (j==64) - j=0; - // printf("j %d : %d,%d\n",j,tmp_t[j<<2],tmp_t[1+(j<<2)]); -#ifdef EXMIMO - output_ptr2[(i<<1)] = tmp_t[j<<2]<<2; // RE component - output_ptr2[1+(i<<1)] = tmp_t[1+(j<<2)]<<2; // IM component -#else - output_ptr2[(i<<1)] = tmp_t[j<<2]; // RE component - output_ptr2[1+(i<<1)] = tmp_t[1+(j<<2)]; // IM component -#endif - } - if (overlap == 1) { - memcpy((void*)output_ptr, - (void*)&output_ptr[frame_length<<1], - (tx_offset2 + 160 - (frame_length<<1))<<1); - } - } - - - return(400+(80*dlen_symb)); -} - -int init_tx=0; - -int phy_tx_start(TX_VECTOR_t *tx_vector,uint32_t *tx_frame,uint32_t next_TXop_offset,int frame_length,uint8_t *data_ind) { -#ifdef DEBUG_TX - printf("tx_frame %p\n",tx_frame); -#endif - return(phy_tx_start_bot(tx_vector,(int16_t *)tx_frame,next_TXop_offset,frame_length,data_ind)); - -} diff --git a/openairITS/phy/DOT11/scrambler.c b/openairITS/phy/DOT11/scrambler.c deleted file mode 100644 index af89d798251..00000000000 --- a/openairITS/phy/DOT11/scrambler.c +++ /dev/null @@ -1,27 +0,0 @@ -#include <stdint.h> - -uint8_t scrambler[127*8] = {0x70, - 0x4f, - 0x93, - 0x40, - 0x64, - 0x74, - 0x6d, - 0x30, - 0x2b, - 0xe7, - 0x2d, - 0x54, - 0x5f, - 0x8a, - 0x1d, - 0xff}; - -void init_scrambler() { - - int i; - - for (i=16;i<(127*8);i++) { - scrambler[i] = (scrambler[i-16]>>1) + ((scrambler[i-15]&1)<<7); - } -} diff --git a/openairITS/phy/DOT11/txvars.h b/openairITS/phy/DOT11/txvars.h deleted file mode 100644 index acc537c2d68..00000000000 --- a/openairITS/phy/DOT11/txvars.h +++ /dev/null @@ -1,54 +0,0 @@ -#include "defs.h" - -int16_t STS_LTS_t[640] = { 376, 376,-1086, 19, -111, -644, 1169, -104, 753, 0, 1169, -104, -111, -644,-1086, 19, - 376, 376, 19,-1086, -644, -111, -104, 1169, 0, 753, -104, 1169, -644, -111, 19,-1086, - 376, 376,-1086, 19, -111, -644, 1169, -104, 753, 0, 1169, -104, -111, -644,-1086, 19, - 376, 376, 19,-1086, -644, -111, -104, 1169, 0, 753, -104, 1169, -644, -111, 19,-1086, - 376, 376,-1086, 19, -111, -644, 1169, -104, 753, 0, 1169, -104, -111, -644,-1086, 19, - 376, 376, 19,-1086, -644, -111, -104, 1169, 0, 753, -104, 1169, -644, -111, 19,-1086, - 376, 376,-1086, 19, -111, -644, 1169, -104, 753, 0, 1169, -104, -111, -644,-1086, 19, - 376, 376, 19,-1086, -644, -111, -104, 1169, 0, 753, -104, 1169, -644, -111, 19,-1086, - 376, 376,-1086, 19, -111, -644, 1169, -104, 753, 0, 1169, -104, -111, -644,-1086, 19, - 376, 376, 19,-1086, -644, -111, -104, 1169, 0, 753, -104, 1169, -644, -111, 19,-1086, - 376, 376,-1086, 19, -111, -644, 1169, -104, 753, 0, 1169, -104, -111, -644,-1086, 19, - 376, 376, 19,-1086, -644, -111, -104, 1169, 0, 753, -104, 1169, -644, -111, 19,-1086, - 376, 376,-1086, 19, -111, -644, 1169, -104, 753, 0, 1169, -104, -111, -644,-1086, 19, - 376, 376, 19,-1086, -644, -111, -104, 1169, 0, 753, -104, 1169, -644, -111, 19,-1086, - 376, 376,-1086, 19, -111, -644, 1169, -104, 753, 0, 1169, -104, -111, -644,-1086, 19, - 376, 376, 19,-1086, -644, -111, -104, 1169, 0, 753, -104, 1169, -644, -111, 19,-1086, - 376, 376,-1086, 19, -111, -644, 1169, -104, 753, 0, 1169, -104, -111, -644,-1086, 19, - 376, 376, 19,-1086, -644, -111, -104, 1169, 0, 753, -104, 1169, -644, -111, 19,-1086, - 376, 376,-1086, 19, -111, -644, 1169, -104, 753, 0, 1169, -104, -111, -644,-1086, 19, - 376, 376, 19,-1086, -644, -111, -104, 1169, 0, 753, -104, 1169, -644, -111, 19,-1086, - -1280, 0, 100, -800, 751, -868, -753, -944, -23, -441, 615, 606,-1044, 167, -999, 135, - -288, 1236, -463, 178, -495, -666, 569, -116, 673, -757,-1076, -535, -469, -322, 302, -806, - 512, 512, 976, 33, -185,-1317, 480, 122, 200, 479,-1121, 388, 8, 942, 436, -34, - 799, 212, -314, 869, -944, 452, 490, 718, 172, -229, 793, -679, 325, 910, -42, 985, - 1280, 0, -42, -986, 325, -911, 793, 678, 172, 228, 490, -719, -944, -453, -314, -870, - 799, -213, 436, 33, 8, -943,-1121, -389, 200, -480, 480, -123, -185, 1316, 976, -34, - 512, -512, 302, 805, -469, 321,-1076, 534, 673, 756, 569, 115, -495, 665, -463, -179, - -288,-1237, -999, -136,-1044, -168, 615, -607, -23, 440, -753, 943, 751, 867, 100, 799, - -1280, 0, 100, -800, 751, -868, -753, -944, -23, -441, 615, 606,-1044, 167, -999, 135, - -288, 1236, -463, 178, -495, -666, 569, -116, 673, -757,-1076, -535, -469, -322, 302, -806, - 512, 512, 976, 33, -185,-1317, 480, 122, 200, 479,-1121, 388, 8, 942, 436, -34, - 799, 212, -314, 869, -944, 452, 490, 718, 172, -229, 793, -679, 325, 910, -42, 985, - 1280, 0, -42, -986, 325, -911, 793, 678, 172, 228, 490, -719, -944, -453, -314, -870, - 799, -213, 436, 33, 8, -943,-1121, -389, 200, -480, 480, -123, -185, 1316, 976, -34, - 512, -512, 302, 805, -469, 321,-1076, 534, 673, 756, 569, 115, -495, 665, -463, -179, - -288,-1237, -999, -136,-1044, -168, 615, -607, -23, 440, -753, 943, 751, 867, 100, 799, - -1280, 0, 100, -800, 751, -868, -753, -944, -23, -441, 615, 606,-1044, 167, -999, 135, - -288, 1236, -463, 178, -495, -666, 569, -116, 673, -757,-1076, -535, -469, -322, 302, -806, - 512, 512, 976, 33, -185,-1317, 480, 122, 200, 479,-1121, 388, 8, 942, 436, -34, - 799, 212, -314, 869, -944, 452, 490, 718, 172, -229, 793, -679, 325, 910, -42, 985}; - -// Pilot sequence of 127 BPSK symbols - -int16_t Pseq[127] = { AMP, AMP, AMP, AMP,-AMP,-AMP,-AMP, AMP,-AMP,-AMP,-AMP,-AMP, AMP, AMP,-AMP, AMP, - -AMP,-AMP, AMP, AMP,-AMP, AMP, AMP,-AMP, AMP, AMP, AMP, AMP, AMP, AMP,-AMP, AMP, - AMP, AMP,-AMP, AMP, AMP,-AMP,-AMP, AMP, AMP, AMP,-AMP, AMP,-AMP,-AMP,-AMP, AMP, - -AMP, AMP,-AMP,-AMP, AMP,-AMP,-AMP, AMP, AMP, AMP, AMP, AMP,-AMP,-AMP, AMP, AMP, - -AMP,-AMP, AMP,-AMP, AMP,-AMP, AMP, AMP,-AMP,-AMP,-AMP, AMP, AMP,-AMP,-AMP,-AMP, - -AMP, AMP,-AMP,-AMP, AMP,-AMP, AMP, AMP, AMP, AMP,-AMP, AMP,-AMP, AMP,-AMP, AMP, - -AMP,-AMP,-AMP,-AMP,-AMP, AMP,-AMP, AMP, AMP,-AMP, AMP,-AMP, AMP, AMP, AMP,-AMP, - -AMP, AMP,-AMP,-AMP,-AMP, AMP, AMP, AMP,-AMP,-AMP,-AMP,-AMP,-AMP,-AMP,-AMP}; - diff --git a/openairITS/phy/DRIVERS/.cproject b/openairITS/phy/DRIVERS/.cproject deleted file mode 100644 index 88bba729692..00000000000 --- a/openairITS/phy/DRIVERS/.cproject +++ /dev/null @@ -1,209 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<?fileVersion 4.0.0?> - -<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage"> -<storageModule moduleId="org.eclipse.cdt.core.settings"> -<cconfiguration id="0.1125711717"> -<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1125711717" moduleId="org.eclipse.cdt.core.settings" name="Default"> -<externalSettings/> -<extensions> -<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> -<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> -<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> -<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> -<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/> -</extensions> -</storageModule> -<storageModule moduleId="cdtBuildSystem" version="4.0.0"> -<configuration artifactName="PLATA" buildProperties="" description="" id="0.1125711717" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg"> -<folderInfo id="0.1125711717." name="/" resourcePath=""> -<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.437818120" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain"> -<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.437818120.752172131" name=""/> -<builder id="org.eclipse.cdt.build.core.settings.default.builder.3157722" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/> -<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1914665025" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/> -<tool id="org.eclipse.cdt.build.core.settings.holder.1382871406" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder"> -<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1261785620" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> -</tool> -<tool id="org.eclipse.cdt.build.core.settings.holder.931759746" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder"> -<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1501233835" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> -</tool> -<tool id="org.eclipse.cdt.build.core.settings.holder.1617553560" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder"> -<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1408170227" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/> -</tool> -</toolChain> -</folderInfo> -</configuration> -</storageModule> -<storageModule moduleId="scannerConfiguration"> -<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> -<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="makefileGenerator"> -<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<scannerConfigBuildInfo instanceId="0.1125711717"> -<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"/> -<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerProjectProfile"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="makefileGenerator"> -<runAction arguments="-f ${project_name}_scd.mk" command="make" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfile"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-E -P -v -dD ${plugin_state_location}/${specs_file}" command="gcc" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.cpp" command="g++" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-E -P -v -dD ${plugin_state_location}/specs.c" command="gcc" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfile"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/${specs_file}"'" command="sh" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-c 'g++ -E -P -v -dD "${plugin_state_location}/specs.cpp"'" command="sh" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -<profile id="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"> -<buildOutputProvider> -<openAction enabled="true" filePath=""/> -<parser enabled="true"/> -</buildOutputProvider> -<scannerInfoProvider id="specsFile"> -<runAction arguments="-c 'gcc -E -P -v -dD "${plugin_state_location}/specs.c"'" command="sh" useDefault="true"/> -<parser enabled="true"/> -</scannerInfoProvider> -</profile> -</scannerConfigBuildInfo> -</storageModule> -<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/> -</cconfiguration> -</storageModule> -<storageModule moduleId="cdtBuildSystem" version="4.0.0"> -<project id="PLATA.null.1559258045" name="PLATA"/> -</storageModule> -</cproject> diff --git a/openairITS/phy/DRIVERS/.project b/openairITS/phy/DRIVERS/.project deleted file mode 100644 index a8b5ab5da02..00000000000 --- a/openairITS/phy/DRIVERS/.project +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>PLATA</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> - <triggers>clean,full,incremental,</triggers> - <arguments> - <dictionary> - <key>?name?</key> - <value></value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.append_environment</key> - <value>true</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.autoBuildTarget</key> - <value>all</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.buildArguments</key> - <value></value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.buildCommand</key> - <value>make</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.cleanBuildTarget</key> - <value>clean</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.contents</key> - <value>org.eclipse.cdt.make.core.activeConfigSettings</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.enableAutoBuild</key> - <value>false</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.enableCleanBuild</key> - <value>true</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.enableFullBuild</key> - <value>true</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.fullBuildTarget</key> - <value>all</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.stopOnError</key> - <value>true</value> - </dictionary> - <dictionary> - <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key> - <value>true</value> - </dictionary> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.cdt.core.cnature</nature> - <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> - <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> - </natures> -</projectDescription> diff --git a/openairITS/phy/DRIVERS/Makefile b/openairITS/phy/DRIVERS/Makefile deleted file mode 100644 index d3cae5c274b..00000000000 --- a/openairITS/phy/DRIVERS/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -CC=gcc -MAKE=/usr/bin/make -CONFIG_IEEE80211P=m -KERNELDIR ?= /lib/modules/$(shell uname -r)/build -PWD := $(shell pwd) - -NOSTDINC_FLAGS := -I$(M)/../../mac/DOT11/include/ \ - -obj-$(CONFIG_IEEE80211P) += ieee80211p.o -ieee80211p-y += ieee80211p-driver.o - -default : - $(MAKE) -C $(KERNELDIR) M=$(PWD) modules - -clean : - $(MAKE) -C $(KERNELDIR) M=$(PWD) clean - -show : - @echo $(KERNELDIR) - @echo $(NOSTDINC_FLAGS) diff --git a/openairITS/phy/DRIVERS/ieee80211p-driver.c b/openairITS/phy/DRIVERS/ieee80211p-driver.c deleted file mode 100644 index b11ce7ff707..00000000000 --- a/openairITS/phy/DRIVERS/ieee80211p-driver.c +++ /dev/null @@ -1,701 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) EURECOM / Thales Communications & Security - * - * Portions of this file are derived from the Atheros ath5k project. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Thales Communications & Security <philippe.agostini@thalesgroup.com> - * - *****************************************************************************/ - -/****************************************************************************** - * - * Includes - * - *****************************************************************************/ - -#include "ieee80211p-driver.h" - -/****************************************************************************** - * - * Module information - * - *****************************************************************************/ - -#define DRV_DESCRIPTION "IEEE 802.11p driver" -#define DRV_VERSION "V1.0" -#define DRV_AUTHOR "EURECOM / THALES COMMUNICATIONS & SECURITY" - -MODULE_LICENSE("GPL"); -MODULE_VERSION(DRV_VERSION); -MODULE_DESCRIPTION(DRV_DESCRIPTION); -MODULE_AUTHOR(DRV_AUTHOR); - -/****************************************************************************** - * - * Driver's private data - * - *****************************************************************************/ - -static struct ieee80211p_priv drv_priv_data; - -/****************************************************************************** - * - * Driver's private data related routines : RX path / Init / Exit - * - *****************************************************************************/ - -/*********** - * RX path * - ***********/ - -int find_rate_idx(struct ieee80211p_priv *priv, - enum ieee80211_band band, u16 bitrate) { - - /* Data rate index */ - int rate_idx = -1; - - /* Loop variable */ - int i; - - struct wiphy *wiphy = priv->hw->wiphy; - - /* We look for the idx of the RX bitrate in the bitrates of the band */ - for (i=0;i<wiphy->bands[band]->n_bitrates;i++) { - if (wiphy->bands[band]->bitrates[i].bitrate == bitrate) { - rate_idx = i; - } - } - - return rate_idx; - -} /* ieee80211p_find_rate_idx */ - -/************************ - * RX path / RX tasklet * - ************************/ - -static void ieee80211p_tasklet_rx(unsigned long data) { - - /* Driver's private data */ - struct ieee80211p_priv *priv = (void *)data; - - /* RX skb */ - struct sk_buff *skb = priv->rx_skb; - - /* RX status */ - struct ieee80211_rx_status *rxs = NULL; - struct ieee80211p_rx_status *rs = NULL; - - /* Netlink header */ - struct nlmsghdr *nlh = NULL; - - /* Netlink command */ - char *nlcmd = NULL; - - /* Received data rate index */ - int rate_idx = -1; - - /* lock */ - spin_lock(&priv->rxq_lock); - - /************************ - * Netlink skb handling * - ************************/ - - printk(KERN_ERR "ieee80211p_tasklet_rx: receiving data from PHY\n"); - - if (skb == NULL) { - printk(KERN_ERR "ieee80211_tasklet_rx: received skb == NULL\n"); - goto error; - } - - /* Get the netlink message header */ - nlh = (struct nlmsghdr *)skb->data; - - /* Check the command of the received msg */ - nlcmd = (char *)NLMSG_DATA(nlh); - if (*nlcmd == NLCMD_INIT) { - /* Keep track of the softmodem pid */ - priv->pid_softmodem = nlh->nlmsg_pid; - printk(KERN_ERR "ieee80211_tasklet_rx: NLCMD_INIT received / softmodem pid = %u\n",priv->pid_softmodem); - dev_kfree_skb_any(skb); - goto error; - } - - /* Remove the nlmsg header + netlink command */ - rs = (struct ieee80211p_rx_status *)skb_pull(skb,sizeof(struct nlmsghdr)+NLCMD_SIZE); - - if (rs == NULL) { - printk(KERN_ERR "ieee80211_tasklet_rx: rx status == NULL\n"); - dev_kfree_skb_any(skb); - goto error; - } - - /********* - * Stats * - *********/ - - rxs = IEEE80211_SKB_RXCB(skb); - - if (rxs == NULL) { - printk(KERN_ERR "ieee80211_tasklet_rx: rx status == NULL\n"); - dev_kfree_skb_any(skb); - goto error; - } - - /* Keep track of the stats sent by the softmodem */ - rxs->freq = priv->cur_chan->center_freq; - rxs->signal = rs->rssi; - rxs->band = rs->band; - rxs->flag = 0; - rate_idx = find_rate_idx(priv,rxs->band,rs->rate); - - if (rate_idx == -1) { - printk(KERN_ERR "ieee80211_tasklet_rx: unknown data rate %u\n",rs->rate); - dev_kfree_skb_any(skb); - goto error; - } else { - rxs->rate_idx = rate_idx; - } - - if (rs->flags & IEEE80211P_MMIC_ERROR) { - rxs->flag |= RX_FLAG_MMIC_ERROR; - } - if (rs->flags & IEEE80211P_FAILED_FCS_CRC) { - rxs->flag |= RX_FLAG_FAILED_FCS_CRC; - } - if (rs->flags & IEEE80211P_FAILED_PLCP_CRC) { - rxs->flag |= RX_FLAG_FAILED_PLCP_CRC; - } - if (rs->flags & IEEE80211P_MACTIME_MPDU) { - rxs->flag |= RX_FLAG_MACTIME_MPDU; - } - if (rs->flags & IEEE80211P_NO_SIGNAL_VAL) { - rxs->flag |= RX_FLAG_NO_SIGNAL_VAL; - } - - /* Remove the rx status from the skb */ - skb_pull(skb,sizeof(struct ieee80211p_rx_status)); - - printk(KERN_ERR "ieee80211p_tasklet_rx: sending data to ieee80211\n"); - - /* Give skb to the mac80211 subsystem */ - ieee80211_rx(priv->hw, skb); - -error: - /* unlock */ - spin_unlock(&priv->rxq_lock); - -} /* ieee80211p_tasklet_rx */ - -/************************ - * RX path / RX handler * - ************************/ - -static void ieee80211p_rx(struct sk_buff *skb) { - - /* We copy the received buffer since we need to modify it */ - drv_priv_data.rx_skb = skb_copy(skb,GFP_ATOMIC); - - /* Schedule a tasklet to handle the receivded skb */ - tasklet_schedule(&drv_priv_data.rx_tq); -} - -/******** - * Init * - ********/ - -static int reg_copy_regd(const struct ieee80211_regdomain **dst_regd, - const struct ieee80211_regdomain *src_regd) { - - struct ieee80211_regdomain *regd; - int size_of_regd = 0; - int ret = 0; - int i = 0; - - size_of_regd = sizeof(struct ieee80211_regdomain) + ((src_regd->n_reg_rules + 1)*(sizeof(struct ieee80211_reg_rule))); - - regd = kzalloc(size_of_regd, GFP_KERNEL); - - if (!regd) { - ret = -1; - goto error; - } - - memcpy(regd,src_regd,sizeof(struct ieee80211_regdomain)); - - for (i=0;i<src_regd->n_reg_rules;i++) { - memcpy(®d->reg_rules[i],&src_regd->reg_rules[i], - sizeof(struct ieee80211_reg_rule)); - } - - *dst_regd = regd; - -error: - return ret; - -} /* reg_copy_regd */ - -int ieee80211p_priv_init(struct ieee80211p_priv *priv) { - - /* Configuration and hardware information for an 802.11 PHY */ - struct ieee80211_hw *hw = priv->hw; - struct wiphy *wiphy = hw->wiphy; - - /* Return value */ - int ret = 0; - - /****************************** - * Initializing hardware data * - ******************************/ - - /* Received signal power is given in dBm */ - /* hw supports 11.p */ - hw->flags = IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_DOT11OCB_SUPPORTED; - - /* Headroom to reserve in each transmit skb */ - hw->extra_tx_headroom = 0; - - /* Number of available hardware queues */ - hw->queues = IEEE80211P_NUM_TXQ; - - /* Virtual interface's private data size */ - hw->vif_data_size = sizeof(struct ieee80211p_vif_priv); - - /*************************** - * Initializing wiphy data * - ***************************/ - - /* We have our own regulatory domain */ - ret = reg_copy_regd(&wiphy->regd,®d); - - if (ret == -1) { - printk(KERN_ERR "ieee80211p_priv_init: reg domain copy failed\n"); - goto error; - } - - /* Set interface mode */ - /* For now the only supported type of interface is adhoc */ - wiphy->interface_modes = BIT(NL80211_IFTYPE_ADHOC); - - /* Describes the frequency bands a wiphy is able to operate in */ - wiphy->bands[IEEE80211_BAND_0_8GHZ] = &bands; - - /* Enable ieee 80211.p mode */ - wiphy->dot11OCBActivated = 1; - - /*********************************** - * Initilizing driver private data * - ***********************************/ - - /* Lock */ - spin_lock_init(&priv->lock); - - /* RX queues setup */ - spin_lock_init(&priv->rxq_lock); - - tasklet_init(&priv->rx_tq,ieee80211p_tasklet_rx,(unsigned long)priv); - - /* Virtual interfaces init */ - priv->nvifs = 0; - - /* Current channel init */ - /* The default current channel is the 1st one in the band */ - priv->cur_chan = &bands.channels[0]; - - /* Power level init */ - /* Default value = max power level in the default curent channel */ - priv->cur_power = priv->cur_chan->max_power; - - /* Data rate init */ - /* Default value = first bitrate of the band */ - priv->cur_datarate = bands.bitrates[0].bitrate; - - /* Netlink socket init */ - priv->nl_sock = netlink_kernel_create(&init_net,NETLINK_80211P,0,ieee80211p_rx,NULL,THIS_MODULE); - if (priv->nl_sock == NULL) { - printk(KERN_ERR "ieee80211p_priv_init: netlink_kernel_create failed\n"); - ret = -1; - goto error; - } - - priv->pid_softmodem = 0; - - priv->rx_skb = NULL; - - printk(KERN_ERR "ieee80211p_priv_init: initialization done\n"); - -error: - return ret; - -} /* ieee80211p_priv_init */ - -/******** - * Exit * - ********/ - -void ieee80211p_priv_exit(struct ieee80211p_priv *priv) { - - /********************************* - * Freeing driver's private data * - *********************************/ - - tasklet_kill(&priv->rx_tq); - - /*TODO: check if needed */ - /*if (priv->rx_skb != NULL) { - dev_kfree_skb_any(priv->rx_skb); - }*/ - - sock_release(priv->nl_sock->sk_socket); - -} /* ieee80211_priv_exit */ - -/****************************************************************************** - * - * Mandatory callbacks from mac80211 to the driver: TX path, add interface... - * - *****************************************************************************/ - -static void ieee80211p_tx(struct ieee80211_hw *hw, struct sk_buff *skb) { - - /* Netlink message header */ - struct nlmsghdr *nlh = NULL; - - /* Netlink skb */ - struct sk_buff *nlskb = NULL; - - /* The size of the skb */ - int skblen; - - /* Get driver's private data */ - struct ieee80211p_priv *priv = hw->priv; - - /* Get the number of the TX queue */ - int qnum = skb_get_queue_mapping(skb); - - /* Return value */ - int ret = 0; - - printk(KERN_ERR "ieee80211p_tx: receiving data from ieee80211\n"); - - if (qnum >= IEEE80211P_NUM_TXQ) { - printk(KERN_ERR "ieee80211p_tx: wrong queue number\n"); - dev_kfree_skb_any(skb); - return; - } - - if (priv->pid_softmodem == 0) { - printk(KERN_ERR "ieee80211_tx: softmodem pid unknown\n"); - dev_kfree_skb_any(skb); - return; - } - - /* Get the size of the skb */ - if (skb->data_len == 0) { - skblen = skb->len; - } - else { - printk(KERN_ERR "ieee80211p_tx: skb not linear\n"); - dev_kfree_skb_any(skb); - return; - } - - /* Allocate nlskb */ - nlskb = alloc_skb(NLMSG_SPACE(skblen), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); - - if (nlskb == NULL) { - printk(KERN_ERR "ieee80211p_tx: alloc nlskb failed\n"); - return; - } - - /* Add room for the nlmsg header */ - skb_put(nlskb, NLMSG_SPACE(skblen)); - - /* Configure the nlmsg header */ - nlh = (struct nlmsghdr *)nlskb->data; - nlh->nlmsg_len = NLMSG_SPACE(skblen); - nlh->nlmsg_pid = priv->pid_softmodem; - nlh->nlmsg_flags = 0; - - NETLINK_CB(nlskb).pid = 0; // nlmsg sent from kernel - NETLINK_CB(nlskb).dst_group = NETLINK_80211P_GROUP; - - /* Copy the data from the skb to the nlskb */ - memcpy(NLMSG_DATA(nlh),skb->data,skb->len); - - /* Free the old skb */ - dev_kfree_skb_any(skb); - - printk(KERN_ERR "ieee80211p_tx: sending data to PHY using pid = %d\n",priv->pid_softmodem); - - ret = netlink_unicast(priv->nl_sock,nlskb,priv->pid_softmodem,NETLINK_80211P_GROUP); - - if (ret <= 0) { - printk(KERN_ERR "ieee80211p_tx: netlink mesg not sent ret = %d\n",ret); - return; - } - -} /* ieee80211p_tx */ - - -static int ieee80211p_start(struct ieee80211_hw *hw) { - - /* Nothing to be done here */ - - return 0; - -} /* ieee80211p_start */ - - -static void ieee80211p_stop(struct ieee80211_hw *hw) { - - /* Nothing to be done here */ - -} /* ieee80211p_stop */ - - -static int ieee80211p_add_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) { - - /* Get driver's private data */ - struct ieee80211p_priv *priv = hw->priv; - struct ieee80211p_vif_priv *vif_priv = (void *)vif->drv_priv; - - /* Return value */ - int ret = 0; - - spin_lock(&priv->lock); - - /* Only ADHOC interfaces supported */ - if (vif->type == NL80211_IFTYPE_ADHOC) { - vif_priv->opmode = vif->type; - } else { - printk(KERN_ERR "ieee80211p_add_interface: wrong interface type\n"); - ret = -EOPNOTSUPP; - goto end; - } - - /* Keep track of the number of virtual interfaces */ - priv->nvifs++; - -end: - spin_unlock(&priv->lock); - return ret; - -} /* ieee80211p_add_interface */ - - -static void ieee80211p_remove_interface(struct ieee80211_hw *hw, - struct ieee80211_vif *vif) { - - /* Get driver's private data */ - struct ieee80211p_priv *priv = hw->priv; - - spin_lock(&priv->lock); - - /* Keep track of the number of virtual interfaces */ - priv->nvifs--; - - spin_unlock(&priv->lock); - -} /* ieee80211p_remove_interface */ - - -static int ieee80211p_config(struct ieee80211_hw *hw, u32 changed) { - - /* Get driver's private data */ - struct ieee80211p_priv *priv = hw->priv; - - /* Get device configuration */ - struct ieee80211_conf *conf = &hw->conf; - - spin_lock(&priv->lock); - - /* Current channel changed */ - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { - if (conf->channel != NULL) { - priv->cur_chan = conf->channel; - } - } - - /* Transmit power changed */ - if (changed & IEEE80211_CONF_CHANGE_POWER) { - priv->cur_power = conf->power_level; - } - - spin_unlock(&priv->lock); - - return 0; - -} /* ieee80211p_config */ - - -static void ieee80211p_configure_filter(struct ieee80211_hw *hw, - unsigned int changed_flags,unsigned int *new_flags, u64 multicast) { - -#define SUPPORTED_FIF_FLAGS \ - (FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL | \ - FIF_PLCPFAIL | FIF_CONTROL | FIF_OTHER_BSS | \ - FIF_BCN_PRBRESP_PROMISC) - - *new_flags &= SUPPORTED_FIF_FLAGS; - -} /* ieee80211p_configure_filter */ - -/************************************************************************** - * Only the mandatory callbacks of ieee80211p_ops have been implemented * - **************************************************************************/ - -const struct ieee80211_ops ieee80211p_driver_ops = { - .tx = ieee80211p_tx, - .start = ieee80211p_start, - .stop = ieee80211p_stop, - .add_interface = ieee80211p_add_interface, - .remove_interface = ieee80211p_remove_interface, - .config = ieee80211p_config, - .configure_filter = ieee80211p_configure_filter, -}; - -/****************************************************************************** - * - * Driver's entry point - * - *****************************************************************************/ - -/****************** - * Start function * - ******************/ - -static int ieee80211p_driver_start(struct ieee80211p_priv *priv) { - - /* Return value */ - int ret = 0; - - /* Configuration and hardware information for an 802.11 PHY */ - struct ieee80211_hw *hw = NULL; - - /******************************************* - * Allocating hw (mac80211 main structure) * - * and priv (driver private data) * - *******************************************/ - - hw = ieee80211_alloc_hw(sizeof(struct ieee80211p_priv),&ieee80211p_driver_ops); - - if (hw == NULL) { - ret = -1; - printk(KERN_ERR "ieee80211p_driver_start: can't alloc ieee80211 hw\n"); - goto error; - } - - priv->hw = hw; - hw->priv = priv; - - /************************************************* - * Initializing hardware and driver private data * - *************************************************/ - - ret = ieee80211p_priv_init(priv); - - if (ret == -1) { - printk(KERN_ERR "ieee80211p_driver_start: can't init priv data hw\n"); - goto error; - } - - /****************** - * Registering hw * - *****************/ - - ret = ieee80211_register_hw(hw); - - if (ret) { - printk(KERN_ERR "ieee80211p_driver_start: can't reg ieee80211 hw\n"); - goto error; - } - - return 0; - -error: - return ret; - -} /* ieee80211p_driver_start */ - -/***************** - * Stop function * - *****************/ - -static void ieee80211p_driver_stop(struct ieee80211p_priv *priv) { - - /******************** - * Freeing hardware * - ********************/ - - struct ieee80211_hw *hw = priv->hw; - - /* TODO: check if needed */ - //kfree(hw->wiphy->regd); - - ieee80211_unregister_hw(hw); - - ieee80211_free_hw(hw); - - /********************************* - * Freeing driver's private data * - *********************************/ - - ieee80211p_priv_exit(priv); - -} /* ieee80211p_driver_stop */ - -/******************************************* - * Driver's init function called at insmod * - *******************************************/ - -static int __init ieee80211p_init(void) -{ - int ret = 0; - - printk(KERN_DEBUG "ieee80211p_init: ieee80211p module inserted\n"); - - ret = ieee80211p_driver_start(&drv_priv_data); - - if (ret == -1) { - printk(KERN_ERR "ieee80211p_init: can't start ieee80211p driver\n"); - } - - return 0; - -} /* ieee80211p_init */ - -/****************************************** - * Driver's exit function called at rmmod * - ******************************************/ - -static void __exit ieee80211p_exit(void) -{ - ieee80211p_driver_stop(&drv_priv_data); - - printk(KERN_DEBUG "ieee80211p_init: ieee80211p module removed\n"); - -} /* ieee80211p_exit */ - -module_exit(ieee80211p_exit); -module_init(ieee80211p_init); diff --git a/openairITS/phy/DRIVERS/ieee80211p-driver.h b/openairITS/phy/DRIVERS/ieee80211p-driver.h deleted file mode 100644 index 6f71bff8be5..00000000000 --- a/openairITS/phy/DRIVERS/ieee80211p-driver.h +++ /dev/null @@ -1,189 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) EURECOM / Thales Communications & Security - * - * Portions of this file are derived from the Atheros ath5k project. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Thales Communications & Security <philippe.agostini@thalesgroup.com> - * - *****************************************************************************/ - -#ifndef __ieee80211p_driver_h__ -#define __ieee80211p_driver_h__ - -/****************************************************************************** - * - * Includes - * - *****************************************************************************/ - -#include <linux/init.h> -#include <linux/module.h> -#include <linux/spinlock.h> -#include <linux/interrupt.h> -#include <linux/skbuff.h> -#include <linux/gfp.h> -#include <net/sock.h> -#include <linux/netlink.h> -#include <net/mac80211.h> -#include <net/cfg80211.h> - -/****************************************************************************** - * - * Macros - * - *****************************************************************************/ - -#define ETH_ALEN 6 -#define IEEE80211P_NUM_TXQ 1 -#define IEEE80211P_TXQ_LEN_MAX 100 -#define FALSE 0 -#define TRUE 1 -#define NETLINK_80211P 17 -#define NETLINK_80211P_GROUP 1 -#define NLCMD_INIT 1 -#define NLCMD_DATA 2 -#define NLCMD_SIZE 1 - -/****************************************************************************** - * - * Device structures - * - *****************************************************************************/ - -/****************************** - * Channels / Birates / Bands * - ******************************/ - -/* Supported channel */ -static struct ieee80211_channel channels = { - .band = IEEE80211_BAND_0_8GHZ, - .center_freq = 800, - .hw_value = 0, - .flags = 0, - .max_antenna_gain = 3, - .max_power = 10, - .max_reg_power = 10, - .beacon_found = FALSE, - .orig_flags = 0, - .orig_mag = 0, - .orig_mpwr = 0, -};/* struct ieee80211_channel */ - - -/* Supported bitrate */ -static struct ieee80211_rate bitrates = { - .flags = 0, - .bitrate = 60, //bitrate in units of 100 Kbps - .hw_value = 0, - .hw_value_short = 0, -};/* struct ieee80211_rate */ - -/* Supported bands (channels + bitrates) */ -static struct ieee80211_supported_band bands = { - .channels = &channels, - .bitrates = &bitrates, - .band = IEEE80211_BAND_0_8GHZ, - .n_channels = 1, - .n_bitrates = 1, - .ht_cap.ht_supported = FALSE, -};/* struct ieee80211_supported_band */ - -/*********** - * RX path * - ***********/ - -enum ieee80211p_rx_flags { - IEEE80211P_MMIC_ERROR = 1 << 0, - IEEE80211P_FAILED_FCS_CRC = 1 << 1, - IEEE80211P_FAILED_PLCP_CRC = 1 << 2, - IEEE80211P_MACTIME_MPDU = 1 << 3, - IEEE80211P_NO_SIGNAL_VAL = 1 << 4, -}; - -struct ieee80211p_rx_status { - u16 data_len; //frame data length - u8 rssi; //received power - u8 rate; //reveived data rate in units of 100 kbps - enum ieee80211_band band; - u8 flags; //RX flags -}; /* struct ieee80211p_rx_status */ - -/********************* - * Regulatory domain * - *********************/ - -/* Regulatory domain */ -static struct ieee80211_regdomain regd = { - .n_reg_rules = 1, - .alpha2 = "99", - .dfs_region = 0, - .reg_rules = { - /* start freq / end freq / bandwidth / gain / eirp / flags */ - REG_RULE(0,6000,40,3,47,0), - } -}; - -/************************************ - * Virtual interface's private data * - ************************************/ - -struct ieee80211p_vif_priv { - enum nl80211_iftype opmode; -}; - -/****************************************************************************** - * - * Driver's private data - * - *****************************************************************************/ - -struct ieee80211p_priv { - - /* Configuration and hardware information for an 802.11 PHY */ - struct ieee80211_hw *hw; - - /* RX */ - spinlock_t rxq_lock; - struct tasklet_struct rx_tq; - - /* Nb of virtual interfaces */ - int nvifs; - - /* Current channel in use */ - struct ieee80211_channel *cur_chan; - - /* Current power level in dBm */ - int cur_power; - - /* Current data rate in units of 100 kbps */ - u16 cur_datarate; - - /* Lock used for misc purposes */ - spinlock_t lock; - - /* Netlink socket used for softmodem <-> ieee80211p communications */ - struct sock *nl_sock; - unsigned int pid_softmodem; - struct sk_buff *rx_skb; - -};/* ieee80211p_device_priv */ - -#endif /* __ieee80211_device_h__ */ diff --git a/openairITS/phy/DRIVERS/ieee80211p-netlinkapi.c b/openairITS/phy/DRIVERS/ieee80211p-netlinkapi.c deleted file mode 100644 index 4f8a3985b91..00000000000 --- a/openairITS/phy/DRIVERS/ieee80211p-netlinkapi.c +++ /dev/null @@ -1,195 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) EURECOM / Thales Communications & Security - * - * Portions of this file are derived from Matthias Ihmig source code. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Thales Communications & Security <philippe.agostini@thalesgroup.com> - * - *****************************************************************************/ - -/****************************************************************************** - * - * Includes - * - *****************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <pthread.h> -#include <unistd.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <linux/netlink.h> -#include "ieee80211p-netlinkapi.h" - -/****************************************************************************** - * - * Routines - * - *****************************************************************************/ - -int netlink_init() { - - int fd, ret; - struct sockaddr_nl s_nladdr; - - fd = socket(AF_NETLINK,SOCK_RAW,NETLINK_80211P); - - if (fd < 0) { - printf("ERROR: socket() failed\n"); - return -1; - } - - /* Source address => from user space */ - memset(&s_nladdr, 0 ,sizeof(s_nladdr)); - s_nladdr.nl_family= AF_NETLINK ; - s_nladdr.nl_pad=0; - s_nladdr.nl_pid = getpid(); - printf("ieee80211 netlink_init(): app pid = %u\n",s_nladdr.nl_pid); - s_nladdr.nl_groups = NETLINK_80211P_GROUP; - - ret = bind(fd, (struct sockaddr*)&s_nladdr, sizeof(s_nladdr)); - - if (ret < 0) { - printf("netlink_init(): bind failed\n"); - return -1; - } - - return fd; -} - -int netlink_send(int fd, int cmd,int payloadlen, char *payload) { - - struct sockaddr_nl d_nladdr; - struct nlmsghdr *nlh = NULL; - char *data; - struct iovec iov; - struct msghdr msg; - int ret; - - /* Destination address â¼> to kernel space */ - memset(&d_nladdr, 0 ,sizeof(d_nladdr)); - d_nladdr.nl_family= AF_NETLINK ; - d_nladdr.nl_pad=0; - d_nladdr.nl_pid = 0; - d_nladdr.nl_groups = NETLINK_80211P_GROUP; - - /* Netlink message building */ - nlh = (struct nlmsghdr *)malloc(NLMSG_SPACE(payloadlen)+NLMSG_HDRLEN+NLCMD_SIZE); - if (nlh == NULL) { - printf("netlink_send(): netlink header memory not allocated\n"); - return -1; - } - memset(nlh,0,NLMSG_SPACE(payloadlen)+NLMSG_HDRLEN+NLCMD_SIZE); - - /* Header */ - nlh->nlmsg_len = NLMSG_SPACE(payloadlen+NLCMD_SIZE); - nlh->nlmsg_pid = getpid(); - printf("ieee80211 netlink_send(): sending app pid = %u\n",nlh->nlmsg_pid); - nlh->nlmsg_flags = NLM_F_REQUEST; - nlh->nlmsg_type = 21; - - data = (char *)NLMSG_DATA(nlh); - /* Netlink command */ - data[0] = cmd; - /* Payload */ - memcpy(&data[1],payload,payloadlen); - iov.iov_base = (void *)nlh; - iov.iov_len = nlh->nlmsg_len; - memset(&msg,0,sizeof(msg)); - msg.msg_name = (void *)&d_nladdr; - msg.msg_namelen = sizeof(d_nladdr); - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - /* Send the msg through the netlink socket */ - ret = sendmsg(fd,&msg,0); - - /* Free the netlink msg */ - free(nlh); - - return ret; - -} - -int netlink_recv(int fd,char *packetpayload) { - - struct sockaddr_nl d_nladdr; - struct nlmsghdr *nlh = NULL; - struct iovec iov; - struct msghdr msg; - int packetpayloadlen = 0; - int ret; - - /* Destination address â¼> to user space */ - memset(&d_nladdr, 0 ,sizeof(d_nladdr)); - - d_nladdr.nl_family= AF_NETLINK; - d_nladdr.nl_groups = NETLINK_80211P_GROUP; - - /* Netlink message building */ - nlh = (struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PKT_SIZE)+NLMSG_HDRLEN); - - if (nlh == NULL) { - printf("netlink_recv(): netlink header memory not allocated\n"); - return -1; - } - - memset(nlh,0,NLMSG_SPACE(NL_MAX_PKT_SIZE)+NLMSG_HDRLEN); - - iov.iov_base = (void *)nlh; - iov.iov_len = NLMSG_SPACE(NL_MAX_PKT_SIZE); - - memset(&msg,0,sizeof(msg)); - msg.msg_name = (void *)&d_nladdr; - msg.msg_namelen = sizeof(d_nladdr); - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - /* Receive the msg from the netlink socket */ - /* Blocking call */ - ret = recvmsg(fd,&msg,0); - - if (ret < 0) { - printf("netlink_recv(): error in recvmsg\n"); - return -1; - } - - packetpayloadlen = nlh->nlmsg_len-NLMSG_HDRLEN; - - if (packetpayloadlen < 0) { - printf("netlink_recv(): error in recvmsg\n"); - return -1; - } - - memcpy(packetpayload,NLMSG_DATA(nlh),packetpayloadlen); - - free(nlh); - - return packetpayloadlen; - -} - -void netlink_close(int fd) { - close(fd); -} diff --git a/openairITS/phy/DRIVERS/ieee80211p-netlinkapi.h b/openairITS/phy/DRIVERS/ieee80211p-netlinkapi.h deleted file mode 100644 index 13d60194beb..00000000000 --- a/openairITS/phy/DRIVERS/ieee80211p-netlinkapi.h +++ /dev/null @@ -1,55 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) EURECOM / Thales Communications & Security - * - * Portions of this file are derived from Matthias Ihmig source code. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Thales Communications & Security <philippe.agostini@thalesgroup.com> - * - *****************************************************************************/ - -#ifndef __ieee80211p_netlinkapi_h__ -#define __ieee80211p_netlinkapi_h__ - -/****************************************************************************** - * - * Macros - * - *****************************************************************************/ - -#define NL_MAX_PKT_SIZE 2000 -#define NETLINK_80211P 17 -#define NETLINK_80211P_GROUP 1 -#define NLCMD_INIT 1 -#define NLCMD_DATA 2 -#define NLCMD_SIZE 1 - -/****************************************************************************** - * - * Declarations - * - *****************************************************************************/ - -int netlink_init(); -int netlink_send(int fd, int cmd,int payloadlen, char *payload); -int netlink_recv(int fd,char *packetpayload); -void netlink_close(int fd); - -#endif /* __ieee80211_netlinkapi_h__ */ diff --git a/openairITS/phy/DRIVERS/ieee80211p-softmodem.c b/openairITS/phy/DRIVERS/ieee80211p-softmodem.c deleted file mode 100644 index 397aa7b3a66..00000000000 --- a/openairITS/phy/DRIVERS/ieee80211p-softmodem.c +++ /dev/null @@ -1,141 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) EURECOM / Thales Communications & Security - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Thales Communications & Security <philippe.agostini@thalesgroup.com> - * - *****************************************************************************/ - -/****************************************************************************** - * - * Includes - * - *****************************************************************************/ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include "ieee80211p-netlinkapi.h" - -/****************************************************************************** - * - * Definitions - * - *****************************************************************************/ - -enum nl80211_band { - NL80211_BAND_2GHZ, - NL80211_BAND_5GHZ, - NL80211_BAND_5_9GHZ, - NL80211_BAND_0_8GHZ, -}; - -enum ieee80211_band { - IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ, - IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ, - IEEE80211_BAND_5_9GHZ = NL80211_BAND_5_9GHZ, - IEEE80211_BAND_0_8GHZ = NL80211_BAND_0_8GHZ, -}; - -struct ieee80211p_rx_status { - short data_len; //frame data length in bytes - char rssi; //received power in dBm - char rate; //reveived data rate in units of 100 kbps - enum ieee80211_band band; - char flags; //RX flags -}; /* struct ieee80211p_rx_status */ - -/****************************************************************************** - * - * Main - * - *****************************************************************************/ - -int main() { - - int fd; - int ret; - /* txdata = data received over the air and to be sent to the stack */ - /* txdata = rx_status (12 bytes) + ICMP echo request (116 bytes) */ - char txdata[128] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x10, 0x21, 0x22, 0x23, 0x24, 0x25, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00, 0x00, 0x54, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01, 0xb6, 0x57, 0xc0, 0xa8, 0x01, 0x02, 0xc0, 0xa8, 0x01, 0xff, 0x08, 0x00, 0xa6, 0x7e, 0x2a, 0x39, 0x00, 0x0a, 0x4d, 0xcf, 0x1f, 0x50, 0xc5, 0x1b, 0x0a, 0x00, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37}; - /* rxdata = data received from the stack and to be tx over the air */ - char *rxdata; - int i; - struct ieee80211p_rx_status *rs; - - /*********************** - * Netlink socket init * - ***********************/ - - fd = netlink_init(); - - if (fd == -1) { - return -1; - } - - rxdata = (char *)malloc(2000); - - /************************************************************************* - * Send data to the socket to give to the kernel the pid of this process * - *************************************************************************/ - - ret = netlink_send(fd,NLCMD_INIT,10,&txdata[0]); - - /************************************************ - * Send/receive data to/from the netlink socket * - ************************************************/ - - /* Set up struct rx status */ - rs = (struct ieee80211p_rx_status *)&txdata[0]; - rs->data_len = 128; - rs->rssi = 20; - rs->rate = 60; - rs->band = IEEE80211_BAND_0_8GHZ; - rs->flags = 0; - - while (1) { - - /* Send ICMP echo request */ - printf("ieee80211p-softmodem main(): sending echo request\n"); - ret = netlink_send(fd,NLCMD_DATA,128,&txdata[0]); - - /* Receive ICMP echo reply */ - printf("ieee80211p-softmodem main(): waiting echo reply\n"); - ret = netlink_recv(fd,rxdata); - - if (ret > 0) { - - printf("ieee80211p-softmodem main(): "); - for (i=0;i<ret;i++) { - printf("%02hhx ",rxdata[i]); - } - - printf("\n"); - - } - - sleep(1); - - } - - free(rxdata); - - return 0; -} diff --git a/openairITS/phy/SIMULATION/Makefile b/openairITS/phy/SIMULATION/Makefile deleted file mode 100644 index 3dbe734e476..00000000000 --- a/openairITS/phy/SIMULATION/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -export TOP_DIR = $(OPENAIR1_DIR) -export OPENAIR2_TOP = $(OPENAIR2_DIR) -export COMMON_UTILS_DIR = $(OPENAIR_HOME)/common/utils - -include $(OPENAIR_HOME)/common/utils/Makefile.inc -include $(OPENAIR1_DIR)/SIMULATION/Makefile.inc -include $(OPENAIR2_DIR)/UTIL/Makefile.inc -include $(OPENAIRITS_DIR)/phy/DOT11/Makefile.inc - -CFLAGS += -DMALLOC_CHECK_=1 -DEXECTIME - -CFLAGS += -DUSER_MODE -DNB_ANTENNAS_TX=1 -DNB_ANTENNAS_RX=2 - -CFLAGS += $(UTILS_incl) -I$(OPENAIR1_DIR) -I$(OPENAIRITS_DIR) -I$(OPENAIR2_DIR) -I$(OPENAIR2_DIR)/COMMON - -LFLAGS = -lm -lblas -lxml2 -lrt - -ifdef DEBUG_PHY -CFLAGS += -DDEBUG_PHY -endif - -ifdef XFORMS -CFLAGS += -DXFORMS -LFLAGS += -lforms -endif - -ifdef PERFECT_CE -CFLAGS += -DPERFECT_CE -endif - -CFLAGS += -I/usr/include/X11 -I/usr/X11R6/include - -#TOOLS_OBJS += $(OPENAIR1_DIR)/PHY/TOOLS/file_output.o - -OBJ = $(PHY_OBJS) $(SIMULATION_OBJS) $(TOOLS_OBJS) $(LOG_OBJS) $(ITTI_DIR)/backtrace.o - -ifdef XFORMS -OBJ += dot11_scope.o -endif - -ifdef STATIC -LFLAGS += -static -L/usr/lib/libblas -endif - - - -all: dot11sim - -$(OBJ) : %.o : %.c - @echo - @echo Compiling $< ... - @$(CC) -c $(CFLAGS) -o $@ $< - -dot11sim : $(OBJ) dot11sim.c - @echo "Compiling dot11sim.c ..." - @$(CC) dot11sim.c -o dot11sim $(CFLAGS) $(OBJ) $(LFLAGS) - -clean : - rm -f $(OBJ) - rm -f *.o - -cleanall : clean - rm -f dot11sim - rm -f *.exe* - -showflags : - @echo $(CFLAGS) - @echo $(LFLAGS) - @echo $(OBJ) diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_0_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_0_1024.m deleted file mode 100644 index a4063a39ff2..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_0_1024.m +++ /dev/null @@ -1,26 +0,0 @@ -SNR_0_1024_v = [4 -4.2 -4.4 -4.6 -4.8 -5 -5.2 -5.4 -5.6 -5.8 -6 -6.2 -6.4 -6.6 -6.8 -7 -7.2 -7.4 -7.6 -7.8 -8 -8.2 -8.4 -8.6 -8.8 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_0_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_0_256.m deleted file mode 100644 index 10b86e14018..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_0_256.m +++ /dev/null @@ -1,26 +0,0 @@ -SNR_0_256_v = [3 -3.2 -3.4 -3.6 -3.8 -4 -4.2 -4.4 -4.6 -4.8 -5 -5.2 -5.4 -5.6 -5.8 -6 -6.2 -6.4 -6.6 -6.8 -7 -7.2 -7.4 -7.6 -7.8 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_1_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_1_1024.m deleted file mode 100644 index 5a3cdf53d51..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_1_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -SNR_1_1024_v = [5 -5.2 -5.4 -5.6 -5.8 -6 -6.2 -6.4 -6.6 -6.8 -7 -7.2 -7.4 -7.6 -7.8 -8 -8.2 -8.4 -8.6 -8.8 -9 -9.2 -9.4 -9.6 -9.8 -10 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_1_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_1_256.m deleted file mode 100644 index c5fd108b50c..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_1_256.m +++ /dev/null @@ -1,26 +0,0 @@ -SNR_1_256_v = [4 -4.2 -4.4 -4.6 -4.8 -5 -5.2 -5.4 -5.6 -5.8 -6 -6.2 -6.4 -6.6 -6.8 -7 -7.2 -7.4 -7.6 -7.8 -8 -8.2 -8.4 -8.6 -8.8 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_2_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_2_1024.m deleted file mode 100644 index f3f487314c3..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_2_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -SNR_2_1024_v = [6 -6.2 -6.4 -6.6 -6.8 -7 -7.2 -7.4 -7.6 -7.8 -8 -8.2 -8.4 -8.6 -8.8 -9 -9.2 -9.4 -9.6 -9.8 -10 -10.2 -10.4 -10.6 -10.8 -11 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_2_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_2_256.m deleted file mode 100644 index 28bb2975329..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_2_256.m +++ /dev/null @@ -1,27 +0,0 @@ -SNR_2_256_v = [5 -5.2 -5.4 -5.6 -5.8 -6 -6.2 -6.4 -6.6 -6.8 -7 -7.2 -7.4 -7.6 -7.8 -8 -8.2 -8.4 -8.6 -8.8 -9 -9.2 -9.4 -9.6 -9.8 -10 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_3_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_3_1024.m deleted file mode 100644 index a5fbee0a5d6..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_3_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -SNR_3_1024_v = [8 -8.2 -8.4 -8.6 -8.8 -9 -9.2 -9.4 -9.6 -9.8 -10 -10.2 -10.4 -10.6 -10.8 -11 -11.2 -11.4 -11.6 -11.8 -12 -12.2 -12.4 -12.6 -12.8 -13 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_3_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_3_256.m deleted file mode 100644 index d21da444f89..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_3_256.m +++ /dev/null @@ -1,27 +0,0 @@ -SNR_3_256_v = [6 -6.2 -6.4 -6.6 -6.8 -7 -7.2 -7.4 -7.6 -7.8 -8 -8.2 -8.4 -8.6 -8.8 -9 -9.2 -9.4 -9.6 -9.8 -10 -10.2 -10.4 -10.6 -10.8 -11 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_4_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_4_1024.m deleted file mode 100644 index 71e6b16ba06..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_4_1024.m +++ /dev/null @@ -1,17 +0,0 @@ -SNR_4_1024_v = [12 -12.2 -12.4 -12.6 -12.8 -13 -13.2 -13.4 -13.6 -13.8 -14 -14.2 -14.4 -14.6 -14.8 -15 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_4_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_4_256.m deleted file mode 100644 index d9c7ebd241c..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_4_256.m +++ /dev/null @@ -1,27 +0,0 @@ -SNR_4_256_v = [10 -10.2 -10.4 -10.6 -10.8 -11 -11.2 -11.4 -11.6 -11.8 -12 -12.2 -12.4 -12.6 -12.8 -13 -13.2 -13.4 -13.6 -13.8 -14 -14.2 -14.4 -14.6 -14.8 -15 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_5_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_5_1024.m deleted file mode 100644 index a643e70c2c8..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_5_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -SNR_5_1024_v = [14 -14.2 -14.4 -14.6 -14.8 -15 -15.2 -15.4 -15.6 -15.8 -16 -16.2 -16.4 -16.6 -16.8 -17 -17.2 -17.4 -17.6 -17.8 -18 -18.2 -18.4 -18.6 -18.8 -19 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_5_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/SNR_5_256.m deleted file mode 100644 index 373c6e630b6..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/SNR_5_256.m +++ /dev/null @@ -1,27 +0,0 @@ -SNR_5_256_v = [14 -14.2 -14.4 -14.6 -14.8 -15 -15.2 -15.4 -15.6 -15.8 -16 -16.2 -16.4 -16.6 -16.8 -17 -17.2 -17.4 -17.6 -17.8 -18 -18.2 -18.4 -18.6 -18.8 -19 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_0_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_0_1024.m deleted file mode 100644 index 4132f40022d..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_0_1024.m +++ /dev/null @@ -1,26 +0,0 @@ -errors_0_1024_v = [1001 -1001 -1001 -1001 -1001 -1001 -1001 -634 -378 -202 -109 -51 -36 -14 -12 -3 -5 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_0_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_0_256.m deleted file mode 100644 index 8595ecd7dbd..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_0_256.m +++ /dev/null @@ -1,26 +0,0 @@ -errors_0_256_v = [1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -706 -390 -229 -121 -63 -27 -24 -11 -6 -4 -2 -3 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_1_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_1_1024.m deleted file mode 100644 index 114f1f6413a..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_1_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -errors_1_1024_v = [1001 -1001 -1001 -1001 -1001 -1001 -745 -431 -237 -132 -103 -76 -41 -28 -14 -7 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_1_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_1_256.m deleted file mode 100644 index ee4bf09154e..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_1_256.m +++ /dev/null @@ -1,26 +0,0 @@ -errors_1_256_v = [1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -859 -475 -269 -129 -72 -70 -43 -24 -18 -4 -5 -3 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_2_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_2_1024.m deleted file mode 100644 index 3e1d8951680..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_2_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -errors_2_1024_v = [1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -888 -706 -497 -371 -268 -193 -142 -80 -56 -35 -14 -11 -4 -1 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_2_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_2_256.m deleted file mode 100644 index 48d1170321b..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_2_256.m +++ /dev/null @@ -1,27 +0,0 @@ -errors_2_256_v = [1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1002 -1001 -1001 -1001 -1001 -964 -800 -578 -413 -328 -268 -193 -131 -92 -67 -48 -26 -17 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_3_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_3_1024.m deleted file mode 100644 index 3befc5727f1..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_3_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -errors_3_1024_v = [1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -681 -460 -270 -168 -84 -43 -26 -17 -8 -5 -4 -4 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_3_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_3_256.m deleted file mode 100644 index 39c57f53daa..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_3_256.m +++ /dev/null @@ -1,27 +0,0 @@ -errors_3_256_v = [1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -766 -583 -365 -221 -146 -85 -62 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_4_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_4_1024.m deleted file mode 100644 index f03b846baa4..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_4_1024.m +++ /dev/null @@ -1,17 +0,0 @@ -errors_4_1024_v = [1001 -1001 -1001 -1001 -1001 -720 -421 -209 -86 -44 -24 -5 -3 -1 -2 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_4_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_4_256.m deleted file mode 100644 index c5876a6e2c6..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_4_256.m +++ /dev/null @@ -1,27 +0,0 @@ -errors_4_256_v = [1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -757 -391 -216 -117 -66 -24 -16 -8 -4 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_5_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_5_1024.m deleted file mode 100644 index 0db75d58714..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_5_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -errors_5_1024_v = [1001 -1001 -1001 -1001 -1001 -1001 -1001 -1001 -756 -454 -205 -124 -64 -47 -46 -40 -42 -46 -29 -28 -20 -14 -7 -2 -1 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/errors_5_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/errors_5_256.m deleted file mode 100644 index 86c01bf6ce5..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/errors_5_256.m +++ /dev/null @@ -1,27 +0,0 @@ -errors_5_256_v = [1001 -1001 -1001 -1001 -1001 -1001 -656 -387 -204 -107 -54 -48 -15 -17 -15 -10 -8 -11 -8 -5 -5 -1 -0 -0 -1 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/plots.m b/openairITS/phy/SIMULATION/PER_PLOTS/plots.m deleted file mode 100644 index 6f892415fbb..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/plots.m +++ /dev/null @@ -1,73 +0,0 @@ -SNR_0_256 -errors_0_256 -trials_0_256 -signal_errors_0_256 - -SNR_1_256 -errors_1_256 -trials_1_256 - -SNR_2_256 -errors_2_256 -trials_2_256 - -SNR_3_256 -errors_3_256 -trials_3_256 - -SNR_4_256 -errors_4_256 -trials_4_256 - -SNR_5_256 -errors_5_256 -trials_5_256 - -SNR_0_1024 -errors_0_1024 -trials_0_1024 -signal_errors_0_1024 - -SNR_1_1024 -errors_1_1024 -trials_1_1024 - -SNR_2_1024 -errors_2_1024 -trials_2_1024 - -SNR_3_1024 -errors_3_1024 -trials_3_1024 - -SNR_4_1024 -errors_4_1024 -trials_4_1024 - -SNR_5_1024 -errors_5_1024 -trials_5_1024 - -Pe_signal = signal_errors_0_256_v./trials_0_256_v; -Pe_data_0 = errors_0_256_v./trials_0_256_v; -Pe_data_1 = errors_1_256_v./trials_1_256_v; -Pe_data_2 = errors_2_256_v./trials_2_256_v; -Pe_data_3 = errors_3_256_v./trials_3_256_v; -Pe_data_4 = errors_4_256_v./trials_4_256_v; -Pe_data_5 = errors_5_256_v./trials_5_256_v; - -Pe_data_0_1024 = errors_0_1024_v./trials_0_1024_v; -Pe_data_1_1024 = errors_1_1024_v./trials_1_1024_v; -Pe_data_2_1024 = errors_2_1024_v./trials_2_1024_v; -Pe_data_3_1024 = errors_3_1024_v./trials_3_1024_v; -Pe_data_4_1024 = errors_4_1024_v./trials_4_1024_v; -Pe_data_5_1024 = errors_5_1024_v./trials_5_1024_v; - -semilogy(SNR_0_256_v,Pe_signal,'b',SNR_0_256_v,Pe_data_0,'r',SNR_0_1024_v,Pe_data_0_1024,'k',SNR_1_256_v,Pe_data_1,'r',SNR_2_256_v,Pe_data_2,'r',SNR_3_256_v,Pe_data_3,'r',SNR_4_256_v,Pe_data_4,'r',SNR_5_256_v,Pe_data_5,'r',SNR_1_1024_v,Pe_data_1_1024,'k',SNR_2_1024_v,Pe_data_2_1024,'k',SNR_3_1024_v,Pe_data_3_1024,'k',SNR_4_1024_v,Pe_data_4_1024,'k',SNR_5_1024_v,Pe_data_5_1024,'k'); - -axis([1 20 5e-3 .5]) -grid -legend('SIGNAL','256 byte SDU','1024 byte SDU'); -title('openairITS Block Error Rates for SIGNAL, 802.11p rates 0-5, for SDU lengths 256 and 1024 bytes') -xlabel('SNR dB') -ylabel('PER') diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_0_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_0_1024.m deleted file mode 100644 index 4c930b51dd0..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_0_1024.m +++ /dev/null @@ -1,26 +0,0 @@ -signal_errors_0_1024_v = [14 -10 -11 -5 -7 -5 -2 -2 -1 -1 -0 -0 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_0_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_0_256.m deleted file mode 100644 index cb4247f382c..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_0_256.m +++ /dev/null @@ -1,26 +0,0 @@ -signal_errors_0_256_v = [227 -137 -91 -63 -46 -34 -22 -22 -20 -18 -11 -3 -3 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_1_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_1_1024.m deleted file mode 100644 index a20e8cc3b8e..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_1_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -signal_errors_1_1024_v = [1 -1 -0 -0 -0 -1 -0 -0 -0 -0 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_1_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_1_256.m deleted file mode 100644 index cb704bf9b90..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_1_256.m +++ /dev/null @@ -1,26 +0,0 @@ -signal_errors_1_256_v = [24 -15 -5 -6 -3 -5 -0 -2 -3 -0 -0 -0 -0 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_2_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_2_1024.m deleted file mode 100644 index c9bbd9bd1e8..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_2_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -signal_errors_2_1024_v = [0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_2_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_2_256.m deleted file mode 100644 index 5f334a4eea6..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_2_256.m +++ /dev/null @@ -1,27 +0,0 @@ -signal_errors_2_256_v = [2 -0 -3 -0 -1 -0 -0 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_3_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_3_1024.m deleted file mode 100644 index 715b9063510..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_3_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -signal_errors_3_1024_v = [0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_3_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_3_256.m deleted file mode 100644 index 0f367804148..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_3_256.m +++ /dev/null @@ -1,27 +0,0 @@ -signal_errors_3_256_v = [0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_4_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_4_1024.m deleted file mode 100644 index 22539fb5b2f..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_4_1024.m +++ /dev/null @@ -1,17 +0,0 @@ -signal_errors_4_1024_v = [0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_4_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_4_256.m deleted file mode 100644 index 6165235c5fa..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_4_256.m +++ /dev/null @@ -1,27 +0,0 @@ -signal_errors_4_256_v = [0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_5_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_5_1024.m deleted file mode 100644 index 71eb0166a2e..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_5_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -signal_errors_5_1024_v = [0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_5_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_5_256.m deleted file mode 100644 index 422495d4b41..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/signal_errors_5_256.m +++ /dev/null @@ -1,27 +0,0 @@ -signal_errors_5_256_v = [0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_0_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_0_1024.m deleted file mode 100644 index 30d265e6e0c..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_0_1024.m +++ /dev/null @@ -1,26 +0,0 @@ -trials_0_1024_v = [1228 -1474 -1875 -2517 -3900 -5658 -9317 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_0_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_0_256.m deleted file mode 100644 index f765f1f7d0e..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_0_256.m +++ /dev/null @@ -1,26 +0,0 @@ -trials_0_256_v = [1278 -1202 -1212 -1309 -1522 -1872 -2372 -3593 -5295 -8257 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_1_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_1_1024.m deleted file mode 100644 index dd44f93cd2d..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_1_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -trials_1_1024_v = [1190 -1447 -1919 -2741 -4649 -7694 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_1_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_1_256.m deleted file mode 100644 index 6105eec68a4..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_1_256.m +++ /dev/null @@ -1,26 +0,0 @@ -trials_1_256_v = [1032 -1040 -1065 -1176 -1409 -1871 -2492 -4034 -6736 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_2_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_2_1024.m deleted file mode 100644 index 07f13d954b8..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_2_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -trials_2_1024_v = [1114 -1186 -1341 -1579 -1886 -2339 -2902 -3620 -4132 -5476 -7065 -9250 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_2_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_2_256.m deleted file mode 100644 index bae519834a7..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_2_256.m +++ /dev/null @@ -1,27 +0,0 @@ -trials_2_256_v = [1019 -1051 -1112 -1224 -1401 -1642 -1953 -2405 -3036 -3685 -4897 -6412 -7686 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_3_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_3_1024.m deleted file mode 100644 index a5bf3ca9f74..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_3_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -trials_3_1024_v = [1179 -1345 -1439 -1642 -1934 -2190 -2516 -3198 -4124 -5120 -6859 -9578 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_3_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_3_256.m deleted file mode 100644 index b8375878ed1..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_3_256.m +++ /dev/null @@ -1,27 +0,0 @@ -trials_3_256_v = [1000 -1001 -1003 -1014 -1028 -1053 -1142 -1253 -1385 -1585 -1887 -2307 -2714 -3080 -3854 -4687 -5712 -7556 -9480 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_4_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_4_1024.m deleted file mode 100644 index 7d2189b7590..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_4_1024.m +++ /dev/null @@ -1,17 +0,0 @@ -trials_4_1024_v = [1361 -1795 -2665 -4186 -7512 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_4_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_4_256.m deleted file mode 100644 index b07cfaa6fc3..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_4_256.m +++ /dev/null @@ -1,27 +0,0 @@ -trials_4_256_v = [1144 -1197 -1191 -1154 -1108 -1072 -1109 -1201 -1494 -1946 -2816 -4492 -7191 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_5_1024.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_5_1024.m deleted file mode 100644 index bdcdddd3605..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_5_1024.m +++ /dev/null @@ -1,27 +0,0 @@ -trials_5_1024_v = [1015 -1051 -1172 -1346 -1839 -2786 -4323 -7288 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/PER_PLOTS/trials_5_256.m b/openairITS/phy/SIMULATION/PER_PLOTS/trials_5_256.m deleted file mode 100644 index 1678ba8b700..00000000000 --- a/openairITS/phy/SIMULATION/PER_PLOTS/trials_5_256.m +++ /dev/null @@ -1,27 +0,0 @@ -trials_5_256_v = [1253 -1589 -2168 -3266 -5020 -8752 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -10000 -]; diff --git a/openairITS/phy/SIMULATION/dot11sim.c b/openairITS/phy/SIMULATION/dot11sim.c deleted file mode 100644 index 9a5b945dfc0..00000000000 --- a/openairITS/phy/SIMULATION/dot11sim.c +++ /dev/null @@ -1,439 +0,0 @@ -#include <string.h> -#include <math.h> -#include <unistd.h> -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> -#include "SIMULATION/TOOLS/defs.h" -#include "SIMULATION/RF/defs.h" - -#include "phy/DOT11/defs.h" -#include "phy/DOT11/commonvars.h" -#include <malloc.h> - -#define BW 5.0 - -//#include "PHY/TOOLS/twiddle64.h" - -#include "UTIL/LOG/log.h" - -#define FRAME_LENGTH_SAMPLES_MAX 76800 - -uint16_t rev64[64]; - -#define RX_THRES_dB 26 - -int opp_enabled=1; - -int main(int argc, char **argv) { - - char c; - - int i,aa,aarx; - double sigma2, sigma2_dB=0,SNR,snr0=10.0,snr1=10.2; - int snr1set=0; - uint32_t *txdata,*rxdata[2]; - double *s_re[2],*s_im[2],*r_re[2],*r_im[2]; - double iqim=0.0; - int trial, ntrials=1; - int n_rx=1; - - int awgn_flag=0; - int n_frames=1; - channel_desc_t *ch; - uint32_t tx_lev,tx_lev_dB; - int interf1=-19,interf2=-19; - SCM_t channel_model=AWGN; - uint32_t sdu_length_samples; - TX_VECTOR_t tx_vector; - int errors=0,misdetected_errors=0,signal_errors=0; - int symbols=0; - int tx_offset = 0,rx_offset; - RX_VECTOR_t *rxv; - uint8_t *data_ind,*data_ind_rx; - int no_detection=1; - int missed_packets=0; - uint8_t rxp; - int off,off2; - double txg,txg_dB; - int log2_maxh; - double snr_array[100]; - int errors_array[100]; - int trials_array[100]; - int misdetected_errors_array[100]; - int signal_errors_array[100]; - int missed_packets_array[100]; - int cnt=0; - char fname[100],vname[100]; - int stop=0; - - data_ind = (uint8_t*)malloc(4095+2+1); - data_ind_rx = (uint8_t*)malloc(4095+2+1); - - tx_vector.rate=1; - tx_vector.sdu_length=256; - tx_vector.service=0; - - logInit(); - - randominit(0); - set_taus_seed(0); - - // Basic initializations - init_fft(64,6,rev64); - init_interleavers(); - ccodedot11_init(); - ccodedot11_init_inv(); - phy_generate_viterbi_tables(); - - init_crc32(); - - data_ind[0] = 0; - data_ind[1] = 0; - - tx_offset = taus()%(FRAME_LENGTH_SAMPLES_MAX/2); - - while ((c = getopt (argc, argv, "hag:n:s:S:z:r:p:d:")) != -1) { - switch (c) { - case 'a': - printf("Running AWGN simulation\n"); - awgn_flag = 1; - ntrials=1; - break; - case 'g': - switch((char)*optarg) { - case 'A': - channel_model=SCM_A; - break; - case 'B': - channel_model=SCM_B; - break; - case 'C': - channel_model=SCM_C; - break; - case 'D': - channel_model=SCM_D; - break; - case 'E': - channel_model=EPA; - break; - case 'F': - channel_model=EVA; - break; - case 'G': - channel_model=ETU; - break; - case 'H': - channel_model=Rayleigh8; - case 'I': - channel_model=Rayleigh1; - case 'J': - channel_model=Rayleigh1_corr; - case 'K': - channel_model=Rayleigh1_anticorr; - case 'L': - channel_model=Rice8; - case 'M': - channel_model=Rice1; - break; - default: - printf("Unsupported channel model!\n"); - exit(-1); - } - break; - case 'd': - tx_offset = atoi(optarg); - break; - case 'p': - tx_vector.sdu_length = atoi(optarg); - if (atoi(optarg)>4095) { - printf("Illegal sdu_length %d\n",tx_vector.sdu_length); - exit(-1); - } - break; - case 'r': - tx_vector.rate = atoi(optarg); - if (atoi(optarg)>7) { - printf("Illegal rate %d\n",tx_vector.rate); - exit(-1); - } - break; - case 'n': - n_frames = atoi(optarg); - break; - case 's': - snr0 = atof(optarg); - printf("Setting SNR0 to %f\n",snr0); - break; - case 'S': - snr1 = atof(optarg); - snr1set=1; - printf("Setting SNR1 to %f\n",snr1); - break; - case 'z': - n_rx=atoi(optarg); - if ((n_rx==0) || (n_rx>2)) { - printf("Unsupported number of rx antennas %d\n",n_rx); - exit(-1); - } - break; - default: - case 'h': - printf("%s -h(elp) -a(wgn on) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -r Ricean_FactordB -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",argv[0]); - printf("-h This message\n"); - printf("-a Use AWGN channel and not multipath\n"); - printf("-n Number of frames to simulate\n"); - printf("-s Starting SNR, runs from SNR0 to SNR0 + 5 dB. If n_frames is 1 then just SNR is simulated\n"); - printf("-S Ending SNR, runs from SNR0 to SNR1\n"); - printf("-g [A,B,C,D,E,F,G] Use 3GPP SCM (A,B,C,D) or 36-101 (E-EPA,F-EVA,G-ETU) models (ignores delay spread and Ricean factor)\n"); - printf("-z Number of RX antennas used\n"); - printf("-F Input filename (.txt format) for RX conformance testing\n"); - exit (-1); - break; - } - } - - if (n_frames==1) - snr1 = snr0+.2; - else - snr1 = snr0+5; - for (i=0;i<tx_vector.sdu_length;i++) - data_ind[i+2] = i;//taus(); // randomize packet - data_ind[tx_vector.sdu_length+2+4]=0; // Tail byte - - // compute number of OFDM symbols in DATA period - symbols = ((4+2+1+tx_vector.sdu_length)<<1) / nibbles_per_symbol[tx_vector.rate]; - if ((((4+2+1+tx_vector.sdu_length)<<1) % nibbles_per_symbol[tx_vector.rate]) > 0) - symbols++; - - sdu_length_samples = (symbols + 5) * 80; - - printf("Number of symbols for sdu : %d, samples %d\n",symbols,sdu_length_samples); - - txdata = (uint32_t*)memalign(16,sdu_length_samples*sizeof(uint32_t)); - for (i=0;i<n_rx;i++) { - rxdata[i] = (uint32_t*)memalign(16,(FRAME_LENGTH_SAMPLES_MAX+1280)*sizeof(uint32_t)); - bzero(rxdata[i],(FRAME_LENGTH_SAMPLES_MAX+1280)*sizeof(uint32_t)); - } - s_re[0] = (double *)malloc(sdu_length_samples*sizeof(double)); - bzero(s_re[0],sdu_length_samples*sizeof(double)); - s_im[0] = (double *)malloc(sdu_length_samples*sizeof(double)); - bzero(s_im[0],sdu_length_samples*sizeof(double)); - for (i=0;i<n_rx;i++) { - r_re[i] = (double *)malloc((sdu_length_samples+100)*sizeof(double)); - bzero(r_re[i],(sdu_length_samples+100)*sizeof(double)); - r_im[i] = (double *)malloc((sdu_length_samples+100)*sizeof(double)); - bzero(r_im[i],(sdu_length_samples+100)*sizeof(double)); - } - - ch = new_channel_desc_scm(1, - n_rx, - channel_model, - BW, - 0.0, - 0, - 0); - - - if (ch==NULL) { - printf("Problem generating channel model. Exiting.\n"); - exit(-1); - } - - - phy_tx_start(&tx_vector,txdata,0,FRAME_LENGTH_SAMPLES_MAX,data_ind); - - tx_lev = signal_energy((int32_t*)txdata,320); - tx_lev_dB = (unsigned int) dB_fixed(tx_lev); - - write_output("txsig0.m","txs", txdata,sdu_length_samples,1,1); - - // multipath channel - - for (i=0;i<sdu_length_samples;i++) { - s_re[0][i] = (double)(((short *)txdata)[(i<<1)]); - s_im[0][i] = (double)(((short *)txdata)[(i<<1)+1]); - } - - for (SNR=snr0;SNR<snr1;SNR+=.2) { - - printf("n_frames %d SNR %f sdu_length %d rate %d\n",n_frames,SNR,tx_vector.sdu_length,tx_vector.rate); - errors=0; - misdetected_errors=0; - signal_errors=0; - missed_packets=0; - stop=0; - for (trial=0; trial<n_frames; trial++) { - // printf("Trial %d (errors %d), sdu_length_samples %d\n",trial,errors,sdu_length_samples); - sigma2_dB = 25; //10*log10((double)tx_lev) - SNR; - txg_dB = 10*log10((double)tx_lev) - (SNR + sigma2_dB); - txg = pow(10.0,-.05*txg_dB); - if (n_frames==1) - printf("sigma2_dB %f (SNR %f dB) tx_lev_dB %f, txg %f\n",sigma2_dB,SNR,10*log10((double)tx_lev)-txg_dB,txg_dB); - //AWGN - sigma2 = pow(10,sigma2_dB/10); - // printf("Sigma2 %f (sigma2_dB %f)\n",sigma2,sigma2_dB); - - // sigma2 = 0; - - multipath_channel(ch,s_re,s_im,r_re,r_im, - sdu_length_samples,0); - - if (n_frames==1) { - printf("rx_level data symbol %f, tx_lev %f\n", - 10*log10(signal_energy_fp(r_re,r_im,1,80,0)), - 10*log10(tx_lev)); - } - - for (aa=0;aa<n_rx;aa++) { - for (i=0; i<(sdu_length_samples+100); i++) { - - - ((short*)&rxdata[aa][tx_offset])[(i<<1)] = (short) (((txg*r_re[aa][i]) + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); - ((short*)&rxdata[aa][tx_offset])[1+(i<<1)] = (short) (((txg*r_im[aa][i]) + (iqim*r_re[aa][i]*txg) + sqrt(sigma2/2)*gaussdouble(0.0,1.0))); - - // if (i<128) - // printf("i%d : rxdata %d, txdata %d\n",i,((short *)rxdata[aa])[rx_offset+(i<<1)],((short *)txdata)[i<<1]); - } - - for (i=0;i<tx_offset;i++) { - ((short*) rxdata[aa])[(i<<1)] = (short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0)); - ((short*) rxdata[aa])[1+(i<<1)] = (short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0)); - } - for (i=(tx_offset+sdu_length_samples+100);i<FRAME_LENGTH_SAMPLES_MAX;i++) { - ((short*) rxdata[aa])[(i<<1)] = (short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0)); - ((short*) rxdata[aa])[1+(i<<1)] = (short) (sqrt(sigma2/2)*gaussdouble(0.0,1.0)); - } - - } - if (n_frames==1) { - write_output("rxsig0.m","rxs", &rxdata[0][0],FRAME_LENGTH_SAMPLES_MAX,1,1); - } - no_detection=1; - off = 0; - while(off<FRAME_LENGTH_SAMPLES_MAX) { - - rxp = dB_fixed(signal_energy(rxdata[0]+off,512)); - if (n_frames==1) - printf("off %d: rxp %d (%d)\n",off,rxp,signal_energy(rxdata[0]+off,104)); - - if (rxp>RX_THRES_dB) { - if (off<105) - off2 = FRAME_LENGTH_SAMPLES_MAX-105; - else - off2=off; - if ((initial_sync(&rxv,&rx_offset,&log2_maxh,(uint32_t*)rxdata[0],FRAME_LENGTH_SAMPLES_MAX,off2,1) == BUSY)) { - if (n_frames==1) - printf("Channel is busy, rxv %p, offset %d\n",(void*)rxv,rx_offset); - no_detection=0; - if (rxv) { - if (n_frames==1) - printf("Rate %d, SDU_LENGTH %d\n",rxv->rate,rxv->sdu_length); - if ( (rxv->rate != tx_vector.rate)||(rxv->sdu_length != tx_vector.sdu_length)) { - signal_errors++; - if ((signal_errors > (n_frames/10)) && (trial>=100)) { - stop=1; - } - if (n_frames == 1) - printf("SIGNAL error: rx_offset %d, tx_offset %d (off2 %d)\n",rx_offset,tx_offset,off2); - break; - } - else { - memset(data_ind_rx,0,rxv->sdu_length+4+2+1); - if (data_detection(rxv,data_ind_rx,(uint32_t*)rxdata[0],FRAME_LENGTH_SAMPLES_MAX,rx_offset,log2_maxh,NULL)) { - for (i=0;i<rxv->sdu_length+6;i++) { - if (data_ind[i]!=data_ind_rx[i]) { - //printf("error position %d : %x,%x\n",i,data_ind[i],data_ind_rx[i]); - misdetected_errors++; - errors++; - } - } - if ((errors > (n_frames/10)) && (trial>100)) { - stop=1; - break; - } - } // initial_synch returns IDLE - else { - errors++; - if (n_frames == 1) { - printf("Running data_detection fails\n"); - - for (i=0;i<rxv->sdu_length+6;i++) { - if (data_ind[i]!=data_ind_rx[i]) { - printf("error position %d : %x,%x\n",i,data_ind[i],data_ind_rx[i]); - } - } - } - if ((errors > (n_frames/10)) && (trial>=100)) { - stop=1; - break; - } - - } - break; - } - } - } - } - - off+=105; - } - if (no_detection==1) - missed_packets++; - if (stop==1) - break; - } - - printf("\nSNR %f dB: errors %d/%d, misdetected errors %d/%d,signal_errors %d/%d, missed_packets %d/%d\n",SNR,errors,trial-signal_errors,misdetected_errors,trial-signal_errors,signal_errors,trial,missed_packets,trial); - snr_array[cnt] = SNR; - errors_array[cnt] = errors; - trials_array[cnt] = trial; - misdetected_errors_array[cnt] = misdetected_errors; - signal_errors_array[cnt] = signal_errors; - missed_packets_array[cnt] = missed_packets; - cnt++; - if (cnt>99) { - printf("too many SNR points, exiting ...\n"); - break; - } - if (errors == 0) - break; -#ifdef EXECTIME - print_is_stats(); - print_dd_stats(); -#endif - } - - - sprintf(fname,"SNR_%d_%d.m",tx_vector.rate,tx_vector.sdu_length); - sprintf(vname,"SNR_%d_%d_v",tx_vector.rate,tx_vector.sdu_length); - write_output(fname,vname,snr_array,cnt,1,7); - sprintf(fname,"errors_%d_%d.m",tx_vector.rate,tx_vector.sdu_length); - sprintf(vname,"errors_%d_%d_v",tx_vector.rate,tx_vector.sdu_length); - write_output(fname,vname,errors_array,cnt,1,2); - sprintf(fname,"trials_%d_%d.m",tx_vector.rate,tx_vector.sdu_length); - sprintf(vname,"trials_%d_%d_v",tx_vector.rate,tx_vector.sdu_length); - write_output(fname,vname,trials_array,cnt,1,2); - sprintf(fname,"signal_errors_%d_%d.m",tx_vector.rate,tx_vector.sdu_length); - sprintf(vname,"signal_errors_%d_%d_v",tx_vector.rate,tx_vector.sdu_length); - write_output(fname,vname,signal_errors_array,cnt,1,2); - free(data_ind); - free(data_ind_rx); - // free_channel_desc_scm(ch); - - free(txdata); - for (i=0;i<n_rx;i++) { - free(rxdata[i]); - } - - free(s_re[0]); - free(s_im[0]); - - for (i=0;i<n_rx;i++) { - free(r_re[i]); - free(r_im[i]); - } - - return(0); - -} -- GitLab