[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug in CSMA/CD MAC



Hi,

There seems to be a bug in the CSMA/CD MAC backoff algorithm (at least in
ns-allinone-2.1b4a) that, given a collision, always causes a second collision
to occur.  In ns-2/tcl/lan/ns-mac.tcl, the minimum collision window is defined
using:

	Mac/Csma/Cd set cwmin_ 1

After a collision, a random slot is selected in MacCsma::backoff with
the line:

	int slot = Random::integer(cw_);

but cw_ == cwmin_ after the first collision and Random::integer(x) returns
a non-negative value less than x. The net result is that the slot selected
by all contending nodes is always 0 after the first collision, resulting
in a second collision.  The problem can be fixed in either ns-mac.tcl (if
the problem is only with some of the CSMA-derived MACs) or mac-csma.cc (if
all the CSMA-derived MACs have the same problem).

-- 
Henry Ptasinski			San Diego Supercomputer Center
[email protected]			(619) 534-5000