ath9k-hmac/README.md

131 lines
6.0 KiB
Markdown
Raw Normal View History

2016-09-26 13:46:33 +00:00
# ATH9K HTDMA Hybrid TDMA/CSMA MAC
2016-09-26 15:04:44 +00:00
```
+-----------+------------------------------------+
| | | Python HMAC Wrapper enables
| User | HMAC Python Wrapper | easy integration in python scripts
| Space | | starts / stops / updates HMAC
| | | user-space daemon and schedule
| +---------------+--------------------+ via ZMQ IPC
| | |
| | ZeroMQ |
| | |
2016-09-26 15:03:08 +00:00
| | |
| +---------------v--------------------+
| | | HMAC User Space Daemon
| | HMAC User-Space Daemon | schedules Software Queues
| | | by sending Netlink Commands
| | | to wake/sleep specific TIDs
+-----------+---------------+--------------------+ of a Link identied through
| MAC address
| Netlink
|
2016-09-26 15:01:19 +00:00
+-----------+------------------------------------+
| | | |
| Kernel | cfg80211 | |
| Space | | |
| | | |
| +------------------------------------+
| | | |
| | | |
| | mac80211 | |
| | | |
| +------------------------------------+
| | | MAC ao:f1:... | ATH9k Traffic Identifier
| | +--+--+--+--+ | Software Queues
| | ath9k | | | | |... | HMAC pauses/unpauses Queues
| | |0 |1 |2 |3 | | 7 Queues (TIDs per Link)
+-----------+---------------------------+--------+
2016-09-26 15:04:44 +00:00
```
2016-09-26 14:35:47 +00:00
2016-09-26 13:46:33 +00:00
## HOW TO INSTALL ATH9K HTDMA on Ubuntu Linux in 3 steps:
### Download HMAC sources:
2016-09-26 13:34:32 +00:00
```
2016-09-26 13:46:33 +00:00
cd ~; mkdir hmac; cd hmac; git clone https://github.com/szehl/ath9k-hmac.git;
2016-09-26 13:34:32 +00:00
```
2016-09-26 13:46:33 +00:00
### Install 3.12 kernel:
```
chmod +x ath9k-hmac/install_3.12_kernel.sh; ath9k-hmac/install_3.12_kernel.sh
```
Now reboot machine and choose 3.12 kernel during boot in the grub menu.
### Install HMAC driver
```
cd ~/hmac/ath9k-hmac/backports-3.12.8-1; make defconfig-ath9k; make -j4; sudo make install
```
Now again reboot your machine and choose 3.12 kernel during boot in the grub menu.
After Reboot the ATH9k-HMAC should be installed, you can check by typing
```
dmesg | grep TID
```
If the output is something like:
```
[ 3.648915] ath: TID SLEEPING MODE ENABLED
```
Everything went well.
2016-09-26 13:49:55 +00:00
## How to install HMAC on other Linux distributions and Kernels:
2016-09-26 13:46:33 +00:00
2016-09-26 13:34:32 +00:00
Go to https://www.kernel.org/pub/linux/kernel/projects/backports/stable
and look for the backports version that fits for your kernel, download and unpack it.
```
e.g.
cd /tmp/
mkdir backports
cd backports
wget https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.12.8/backports-3.12.8-1.tar.gz
tar -xzf backports-3.12.8-1.tar.gz
```
Download ATH9k-HMAC Patch for your kernel (hopefully we have the correct one for you, otherwise you have to adjust the patch on your own or switch to another kernel), apply patch to your backports source.
```
cd /tmp/
2016-09-26 13:49:55 +00:00
https://github.com/szehl/ath9k-hmac.git
2016-09-26 13:34:32 +00:00
cd backports/backports-3.12.8-1/
2016-09-26 13:49:55 +00:00
patch -t -p3 < ../../patch/ath9k-hmac/ath9k-hmac-backports-3.12.8-1.patch
2016-09-26 13:34:32 +00:00
```
Build and install the ATH9k-HMAC driver.
```
cd /tmp/backports/backports-3.12.8-1/
make defconfig-ath9k
make -j4
2016-09-26 13:49:55 +00:00
sudo make install
2016-09-26 13:34:32 +00:00
```
2016-09-26 13:49:55 +00:00
After Reboot the ATH9k-HMAC should be installed, you can check by typing
```
dmesg | grep TID
```
If the output is something like:
```
[ 3.648915] ath: TID SLEEPING MODE ENABLED
```
Everything went well.
2016-09-26 15:09:48 +00:00
## HOW TO USE ATH9k HMAC
2016-09-26 15:49:29 +00:00
First you have to compile the hmac_userspace_daemon.
2016-09-26 15:45:27 +00:00
If you installed the ATH9k HMAC driver with the 3 step manual, you can simply use:
```
cd ~/hmac/ath9k-hmac/hmac_userspace_daemon; make;
```
Otherwise make sure that the file hmac_userspace_daemon/hybrid_tdma_csma_mac.c includes the correct nl80211.h you used during building the ATH9k HTDMA driver.
2016-09-26 15:50:03 +00:00
2016-09-26 15:49:29 +00:00
We are now able to give the HMAC a first try without the Python wrapper. Just execute the following line in the hmac_userspace_daemon folder (replace wlan0 with your ATH9k WiFi interface, take sure it is up and rfkill is disabled (e.g. sudo rfkill unblock all)):
```
sudo ./hmac_userspace_daemon -i wlan0 -f 20000 -n 10 -c 1,b8:a3:86:96:96:8a,1#2,b8:a3:86:96:96:8a,1#3,b8:a3:86:96:96:8a,1#4,b8:a3:86:96:96:8a,1#6,ec:1f:72:82:09:56,1#7,ec:1f:72:82:09:56,1#8,ec:1f:72:82:09:56,1#9,ec:1f:72:82:09:56,1
```
2016-09-26 15:55:22 +00:00
If no error is shown and the daemon just prints out the current slot size, we are fine, the HMAC is working.
The HMAC user-space deaemon is using the following configuration parameters:
```
sudo ./hmac_userspace_daemon
-i wlan0 # ATH9k WiFi Interface on which HMAC schedule should be applied
-f 20000 # Size of each slot in micro seconds
-n 10 # Number of Slots
2016-09-26 15:56:35 +00:00
-c # Schedule, format: "Slotnumber","MAC Address of Destination","TID Bitmap"#
#e.g.:
2016-09-26 16:00:49 +00:00
1,b8:a3:86:96:96:8a,1#2,ec:1f:72:82:09:56,1#3,b8:a3:86:96:96:8a,1#4,b8:a3:86:96:96:8a,1#6,ec:1f:72:82:09:56,1#7,ec:1f:72:82:09:56,1#8,ec:1f:72:82:09:56,1#9,ec:1f:72:82:09:56,1
2016-09-26 15:55:22 +00:00
```
2016-09-26 16:00:49 +00:00
The example uses the following configuration: Interface: wlan0, Size of each Slot: 20ms, Number of Slots: 10 (SuperSlot = 200ms), Scheduler Konfiguration: first slot, Link with STA b8:a3:86:96:96:8a, TID MAP: 0b0000001 means TID 1 (Best Effort), '#' is used as seperator, second slot: Link with STA ec:1f:72:82:09:56, TID TID MAP: 0b0000001 means TID 1 (Best Effort), ... etc.