A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
pfifo-fast-queue-disc.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007, 2014 University of Washington
3 * 2015 Universita' degli Studi di Napoli Federico II
4 *
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
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Stefano Avallone <stavallo@unina.it>
19 * Tom Henderson <tomhend@u.washington.edu>
20 */
21
22#ifndef PFIFO_FAST_H
23#define PFIFO_FAST_H
24
25#include "queue-disc.h"
26
27namespace ns3
28{
29
30/**
31 * \ingroup traffic-control
32 *
33 * Linux pfifo_fast is the default priority queue enabled on Linux
34 * systems. Packets are enqueued in three FIFO droptail queues according
35 * to three priority bands based on the packet priority.
36 *
37 * The system behaves similar to three ns3::DropTail queues operating
38 * together, in which packets from higher priority bands are always
39 * dequeued before a packet from a lower priority band is dequeued.
40 *
41 * The queue disc capacity, i.e., the maximum number of packets that can
42 * be enqueued in the queue disc, is set through the limit attribute, which
43 * plays the same role as txqueuelen in Linux. If no internal queue is
44 * provided, three DropTail queues having each a capacity equal to limit are
45 * created by default. User is allowed to provide queues, but they must be
46 * three, operate in packet mode and each have a capacity not less
47 * than limit. No packet filter can be provided.
48 */
50{
51 public:
52 /**
53 * \brief Get the type ID.
54 * \return the object TypeId
55 */
56 static TypeId GetTypeId();
57 /**
58 * \brief PfifoFastQueueDisc constructor
59 *
60 * Creates a queue with a depth of 1000 packets per band by default
61 */
63
64 ~PfifoFastQueueDisc() override;
65
66 // Reasons for dropping packets
67 static constexpr const char* LIMIT_EXCEEDED_DROP =
68 "Queue disc limit exceeded"; //!< Packet dropped due to queue disc limit exceeded
69
70 private:
71 /**
72 * Priority to band map. Values are taken from the prio2band array used by
73 * the Linux pfifo_fast queue disc.
74 */
75 static const uint32_t prio2band[16];
76
77 bool DoEnqueue(Ptr<QueueDiscItem> item) override;
80 bool CheckConfig() override;
81 void InitializeParams() override;
82};
83
84} // namespace ns3
85
86#endif /* PFIFO_FAST_H */
Linux pfifo_fast is the default priority queue enabled on Linux systems.
bool DoEnqueue(Ptr< QueueDiscItem > item) override
This function actually enqueues a packet into the queue disc.
Ptr< const QueueDiscItem > DoPeek() override
Return a copy of the next packet the queue disc will extract.
static TypeId GetTypeId()
Get the type ID.
bool CheckConfig() override
Check whether the current configuration is correct.
Ptr< QueueDiscItem > DoDequeue() override
This function actually extracts a packet from the queue disc.
static constexpr const char * LIMIT_EXCEEDED_DROP
Packet dropped due to queue disc limit exceeded.
void InitializeParams() override
Initialize parameters (if any) before the first packet is enqueued.
static const uint32_t prio2band[16]
Priority to band map.
PfifoFastQueueDisc()
PfifoFastQueueDisc constructor.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
QueueDisc is an abstract base class providing the interface and implementing the operations common to...
Definition: queue-disc.h:184
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.