23 #include "ns3/packet.h" 49 .SetGroupName (
"Wifi")
81 Time ppduDurationLimit)
const 83 NS_LOG_FUNCTION (recipient << +tid << txVector << ampduSize << ppduDurationLimit);
93 WifiMacQueue::ConstIterator peekedIt = queue->PeekByTidAndAddress (tid, recipient);
95 if (peekedIt == queue->end ())
97 NS_LOG_DEBUG (
"No packet with the given TID and address in the queue");
113 if (maxAmsduSize == 0)
118 Ptr<WifiMacQueueItem> amsdu = Create<WifiMacQueueItem> (Create<const Packet> (), (*peekedIt)->GetHeader ());
122 WifiMacQueue::ConstIterator
first = peekedIt;
127 while (peekedIt != queue->end ())
131 amsdu->GetPacket ()->GetSize ());
133 if (newAmsduSize > maxAmsduSize)
135 NS_LOG_DEBUG (
"No other MSDU can be aggregated: maximum A-MSDU size reached");
141 if (!qosTxop->GetLow ()->IsWithinSizeAndTimeLimits (amsdu->GetHeader ().GetSize () + newAmsduSize
143 recipient, tid, txVector, ampduSize, ppduDurationLimit))
153 amsdu =
Copy (*peekedIt);
159 amsdu->Aggregate (*peekedIt);
160 peekedIt = queue->Remove (peekedIt);
165 peekedIt = queue->PeekByTidAndAddress (tid, recipient, peekedIt);
170 NS_LOG_DEBUG (
"Aggregation failed (could not aggregate at least two MSDUs)");
175 queue->Remove (
first);
183 return (4 - (amsduSize % 4 )) % 4;
205 device->
GetMac ()->GetAttribute (
"BE_MaxAmsduSize", size);
208 device->
GetMac ()->GetAttribute (
"BK_MaxAmsduSize", size);
211 device->
GetMac ()->GetAttribute (
"VI_MaxAmsduSize", size);
214 device->
GetMac ()->GetAttribute (
"VO_MaxAmsduSize", size);
221 uint16_t maxAmsduSize = size.
Get ();
223 if (maxAmsduSize == 0)
225 NS_LOG_DEBUG (
"A-MSDU Aggregation is disabled on this station for AC " << ac);
239 NS_LOG_DEBUG (
"A-MSDU Aggregation disabled because the recipient did not" 240 " send an HT Capabilities element");
251 NS_ABORT_MSG_IF (!vhtCapabilities,
"VHT Capabilities element not received");
253 maxAmsduSize =
std::min (maxAmsduSize, static_cast<uint16_t>(vhtCapabilities->GetMaxMpduLength () - 56));
261 maxAmsduSize =
std::min (maxAmsduSize, htCapabilities->GetMaxAmsduLength ());
268 maxAmsduSize =
std::min (maxAmsduSize, static_cast<uint16_t>(3839));
282 uint32_t maxSize = aggregatedPacket->
GetSize ();
283 uint16_t extractedLength;
285 uint32_t deserialized = 0;
287 while (deserialized < maxSize)
291 extractedMsdu = aggregatedPacket->
CreateFragment (0, static_cast<uint32_t> (extractedLength));
293 deserialized += extractedLength;
295 padding = (4 - ((extractedLength + 14) % 4 )) % 4;
297 if (padding > 0 && deserialized < maxSize)
300 deserialized += padding;
304 set.push_back (packetHdr);
306 NS_LOG_INFO (
"Deaggreated A-MSDU: extracted " <<
set.size () <<
" MSDUs");
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
uint16_t GetMaxAmsduSize(Mac48Address recipient, uint8_t tid, WifiModulationClass modulation) const
Determine the maximum size for an A-MSDU of the given TID that can be sent to the given receiver when...
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
static const uint16_t WIFI_MAC_FCS_LENGTH
The length in octects of the IEEE 802.11 MAC FCS field.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
static DeaggregatedMsdus Deaggregate(Ptr< Packet > aggregatedPacket)
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
EdcaQueues m_edca
the map of EDCA queues
void RemoveAtStart(uint32_t size)
Remove size bytes from the start of the current packet.
Ptr< WifiRemoteStationManager > GetRemoteStationManager(void) const
void SetEdcaQueues(EdcaQueues map)
Set the map of EDCA queues.
std::list< std::pair< Ptr< const Packet >, AmsduSubframeHeader > > DeaggregatedMsdus
DeaggregatedMsdus typedef.
Hold an unsigned integer type.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
WifiMode GetMode(void) const
static TypeId GetTypeId(void)
Get the type ID.
static uint16_t GetSizeIfAggregated(uint16_t msduSize, uint16_t amsduSize)
Compute the size of the A-MSDU resulting from the aggregation of an MSDU of size msduSize and an A-MS...
WifiModulationClass GetModulationClass() const
Ptr< const HtCapabilities > GetStationHtCapabilities(Mac48Address from)
Return the HT capabilities sent by the remote station.
Ptr< MacLow > GetLow(void) const
Return the MacLow associated with this Txop.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual ~MsduAggregator()
Ptr< WifiMac > GetMac(void) const
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Ptr< const VhtCapabilities > GetStationVhtCapabilities(Mac48Address from)
Return the VHT capabilities sent by the remote station.
static uint8_t CalculatePadding(uint16_t amsduSize)
Calculate how much padding must be added to the end of an A-MSDU of the given size if a new MSDU is a...
Aggregator used to construct A-MSDUs.
A base class which provides memory management and object aggregation.
Ptr< WifiMacQueueItem > GetNextAmsdu(Mac48Address recipient, uint8_t tid, WifiTxVector txVector, uint32_t ampduSize=0, Time ppduDurationLimit=Time::Min()) const
Dequeue MSDUs to be transmitted to a given station and belonging to a given TID from the correspondin...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Ptr< T > Copy(Ptr< T > object)
Return a deep copy of a Ptr.
std::map< AcIndex, Ptr< QosTxop > > EdcaQueues
EDCA queues typedef.