The Linux wireless networking stack (i.e. driver, mac80211, cfg80211, net_dev, user app) is a robust implementation supporting a plethora of wireless devices. As robust as it is, it also has a drawback when it comes to single-layer testing.
Ping and Iperf are well established performance measurement tools. However, using such tools to measure 802.11 PHY performance can be misleading, simply because they touch multiple layers in the network stack.
Luckily, the mac80211 Linux subsystem provides packet injection functionality and it allows us to have finer control over physical layer testing.
To this end, we have adapted a [packetspammer](https://github.com/gnychis/packetspammer) application originally written by Andy Green <andy@warmcat.com> and maintained by George Nychis <gnychis@gmail.com>.
### inject_80211
Userspace program to inject 802.11 packets through mac80211 supported (softmac) wireless devices.
### Options
```
-m/--hw_mode <hardwareoperationmode> (a,g,n)
-r/--rate_index <rate/MCSindex> (0,1,2,3,4,5,6,7)
-i/--sgi_flag (0,1)
-n/--num_packets <numberofpackets>
-s/--payload_size <payloadsizeinbytes>
-d/--delay <delaybetweenpacketsinusec>
-h this menu
```
### Example:
```
iw dev wlan0 interface add mon0 type monitor && ifconfig mon0 up
inject_80211 -m n -r 0 -n 64 -s 100 mon0 # Inject 10 802.11n packets at 6.5Mbps bitrate and 64bytes size
```
### Link performance test
To make a profound experimental analysis on the physical layer performance, we can rely on automation scripts.
The following script will inject 100 802.11n packets at different bitrates and payload sizes.