Backoff

June 12, 2009

The 802.11 protocol is a distributed one; it gives chance to all the players without first deciding on who transmits when. For this to work, it is necessary that all devices follow the backoff protocol–waits for DIFS before transmission when no one else is transmitting, backoff a random amount when other transmissions are detected. Changing the backoff is not a good idea because doing so is being unfair to all the other participants in the network.

However, for a large number of experiments and many other purposes such as automatic prioritization of some devices, it might be necessary to modify the backoff mechanism. The madwifi truck version has a function called txcont_configure_radio(). This function allows continuous tranmission of scrambled packets through the iwpriv athx txcont 1 command. Even if one does not want continuous transmission of packets, the working of this function is very beneficial for any control on tranmission timing and the backoff mechanism. The function is so well commented, that I do not think it worth to mention any of those things here. A glance through the code will make it clear how to disable backoff. However, if you wish to space packets by exactly some time interval, you may want to consider changing the AIFS time. We have observed that the aifs values (with cwmin, cwmax set to zero) can cause tranmission to be interspaced by (10 + (aifs *20)) microseconds. We have checked this on a spectrum analyzer for madwifi 0.9.4, so if you are experimenting with this, I would advice you to check again.

If you are curious, search for cwmin in the if_ath.c file. You will see how the random backoff is set in the 802.11 code. While you are at it, also examine how adding qi.tqi_qflags |= HAL_TXQ_BACKOFF_DISABLE; in ath_txq_setup() works. It may also interest you that newer devices support modes known as burst and fast frames. These modes can wreak havoc if you do not check their working properly. Basically, multiple packets are sent together in a transmission opportunity (burst) without waiting for DIFS time and this burst length may be as large as 8ms. Both these modes are surely present if you device advertises that it can transmit at 108Mbps. They can be turned off using the iwpriv athx burst 0 and iwpriv athx ff 0 commands. A suggestion is to keep a power meter / spectrum analyzer / CRO alongside when you experiment with backoff. It is the best way of validating if you are really getting what you want. Don’t rely on only receive timestamps.