Index: mac-802_11.cc =================================================================== RCS file: /home/anoncvs/PUBLIC_CVSROOT/ns-2/mac/mac-802_11.cc,v retrieving revision 1.41 diff -a -u -r1.41 mac-802_11.cc --- mac-802_11.cc 21 Feb 2003 00:40:22 -0000 1.41 +++ mac-802_11.cc 22 Apr 2003 21:53:19 -0000 @@ -1003,7 +1003,9 @@ (*rcount)++; - if(*rcount > *thresh) { + /* IEEE Spec section 9.2.3.5 says this should be greater than + or equal */ + if(*rcount >= *thresh) { macmib_->FailedCount++; /* tell the callback the send operation failed before discarding the packet */ @@ -1359,7 +1361,11 @@ * that our RTS was successful. Hence, we can reset * the Short Retry Count and the CW. */ - //ssrc_ = 0; + + /* actually - according to the IEEE spec 9.2.5.3, you must + reset the ssrc_, but not the congestion window. */ + + ssrc_ = 0; //rst_cw(); tx_resume(); @@ -1473,12 +1479,11 @@ struct hdr_cmn *ch = HDR_CMN(p); if(tx_state_ != MAC_SEND) { - discard(p, DROP_MAC_INVALID_STATE); - return; + discard(p, DROP_MAC_INVALID_STATE); + return; } //printf("(%d)...................recving ACK:%x\n",index_,p); assert(pktTx_); - Packet::free(pktTx_); pktTx_ = 0; mhSend_.stop(); @@ -1487,15 +1492,21 @@ * that our DATA transmission was successful. Hence, * we can reset the Short/Long Retry Count and the CW. */ - if((u_int32_t) ch->size() <= macmib_->RTSThreshold) + + /* need to check the size of the packet we sent that's being + ACK'd, not the size of the ACK packet. + */ + if((u_int32_t) HDR_CMN(pktTx_)->size() <= macmib_->RTSThreshold) ssrc_ = 0; else slrc_ = 0; + rst_cw(); + + Packet::free(pktTx_); pktTx_ = 0; /* * Backoff before sending again. */ - rst_cw(); assert(mhBackoff_.busy() == 0); mhBackoff_.start(cw_, is_idle());