Left: | ||
Right: |
OLD | NEW |
---|---|
1 // /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 // /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright © 2011 Marcos Talau | 3 * Copyright © 2011 Marcos Talau |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 .AddAttribute ("Wait", | 96 .AddAttribute ("Wait", |
97 "True for waiting between dropped packets", | 97 "True for waiting between dropped packets", |
98 BooleanValue (true), | 98 BooleanValue (true), |
99 MakeBooleanAccessor (&RedQueueDisc::m_isWait), | 99 MakeBooleanAccessor (&RedQueueDisc::m_isWait), |
100 MakeBooleanChecker ()) | 100 MakeBooleanChecker ()) |
101 .AddAttribute ("Gentle", | 101 .AddAttribute ("Gentle", |
102 "True to increases dropping probability slowly when average q ueue exceeds maxthresh", | 102 "True to increases dropping probability slowly when average q ueue exceeds maxthresh", |
103 BooleanValue (true), | 103 BooleanValue (true), |
104 MakeBooleanAccessor (&RedQueueDisc::m_isGentle), | 104 MakeBooleanAccessor (&RedQueueDisc::m_isGentle), |
105 MakeBooleanChecker ()) | 105 MakeBooleanChecker ()) |
106 .AddAttribute ("NLRED", | |
107 "True to enable Nonlinear RED", | |
108 BooleanValue (false), | |
109 MakeBooleanAccessor (&RedQueueDisc::m_isNonlinear), | |
110 MakeBooleanChecker ()) | |
106 .AddAttribute ("ARED", | 111 .AddAttribute ("ARED", |
107 "True to enable ARED", | 112 "True to enable ARED", |
108 BooleanValue (false), | 113 BooleanValue (false), |
109 MakeBooleanAccessor (&RedQueueDisc::m_isARED), | 114 MakeBooleanAccessor (&RedQueueDisc::m_isARED), |
110 MakeBooleanChecker ()) | 115 MakeBooleanChecker ()) |
111 .AddAttribute ("AdaptMaxP", | 116 .AddAttribute ("AdaptMaxP", |
112 "True to adapt m_curMaxP", | 117 "True to adapt m_curMaxP", |
113 BooleanValue (false), | 118 BooleanValue (false), |
114 MakeBooleanAccessor (&RedQueueDisc::m_isAdaptMaxP), | 119 MakeBooleanAccessor (&RedQueueDisc::m_isAdaptMaxP), |
115 MakeBooleanChecker ()) | 120 MakeBooleanChecker ()) |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
697 */ | 702 */ |
698 p = 1.0; | 703 p = 1.0; |
699 } | 704 } |
700 else | 705 else |
701 { | 706 { |
702 /* | 707 /* |
703 * p ranges from 0 to max_p as the average queue size ranges from | 708 * p ranges from 0 to max_p as the average queue size ranges from |
704 * th_min to th_max | 709 * th_min to th_max |
705 */ | 710 */ |
706 p = vA * qAvg + vB; | 711 p = vA * qAvg + vB; |
707 p *= maxP; | 712 ···· |
Stefano Avallone
2017/01/27 14:10:56
I can't find in the reference that maxP is set to
Nichit Bodhak Goel
2017/01/31 11:05:35
In the paragraph just before Section 3.2, authors
| |
713 if (m_isNonlinear) | |
714 { | |
715 p = p * p; | |
716 // maxP is set to 1.5 times of its old value [Ref: http://www.scienced irect.com/science/article/pii/S1389128606000879] | |
717 p *= maxP * 1.5; | |
718 } | |
719 else | |
720 { | |
721 /* | |
722 * p ranges from 0 to max_p as the average queue size ranges from | |
723 * th_min to th_max | |
724 */ | |
725 p *= maxP; | |
726 } | |
Stefano Avallone
2017/01/27 14:10:56
I think this can be further simplified:
else
Nichit Bodhak Goel
2017/01/31 11:05:35
Done.
However, I have slightly modified the code
| |
708 } | 727 } |
709 | 728 |
710 if (p > 1.0) | 729 if (p > 1.0) |
711 { | 730 { |
712 p = 1.0; | 731 p = 1.0; |
713 } | 732 } |
714 | 733 |
715 return p; | 734 return p; |
716 } | 735 } |
717 | 736 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
878 (m_mode == Queue::QUEUE_MODE_BYTES && GetInternalQueue (0)->GetMaxBytes ( ) < m_queueLimit)) | 897 (m_mode == Queue::QUEUE_MODE_BYTES && GetInternalQueue (0)->GetMaxBytes ( ) < m_queueLimit)) |
879 { | 898 { |
880 NS_LOG_ERROR ("The size of the internal queue is less than the queue disc limit"); | 899 NS_LOG_ERROR ("The size of the internal queue is less than the queue disc limit"); |
881 return false; | 900 return false; |
882 } | 901 } |
883 | 902 |
884 return true; | 903 return true; |
885 } | 904 } |
886 | 905 |
887 } // namespace ns3 | 906 } // namespace ns3 |
OLD | NEW |