A Discrete-Event Network Simulator
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016 Universita' degli Studi di Napoli Federico II
4  * Copyright (c) 2020 NITK Surathkal (adapted for COBALT)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Pasquale Imputato <p.imputato@gmail.com>
20  * Stefano Avallone <stefano.avallone@unina.it>
21  * Modified by: Bhaskar Kataria <bhaskar.k7920@gmail.com> (for COBALT)
22  * Tom Henderson <tomhend@u.washington.edu>
23  * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
24  * Vivek Jain <jain.vivek.anand@gmail.com>
25  * Ankit Deepak <adadeepak8@gmail.com>
26  */
31 #include "ns3/queue-disc.h"
32 #include "ns3/object-factory.h"
33 #include <list>
34 #include <map>
36 namespace ns3 {
45 {
46 public:
51  static TypeId GetTypeId (void);
55  FqCobaltFlow ();
57  virtual ~FqCobaltFlow ();
64  {
68  };
74  void SetDeficit (uint32_t deficit);
79  int32_t GetDeficit (void) const;
84  void IncreaseDeficit (int32_t deficit);
89  void SetStatus (FlowStatus status);
94  FlowStatus GetStatus (void) const;
99  void SetIndex (uint32_t index);
104  uint32_t GetIndex (void) const;
106 private:
107  int32_t m_deficit;
109  uint32_t m_index;
110 };
120 {
121 public:
126  static TypeId GetTypeId (void);
132  virtual ~FqCobaltQueueDisc ();
139  void SetQuantum (uint32_t quantum);
146  uint32_t GetQuantum (void) const;
148  // Reasons for dropping packets
149  static constexpr const char* UNCLASSIFIED_DROP = "Unclassified drop";
150  static constexpr const char* OVERLIMIT_DROP = "Overlimit drop";
152 private:
153  virtual bool DoEnqueue (Ptr<QueueDiscItem> item);
154  virtual Ptr<QueueDiscItem> DoDequeue (void);
155  virtual bool CheckConfig (void);
156  virtual void InitializeParams (void);
162  uint32_t FqCobaltDrop (void);
171  uint32_t SetAssociativeHash (uint32_t flowHash);
173  std::string m_interval;
174  std::string m_target;
175  uint32_t m_quantum;
176  uint32_t m_flows;
177  uint32_t m_setWays;
178  uint32_t m_dropBatchSize;
179  uint32_t m_perturbation;
180  bool m_useEcn;
183  bool m_useL4s;
184  double m_increment;
185  double m_decrement;
186  double m_Pdrop;
189  std::list<Ptr<FqCobaltFlow> > m_newFlows;
190  std::list<Ptr<FqCobaltFlow> > m_oldFlows;
192  std::map<uint32_t, uint32_t> m_flowsIndices;
193  std::map<uint32_t, uint32_t> m_tags;
197 };
199 } // namespace ns3
201 #endif /* FQ_COBALT_QUEUE_DISC */
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
std::string m_target
CoDel target attribute.
uint32_t GetIndex(void) const
Get the index of this flow.
std::string m_interval
CoDel interval attribute.
std::list< Ptr< FqCobaltFlow > > m_oldFlows
The list of old flows.
ObjectFactory m_queueDiscFactory
Factory to create a new queue.
std::list< Ptr< FqCobaltFlow > > m_newFlows
The list of new flows.
virtual bool DoEnqueue(Ptr< QueueDiscItem > item)
This function actually enqueues a packet into the queue disc.
virtual Ptr< QueueDiscItem > DoDequeue(void)
This function actually extracts a packet from the queue disc.
void SetQuantum(uint32_t quantum)
Set the quantum value.
double m_increment
increment value for marking probability
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Definition: queue-disc.h:181
FqCobaltFlow constructor.
double m_Pdrop
Drop Probability.
double m_decrement
decrement value for marking probability
uint32_t m_quantum
Deficit assigned to flows at each round.
bool m_useEcn
True if ECN is used (packets are marked instead of being dropped)
static TypeId GetTypeId(void)
Get the type ID.
A FqCobalt packet queue disc.
FlowStatus m_status
the status of this flow
static TypeId GetTypeId(void)
Get the type ID.
bool m_enableSetAssociativeHash
whether to enable set associative hash
std::map< uint32_t, uint32_t > m_tags
Tags used by set associative hash.
virtual bool CheckConfig(void)
Check whether the current configuration is correct.
Used to determine the status of this flow queue.
Time m_ceThreshold
Threshold above which to CE mark.
void IncreaseDeficit(int32_t deficit)
Increase the deficit for this flow.
uint32_t m_index
the index for this flow
QueueDiscClass is the base class for classes that are included in a queue disc.
Definition: queue-disc.h:49
A flow queue used by the FqCobalt queue disc.
void SetIndex(uint32_t index)
Set the index for this flow.
ObjectFactory m_flowFactory
Factory to create a new flow.
std::map< uint32_t, uint32_t > m_flowsIndices
Map with the index of class for each flow.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
int32_t GetDeficit(void) const
Get the deficit for this flow.
uint32_t m_flows
Number of flow queues.
FqCobaltQueueDisc constructor.
static constexpr const char * UNCLASSIFIED_DROP
No packet filter able to classify packet.
Instantiate subclasses of ns3::Object.
uint32_t GetQuantum(void) const
Get the quantum value.
int32_t m_deficit
the deficit for this flow
uint32_t SetAssociativeHash(uint32_t flowHash)
Compute the index of the queue for the flow having the given flowHash, according to the set associati...
void SetDeficit(uint32_t deficit)
Set the deficit for this flow.
uint32_t m_perturbation
hash perturbation value
void SetStatus(FlowStatus status)
Set the status for this flow.
FlowStatus GetStatus(void) const
Get the status of this flow.
Time m_blueThreshold
Threshold to enable blue enhancement.
uint32_t m_dropBatchSize
Max number of packets dropped from the fat flow.
uint32_t FqCobaltDrop(void)
Drop a packet from the head of the queue with the largest current byte count.
a unique identifier for an interface.
Definition: type-id.h:58
virtual void InitializeParams(void)
Initialize parameters (if any) before the first packet is enqueued.
uint32_t m_setWays
size of a set of queues (used by set associative hash)
static constexpr const char * OVERLIMIT_DROP
Overlimit dropped packets.
bool m_useL4s
True if L4S is used (ECT1 packets are marked at CE threshold)