23 #include "ns3/packet.h" 33 #include "ns3/ht-capabilities.h" 34 #include "ns3/vht-capabilities.h" 35 #include "ns3/he-capabilities.h" 52 .SetGroupName (
"Wifi")
134 m_mac->GetAttribute (
"BE_MaxAmpduSize", size);
137 m_mac->GetAttribute (
"BK_MaxAmpduSize", size);
140 m_mac->GetAttribute (
"VI_MaxAmpduSize", size);
143 m_mac->GetAttribute (
"VO_MaxAmpduSize", size);
150 uint32_t maxAmpduSize = size.
Get ();
152 if (maxAmpduSize == 0)
154 NS_LOG_DEBUG (
"A-MPDU Aggregation is disabled on this station for AC " << ac);
170 NS_ABORT_MSG_IF (!heCapabilities,
"HE Capabilities element not received");
172 maxAmpduSize =
std::min (maxAmpduSize, heCapabilities->GetMaxAmpduLength ());
176 NS_ABORT_MSG_IF (!vhtCapabilities,
"VHT Capabilities element not received");
178 maxAmpduSize =
std::min (maxAmpduSize, vhtCapabilities->GetMaxAmpduLength ());
182 NS_ABORT_MSG_IF (!htCapabilities,
"HT Capabilities element not received");
184 maxAmpduSize =
std::min (maxAmpduSize, htCapabilities->GetMaxAmpduLength ());
188 NS_LOG_DEBUG (
"A-MPDU aggregation is not available for non-HT PHYs");
199 return (4 - (ampduSize % 4 )) % 4;
214 std::vector<Ptr<WifiMacQueueItem>>
220 std::vector<Ptr<WifiMacQueueItem>> mpduList;
236 while (nextMpdu != 0)
240 <<
" to A-MPDU, packet size = " << nextMpdu->
GetSize ()
241 <<
", A-MPDU size = " << txParams.
GetSize (recipient));
243 mpduList.push_back (nextMpdu);
249 peekedMpdu = qosTxop->
PeekNextMpdu (queueIt, tid, recipient);
261 nextMpdu = qosTxop->
GetNextMpdu (peekedMpdu, txParams, availableTime,
false, queueIt);
265 if (mpduList.size () == 1)
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802...
Aggregator used to construct A-MPDUs.
Ptr< const WifiMacQueueItem > PeekNextMpdu(uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast())
Peek the next frame to transmit to the given receiver and of the given TID from the block ack manager...
bool IsBroadcast(void) const
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 "...
std::vector< Ptr< WifiMacQueueItem > > GetNextAmpdu(Ptr< WifiMacQueueItem > mpdu, WifiTxParameters &txParams, Time availableTime, WifiMacQueueItem::QueueIteratorPair queueIt) const
Attempt to aggregate other MPDUs to the given MPDU, while meeting the following constraints: ...
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#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).
void AddWifiMacTrailer(Ptr< Packet > packet)
Add FCS trailer to a packet.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
uint32_t GetSize(void) const
Return the size of the packet stored by this item, including header size and trailer size...
WifiModulationClass GetModulationClass(void) const
Get the modulation class specified by this TXVECTOR.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Information needed to remove an MSDU from the queue.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetWifiMac(const Ptr< RegularWifiMac > mac)
Set the MAC layer to use.
Ptr< RegularWifiMac > m_mac
the MAC of this station
uint16_t GetBaStartingSequence(Mac48Address address, uint8_t tid) const
virtual void DoDispose(void)
Destructor implementation.
static uint32_t GetSizeIfAggregated(uint32_t mpduSize, uint32_t ampduSize)
Compute the size of the A-MPDU resulting from the aggregation of an MPDU of size mpduSize and an A-MP...
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Hold an unsigned integer type.
virtual ~MpduAggregator()
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Ptr< const HeCapabilities > GetStationHeCapabilities(Mac48Address from)
Return the HE capabilities sent by the remote station.
Ptr< const HtCapabilities > GetStationHtCapabilities(Mac48Address from)
Return the HT capabilities sent by the remote station.
static void Aggregate(Ptr< const WifiMacQueueItem > mpdu, Ptr< Packet > ampdu, bool isSingle)
Aggregate an MPDU to an A-MPDU.
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static uint8_t CalculatePadding(uint32_t ampduSize)
bool IsInWindow(uint16_t seq, uint16_t winstart, uint16_t winsize)
uint32_t GetSize(Mac48Address receiver) const
Get the size in bytes of the (A-)MPDU addressed to the given receiver.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
uint32_t GetMaxAmpduSize(Mac48Address recipient, uint8_t tid, WifiModulationClass modulation) const
Determine the maximum size for an A-MPDU of the given TID that can be sent to the given receiver when...
bool GetBaAgreementEstablished(Mac48Address address, uint8_t tid) const
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
static TypeId GetTypeId(void)
Get the type ID.
Ptr< const VhtCapabilities > GetStationVhtCapabilities(Mac48Address from)
Return the VHT capabilities sent by the remote station.
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism...
uint16_t GetBaBufferSize(Mac48Address address, uint8_t tid) const
A base class which provides memory management and object aggregation.
Ptr< WifiMacQueueItem > GetNextMpdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame, WifiMacQueueItem::QueueIteratorPair &queueIt)
Prepare the frame to transmit starting from the MPDU that has been previously peeked by calling PeekN...
static AmpduSubframeHeader GetAmpduSubframeHeader(uint16_t mpduSize, bool isSingle)
Get the A-MPDU subframe header corresponding to the MPDU size and whether the MPDU is a single MPDU...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void AddHeader(const Header &header)
Add header to this packet.
void DoDispose() override
Destructor implementation.