wifi: ChannelAccessManager and FrameExchangeManager are configured with their link ID

This commit is contained in:
Stefano Avallone
2022-02-23 14:45:58 +01:00
committed by Stefano Avallone
parent 9e7796616a
commit f05df09246
9 changed files with 41 additions and 6 deletions

View File

@@ -26,6 +26,9 @@
#include "wifi-phy.h"
#include "frame-exchange-manager.h"
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "] "
namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("ChannelAccessManager");
@@ -109,7 +112,8 @@ ChannelAccessManager::ChannelAccessManager ()
m_lastSwitchingEnd (MicroSeconds (0)),
m_sleeping (false),
m_off (false),
m_phyListener (0)
m_phyListener (0),
m_linkId (0)
{
NS_LOG_FUNCTION (this);
InitLastBusyStructs ();
@@ -159,6 +163,13 @@ ChannelAccessManager::RemovePhyListener (Ptr<WifiPhy> phy)
}
}
void
ChannelAccessManager::SetLinkId (uint8_t linkId)
{
NS_LOG_FUNCTION (this << +linkId);
m_linkId = linkId;
}
void
ChannelAccessManager::SetupFrameExchangeManager (Ptr<FrameExchangeManager> feManager)
{

View File

@@ -68,6 +68,12 @@ public:
* \param phy the WifiPhy to listen to
*/
void RemovePhyListener (Ptr<WifiPhy> phy);
/**
* Set the ID of the link this Channel Access Manager is associated with.
*
* \param linkId the ID of the link this Channel Access Manager is associated with
*/
void SetLinkId (uint8_t linkId);
/**
* Set up the Frame Exchange Manager.
*
@@ -352,6 +358,7 @@ private:
PhyListener* m_phyListener; //!< the PHY listener
Ptr<WifiPhy> m_phy; //!< pointer to the PHY
Ptr<FrameExchangeManager> m_feManager; //!< pointer to the Frame Exchange Manager
uint8_t m_linkId; //!< the ID of the link this object is associated with
};
} //namespace ns3

View File

@@ -27,7 +27,7 @@
#include "wifi-mac-trailer.h"
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] "
#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] "
// Time (in nanoseconds) to be added to the PSDU duration to yield the duration
// of the timer that is started when the PHY indicates the start of the reception
@@ -53,6 +53,7 @@ FrameExchangeManager::GetTypeId (void)
FrameExchangeManager::FrameExchangeManager ()
: m_navEnd (Seconds (0)),
m_linkId (0),
m_promisc (false),
m_moreFragments (false)
{
@@ -126,6 +127,13 @@ FrameExchangeManager::GetAckManager (void) const
return m_ackManager;
}
void
FrameExchangeManager::SetLinkId (uint8_t linkId)
{
NS_LOG_FUNCTION (this << +linkId);
m_linkId = linkId;
}
void
FrameExchangeManager::SetWifiMac (Ptr<WifiMac> mac)
{

View File

@@ -91,6 +91,12 @@ public:
void Receive (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo,
WifiTxVector txVector, std::vector<bool> perMpduStatus);
/**
* Set the ID of the link this Frame Exchange Manager is associated with.
*
* \param linkId the ID of the link this Frame Exchange Manager is associated with
*/
void SetLinkId (uint8_t linkId);
/**
* Set the MAC layer to use.
*
@@ -398,6 +404,7 @@ protected:
Mac48Address m_self; //!< the MAC address of this device
Mac48Address m_bssid; //!< BSSID address (Mac48Address)
Time m_navEnd; //!< NAV expiration time
uint8_t m_linkId; //!< the ID of the link this object is associated with
bool m_promisc; //!< Flag if the device is operating in promiscuous mode
DroppedMpdu m_droppedMpduCallback; //!< the dropped MPDU callback
AckedMpdu m_ackedMpduCallback; //!< the acknowledged MPDU callback

View File

@@ -32,7 +32,7 @@
#include <functional>
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] "
#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] "
namespace ns3 {

View File

@@ -31,7 +31,7 @@
#include <optional>
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] "
#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] "
namespace ns3 {

View File

@@ -26,7 +26,7 @@
#include "ap-wifi-mac.h"
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] "
#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] "
namespace ns3 {

View File

@@ -23,7 +23,7 @@
#include "vht-frame-exchange-manager.h"
#undef NS_LOG_APPEND_CONTEXT
#define NS_LOG_APPEND_CONTEXT std::clog << "[mac=" << m_self << "] "
#define NS_LOG_APPEND_CONTEXT std::clog << "[link=" << +m_linkId << "][mac=" << m_self << "] "
namespace ns3 {

View File

@@ -678,6 +678,8 @@ WifiMac::ConfigureStandard (WifiStandard standard)
}
link->feManager->SetWifiPhy (link->phy);
link->feManager->SetWifiMac (this);
link->feManager->SetLinkId (link->id);
link->channelAccessManager->SetLinkId (link->id);
link->channelAccessManager->SetupFrameExchangeManager (link->feManager);
if (m_txop != nullptr)