wifi: Add link ID parameter to more WifiMac methods

This commit is contained in:
Stefano Avallone
2022-08-05 17:08:26 +02:00
committed by Stefano Avallone
parent bce5044a62
commit 72d5720f60
6 changed files with 73 additions and 67 deletions

View File

@@ -171,11 +171,11 @@ OcbWifiMac::Enqueue (Ptr<Packet> packet, Mac48Address to)
if (GetHtSupported () || GetVhtSupported ())
{
GetWifiRemoteStationManager ()->AddAllSupportedMcs (to);
GetWifiRemoteStationManager ()->AddStationHtCapabilities (to, GetHtCapabilities());
GetWifiRemoteStationManager ()->AddStationHtCapabilities (to, GetHtCapabilities(SINGLE_LINK_OP_ID));
}
if (GetVhtSupported ())
{
GetWifiRemoteStationManager ()->AddStationVhtCapabilities (to, GetVhtCapabilities());
GetWifiRemoteStationManager ()->AddStationVhtCapabilities (to, GetVhtCapabilities(SINGLE_LINK_OP_ID));
}
GetWifiRemoteStationManager ()->AddAllSupportedModes (to);
GetWifiRemoteStationManager ()->RecordDisassociated (to);
@@ -263,11 +263,11 @@ OcbWifiMac::Receive (Ptr<WifiMpdu> mpdu, uint8_t linkId)
if (GetHtSupported () || GetVhtSupported ())
{
GetWifiRemoteStationManager ()->AddAllSupportedMcs (from);
GetWifiRemoteStationManager ()->AddStationHtCapabilities (from, GetHtCapabilities());
GetWifiRemoteStationManager ()->AddStationHtCapabilities (from, GetHtCapabilities(SINGLE_LINK_OP_ID));
}
if (GetVhtSupported ())
{
GetWifiRemoteStationManager ()->AddStationVhtCapabilities (from, GetVhtCapabilities());
GetWifiRemoteStationManager ()->AddStationVhtCapabilities (from, GetVhtCapabilities(SINGLE_LINK_OP_ID));
}
GetWifiRemoteStationManager ()->AddAllSupportedModes (from);
GetWifiRemoteStationManager ()->RecordDisassociated (from);

View File

@@ -74,19 +74,19 @@ AdhocWifiMac::Enqueue (Ptr<Packet> packet, Mac48Address to)
if (GetHtSupported ())
{
GetWifiRemoteStationManager ()->AddAllSupportedMcs (to);
GetWifiRemoteStationManager ()->AddStationHtCapabilities (to, GetHtCapabilities ());
GetWifiRemoteStationManager ()->AddStationHtCapabilities (to, GetHtCapabilities (SINGLE_LINK_OP_ID));
}
if (GetVhtSupported ())
{
GetWifiRemoteStationManager ()->AddStationVhtCapabilities (to, GetVhtCapabilities ());
GetWifiRemoteStationManager ()->AddStationVhtCapabilities (to, GetVhtCapabilities (SINGLE_LINK_OP_ID));
}
if (GetHeSupported ())
{
GetWifiRemoteStationManager ()->AddStationHeCapabilities (to, GetHeCapabilities ());
GetWifiRemoteStationManager ()->AddStationHeCapabilities (to, GetHeCapabilities (SINGLE_LINK_OP_ID));
}
if (GetEhtSupported ())
{
GetWifiRemoteStationManager ()->AddStationEhtCapabilities (to, GetEhtCapabilities ());
GetWifiRemoteStationManager ()->AddStationEhtCapabilities (to, GetEhtCapabilities (SINGLE_LINK_OP_ID));
}
GetWifiRemoteStationManager ()->AddAllSupportedModes (to);
GetWifiRemoteStationManager ()->RecordDisassociated (to);
@@ -178,19 +178,19 @@ AdhocWifiMac::Receive (Ptr<WifiMpdu> mpdu, uint8_t linkId)
if (GetHtSupported ())
{
GetWifiRemoteStationManager ()->AddAllSupportedMcs (from);
GetWifiRemoteStationManager ()->AddStationHtCapabilities (from, GetHtCapabilities ());
GetWifiRemoteStationManager ()->AddStationHtCapabilities (from, GetHtCapabilities (SINGLE_LINK_OP_ID));
}
if (GetVhtSupported ())
{
GetWifiRemoteStationManager ()->AddStationVhtCapabilities (from, GetVhtCapabilities ());
GetWifiRemoteStationManager ()->AddStationVhtCapabilities (from, GetVhtCapabilities (SINGLE_LINK_OP_ID));
}
if (GetHeSupported ())
{
GetWifiRemoteStationManager ()->AddStationHeCapabilities (from, GetHeCapabilities ());
GetWifiRemoteStationManager ()->AddStationHeCapabilities (from, GetHeCapabilities (SINGLE_LINK_OP_ID));
}
if (GetEhtSupported ())
{
GetWifiRemoteStationManager ()->AddStationEhtCapabilities (from, GetEhtCapabilities ());
GetWifiRemoteStationManager ()->AddStationEhtCapabilities (from, GetEhtCapabilities (SINGLE_LINK_OP_ID));
}
GetWifiRemoteStationManager ()->AddAllSupportedModes (from);
GetWifiRemoteStationManager ()->RecordDisassociated (from);

View File

@@ -868,17 +868,17 @@ ApWifiMac::SendProbeResp (Mac48Address to, uint8_t linkId)
if (GetHtSupported ())
{
probe.SetExtendedCapabilities (GetExtendedCapabilities ());
probe.SetHtCapabilities (GetHtCapabilities ());
probe.SetHtCapabilities (GetHtCapabilities (linkId));
probe.SetHtOperation (GetHtOperation (linkId));
}
if (GetVhtSupported ())
{
probe.SetVhtCapabilities (GetVhtCapabilities ());
probe.SetVhtCapabilities (GetVhtCapabilities (linkId));
probe.SetVhtOperation (GetVhtOperation (linkId));
}
if (GetHeSupported ())
{
probe.SetHeCapabilities (GetHeCapabilities ());
probe.SetHeCapabilities (GetHeCapabilities (linkId));
probe.SetHeOperation (GetHeOperation (linkId));
if (auto muEdcaParameterSet = GetMuEdcaParameterSet (); muEdcaParameterSet.has_value ())
{
@@ -887,7 +887,7 @@ ApWifiMac::SendProbeResp (Mac48Address to, uint8_t linkId)
}
if (GetEhtSupported ())
{
probe.SetEhtCapabilities (GetEhtCapabilities ());
probe.SetEhtCapabilities (GetEhtCapabilities (linkId));
if (GetNLinks () > 1)
{
@@ -967,17 +967,17 @@ ApWifiMac::GetAssocResp (Mac48Address to, uint8_t linkId)
if (GetHtSupported ())
{
assoc.SetExtendedCapabilities (GetExtendedCapabilities ());
assoc.SetHtCapabilities (GetHtCapabilities ());
assoc.SetHtCapabilities (GetHtCapabilities (linkId));
assoc.SetHtOperation (GetHtOperation (linkId));
}
if (GetVhtSupported ())
{
assoc.SetVhtCapabilities (GetVhtCapabilities ());
assoc.SetVhtCapabilities (GetVhtCapabilities (linkId));
assoc.SetVhtOperation (GetVhtOperation (linkId));
}
if (GetHeSupported ())
{
assoc.SetHeCapabilities (GetHeCapabilities ());
assoc.SetHeCapabilities (GetHeCapabilities (linkId));
assoc.SetHeOperation (GetHeOperation (linkId));
if (auto muEdcaParameterSet = GetMuEdcaParameterSet (); muEdcaParameterSet.has_value ())
{
@@ -986,7 +986,7 @@ ApWifiMac::GetAssocResp (Mac48Address to, uint8_t linkId)
}
if (GetEhtSupported ())
{
assoc.SetEhtCapabilities (GetEhtCapabilities ());
assoc.SetEhtCapabilities (GetEhtCapabilities (linkId));
}
return assoc;
}
@@ -1231,17 +1231,17 @@ ApWifiMac::SendOneBeacon (uint8_t linkId)
if (GetHtSupported ())
{
beacon.SetExtendedCapabilities (GetExtendedCapabilities ());
beacon.SetHtCapabilities (GetHtCapabilities ());
beacon.SetHtCapabilities (GetHtCapabilities (linkId));
beacon.SetHtOperation (GetHtOperation (linkId));
}
if (GetVhtSupported ())
{
beacon.SetVhtCapabilities (GetVhtCapabilities ());
beacon.SetVhtCapabilities (GetVhtCapabilities (linkId));
beacon.SetVhtOperation (GetVhtOperation (linkId));
}
if (GetHeSupported ())
{
beacon.SetHeCapabilities (GetHeCapabilities ());
beacon.SetHeCapabilities (GetHeCapabilities (linkId));
beacon.SetHeOperation (GetHeOperation (linkId));
if (auto muEdcaParameterSet = GetMuEdcaParameterSet (); muEdcaParameterSet.has_value ())
{
@@ -1250,7 +1250,7 @@ ApWifiMac::SendOneBeacon (uint8_t linkId)
}
if (GetEhtSupported ())
{
beacon.SetEhtCapabilities (GetEhtCapabilities ());
beacon.SetEhtCapabilities (GetEhtCapabilities (linkId));
if (GetNLinks () > 1)
{

View File

@@ -232,19 +232,19 @@ StaWifiMac::SendProbeRequest (void)
if (GetHtSupported ())
{
probe.SetExtendedCapabilities (GetExtendedCapabilities ());
probe.SetHtCapabilities (GetHtCapabilities ());
probe.SetHtCapabilities (GetHtCapabilities (SINGLE_LINK_OP_ID));
}
if (GetVhtSupported ())
{
probe.SetVhtCapabilities (GetVhtCapabilities ());
probe.SetVhtCapabilities (GetVhtCapabilities (SINGLE_LINK_OP_ID));
}
if (GetHeSupported ())
{
probe.SetHeCapabilities (GetHeCapabilities ());
probe.SetHeCapabilities (GetHeCapabilities (SINGLE_LINK_OP_ID));
}
if (GetEhtSupported ())
{
probe.SetEhtCapabilities (GetEhtCapabilities ());
probe.SetEhtCapabilities (GetEhtCapabilities (SINGLE_LINK_OP_ID));
}
packet->AddHeader (probe);
@@ -294,19 +294,19 @@ StaWifiMac::GetAssociationRequest (bool isReassoc, uint8_t linkId) const
if (GetHtSupported ())
{
frame.SetExtendedCapabilities (GetExtendedCapabilities ());
frame.SetHtCapabilities (GetHtCapabilities ());
frame.SetHtCapabilities (GetHtCapabilities (linkId));
}
if (GetVhtSupported ())
{
frame.SetVhtCapabilities (GetVhtCapabilities ());
frame.SetVhtCapabilities (GetVhtCapabilities (linkId));
}
if (GetHeSupported ())
{
frame.SetHeCapabilities (GetHeCapabilities ());
frame.SetHeCapabilities (GetHeCapabilities (linkId));
}
if (GetEhtSupported ())
{
frame.SetEhtCapabilities (GetEhtCapabilities ());
frame.SetEhtCapabilities (GetEhtCapabilities (linkId));
}
};

View File

@@ -1329,21 +1329,22 @@ WifiMac::GetExtendedCapabilities (void) const
}
HtCapabilities
WifiMac::GetHtCapabilities (void) const
WifiMac::GetHtCapabilities (uint8_t linkId) const
{
NS_LOG_FUNCTION (this);
NS_LOG_FUNCTION (this << +linkId);
NS_ASSERT (GetHtSupported ());
HtCapabilities capabilities;
auto phy = GetWifiPhy (linkId);
Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
bool sgiSupported = htConfiguration->GetShortGuardIntervalSupported ();
capabilities.SetLdpc (htConfiguration->GetLdpcSupported ());
capabilities.SetSupportedChannelWidth (htConfiguration->Get40MHzOperationSupported () ? 1 : 0);
capabilities.SetShortGuardInterval20 (sgiSupported);
capabilities.SetShortGuardInterval40 (GetWifiPhy ()->GetChannelWidth () >= 40 && sgiSupported);
capabilities.SetShortGuardInterval40 (phy->GetChannelWidth () >= 40 && sgiSupported);
// Set Maximum A-MSDU Length subfield
uint16_t maxAmsduSize = std::max ({m_voMaxAmsduSize, m_viMaxAmsduSize,
m_beMaxAmsduSize, m_bkMaxAmsduSize});
m_beMaxAmsduSize, m_bkMaxAmsduSize});
if (maxAmsduSize <= 3839)
{
capabilities.SetMaxAmsduLength (3839);
@@ -1353,7 +1354,7 @@ WifiMac::GetHtCapabilities (void) const
capabilities.SetMaxAmsduLength (7935);
}
uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
m_beMaxAmpduSize, m_bkMaxAmpduSize});
m_beMaxAmpduSize, m_bkMaxAmpduSize});
// round to the next power of two minus one
maxAmpduLength = (1ul << static_cast<uint32_t> (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
// The maximum A-MPDU length in HT capabilities elements ranges from 2^13-1 to 2^16-1
@@ -1361,12 +1362,12 @@ WifiMac::GetHtCapabilities (void) const
capabilities.SetLSigProtectionSupport (true);
uint64_t maxSupportedRate = 0; //in bit/s
for (const auto & mcs : GetWifiPhy ()->GetMcsList (WIFI_MOD_CLASS_HT))
for (const auto & mcs : phy->GetMcsList (WIFI_MOD_CLASS_HT))
{
capabilities.SetRxMcsBitmask (mcs.GetMcsValue ());
uint8_t nss = (mcs.GetMcsValue () / 8) + 1;
NS_ASSERT (nss > 0 && nss < 5);
uint64_t dataRate = mcs.GetDataRate (GetWifiPhy ()->GetChannelWidth (), sgiSupported ? 400 : 800, nss);
uint64_t dataRate = mcs.GetDataRate (phy->GetChannelWidth (), sgiSupported ? 400 : 800, nss);
if (dataRate > maxSupportedRate)
{
maxSupportedRate = dataRate;
@@ -1374,8 +1375,8 @@ WifiMac::GetHtCapabilities (void) const
}
}
capabilities.SetRxHighestSupportedDataRate (static_cast<uint16_t> (maxSupportedRate / 1e6)); //in Mbit/s
capabilities.SetTxMcsSetDefined (GetWifiPhy ()->GetNMcs () > 0);
capabilities.SetTxMaxNSpatialStreams (GetWifiPhy ()->GetMaxSupportedTxSpatialStreams ());
capabilities.SetTxMcsSetDefined (phy->GetNMcs () > 0);
capabilities.SetTxMaxNSpatialStreams (phy->GetMaxSupportedTxSpatialStreams ());
//we do not support unequal modulations
capabilities.SetTxRxMcsSetUnequal (0);
capabilities.SetTxUnequalModulation (0);
@@ -1384,12 +1385,13 @@ WifiMac::GetHtCapabilities (void) const
}
VhtCapabilities
WifiMac::GetVhtCapabilities (void) const
WifiMac::GetVhtCapabilities (uint8_t linkId) const
{
NS_LOG_FUNCTION (this);
NS_LOG_FUNCTION (this << +linkId);
NS_ASSERT (GetVhtSupported ());
VhtCapabilities capabilities;
auto phy = GetWifiPhy (linkId);
Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
NS_ABORT_MSG_IF (!htConfiguration->Get40MHzOperationSupported (),
"VHT stations have to support 40 MHz operation");
@@ -1398,7 +1400,7 @@ WifiMac::GetVhtCapabilities (void) const
capabilities.SetSupportedChannelWidthSet (vhtConfiguration->Get160MHzOperationSupported () ? 1 : 0);
// Set Maximum MPDU Length subfield
uint16_t maxAmsduSize = std::max ({m_voMaxAmsduSize, m_viMaxAmsduSize,
m_beMaxAmsduSize, m_bkMaxAmsduSize});
m_beMaxAmsduSize, m_bkMaxAmsduSize});
if (maxAmsduSize <= 3839)
{
capabilities.SetMaxMpduLength (3895);
@@ -1412,17 +1414,17 @@ WifiMac::GetVhtCapabilities (void) const
capabilities.SetMaxMpduLength (11454);
}
uint32_t maxAmpduLength = std::max ({m_voMaxAmpduSize, m_viMaxAmpduSize,
m_beMaxAmpduSize, m_bkMaxAmpduSize});
m_beMaxAmpduSize, m_bkMaxAmpduSize});
// round to the next power of two minus one
maxAmpduLength = (1ul << static_cast<uint32_t> (std::ceil (std::log2 (maxAmpduLength + 1)))) - 1;
// The maximum A-MPDU length in VHT capabilities elements ranges from 2^13-1 to 2^20-1
capabilities.SetMaxAmpduLength (std::min (std::max (maxAmpduLength, 8191u), 1048575u));
capabilities.SetRxLdpc (htConfiguration->GetLdpcSupported ());
capabilities.SetShortGuardIntervalFor80Mhz ((GetWifiPhy ()->GetChannelWidth () == 80) && sgiSupported);
capabilities.SetShortGuardIntervalFor160Mhz ((GetWifiPhy ()->GetChannelWidth () == 160) && sgiSupported);
capabilities.SetShortGuardIntervalFor80Mhz ((phy->GetChannelWidth () == 80) && sgiSupported);
capabilities.SetShortGuardIntervalFor160Mhz ((phy->GetChannelWidth () == 160) && sgiSupported);
uint8_t maxMcs = 0;
for (const auto & mcs : GetWifiPhy ()->GetMcsList (WIFI_MOD_CLASS_VHT))
for (const auto & mcs : phy->GetMcsList (WIFI_MOD_CLASS_VHT))
{
if (mcs.GetMcsValue () > maxMcs)
{
@@ -1430,24 +1432,24 @@ WifiMac::GetVhtCapabilities (void) const
}
}
// Support same MaxMCS for each spatial stream
for (uint8_t nss = 1; nss <= GetWifiPhy ()->GetMaxSupportedRxSpatialStreams (); nss++)
for (uint8_t nss = 1; nss <= phy->GetMaxSupportedRxSpatialStreams (); nss++)
{
capabilities.SetRxMcsMap (maxMcs, nss);
}
for (uint8_t nss = 1; nss <= GetWifiPhy ()->GetMaxSupportedTxSpatialStreams (); nss++)
for (uint8_t nss = 1; nss <= phy->GetMaxSupportedTxSpatialStreams (); nss++)
{
capabilities.SetTxMcsMap (maxMcs, nss);
}
uint64_t maxSupportedRateLGI = 0; //in bit/s
for (const auto & mcs : GetWifiPhy ()->GetMcsList (WIFI_MOD_CLASS_VHT))
for (const auto & mcs : phy->GetMcsList (WIFI_MOD_CLASS_VHT))
{
if (!mcs.IsAllowed (GetWifiPhy ()->GetChannelWidth (), 1))
if (!mcs.IsAllowed (phy->GetChannelWidth (), 1))
{
continue;
}
if (mcs.GetDataRate (GetWifiPhy ()->GetChannelWidth ()) > maxSupportedRateLGI)
if (mcs.GetDataRate (phy->GetChannelWidth ()) > maxSupportedRateLGI)
{
maxSupportedRateLGI = mcs.GetDataRate (GetWifiPhy ()->GetChannelWidth ());
maxSupportedRateLGI = mcs.GetDataRate (phy->GetChannelWidth ());
NS_LOG_DEBUG ("Updating maxSupportedRateLGI to " << maxSupportedRateLGI);
}
}
@@ -1461,13 +1463,13 @@ WifiMac::GetVhtCapabilities (void) const
}
HeCapabilities
WifiMac::GetHeCapabilities (void) const
WifiMac::GetHeCapabilities (uint8_t linkId) const
{
NS_LOG_FUNCTION (this);
NS_LOG_FUNCTION (this << +linkId);
NS_ASSERT (GetHeSupported ());
HeCapabilities capabilities;
Ptr<WifiPhy> phy = GetLink (SINGLE_LINK_OP_ID).phy;
Ptr<WifiPhy> phy = GetLink (linkId).phy;
Ptr<HtConfiguration> htConfiguration = GetHtConfiguration ();
Ptr<HeConfiguration> heConfiguration = GetHeConfiguration ();
uint8_t channelWidthSet = 0;
@@ -1515,9 +1517,9 @@ WifiMac::GetHeCapabilities (void) const
}
EhtCapabilities
WifiMac::GetEhtCapabilities (void) const
WifiMac::GetEhtCapabilities (uint8_t linkId) const
{
NS_LOG_FUNCTION (this);
NS_LOG_FUNCTION (this << +linkId);
NS_ASSERT (GetEhtSupported ());
EhtCapabilities capabilities;
// TODO: fill in EHT capabilities

View File

@@ -416,29 +416,33 @@ public:
*/
ExtendedCapabilities GetExtendedCapabilities (void) const;
/**
* Return the HT capabilities of the device.
* Return the HT capabilities of the device for the given link.
*
* \param linkId the ID of the given link
* \return the HT capabilities that we support
*/
HtCapabilities GetHtCapabilities (void) const;
HtCapabilities GetHtCapabilities (uint8_t linkId) const;
/**
* Return the VHT capabilities of the device.
* Return the VHT capabilities of the device for the given link.
*
* \param linkId the ID of the given link
* \return the VHT capabilities that we support
*/
VhtCapabilities GetVhtCapabilities (void) const;
VhtCapabilities GetVhtCapabilities (uint8_t linkId) const;
/**
* Return the HE capabilities of the device.
* Return the HE capabilities of the device for the given link.
*
* \param linkId the ID of the given link
* \return the HE capabilities that we support
*/
HeCapabilities GetHeCapabilities (void) const;
HeCapabilities GetHeCapabilities (uint8_t linkId) const;
/**
* Return the EHT capabilities of the device.
* Return the EHT capabilities of the device for the given link.
*
* \param linkId the ID of the given link
* \return the EHT capabilities that we support
*/
EhtCapabilities GetEhtCapabilities (void) const;
EhtCapabilities GetEhtCapabilities (uint8_t linkId) const;
/**
* Return whether the device supports QoS.