diff -bBru ns-2.28.orig/mac/mac-802_11.cc ns-2.28/mac/mac-802_11.cc --- ns-2.28.orig/mac/mac-802_11.cc 2005-01-25 23:38:47.000000000 +0100 +++ ns-2.28/mac/mac-802_11.cc 2005-03-11 15:31:11.585235872 +0100 @@ -39,6 +39,7 @@ * - Sushmita */ +#include "tcp.h" #include "delay.h" #include "connector.h" #include "packet.h" @@ -177,6 +178,7 @@ * to Mac/802_11 variables */ + parent->bind("RetransTime_", &RetransTime); parent->bind("RTSThreshold_", &RTSThreshold); parent->bind("ShortRetryLimit_", &ShortRetryLimit); parent->bind("LongRetryLimit_", &LongRetryLimit); @@ -783,12 +785,15 @@ return 0; } setTxState(MAC_SEND); - if((u_int32_t)ETHER_ADDR(mh->dh_ra) != MAC_BROADCAST) + if((u_int32_t)ETHER_ADDR(mh->dh_ra) != MAC_BROADCAST) { timeout = txtime(pktTx_) + DSSS_MaxPropagationDelay // XXX + phymib_.getSIFS() + txtime(phymib_.getACKlen(), basicRate_) + DSSS_MaxPropagationDelay; // XXX + retrans_time=timeout; + //printf("retransmision time : %f\n",retrans_time); + } else timeout = txtime(pktTx_); break; @@ -1048,6 +1053,8 @@ struct hdr_cmn *ch; struct hdr_mac802_11 *mh; u_int32_t *rcount, thresh; + int retrans, rets_mode; + double timelost; assert(mhBackoff_.busy() == 0); assert(pktTx_); @@ -1084,6 +1091,14 @@ } (*rcount)++; + retrans = *rcount; + timelost = retrans * retrans_time; + rets_mode = macmib_.RetransTime; + + if (rets_mode != 0) { + HDR_TCP(pktTx_)->rets_ += timelost; + //printf("seq : %d - mac rets : %f \n",HDR_TCP(pktTx_)->seqno_,HDR_TCP(pktTx_)->rets_); + } if(*rcount >= thresh) { /* IEEE Spec section 9.2.3.5 says this should be greater than diff -bBru ns-2.28.orig/mac/mac-802_11.h ns-2.28/mac/mac-802_11.h --- ns-2.28.orig/mac/mac-802_11.h 2005-01-19 19:23:28.000000000 +0100 +++ ns-2.28/mac/mac-802_11.h 2005-03-11 15:31:11.585235872 +0100 @@ -205,6 +205,7 @@ u_int32_t FailedCount; u_int32_t RTSFailureCount; u_int32_t ACKFailureCount; + int RetransTime; public: inline u_int32_t getRTSThreshold() { return(RTSThreshold);} inline u_int32_t getShortRetryLimit() { return(ShortRetryLimit);} @@ -257,6 +258,7 @@ void txHandler(void); private: + double retrans_time; int command(int argc, const char*const* argv); /* Seulement dans ns-2.28/: TAGS diff -bBru ns-2.28.orig/tcl/lib/ns-default.tcl ns-2.28/tcl/lib/ns-default.tcl --- ns-2.28.orig/tcl/lib/ns-default.tcl 2005-01-19 19:23:37.000000000 +0100 +++ ns-2.28/tcl/lib/ns-default.tcl 2005-03-11 15:31:11.736212920 +0100 @@ -673,6 +673,7 @@ Mac/802_11 set RTSThreshold_ 0 ;# bytes Mac/802_11 set ShortRetryLimit_ 7 ;# retransmittions Mac/802_11 set LongRetryLimit_ 4 ;# retransmissions + Mac/802_11 set RetransTime_ 0 ;# use Mac retransmissions or not diff -bBru ns-2.28.orig/tcp/tcp.cc ns-2.28/tcp/tcp.cc --- ns-2.28.orig/tcp/tcp.cc 2005-01-25 23:38:47.000000000 +0100 +++ ns-2.28/tcp/tcp.cc 2005-03-11 15:31:12.192143608 +0100 @@ -632,6 +632,7 @@ hdr_ip *iph = hdr_ip::access(p); int databytes = hdr_cmn::access(p)->size(); tcph->seqno() = seqno; + tcph->rets() = 0; tcph->ts() = Scheduler::instance().clock(); // Mark packet for diagnosis purposes if we are in Quick-Start Phase diff -bBru ns-2.28.orig/tcp/tcp.h ns-2.28/tcp/tcp.h --- ns-2.28.orig/tcp/tcp.h 2005-01-19 19:23:52.000000000 +0100 +++ ns-2.28/tcp/tcp.h 2005-03-11 15:31:12.192143608 +0100 @@ -46,6 +46,7 @@ double ts_; /* time packet generated (at source) */ double ts_echo_; /* the echoed timestamp (originally sent by the peer) */ + double rets_; /* retransmission time */ int seqno_; /* sequence number */ int reason_; /* reason for a retransmit */ int sack_area_[NSA+1][2]; /* sack blocks: start, end of block */ @@ -66,6 +67,7 @@ /* per-field member functions */ double& ts() { return (ts_); } double& ts_echo() { return (ts_echo_); } + double& rets() { return (rets_); } int& seqno() { return (seqno_); } int& reason() { return (reason_); } int& sa_left(int n) { return (sack_area_[n][0]); } diff -bBru ns-2.28.orig/tcp/tcp-sink.cc ns-2.28/tcp/tcp-sink.cc --- ns-2.28.orig/tcp/tcp-sink.cc 2005-01-25 23:38:47.000000000 +0100 +++ ns-2.28/tcp/tcp-sink.cc 2005-03-11 15:31:12.191143760 +0100 @@ -293,6 +293,10 @@ ntcp->ts() = now; // timestamp the packet + ntcp->rets() = otcp->rets_; + //printf("seq : %d - ack rets : %f\n",otcp->seqno_,otcp->rets_); + // echo the original's retransmission time + if (ts_echo_bugfix_) /* TCP/IP Illustrated, Vol. 2, pg. 870 */ ntcp->ts_echo() = acker_->ts_to_echo(); else diff -bBru ns-2.28.orig/tcp/tcp-vegas.cc ns-2.28/tcp/tcp-vegas.cc --- ns-2.28.orig/tcp/tcp-vegas.cc 2005-01-25 23:38:47.000000000 +0100 +++ ns-2.28/tcp/tcp-vegas.cc 2005-03-11 15:31:12.191143760 +0100 @@ -182,7 +182,7 @@ if(v_cntRTT_ > 0) rtt = v_sumRTT_ / v_cntRTT_; else - rtt = currentTime - v_begtime_; + rtt = currentTime - v_begtime_ - tcph->rets_; v_sumRTT_ = 0.0; v_cntRTT_ = 0; @@ -285,7 +285,7 @@ if((sendTime !=0.) && (transmits==1)) { // update fine-grained timeout value, v_timeout_. double rtt, n; - rtt = currentTime - sendTime; + rtt = currentTime - sendTime - tcph->rets_; v_sumRTT_ += rtt; ++v_cntRTT_; if(rtt>0) {