-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathpfabric.patch
3270 lines (3131 loc) · 105 KB
/
pfabric.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
From cb67dd736e69ae2384b96f790514b3a21ffe6188 Mon Sep 17 00:00:00 2001
From: Mohammad Alizadeh <[email protected]>
Date: Sat, 19 Jul 2014 18:53:02 -0700
Subject: [PATCH 1/2] changes in ns-code.zip applied
---
classifier/classifier-mpath.cc | 94 ++++-
common/ip.h | 10 +
queue/drop-tail.cc | 164 +++++++-
queue/drop-tail.h | 48 ++-
tcl/lib/ns-default.tcl | 124 +++++-
tcl/lib/ns-node.tcl | 17 +-
tcp/tcp-full.cc | 972 +++++++++++++++++++++++++++++++++-------
tcp/tcp-full.h | 112 +++--
tcp/tcp-newreno.cc | 12 +-
tcp/tcp-sink.cc | 16 +-
tcp/tcp-sink.h | 2 +-
tcp/tcp.cc | 193 ++++++--
tcp/tcp.h | 67 ++--
tools/queue-monitor.cc | 51 ++-
tools/queue-monitor.h | 27 +-
15 files changed, 1598 insertions(+), 311 deletions(-)
diff --git a/classifier/classifier-mpath.cc b/classifier/classifier-mpath.cc
index f41e77f..88ea545 100644
--- a/classifier/classifier-mpath.cc
+++ b/classifier/classifier-mpath.cc
@@ -1,4 +1,5 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
+/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t
+ -*- */
/*
* Copyright (C) 1997 by the University of Southern California
@@ -50,21 +51,106 @@ static const char rcsid[] =
#endif
#include "classifier.h"
+#include "ip.h"
class MultiPathForwarder : public Classifier {
public:
- MultiPathForwarder() : ns_(0) {}
- virtual int classify(Packet*) {
- int cl;
+ MultiPathForwarder() : ns_(0), nodeid_(0), nodetype_(0), perflow_(0), checkpathid_(0) {
+ bind("nodeid_", &nodeid_);
+ bind("nodetype_", &nodetype_);
+ bind("perflow_", &perflow_);
+ bind("checkpathid_", &checkpathid_);
+ }
+ virtual int classify(Packet* p) {
+ int cl;
+ hdr_ip* h = hdr_ip::access(p);
+ // Mohammad: multipath support
+ // fprintf(stdout, "perflow_ = %d, rcv packet in classifier\n", perflow_);
+ if (perflow_ || checkpathid_) {
+ /*if (h->flowid() >= 10000000) {
+ int fail = ns_;
+ do {
+ cl = ns_++;
+ ns_ %= (maxslot_ + 1);
+ } while (slot_[cl] == 0 && ns_ != fail);
+ return cl;
+ }*/
+
+ struct hkey {
+ int nodeid;
+ nsaddr_t src, dst;
+ int fid;
+ };
+ struct hkey buf_;
+ buf_.nodeid = nodeid_;
+ buf_.src = mshift(h->saddr());
+ buf_.dst = mshift(h->daddr());
+ buf_.fid = h->flowid();
+ /*if (checkpathid_)
+ buf_.prio = h->prio();
+ else
+ buf_.prio = 0;*/
+ char* bufString = (char*) &buf_;
+ int length = sizeof(hkey);
+
+ unsigned int ms_ = (unsigned int) HashString(bufString, length);
+ if (checkpathid_) {
+ int pathNum = h->prio();
+ int pathDig;
+ for (int i = 0; i < nodetype_; i++) {
+ pathDig = pathNum % 8;
+ pathNum /= 8;
+ }
+ //printf("%d: %d->%d\n", nodetype_, h->prio(), pathDig);
+ ms_ += h->prio(); //pathDig;
+ }
+ ms_ %= (maxslot_ + 1);
+ //printf("nodeid = %d, pri = %d, ms = %d\n", nodeid_, buf_.prio, ms_);
+ int fail = ms_;
+ do {
+ cl = ms_++;
+ ms_ %= (maxslot_ + 1);
+ } while (slot_[cl] == 0 && ms_ != fail);
+ //printf("nodeid = %d, pri = %d, cl = %d\n", nodeid_, h->prio(), cl);
+ }
+
+ else {
+ //hdr_ip* h = hdr_ip::access(p);
+ //if (h->flowid() == 45) {
+ //cl = h->prio() % (maxslot_ + 1);
+ //}
+ //else {
int fail = ns_;
do {
cl = ns_++;
ns_ %= (maxslot_ + 1);
} while (slot_[cl] == 0 && ns_ != fail);
+ }
+ //}
+
+
return cl;
}
private:
int ns_;
+ // Mohamamd: adding support for perflow multipath
+ int nodeid_;
+ int nodetype_;
+ int perflow_;
+ int checkpathid_;
+
+ static unsigned int
+ HashString(register const char *bytes,int length)
+ {
+ register unsigned int result;
+ register int i;
+
+ result = 0;
+ for (i = 0; i < length; i++) {
+ result += (result<<3) + *bytes++;
+ }
+ return result;
+ }
};
static class MultiPathClass : public TclClass {
diff --git a/common/ip.h b/common/ip.h
index 8e3f153..13fc354 100644
--- a/common/ip.h
+++ b/common/ip.h
@@ -61,6 +61,14 @@ struct hdr_ip {
ns_addr_t dst_;
int ttl_;
+ /* Mohammad: flag to indicate
+ * the last TCP ack for this flow
+ * had EcnEcho set. This is used by
+ * TBF to determin if flow should be
+ *paced. */
+ int gotecnecho;
+ //abd
+
/* Monarch extn */
// u_int16_t sport_;
// u_int16_t dport_;
@@ -68,6 +76,7 @@ struct hdr_ip {
/* IPv6 */
int fid_; /* flow id */
int prio_;
+ int prio_type_; //Shuang
static int offset_;
inline static int& offset() { return offset_; }
@@ -87,6 +96,7 @@ struct hdr_ip {
/* ipv6 fields */
int& flowid() { return (fid_); }
int& prio() { return (prio_); }
+ int& prio_type() {return (prio_type_); }
};
#endif
diff --git a/queue/drop-tail.cc b/queue/drop-tail.cc
index d1a3ed6..4e5b9ac 100644
--- a/queue/drop-tail.cc
+++ b/queue/drop-tail.cc
@@ -87,7 +87,7 @@ void DropTail::enque(Packet* p)
if (summarystats) {
Queue::updateStats(qib_?q_->byteLength():q_->length());
}
-
+ //printf("qlim_ = %d, qib_ = %d, mean_pktsize_ = %d\n", qlim_, qib_, mean_pktsize_);
int qlimBytes = qlim_ * mean_pktsize_;
if ((!qib_ && (q_->length() + 1) >= qlim_) ||
(qib_ && (q_->byteLength() + hdr_cmn::access(p)->size()) >= qlimBytes)){
@@ -96,6 +96,77 @@ void DropTail::enque(Packet* p)
q_->enque(p);
Packet *pp = q_->deque();
drop(pp);
+ }
+ else if (drop_prio_) {
+ Packet *max_pp = p;
+ int max_prio = 0;
+
+ q_->enque(p);
+ q_->resetIterator();
+ for (Packet *pp = q_->getNext(); pp != 0; pp = q_->getNext()) {
+ if (!qib_ || ( q_->byteLength() - hdr_cmn::access(pp)->size() < qlimBytes)) {
+ hdr_ip* h = hdr_ip::access(pp);
+ int prio = h->prio();
+ if (prio >= max_prio) {
+ max_pp = pp;
+ max_prio = prio;
+ }
+ }
+ }
+ q_->remove(max_pp);
+ drop(max_pp);
+ }
+ else if (drop_smart_) {
+ Packet *max_pp = p;
+ int max_count = 0;
+
+ q_->enque(p);
+ q_->resetIterator();
+ for (Packet *pp = q_->getNext(); pp != 0; pp = q_->getNext()) {
+ hdr_ip* h = hdr_ip::access(pp);
+ FlowKey fkey;
+ fkey.src = h->saddr();
+ fkey.dst = h->daddr();
+ fkey.fid = h->flowid();
+
+ char* fkey_buf = (char*) &fkey;
+ int length = sizeof(fkey);
+ string fkey_string(fkey_buf, length);
+
+ std::tr1::hash<string> string_hasher;
+ size_t signature = string_hasher(fkey_string);
+
+ if (sq_counts_.find(signature) != sq_counts_.end()) {
+ int count = sq_counts_[signature];
+ if (count > max_count) {
+ max_count = count;
+ max_pp = pp;
+ }
+ }
+ }
+ q_->remove(max_pp);
+ /*hdr_ip* h = hdr_ip::access(p);
+ FlowKey fkey;
+ fkey.src = h->saddr();
+ fkey.dst = h->daddr();
+ fkey.fid = h->flowid();
+
+ char* fkey_buf = (char*) &fkey;
+ int length = sizeof(fkey);
+ string fkey_string(fkey_buf, length);
+
+ std::tr1::hash<string> string_hasher;
+ size_t p_sig = string_hasher(fkey_string);
+ h = hdr_ip::access(max_pp);
+ fkey.src = h->saddr();
+ fkey.dst = h->daddr();
+ fkey.fid = h->flowid();
+
+ string fkey_string2(fkey_buf, length);
+ size_t maxpp_sig = string_hasher(fkey_string2);
+
+ printf("%s, enqueued %d, dropped %d instead\n", this->name(), p_sig, maxpp_sig);*/
+ drop(max_pp);
} else {
drop(p);
}
@@ -130,7 +201,96 @@ Packet* DropTail::deque()
if (summarystats && &Scheduler::instance() != NULL) {
Queue::updateStats(qib_?q_->byteLength():q_->length());
}
- return q_->deque();
+ //printf("drop_smart_ = %d, sq_limit = %d \n", drop_smart_, sq_limit_);
+
+ /*Shuang: deque the packet with the highest priority */
+ if (deque_prio_) {
+ q_->resetIterator();
+ Packet *p = q_->getNext();
+ int highest_prio_;
+ if (p != 0)
+ highest_prio_ = hdr_ip::access(p)->prio();
+ else
+ return 0;
+ for (Packet *pp = q_->getNext(); pp != 0; pp = q_->getNext()) {
+ hdr_ip* h = hdr_ip::access(pp);
+ int prio = h->prio();
+ //deque from the head
+ if (prio < highest_prio_) {
+ p = pp;
+ highest_prio_ = prio;
+ }
+ }
+ if (keep_order_) {
+ q_->resetIterator();
+ hdr_ip* hp = hdr_ip::access(p);
+ for (Packet *pp = q_->getNext(); pp != p; pp = q_->getNext()) {
+ hdr_ip* h = hdr_ip::access(pp);
+ if (h->saddr() == hp->saddr()
+ && h->daddr() == hp->daddr()
+ && h->flowid() == hp->flowid()) {
+ p = pp;
+ break;
+ }
+ }
+ }
+
+ //if (hdr_ip::access(p)->flowid() == 1) {
+ // q_->resetIterator();
+ // printf("DEQUE: flow %d queue_length %d\n", hdr_ip::access(p)->flowid(), q_->byteLength());
+ // for (Packet *pp = q_->getNext(); pp != 0; pp = q_->getNext()) {
+ // hdr_ip* h = hdr_ip::access(pp);
+ // printf("( %d %d )", h->flowid(), h->prio());
+ // }
+ // printf("\n");
+ // fflush(stdout);
+ //}
+
+ q_->remove(p);
+ return p;
+ } else
+ if (drop_smart_) {
+ Packet *p = q_->deque();
+ if (p) {
+ hdr_ip* h = hdr_ip::access(p);
+ FlowKey fkey;
+ fkey.src = h->saddr();
+ fkey.dst = h->daddr();
+ fkey.fid = h->flowid();
+
+ char* fkey_buf = (char*) &fkey;
+ int length = sizeof(fkey);
+ string fkey_string(fkey_buf, length);
+
+ std::tr1::hash<string> string_hasher;
+ size_t signature = string_hasher(fkey_string);
+ sq_queue_.push(signature);
+
+ if (sq_counts_.find(signature) != sq_counts_.end()) {
+ sq_counts_[signature]++;
+ //printf("%s packet with signature %d, count = %d, qsize = %d\n", this->name(), signature, sq_counts_[signature], sq_queue_.size());
+ }
+ else {
+ sq_counts_[signature] = 1;
+ //printf("%s first packet with signature %d, count = %d, qsize = %d\n", this->name(), signature, sq_counts_[signature], sq_queue_.size());
+ }
+
+ if (sq_queue_.size() > sq_limit_) {
+ //printf("%s we are full %d %d\n", this->name(), sq_counts_.size(), sq_queue_.size());
+ size_t temp = sq_queue_.front(); sq_queue_.pop();
+ sq_counts_[temp]--;
+ if (sq_counts_[temp] == 0)
+ sq_counts_.erase(temp);
+
+ //printf("%s removed front sig = %d, no longer full %d %d\n", this->name(), temp, sq_counts_.size(), sq_queue_.size());
+
+ }
+ }
+ return p;
+
+ } else {
+ return q_->deque();
+ }
}
void DropTail::print_summarystats()
diff --git a/queue/drop-tail.h b/queue/drop-tail.h
index a16399e..b82f7e5 100644
--- a/queue/drop-tail.h
+++ b/queue/drop-tail.h
@@ -37,10 +37,35 @@
#ifndef ns_drop_tail_h
#define ns_drop_tail_h
-#include <string.h>
+/*#ifdef __GNUC__
+#include <ext/hash_map>
+#else
+#include <hash_map>
+#endif
+
+
+namespace std
+{
+ using namespace __gnu_cxx;
+}
+*/
+#include <tr1/unordered_map>
+#include <tr1/functional>
+#include <queue>
+
+using std::queue;
+using std::tr1::unordered_map;
+//using std::tr1::functional;
+
+#include <string>
#include "queue.h"
#include "config.h"
+typedef struct flowkey {
+ nsaddr_t src, dst;
+ int fid;
+} FlowKey;
+
/*
* A bounded, drop-tail queue
*/
@@ -50,27 +75,44 @@ class DropTail : public Queue {
q_ = new PacketQueue;
pq_ = q_;
bind_bool("drop_front_", &drop_front_);
+ bind_bool("drop_smart_", &drop_smart_);
+ bind_bool("drop_prio_", &drop_prio_);
+ bind_bool("deque_prio_", &deque_prio_);
+ bind_bool("keep_order_", &keep_order_);
bind_bool("summarystats_", &summarystats);
bind_bool("queue_in_bytes_", &qib_); // boolean: q in bytes?
bind("mean_pktsize_", &mean_pktsize_);
+ bind("sq_limit_", &sq_limit_);
// _RENAMED("drop-front_", "drop_front_");
}
~DropTail() {
delete q_;
}
- protected:
void reset();
int command(int argc, const char*const* argv);
void enque(Packet*);
Packet* deque();
+ protected:
void shrink_queue(); // To shrink queue and drop excessive packets.
PacketQueue *q_; /* underlying FIFO queue */
- int drop_front_; /* drop-from-front (rather than from tail) */
+ int drop_front_; /* drop-from-front (rather than from tail) */
int summarystats;
void print_summarystats();
int qib_; /* bool: queue measured in bytes? */
int mean_pktsize_; /* configured mean packet size in bytes */
+ // Mohammad: for smart dropping
+ int drop_smart_;
+ // Shuang: for priority dropping
+ int drop_prio_;
+ int deque_prio_;
+ int keep_order_;
+
+
+ unsigned int sq_limit_;
+ unordered_map<size_t, int> sq_counts_;
+ std::queue<size_t> sq_queue_;
+
};
#endif
diff --git a/tcl/lib/ns-default.tcl b/tcl/lib/ns-default.tcl
index 4e4e2f7..c907f04 100644
--- a/tcl/lib/ns-default.tcl
+++ b/tcl/lib/ns-default.tcl
@@ -103,9 +103,17 @@ Queue/DropTail set drop_front_ false
Queue/DropTail set summarystats_ false
Queue/DropTail set queue_in_bytes_ false
Queue/DropTail set mean_pktsize_ 500
+# Mohammad: Smart drop
+Queue/DropTail set drop_smart_ false
+Queue/DropTail set sq_limit_ 10
Queue/DropTail/PriQueue set Prefer_Routing_Protocols 1
+# Shuang: Priority drop
+Queue/DropTail set drop_prio_ false
+Queue/DropTail set deque_prio_ false
+Queue/DropTail set keep_order_ false
+
# special cmu implemented priority queue used by DSR
CMUPriQueue set qlen_logthresh_ 10
CMUPriQueue set fw_logthresh_ 25
@@ -119,6 +127,24 @@ Queue/dsRED set ecn_ 0
# support only xcp flows; set to 1 when supporting both tcp and xcp flows; temporary fix for allocating link BW between xcp and tcp queues until dynamic queue weights come into effect. This fix should then go away
Queue/XCP set tcp_xcp_on_ 0 ;
+# Drop Tail Variant
+# Queue/DropTailVariant set drop_front_ false
+# Queue/DropTailVariant set summarystats_ false
+# Queue/DropTailVariant set queue_in_bytes_ false
+# Queue/DropTailVariant set mean_pktsize_ 500
+# Queue/DropTailVariant set tcp_queue_limit_pkts_ 1000
+
+# Queue/DropTailVariant/RCP set alpha_ 0.4
+# Queue/DropTailVariant/RCP set beta_ 0.4
+# Queue/DropTailVariant/RCP set gamma_ 1
+# Queue/DropTailVariant/RCP set min_pprtt_ 0.01
+# Queue/DropTailVariant/RCP set init_rate_fact_ 0.05
+# Queue/DropTailVariant/RCP set print_status_ 1
+# Queue/DropTailVariant/RCP set rate_fact_mode_ 0
+# Queue/DropTailVariant/RCP set fixed_rate_fact_ 0.05 ;# effecitve only if rate_fact_mode = 1
+# Queue/DropTailVariant/RCP set propag_rtt_ 1.0 ;# effecitve only if rate_fact_mode = 3
+# Queue/DropTailVariant/RCP set upd_timeslot_ 0.01 ;# rate update interval (sec).
+
Queue/RED set bytes_ true ; # default changed on 10/11/2004.
Queue/RED set queue_in_bytes_ true ; # default changed on 10/11/2004.
# Queue/RED set thresh_ 5
@@ -168,6 +194,15 @@ Queue/RED set bottom_ 0
### for automatic configuration.
Queue/RED set cautious_ 0
Queue/RED set feng_adaptive_ 0
+# Mohammad: Phantom Queue extensions
+Queue/RED set pq_enable_ 0
+Queue/RED set pq_mode_ 0
+Queue/RED set pq_drainrate_ 0 ; # need to set this when PQ is enabled
+ # always in bps
+Queue/RED set pq_thresh_ 0
+# Shuang: priority dropping/deque extensions
+Queue/RED set drop_prio_ 0
+Queue/RED set deque_prio_ 0
Queue/RED/RIO set bytes_ false
Queue/RED/RIO set queue_in_bytes_ false
@@ -235,6 +270,9 @@ Queue/Vq set mean_pktsize_ 1000
Queue/Vq set curq_ 0
Queue/Vq set drop_front_ 0
Queue/Vq set markfront_ 0
+# Mohammad
+Queue/Vq set ctilde_ 0
+Queue/Vq set vq_len_ 0
Queue/REM set gamma_ 0.001
Queue/REM set phi_ 1.001
@@ -298,6 +336,20 @@ QueueMonitor set pdrops_ 0
QueueMonitor set pmarks_ 0
QueueMonitor set bdrops_ 0
+#added for count dropping from small flow - Shuang
+QueueMonitor set num_monitor_ 50
+for {set k 0} {$k < 50} {incr k} {
+ set tmp kdrops$k
+ QueueMonitor set $tmp 0
+ set tmp karrivals$k
+ QueueMonitor set $tmp 0
+}
+
+QueueMonitor set ack_arrivals_ 0
+QueueMonitor set ack_drops_ 0
+QueueMonitor set ack_departures_ 0
+
+
QueueMonitor set qs_pkts_ 0
QueueMonitor set qs_bytes_ 0
QueueMonitor set qs_drops_ 0
@@ -360,8 +412,7 @@ DelayLink set bandwidth_ 1.5Mb
DelayLink set delay_ 100ms
DelayLink set debug_ false
DelayLink set avoidReordering_ false ; # Added 3/27/2003.
- # Set to true to avoid reordering when
- # changing link bandwidth or delay.
+ # Set to true to avoid reordering when
DynamicLink set status_ 1
DynamicLink set debug_ false
@@ -389,6 +440,11 @@ Classifier/Addr/MPLS set reroute_option_ 0
Classifier/Addr/MPLS set control_driven_ 0
Classifier/Addr/MPLS set data_driven_ 0
+# Mohammad
+Classifier/MultiPath set nodeid_ 0
+Classifier/MultiPath set nodetype_ 0
+Classifier/MultiPath set perflow_ 0
+Classifier/MultiPath set checkpathid_ 0
#
# FEC models
#
@@ -634,7 +690,16 @@ NetworkInterface set debug_ false
TBF set rate_ 64k
TBF set bucket_ 1024
TBF set qlen_ 0
-
+# Mohammad: Pacer variables
+TBF set pacer_enable_ 0
+TBF set assoc_timeout_ 0.01
+TBF set assoc_prob_ 0.125
+TBF set maxrate_ 1000000000
+TBF set minrate_ 10000000
+TBF set qlength_factor_ 122;
+TBF set rate_ave_factor_ 0.125
+TBF set rate_update_interval_ 0.000064
+TBF set debug_ 0
#
# mobile Ip
#
@@ -1022,6 +1087,18 @@ Agent/TCP set control_increase_ 0
Agent/TCP set SetCWRonRetransmit_ true ; # added on 2005/06/19.
# default changed on 2008/06/05.
+# Mohammad
+Agent/TCP set ecnhat_ false;
+Agent/TCP set ecnhat_smooth_alpha_ true;
+Agent/TCP set ecnhat_alpha_ 0.0;
+Agent/TCP set ecnhat_g_ 0.125;
+Agent/TCP set ecnhat_enable_beta_ false;
+Agent/TCP set ecnhat_beta_ 0.0;
+Agent/TCP set ecnhat_quadratic_beta_ false;
+Agent/TCP set ecnhat_tcp_friendly_ false;
+Agent/TCP set perPacketMP_ false;
+Agent/TCP set pathAwareMP_ false;
+Agent/TCP set num_paths_ 1
# XXX Generate nam trace or plain old text trace for variables.
# When it's true, generate nam trace.
@@ -1057,6 +1134,7 @@ Agent/TCPSink set qs_enabled_ false
Agent/TCPSink set RFC2581_immediate_ack_ true
Agent/TCPSink set bytes_ 0
Agent/TCPSink set ecn_syn_ false ; # Added 2005/11/21 for SYN/ACK pkts.
+Agent/TCPSink set ecnhat_ false;
Agent/TCPSink/DelAck set interval_ 100ms
catch {
@@ -1229,6 +1307,20 @@ if [TclObject is-class Agent/TCP/FullTcp] {
Agent/TCP/FullTcp set ecn_syn_ false; # Make SYN/ACK packet ECN-Capable?
Agent/TCP/FullTcp set ecn_syn_wait_ 0; # Wait after marked SYN/ACK?
Agent/TCP/FullTcp set debug_ false; # Added Sept. 16, 2007.
+ Agent/TCP/FullTcp set flow_remaining_ -1; #Mohammad: added for robust FCT measurement
+ Agent/TCP/FullTcp set dynamic_dupack_ 0; # Mohammad: if non-zero, set dupack threshold to max(3, dynamic_dupack_ * cwnd_)
+ Agent/TCP/FullTcp set prio_scheme_ 2; #Shuang: priority scheme
+ Agent/TCP/FullTcp set prio_num_ 0; #Shuang: number of priority
+ Agent/TCP/FullTcp set prio_cap0 6*1460+15;
+ Agent/TCP/FullTcp set prio_cap1 16*1460+15;
+ Agent/TCP/FullTcp set prio_cap2 30*1460+15;
+ Agent/TCP/FullTcp set prio_cap3 49*1460+15;
+ Agent/TCP/FullTcp set prio_cap4 266*1460+15;
+ Agent/TCP/FullTcp set prio_cap5 1001*1460+15;
+ Agent/TCP/FullTcp set prio_cap6 2825*1460+15;
+ Agent/TCP/FullTcp set prob_cap_ 0; #Shuang: prob mode
+ Agent/TCP/FullTcp set deadline 0; #Shuang: deadline
+ Agent/TCP/FullTcp set early_terminated_ 0; #Shuang
Agent/TCP/FullTcp/Newreno set recov_maxburst_ 2; # max burst dur recov
@@ -1259,6 +1351,14 @@ if [TclObject is-class Agent/TCP/FullTcp] {
set open_cwnd_on_pack_ false
}
+ Agent/TCP/FullTcp/Sack/MinTCP instproc init {} {
+ $self next
+ }
+
+ Agent/TCP/FullTcp/Sack/DDTCP instproc init {} {
+ $self next
+ }
+
}
if [TclObject is-class Agent/TCP/BayFullTcp] {
@@ -1451,6 +1551,24 @@ Queue set util_records_ 5 ; # Changed from 0 to 5, 2/25/05.
Delayer set debug_ false
+# # Nandita: Following is for Video traffic. Taken from Xiaoqing Zhu
+# Application/Traffic/VideoCBR set rate_ 0
+# Application/Traffic/VideoCBR set pktsize_ 1500
+# Application/Traffic/VideoCBR set fps_ 30
+# Application/Traffic/VideoCBR set gop_ 15
+# Application/Traffic/VideoCBR set fix_interval_ 0
+# Application/Traffic/VideoCBR set init_delay_ 0.5
+# Application/Traffic/VideoCBR set debug_ 0
+# Application/Traffic/VideoCBR set random_ 0
+
+# Application/Traffic/VideoTrace set init_delay_ 0.5
+# Application/Traffic/VideoTrace set quality_ 0
+# Application/Traffic/VideoTrace set fps_ 30
+# Application/Traffic/VideoTrace set advance_per_gop_ 1
+# Application/Traffic/VideoTrace set debug_ 0
+# Application/Traffic/VideoTrace set random_ 0
+# Application/Traffic/VideoTrace set loop_ 0
+
Agent/TCP/Linux set rtxcur_init_ 3
Agent/TCP/Linux set maxrto_ 120
Agent/TCP/Linux set minrto_ 0.2
diff --git a/tcl/lib/ns-node.tcl b/tcl/lib/ns-node.tcl
index 045b45d..18b5163 100644
--- a/tcl/lib/ns-node.tcl
+++ b/tcl/lib/ns-node.tcl
@@ -88,9 +88,9 @@ Node instproc init args {
set nodetype_ [$ns_ get-nodetype]
$self mk-default-classifier
-
# XXX Eventually these two should also be converted to modules
set multiPath_ [$class set multiPath_]
+
}
# XXX This instproc is backward compatibility; when satellite node, mobile
@@ -350,8 +350,21 @@ Node instproc add-routes {id ifs} {
# 1. get new MultiPathClassifier,
# 2. migrate existing routes to that mclassifier
# 3. install the mclassifier in the node classifier_
- #
+ #
set mpathClsfr_($id) [new Classifier/MultiPath]
+ $mpathClsfr_($id) set nodeid_ [$self id]
+ set nodecolor_ [$self get-attribute "COLOR"]
+ set nodetype_ 0
+ if {$nodecolor_ == "green"} {
+ set nodetype_ 1
+ }
+ if {$nodecolor_ == "blue"} {
+ set nodetype_ 2
+ }
+ if {$nodecolor_ == "red"} {
+ set nodetype_ 3
+ }
+ $mpathClsfr_($id) set nodetype_ $nodetype_
if {$routes_($id) > 0} {
assert "$routes_($id) == 1"
$mpathClsfr_($id) installNext \
diff --git a/tcp/tcp-full.cc b/tcp/tcp-full.cc
index f2cd360..b8b7fd7 100644
--- a/tcp/tcp-full.cc
+++ b/tcp/tcp-full.cc
@@ -1,75 +1,4 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
-
-/*
- * Copyright (c) Intel Corporation 2001. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Copyright (c) 1997, 1998 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Network Research
- * Group at Lawrence Berkeley National Laboratory.
- * 4. Neither the name of the University nor of the Laboratory may be used
- * to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- *
- * Full-TCP : A two-way TCP very similar to the 4.4BSD version of Reno TCP.
- * This version also includes variants Tahoe, NewReno, and SACK.
- *
- * This code below has received a fairly major restructuring (Aug. 2001).
- * The ReassemblyQueue structure is now removed to a separate module and
- * entirely re-written.
- * Also, the SACK functionality has been re-written (almost) entirely.
- * -KF [[email protected]]
- *
- * This code below was motivated in part by code contributed by
- * Kathie Nichols ([email protected]). The code below is based primarily
- * on the 4.4BSD TCP implementation. -KF [[email protected]]
- *
- * Kathie Nichols and Van Jacobson have contributed significant bug fixes,
- * especially with respect to the the handling of sequence numbers during
- * connection establishment/clearin. Additional fixes have followed
- * theirs.
- *
- * Fixes for gensack() and ReassemblyQueue::add() contributed by Richard
- * Mortier <[email protected]>
+ /* Mortier <[email protected]>
*
* Some warnings and comments:
* this version of TCP will not work correctly if the sequence number
@@ -117,6 +46,7 @@ static const char rcsid[] =
#include "flags.h"
#include "random.h"
#include "template.h"
+#include "math.h"
#ifndef TRUE
#define TRUE 1
@@ -171,6 +101,22 @@ public:
}
} class_sack_full;
+static class MinTcpClass : public TclClass {
+public:
+ MinTcpClass() : TclClass("Agent/TCP/FullTcp/Sack/MinTCP") {}
+ TclObject* create(int, const char*const*) {
+ return (new MinTcpAgent());
+ }
+} class_min_full;
+
+static class DDTcpClass : public TclClass {
+public:
+ DDTcpClass() : TclClass("Agent/TCP/FullTcp/Sack/DDTCP") {}
+ TclObject* create(int, const char*const*) {
+ return (new DDTcpAgent());
+ }
+} class_dd_full;
+
/*
* Delayed-binding variable linkage
*/
@@ -199,6 +145,21 @@ FullTcpAgent::delay_bind_init_all()
delay_bind_init_one("ecn_syn_wait_");
delay_bind_init_one("debug_");
delay_bind_init_one("spa_thresh_");
+
+ delay_bind_init_one("flow_remaining_"); //Mohammad
+ delay_bind_init_one("dynamic_dupack_");
+
+ delay_bind_init_one("prio_scheme_"); // Shuang
+ delay_bind_init_one("prio_num_"); //Shuang
+ delay_bind_init_one("prio_cap0"); //Shuang
+ delay_bind_init_one("prio_cap1"); //Shuang
+ delay_bind_init_one("prio_cap2"); //Shuang
+ delay_bind_init_one("prio_cap3"); //Shuang
+ delay_bind_init_one("prio_cap4"); //Shuang
+ delay_bind_init_one("prio_cap5"); //Shuang
+ delay_bind_init_one("prio_cap6"); //Shuang
+ delay_bind_init_one("deadline"); //Shuang
+ delay_bind_init_one("early_terminated_"); //Shuang
TcpAgent::delay_bind_init_all();
@@ -229,7 +190,20 @@ FullTcpAgent::delay_bind_dispatch(const char *varName, const char *localName, Tc
if (delay_bind_bool(varName, localName, "ecn_syn_", &ecn_syn_, tracer)) return TCL_OK;
if (delay_bind(varName, localName, "ecn_syn_wait_", &ecn_syn_wait_, tracer)) return TCL_OK;
if (delay_bind_bool(varName, localName, "debug_", &debug_, tracer)) return TCL_OK;
-
+ if (delay_bind(varName, localName, "flow_remaining_", &flow_remaining_, tracer)) return TCL_OK; // Mohammad
+ if (delay_bind(varName, localName, "dynamic_dupack_", &dynamic_dupack_, tracer)) return TCL_OK; // Mohammad
+ if (delay_bind(varName, localName, "prio_scheme_", &prio_scheme_, tracer)) return TCL_OK; // Shuang
+ if (delay_bind(varName, localName, "prio_num_", &prio_num_, tracer)) return TCL_OK; //Shuang
+ if (delay_bind(varName, localName, "prio_cap0", &prio_cap_[0], tracer)) return TCL_OK;
+ if (delay_bind(varName, localName, "prio_cap1", &prio_cap_[1], tracer)) return TCL_OK;
+ if (delay_bind(varName, localName, "prio_cap2", &prio_cap_[2], tracer)) return TCL_OK;
+ if (delay_bind(varName, localName, "prio_cap3", &prio_cap_[3], tracer)) return TCL_OK;
+ if (delay_bind(varName, localName, "prio_cap4", &prio_cap_[4], tracer)) return TCL_OK;
+ if (delay_bind(varName, localName, "prio_cap5", &prio_cap_[5], tracer)) return TCL_OK;
+ if (delay_bind(varName, localName, "prio_cap6", &prio_cap_[6], tracer)) return TCL_OK;
+ if (delay_bind(varName, localName, "prob_cap_", &prob_cap_, tracer)) return TCL_OK; //Shuang
+ if (delay_bind(varName, localName, "deadline", &deadline, tracer)) return TCL_OK; //Shuang
+ if (delay_bind(varName, localName, "early_terminated_", &early_terminated_, tracer)) return TCL_OK; //Shuang
return TcpAgent::delay_bind_dispatch(varName, localName, tracer);
}
@@ -297,6 +271,11 @@ FullTcpAgent::command(int argc, const char*const* argv)
advance_bytes(atoi(argv[2]));
return (TCL_OK);
}
+ //Mohammad
+ if (strcmp(argv[1], "get-flow") == 0) {
+ flow_remaining_ = atoi(argv[2]);
+ return(TCL_OK);
+ }
}
if (argc == 4) {
if (strcmp(argv[1], "sendmsg") == 0) {
@@ -330,10 +309,11 @@ FullTcpAgent::command(int argc, const char*const* argv)
void
FullTcpAgent::advanceby(int np)
{
- // XXX hack:
+
+
+// XXX hack:
// because np is in packets and a data source
// may pass a *huge* number as a way to tell us
- // to go forever, just look for the huge number
// and if it's there, pre-divide it
if (np >= 0x10000000)
np /= maxseg_;
@@ -350,6 +330,10 @@ void
FullTcpAgent::advance_bytes(int nb)
{
+////Shuang: hardcode
+ cwnd_ = initial_window();
+// //ssthresh_ = cwnd_;
+
//
// state-specific operations:
// if CLOSED or LISTEN, reset and try a new active open/connect
@@ -357,21 +341,26 @@ FullTcpAgent::advance_bytes(int nb)
// if SYN_SENT or SYN_RCVD, just queue
// if above ESTABLISHED, we are closing, so don't allow
//
-
- switch (state_) {
+ start_time = now();
+ early_terminated_ = 0;
+ switch (state_) {
case TCPS_CLOSED:
case TCPS_LISTEN:
reset();
+ startseq_ = iss_;
curseq_ = iss_ + nb;
- connect(); // initiate new connection
+ seq_bound_ = -1;
+ connect(); // initiate new connection
break;
case TCPS_ESTABLISHED:
case TCPS_SYN_SENT:
case TCPS_SYN_RECEIVED:
if (curseq_ < iss_)
- curseq_ = iss_;
+ curseq_ = iss_;
+ startseq_ = curseq_;
+ seq_bound_ = -1;
curseq_ += nb;
break;
@@ -400,11 +389,15 @@ FullTcpAgent::advance_bytes(int nb)
void
FullTcpAgent::sendmsg(int nbytes, const char *flags)
{
- if (flags && strcmp(flags, "MSG_EOF") == 0)
+ if (flags && strcmp(flags, "MSG_EOF") == 0){
close_on_empty_ = TRUE;
- if (flags && strcmp(flags, "DAT_EOF") == 0)
- signal_on_empty_ = TRUE;
+printf("setting 2 closeonempty to true for fid= %d\n",fid_);
+ }
+ if (flags && strcmp(flags, "DAT_EOF") == 0){
+ signal_on_empty_ = TRUE;
+ printf("setting signalonempty to true for fid= %d\n",fid_);
+ }
if (nbytes == -1) {
infinite_send_ = TRUE;
advance_bytes(0);
@@ -446,6 +439,7 @@ void
FullTcpAgent::bufferempty()
{
signal_on_empty_=FALSE;
+ //printf("flow fid= %d is done\n",fid_);
Tcl::instance().evalf("%s done_data", this->name());
}
@@ -459,7 +453,6 @@ FullTcpAgent::usrclosed()
{
curseq_ = maxseq_ - 1; // now, no more data
infinite_send_ = FALSE; // stop infinite send
-
switch (state_) {
case TCPS_CLOSED:
case TCPS_LISTEN:
@@ -610,9 +603,9 @@ FullTcpAgent::reset()
cancel_timers(); // cancel timers first
TcpAgent::reset(); // resets most variables
rq_.clear(); // clear reassembly queue
- rtt_init(); // zero rtt, srtt, backoff
-
+ rtt_init(); // zero rtt, srtt, backoff
last_ack_sent_ = -1;
+ flow_remaining_ = -1; // Mohammad
rcv_nxt_ = -1;
pipe_ = 0;
rtxbytes_ = 0;
@@ -635,7 +628,12 @@ FullTcpAgent::reset()
ecn_syn_next_ = 1;
else
ecn_syn_next_ = 0;
-
+ //Shuang
+ prob_mode_ = false;
+ prob_count_ = 0;
+ last_sqtotal_ = 0;
+ deadline = 0;
+ early_terminated_ = 0;
}