Bug in Mac80211 in MiXiM backoff when channel busy

This entry was posted by on Thursday, 15 December, 2011 at

This post describes a bug in MiXiM’s Mac80211 which seems to be a fundamental error: when the MAC gets a packet from the Netw and the channel is busy, it schedules a senseChannelWhileIdle(currentIFS + remainingBackoff) after the ongoing transmission ends. Unfortunately, remainingBackoff is often 0 as post-backoff is likely to have completed. The result? Many synchronised collisions one IFS after the ongoing transmission.

Fixed in v2.2

What went wrong?

Mac80211 in MiXiM uses the same mechanism for backoff and post-backoff, a senseChannelWhileIdle which schedules a timer for a duration of IFS + remainingBackoff (i.e. The inter-frame spacing and the present state of the backoff counter).

If Host A were doing post-backoff when the frame from Host B arrived, the remainingBackoff would have been > 0 and backoff would have resumed after the frame from Host B finishes.

However, Host A has already completed its post-backoff (remainingBackoff was 0) so it essentially was IDLE when the beacon was generated (actually, it was receiving Host B’s frame). So what happens now is that all nodes which have an arrival during Host B’s frame AND have completed their post-backoff, will wait one IFS and then transmit, resulting in synchronised collisions one IFS after a transmission (or an EIFS after a collision).

The correct behaviour here is for Host A’s MAC to note that post-backoff has completed (remainingBackoff has reached 0) and the medium is busy, so the MAC must draw a new backoff from the contention window.

How to fix it
Proposed change in beginNewCycle():

if (!fromUpperLayer.empty()) {
	if(!contention->isScheduled()) {
		if(channel.isIdle()) {
			senseChannelWhileIdle(currentIFS + remainingBackoff);
			//channel is busy
				remainingBackoff = backoff();
		//busy in contention, frame is enqueued.
	// we do PBO

Upon completion of the ongoing transmission by Host B, beginNewCycle() will be called. But now the channel has turned idle (we are in the IFS after the transmission) and we have just choosen our IFS (Host B’s frame was correctly received, so we set IFS = AIFS and not EIFS). Then, in beginNewCycle(), it will perform a senseChannelWhileIdle(currentIFS + remainingBackoff). The remainingBackoff was set previously (during the previous iteration of beginNewCycle()) to unif(0,cwMin) and now contains a valid backoff.

The results show an improvement in reception probability in lightly loaded conditions: here it is most probable post-backoff has completed and we get an arrival from the upper layer while the medium is not idle. The collision probability is decreased because the synchronisation after a transmission (e.g. Host B’s transmission) is broken by means of the backoff procedure.

2 Responses to “Bug in Mac80211 in MiXiM backoff when channel busy”

  1. humberto

    Apart from the backoff and postbackoff algorithm, the channel.isIdle() goes wrong in the decider from my point of view.
    This will be just updated with the functions Decider::processNewSignal and Decider::processSignalEnd when they are receiving something.

    The functions (Decider::getChannelState, Decider::answerCRS), that compute the RSSI value, are not doing anything at all with “Decider::isChannelIdle”. These are very important functions for MAC80211. Even worst, they have no value at all for distinguishing if the RSSI reflects a busy or idle channel.
    Therefore, the CS Mechanism does not work properly.

    I have posted it today in a thread -> https://groups.google.com/forum/?token=YwAAAEh5L-SvAAAAPekL8hPN7dF7rqyvXmCeZtY5___8&hl=en&fromgroups=#!topic/omnetpp/VvfkI0XBIg4

    Check it out!

    Btw, did u finally solve all the problems you mention and finally updated the final code? I have found all these problems in my code.


  1. Bug in Mac80211 in MiXiM post-backoff @ Freeminded.org

Leave a Reply