wifi: Rework block ack type

This commit is contained in:
Stefano Avallone
2019-08-04 15:54:17 +02:00
parent cd34fa9290
commit 2b8cb2b182
7 changed files with 254 additions and 121 deletions

View File

@@ -23,21 +23,81 @@
namespace ns3 {
BlockAckType::BlockAckType (Variant v)
: m_variant (v)
{
switch (m_variant)
{
case BASIC:
m_bitmapLen.push_back (128);
break;
case COMPRESSED:
case EXTENDED_COMPRESSED:
m_bitmapLen.push_back (8);
break;
case MULTI_TID:
// m_bitmapLen is left empty.
break;
default:
NS_FATAL_ERROR ("Unknown block ack type");
}
}
BlockAckType::BlockAckType ()
: BlockAckType (BASIC)
{
}
BlockAckType::BlockAckType (Variant v, std::vector<uint8_t> l)
: m_variant (v),
m_bitmapLen (l)
{
}
BlockAckReqType::BlockAckReqType (Variant v)
: m_variant (v)
{
switch (m_variant)
{
case BASIC:
case COMPRESSED:
case EXTENDED_COMPRESSED:
m_nSeqControls = 1;
break;
case MULTI_TID:
m_nSeqControls = 0;
break;
default:
NS_FATAL_ERROR ("Unknown block ack request type");
}
}
BlockAckReqType::BlockAckReqType ()
: BlockAckReqType (BASIC)
{
}
BlockAckReqType::BlockAckReqType (Variant v, uint8_t nSeqControls)
: m_variant (v),
m_nSeqControls (nSeqControls)
{
}
std::ostream &operator << (std::ostream &os, const BlockAckType &type)
{
switch (type)
switch (type.m_variant)
{
case BlockAckType::BASIC_BLOCK_ACK:
case BlockAckType::BASIC:
os << "basic-block-ack";
break;
case BlockAckType::COMPRESSED_BLOCK_ACK:
case BlockAckType::COMPRESSED:
os << "compressed-block-ack";
break;
case BlockAckType::EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::EXTENDED_COMPRESSED:
os << "extended-compressed-block-ack";
break;
case BlockAckType::MULTI_TID_BLOCK_ACK:
os << "multi-tid-block-ack";
case BlockAckType::MULTI_TID:
os << "multi-tid-block-ack[" << type.m_bitmapLen.size () << "]";
break;
default:
NS_FATAL_ERROR ("Unknown block ack type");
@@ -45,4 +105,26 @@ std::ostream &operator << (std::ostream &os, const BlockAckType &type)
return os;
}
std::ostream &operator << (std::ostream &os, const BlockAckReqType &type)
{
switch (type.m_variant)
{
case BlockAckReqType::BASIC:
os << "basic-block-ack-req";
break;
case BlockAckReqType::COMPRESSED:
os << "compressed-block-ack-req";
break;
case BlockAckReqType::EXTENDED_COMPRESSED:
os << "extended-compressed-block-ack-req";
break;
case BlockAckReqType::MULTI_TID:
os << "multi-tid-block-ack-req[" << type.m_nSeqControls << "]";
break;
default:
NS_FATAL_ERROR ("Unknown block ack request type");
}
return os;
}
} //namespace ns3

View File

@@ -22,19 +22,61 @@
#define BLOCK_ACK_TYPE_H
#include <ostream>
#include <vector>
namespace ns3 {
/**
* \ingroup wifi
* The different block ack policies.
* The different BlockAck variants.
*/
enum BlockAckType
struct BlockAckType
{
BASIC_BLOCK_ACK,
COMPRESSED_BLOCK_ACK,
EXTENDED_COMPRESSED_BLOCK_ACK,
MULTI_TID_BLOCK_ACK,
/**
* \enum Variant
* \brief The BlockAck variants
*/
enum Variant
{
BASIC,
COMPRESSED,
EXTENDED_COMPRESSED,
MULTI_TID
};
enum Variant m_variant; //!< Block Ack variant
std::vector<uint8_t> m_bitmapLen; //!< Length (bytes) of included bitmaps
/// Constructors
BlockAckType ();
BlockAckType (Variant v);
BlockAckType (Variant v, std::vector<uint8_t> l);
};
/**
* \ingroup wifi
* The different BlockAckRequest variants.
*/
struct BlockAckReqType
{
/**
* \enum Variant
* \brief The BlockAckReq variants
*/
enum Variant
{
BASIC,
COMPRESSED,
EXTENDED_COMPRESSED,
MULTI_TID
};
enum Variant m_variant; //!< Block Ack Request variant
uint8_t m_nSeqControls; //!< Number of included Starting Sequence Control fields.
//!< This member is added for future support of Multi-TID BARs
/// Constructors
BlockAckReqType ();
BlockAckReqType (Variant v);
BlockAckReqType (Variant v, uint8_t nSeqControls);
};
/**
@@ -46,6 +88,15 @@ enum BlockAckType
*/
std::ostream &operator << (std::ostream &os, const BlockAckType &type);
/**
* Serialize BlockAckReqType to ostream in a human-readable form.
*
* \param os std::ostream
* \param type block ack request type
* \return std::ostream
*/
std::ostream &operator << (std::ostream &os, const BlockAckReqType &type);
} //namespace ns3
#endif /* BLOCK_ACK_TYPE_H */

View File

@@ -140,12 +140,12 @@ ConstantWifiAckPolicySelector::UpdateTxParams (Ptr<WifiPsdu> psdu, MacLowTransmi
if (m_qosTxop->GetBaBufferSize (receiver, tid) > 64)
{
NS_LOG_DEBUG ("Scheduling an Extended Compressed block ack request");
params.EnableBlockAckRequest (BlockAckType::EXTENDED_COMPRESSED_BLOCK_ACK);
params.EnableBlockAckRequest (BlockAckType::EXTENDED_COMPRESSED);
}
else
{
NS_LOG_DEBUG ("Scheduling a Compressed block ack request");
params.EnableBlockAckRequest (BlockAckType::COMPRESSED_BLOCK_ACK);
params.EnableBlockAckRequest (BlockAckType::COMPRESSED);
}
return;
}
@@ -153,12 +153,12 @@ ConstantWifiAckPolicySelector::UpdateTxParams (Ptr<WifiPsdu> psdu, MacLowTransmi
if (m_qosTxop->GetBaBufferSize (receiver, tid) > 64)
{
NS_LOG_DEBUG ("Implicitly requesting an Extended Compressed block ack");
params.EnableBlockAck (BlockAckType::EXTENDED_COMPRESSED_BLOCK_ACK);
params.EnableBlockAck (BlockAckType::EXTENDED_COMPRESSED);
}
else
{
NS_LOG_DEBUG ("Implicitly requesting a Compressed block ack");
params.EnableBlockAck (BlockAckType::COMPRESSED_BLOCK_ACK);
params.EnableBlockAck (BlockAckType::COMPRESSED);
}
}

View File

@@ -31,7 +31,7 @@ NS_OBJECT_ENSURE_REGISTERED (CtrlBAckRequestHeader);
CtrlBAckRequestHeader::CtrlBAckRequestHeader ()
: m_barAckPolicy (false),
m_baType (BASIC_BLOCK_ACK)
m_baType (BlockAckType::BASIC)
{
}
@@ -67,14 +67,14 @@ CtrlBAckRequestHeader::GetSerializedSize () const
{
uint32_t size = 0;
size += 2; //Bar control
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case COMPRESSED_BLOCK_ACK:
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::BASIC:
case BlockAckType::COMPRESSED:
case BlockAckType::EXTENDED_COMPRESSED:
size += 2;
break;
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
size += (2 + 2) * (m_tidInfo + 1);
break;
default:
@@ -89,14 +89,14 @@ CtrlBAckRequestHeader::Serialize (Buffer::Iterator start) const
{
Buffer::Iterator i = start;
i.WriteHtolsbU16 (GetBarControl ());
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case COMPRESSED_BLOCK_ACK:
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::BASIC:
case BlockAckType::COMPRESSED:
case BlockAckType::EXTENDED_COMPRESSED:
i.WriteHtolsbU16 (GetStartingSequenceControl ());
break;
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
break;
default:
@@ -110,14 +110,14 @@ CtrlBAckRequestHeader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
SetBarControl (i.ReadLsbtohU16 ());
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case COMPRESSED_BLOCK_ACK:
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::BASIC:
case BlockAckType::COMPRESSED:
case BlockAckType::EXTENDED_COMPRESSED:
SetStartingSequenceControl (i.ReadLsbtohU16 ());
break;
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
break;
default:
@@ -131,17 +131,17 @@ uint16_t
CtrlBAckRequestHeader::GetBarControl (void) const
{
uint16_t res = 0;
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case BlockAckType::BASIC:
break;
case COMPRESSED_BLOCK_ACK:
case BlockAckType::COMPRESSED:
res |= (0x02 << 1);
break;
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::EXTENDED_COMPRESSED:
res |= (0x01 << 1);
break;
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
res |= (0x03 << 1);
break;
default:
@@ -158,19 +158,19 @@ CtrlBAckRequestHeader::SetBarControl (uint16_t bar)
m_barAckPolicy = ((bar & 0x01) == 1) ? true : false;
if (((bar >> 1) & 0x0f) == 0x03)
{
m_baType = MULTI_TID_BLOCK_ACK;
m_baType.m_variant = BlockAckType::MULTI_TID;
}
else if (((bar >> 1) & 0x0f) == 0x01)
{
m_baType = EXTENDED_COMPRESSED_BLOCK_ACK;
m_baType.m_variant = BlockAckType::EXTENDED_COMPRESSED;
}
else if (((bar >> 1) & 0x0f) == 0x02)
{
m_baType = COMPRESSED_BLOCK_ACK;
m_baType.m_variant = BlockAckType::COMPRESSED;
}
else
{
m_baType = BASIC_BLOCK_ACK;
m_baType.m_variant = BlockAckType::BASIC;
}
m_tidInfo = (bar >> 12) & 0x0f;
}
@@ -239,25 +239,25 @@ CtrlBAckRequestHeader::GetStartingSequence (void) const
bool
CtrlBAckRequestHeader::IsBasic (void) const
{
return (m_baType == BASIC_BLOCK_ACK) ? true : false;
return (m_baType.m_variant == BlockAckType::BASIC) ? true : false;
}
bool
CtrlBAckRequestHeader::IsCompressed (void) const
{
return (m_baType == COMPRESSED_BLOCK_ACK) ? true : false;
return (m_baType.m_variant == BlockAckType::COMPRESSED) ? true : false;
}
bool
CtrlBAckRequestHeader::IsExtendedCompressed (void) const
{
return (m_baType == EXTENDED_COMPRESSED_BLOCK_ACK) ? true : false;
return (m_baType.m_variant == BlockAckType::EXTENDED_COMPRESSED) ? true : false;
}
bool
CtrlBAckRequestHeader::IsMultiTid (void) const
{
return (m_baType == MULTI_TID_BLOCK_ACK) ? true : false;
return (m_baType.m_variant == BlockAckType::MULTI_TID) ? true : false;
}
@@ -269,7 +269,7 @@ NS_OBJECT_ENSURE_REGISTERED (CtrlBAckResponseHeader);
CtrlBAckResponseHeader::CtrlBAckResponseHeader ()
: m_baAckPolicy (false),
m_baType (BASIC_BLOCK_ACK)
m_baType (BlockAckType::BASIC)
{
memset (&bitmap, 0, sizeof (bitmap));
}
@@ -306,18 +306,18 @@ CtrlBAckResponseHeader::GetSerializedSize (void) const
{
uint32_t size = 0;
size += 2; //Bar control
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case BlockAckType::BASIC:
size += (2 + 128);
break;
case COMPRESSED_BLOCK_ACK:
case BlockAckType::COMPRESSED:
size += (2 + 8);
break;
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::EXTENDED_COMPRESSED:
size += (2 + 32);
break;
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
size += (2 + 2 + 8) * (m_tidInfo + 1); //Multi-TID block ack
break;
default:
@@ -332,15 +332,15 @@ CtrlBAckResponseHeader::Serialize (Buffer::Iterator start) const
{
Buffer::Iterator i = start;
i.WriteHtolsbU16 (GetBaControl ());
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case COMPRESSED_BLOCK_ACK:
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::BASIC:
case BlockAckType::COMPRESSED:
case BlockAckType::EXTENDED_COMPRESSED:
i.WriteHtolsbU16 (GetStartingSequenceControl ());
i = SerializeBitmap (i);
break;
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
break;
default:
@@ -354,15 +354,15 @@ CtrlBAckResponseHeader::Deserialize (Buffer::Iterator start)
{
Buffer::Iterator i = start;
SetBaControl (i.ReadLsbtohU16 ());
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case COMPRESSED_BLOCK_ACK:
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::BASIC:
case BlockAckType::COMPRESSED:
case BlockAckType::EXTENDED_COMPRESSED:
SetStartingSequenceControl (i.ReadLsbtohU16 ());
i = DeserializeBitmap (i);
break;
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
break;
default:
@@ -424,25 +424,25 @@ CtrlBAckResponseHeader::GetStartingSequence (void) const
bool
CtrlBAckResponseHeader::IsBasic (void) const
{
return (m_baType == BASIC_BLOCK_ACK) ? true : false;
return (m_baType.m_variant == BlockAckType::BASIC) ? true : false;
}
bool
CtrlBAckResponseHeader::IsCompressed (void) const
{
return (m_baType == COMPRESSED_BLOCK_ACK) ? true : false;
return (m_baType.m_variant == BlockAckType::COMPRESSED) ? true : false;
}
bool
CtrlBAckResponseHeader::IsExtendedCompressed (void) const
{
return (m_baType == EXTENDED_COMPRESSED_BLOCK_ACK) ? true : false;
return (m_baType.m_variant == BlockAckType::EXTENDED_COMPRESSED) ? true : false;
}
bool
CtrlBAckResponseHeader::IsMultiTid (void) const
{
return (m_baType == MULTI_TID_BLOCK_ACK) ? true : false;
return (m_baType.m_variant == BlockAckType::MULTI_TID) ? true : false;
}
uint16_t
@@ -453,17 +453,17 @@ CtrlBAckResponseHeader::GetBaControl (void) const
{
res |= 0x1;
}
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case BlockAckType::BASIC:
break;
case COMPRESSED_BLOCK_ACK:
case BlockAckType::COMPRESSED:
res |= (0x02 << 1);
break;
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::EXTENDED_COMPRESSED:
res |= (0x01 << 1);
break;
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
res |= (0x03 << 1);
break;
default:
@@ -480,19 +480,19 @@ CtrlBAckResponseHeader::SetBaControl (uint16_t ba)
m_baAckPolicy = ((ba & 0x01) == 1) ? true : false;
if (((ba >> 1) & 0x0f) == 0x03)
{
m_baType = MULTI_TID_BLOCK_ACK;
m_baType.m_variant = BlockAckType::MULTI_TID;
}
else if (((ba >> 1) & 0x0f) == 0x01)
{
m_baType = EXTENDED_COMPRESSED_BLOCK_ACK;
m_baType.m_variant = BlockAckType::EXTENDED_COMPRESSED;
}
else if (((ba >> 1) & 0x0f) == 0x02)
{
m_baType = COMPRESSED_BLOCK_ACK;
m_baType.m_variant = BlockAckType::COMPRESSED;
}
else
{
m_baType = BASIC_BLOCK_ACK;
m_baType.m_variant = BlockAckType::BASIC;
}
m_tidInfo = (ba >> 12) & 0x0f;
}
@@ -513,24 +513,24 @@ Buffer::Iterator
CtrlBAckResponseHeader::SerializeBitmap (Buffer::Iterator start) const
{
Buffer::Iterator i = start;
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case BlockAckType::BASIC:
for (uint8_t j = 0; j < 64; j++)
{
i.WriteHtolsbU16 (bitmap.m_bitmap[j]);
}
break;
case COMPRESSED_BLOCK_ACK:
case BlockAckType::COMPRESSED:
i.WriteHtolsbU64 (bitmap.m_compressedBitmap);
break;
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::EXTENDED_COMPRESSED:
i.WriteHtolsbU64 (bitmap.m_extendedCompressedBitmap[0]);
i.WriteHtolsbU64 (bitmap.m_extendedCompressedBitmap[1]);
i.WriteHtolsbU64 (bitmap.m_extendedCompressedBitmap[2]);
i.WriteHtolsbU64 (bitmap.m_extendedCompressedBitmap[3]);
break;
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
break;
default:
@@ -544,24 +544,24 @@ Buffer::Iterator
CtrlBAckResponseHeader::DeserializeBitmap (Buffer::Iterator start)
{
Buffer::Iterator i = start;
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case BlockAckType::BASIC:
for (uint8_t j = 0; j < 64; j++)
{
bitmap.m_bitmap[j] = i.ReadLsbtohU16 ();
}
break;
case COMPRESSED_BLOCK_ACK:
case BlockAckType::COMPRESSED:
bitmap.m_compressedBitmap = i.ReadLsbtohU64 ();
break;
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::EXTENDED_COMPRESSED:
bitmap.m_extendedCompressedBitmap[0] = i.ReadLsbtohU64 ();
bitmap.m_extendedCompressedBitmap[1] = i.ReadLsbtohU64 ();
bitmap.m_extendedCompressedBitmap[2] = i.ReadLsbtohU64 ();
bitmap.m_extendedCompressedBitmap[3] = i.ReadLsbtohU64 ();
break;
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
break;
default:
@@ -578,27 +578,27 @@ CtrlBAckResponseHeader::SetReceivedPacket (uint16_t seq)
{
return;
}
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case BlockAckType::BASIC:
{
/* To set correctly basic block ack bitmap we need fragment number too.
So if it's not specified, we consider packet not fragmented. */
bitmap.m_bitmap[IndexInBitmap (seq)] |= 0x0001;
break;
}
case COMPRESSED_BLOCK_ACK:
case BlockAckType::COMPRESSED:
{
bitmap.m_compressedBitmap |= (uint64_t (0x0000000000000001) << IndexInBitmap (seq));
break;
}
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::EXTENDED_COMPRESSED:
{
uint16_t index = IndexInBitmap (seq);
bitmap.m_extendedCompressedBitmap[index/64] |= (uint64_t (0x0000000000000001) << index);
break;
}
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
{
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
break;
@@ -619,17 +619,17 @@ CtrlBAckResponseHeader::SetReceivedFragment (uint16_t seq, uint8_t frag)
{
return;
}
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case BlockAckType::BASIC:
bitmap.m_bitmap[IndexInBitmap (seq)] |= (0x0001 << frag);
break;
case COMPRESSED_BLOCK_ACK:
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::COMPRESSED:
case BlockAckType::EXTENDED_COMPRESSED:
/* We can ignore this...compressed block ack doesn't support
acknowledgment of single fragments */
break;
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
break;
default:
@@ -645,14 +645,14 @@ CtrlBAckResponseHeader::IsPacketReceived (uint16_t seq) const
{
return false;
}
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case BlockAckType::BASIC:
{
/*It's impossible to say if an entire packet was correctly received. */
return false;
}
case COMPRESSED_BLOCK_ACK:
case BlockAckType::COMPRESSED:
{
/* Although this could make no sense, if packet with sequence number
equal to <i>seq</i> was correctly received, also all of its fragments
@@ -660,13 +660,13 @@ CtrlBAckResponseHeader::IsPacketReceived (uint16_t seq) const
uint64_t mask = uint64_t (0x0000000000000001);
return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1) ? true : false;
}
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::EXTENDED_COMPRESSED:
{
uint64_t mask = uint64_t (0x0000000000000001);
uint16_t index = IndexInBitmap (seq);
return (((bitmap.m_extendedCompressedBitmap[index/64] >> index) & mask) == 1) ? true : false;
}
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
{
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
break;
@@ -688,13 +688,13 @@ CtrlBAckResponseHeader::IsFragmentReceived (uint16_t seq, uint8_t frag) const
{
return false;
}
switch (m_baType)
switch (m_baType.m_variant)
{
case BASIC_BLOCK_ACK:
case BlockAckType::BASIC:
{
return ((bitmap.m_bitmap[IndexInBitmap (seq)] & (0x0001 << frag)) != 0x0000) ? true : false;
}
case COMPRESSED_BLOCK_ACK:
case BlockAckType::COMPRESSED:
{
/* Although this could make no sense, if packet with sequence number
equal to <i>seq</i> was correctly received, also all of its fragments
@@ -702,13 +702,13 @@ CtrlBAckResponseHeader::IsFragmentReceived (uint16_t seq, uint8_t frag) const
uint64_t mask = uint64_t (0x0000000000000001);
return (((bitmap.m_compressedBitmap >> IndexInBitmap (seq)) & mask) == 1) ? true : false;
}
case EXTENDED_COMPRESSED_BLOCK_ACK:
case BlockAckType::EXTENDED_COMPRESSED:
{
uint64_t mask = uint64_t (0x0000000000000001);
uint16_t index = IndexInBitmap (seq);
return (((bitmap.m_extendedCompressedBitmap[index/64] >> index) & mask) == 1) ? true : false;
}
case MULTI_TID_BLOCK_ACK:
case BlockAckType::MULTI_TID:
{
NS_FATAL_ERROR ("Multi-tid block ack is not supported.");
break;
@@ -734,7 +734,7 @@ CtrlBAckResponseHeader::IndexInBitmap (uint16_t seq) const
{
index = 4096 - m_startingSeq + seq;
}
if (m_baType == EXTENDED_COMPRESSED_BLOCK_ACK)
if (m_baType.m_variant == BlockAckType::EXTENDED_COMPRESSED)
{
NS_ASSERT (index <= 255);
}
@@ -748,7 +748,7 @@ CtrlBAckResponseHeader::IndexInBitmap (uint16_t seq) const
bool
CtrlBAckResponseHeader::IsInBitmap (uint16_t seq) const
{
if (m_baType == EXTENDED_COMPRESSED_BLOCK_ACK)
if (m_baType.m_variant == BlockAckType::EXTENDED_COMPRESSED)
{
return (seq - m_startingSeq + 4096) % 4096 < 256;
}

View File

@@ -2171,11 +2171,11 @@ MacLow::SendBlockAckAfterAmpdu (uint8_t tid, Mac48Address originator, Time durat
immediate = (*it).second.first.IsImmediateBlockAck ();
if ((*it).second.first.GetBufferSize () > 64)
{
blockAck.SetType (EXTENDED_COMPRESSED_BLOCK_ACK);
blockAck.SetType (BlockAckType::EXTENDED_COMPRESSED);
}
else
{
blockAck.SetType (COMPRESSED_BLOCK_ACK);
blockAck.SetType (BlockAckType::COMPRESSED);
}
NS_LOG_DEBUG ("Got Implicit block Ack Req with seq " << seqNumber);
(*i).second.FillBlockAckBitmap (&blockAck);
@@ -2209,15 +2209,15 @@ MacLow::SendBlockAckAfterBlockAckRequest (const CtrlBAckRequestHeader reqHdr, Ma
immediate = (*it).second.first.IsImmediateBlockAck ();
if (reqHdr.IsBasic ())
{
blockAck.SetType (BASIC_BLOCK_ACK);
blockAck.SetType (BlockAckType::BASIC);
}
else if (reqHdr.IsCompressed ())
{
blockAck.SetType (COMPRESSED_BLOCK_ACK);
blockAck.SetType (BlockAckType::COMPRESSED);
}
else if (reqHdr.IsExtendedCompressed ())
{
blockAck.SetType (EXTENDED_COMPRESSED_BLOCK_ACK);
blockAck.SetType (BlockAckType::EXTENDED_COMPRESSED);
}
BlockAckCachesI i = m_bAckCaches.find (std::make_pair (originator, tid));
NS_ASSERT (i != m_bAckCaches.end ());

View File

@@ -95,7 +95,7 @@ QosTxop::GetTypeId (void)
QosTxop::QosTxop ()
: m_typeOfStation (STA),
m_blockAckType (COMPRESSED_BLOCK_ACK),
m_blockAckType (BlockAckType::COMPRESSED),
m_startTxop (Seconds (0)),
m_txopDuration (Seconds (0)),
m_isAccessRequestedForRts (false),
@@ -634,12 +634,12 @@ QosTxop::GetTransmissionParameters (Ptr<const WifiMacQueueItem> frame) const
else if (frame->GetHeader ().IsBlockAckReq ())
{
// assume a BlockAck variant. Later, if this frame is not aggregated,
// the acknowledgment type will be switched to normal Ack
if (m_blockAckType == BASIC_BLOCK_ACK)
// the acknowledgment type will be switched to Normal Ack
if (m_blockAckType.m_variant == BlockAckType::BASIC)
{
params.EnableBlockAck (BlockAckType::BASIC_BLOCK_ACK);
params.EnableBlockAck (BlockAckType::BASIC);
}
else if (m_blockAckType == COMPRESSED_BLOCK_ACK)
else if (m_blockAckType.m_variant == BlockAckType::COMPRESSED)
{
CtrlBAckRequestHeader baReqHdr;
frame->GetPacket ()->PeekHeader (baReqHdr);
@@ -647,14 +647,14 @@ QosTxop::GetTransmissionParameters (Ptr<const WifiMacQueueItem> frame) const
if (GetBaBufferSize (recipient, tid) > 64)
{
params.EnableBlockAck (BlockAckType::EXTENDED_COMPRESSED_BLOCK_ACK);
params.EnableBlockAck (BlockAckType::EXTENDED_COMPRESSED);
}
else
{
params.EnableBlockAck (BlockAckType::COMPRESSED_BLOCK_ACK);
params.EnableBlockAck (BlockAckType::COMPRESSED);
}
}
else if (m_blockAckType == MULTI_TID_BLOCK_ACK)
else if (m_blockAckType.m_variant == BlockAckType::MULTI_TID)
{
NS_FATAL_ERROR ("Multi-tid block ack is not supported");
}
@@ -775,7 +775,7 @@ QosTxop::NotifyAccessGranted (void)
//With COMPRESSED_BLOCK_ACK fragmentation must be avoided.
else if (((m_currentHdr.IsQosData () && !m_currentHdr.IsQosAmsdu ())
|| (m_currentHdr.IsData () && !m_currentHdr.IsQosData ()))
&& (GetBlockAckThreshold () == 0 || m_blockAckType == BASIC_BLOCK_ACK)
&& (GetBlockAckThreshold () == 0 || m_blockAckType.m_variant == BlockAckType::BASIC)
&& NeedFragmentation ())
{
m_currentIsFragmented = true;

View File

@@ -569,7 +569,7 @@ CtrlBAckResponseHeaderTest::CtrlBAckResponseHeaderTest ()
void
CtrlBAckResponseHeaderTest::DoRun (void)
{
m_blockAckHdr.SetType (COMPRESSED_BLOCK_ACK);
m_blockAckHdr.SetType (BlockAckType::COMPRESSED);
//Case 1: startSeq < endSeq
// 179 242