wifi: QosTxop skips frames that cannot be forwarded to the destination
This commit is contained in:
@@ -89,6 +89,11 @@ MeshWifiInterfaceMac::~MeshWifiInterfaceMac ()
|
||||
//-----------------------------------------------------------------------------
|
||||
// WifiMac inherited
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
MeshWifiInterfaceMac::CanForwardPacketsTo (Mac48Address to) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
void
|
||||
MeshWifiInterfaceMac::Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from)
|
||||
{
|
||||
|
||||
@@ -65,6 +65,7 @@ public:
|
||||
virtual void Enqueue (Ptr<Packet> packet, Mac48Address to);
|
||||
virtual bool SupportsSendFrom () const;
|
||||
virtual void SetLinkUpCallback (Callback<void> linkUp);
|
||||
virtual bool CanForwardPacketsTo (Mac48Address to) const;
|
||||
|
||||
/// \name Each mesh point interface must know the mesh point address
|
||||
///@{
|
||||
|
||||
@@ -156,6 +156,12 @@ OcbWifiMac::SetLinkDownCallback (Callback<void> linkDown)
|
||||
NS_LOG_WARN ("in OCB mode the like will never down, so linkDown will never be called");
|
||||
}
|
||||
|
||||
bool
|
||||
OcbWifiMac::CanForwardPacketsTo (Mac48Address to) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
OcbWifiMac::Enqueue (Ptr<Packet> packet, Mac48Address to)
|
||||
{
|
||||
|
||||
@@ -126,6 +126,7 @@ public:
|
||||
* access is granted to this MAC.
|
||||
*/
|
||||
virtual void Enqueue (Ptr<Packet> packet, Mac48Address to);
|
||||
virtual bool CanForwardPacketsTo (Mac48Address to) const;
|
||||
/**
|
||||
* \param cwmin the min contention window
|
||||
* \param cwmax the max contention window
|
||||
|
||||
@@ -70,6 +70,12 @@ AdhocWifiMac::SetAddress (Mac48Address address)
|
||||
RegularWifiMac::SetBssid (address);
|
||||
}
|
||||
|
||||
bool
|
||||
AdhocWifiMac::CanForwardPacketsTo (Mac48Address to) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
AdhocWifiMac::Enqueue (Ptr<Packet> packet, Mac48Address to)
|
||||
{
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
void SetAddress (Mac48Address address) override;
|
||||
void SetLinkUpCallback (Callback<void> linkUp) override;
|
||||
void Enqueue (Ptr<Packet> packet, Mac48Address to) override;
|
||||
bool CanForwardPacketsTo (Mac48Address to) const override;
|
||||
|
||||
private:
|
||||
void Receive (Ptr<WifiMacQueueItem> mpdu) override;
|
||||
|
||||
@@ -348,11 +348,17 @@ ApWifiMac::ForwardDown (Ptr<Packet> packet, Mac48Address from,
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ApWifiMac::CanForwardPacketsTo (Mac48Address to) const
|
||||
{
|
||||
return (to.IsGroup () || m_stationManager->IsAssociated (to));
|
||||
}
|
||||
|
||||
void
|
||||
ApWifiMac::Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << to << from);
|
||||
if (to.IsGroup () || m_stationManager->IsAssociated (to))
|
||||
if (CanForwardPacketsTo (to))
|
||||
{
|
||||
ForwardDown (packet, from, to);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
virtual ~ApWifiMac ();
|
||||
|
||||
void SetLinkUpCallback (Callback<void> linkUp) override;
|
||||
bool CanForwardPacketsTo (Mac48Address to) const override;
|
||||
void Enqueue (Ptr<Packet> packet, Mac48Address to) override;
|
||||
void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from) override;
|
||||
bool SupportsSendFrom (void) const override;
|
||||
|
||||
@@ -394,6 +394,12 @@ QosTxop::PeekNextMpdu (uint8_t tid, Mac48Address recipient, Ptr<const WifiMacQue
|
||||
NS_LOG_DEBUG ("Skipping in flight MPDU: " << *item);
|
||||
item = peek ();
|
||||
}
|
||||
else if (item->GetHeader ().HasData ()
|
||||
&& !m_mac->CanForwardPacketsTo (item->GetHeader ().GetAddr1 ()))
|
||||
{
|
||||
NS_LOG_DEBUG ("Skipping frame that cannot be forwarded: " << *item);
|
||||
item = peek ();
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
|
||||
@@ -454,11 +454,17 @@ StaWifiMac::IsWaitAssocResp (void) const
|
||||
return m_state == WAIT_ASSOC_RESP;
|
||||
}
|
||||
|
||||
bool
|
||||
StaWifiMac::CanForwardPacketsTo (Mac48Address to) const
|
||||
{
|
||||
return (IsAssociated ());
|
||||
}
|
||||
|
||||
void
|
||||
StaWifiMac::Enqueue (Ptr<Packet> packet, Mac48Address to)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << packet << to);
|
||||
if (!IsAssociated ())
|
||||
if (!CanForwardPacketsTo (to))
|
||||
{
|
||||
NotifyTxDrop (packet);
|
||||
TryToEnsureAssociated ();
|
||||
|
||||
@@ -130,6 +130,7 @@ public:
|
||||
* access is granted to this MAC.
|
||||
*/
|
||||
void Enqueue (Ptr<Packet> packet, Mac48Address to) override;
|
||||
bool CanForwardPacketsTo (Mac48Address to) const override;
|
||||
|
||||
/**
|
||||
* \param phy the physical layer attached to this MAC.
|
||||
|
||||
@@ -148,6 +148,14 @@ public:
|
||||
*/
|
||||
virtual bool GetShortSlotTimeSupported (void) const = 0;
|
||||
|
||||
/**
|
||||
* Return true if packets can be forwarded to the given destination,
|
||||
* false otherwise.
|
||||
*
|
||||
* \param to the address to which the packet should be sent
|
||||
* \return whether packets can be forwarded to the given destination
|
||||
*/
|
||||
virtual bool CanForwardPacketsTo (Mac48Address to) const = 0;
|
||||
/**
|
||||
* \param packet the packet to send.
|
||||
* \param to the address to which the packet should be sent.
|
||||
|
||||
@@ -133,6 +133,7 @@ AmpduAggregationTest::DoRun (void)
|
||||
fem->SetAckManager (ackManager);
|
||||
m_mac->SetWifiPhy (m_phy);
|
||||
m_device->SetMac (m_mac);
|
||||
m_mac->SetState (StaWifiMac::ASSOCIATED);
|
||||
|
||||
/*
|
||||
* Configure MPDU aggregation.
|
||||
@@ -381,6 +382,7 @@ TwoLevelAggregationTest::DoRun (void)
|
||||
fem->SetAckManager (ackManager);
|
||||
m_mac->SetWifiPhy (m_phy);
|
||||
m_device->SetMac (m_mac);
|
||||
m_mac->SetState (StaWifiMac::ASSOCIATED);
|
||||
|
||||
/*
|
||||
* Configure aggregation.
|
||||
@@ -614,6 +616,7 @@ HeAggregationTest::DoRunSubTest (uint16_t bufferSize)
|
||||
fem->SetAckManager (ackManager);
|
||||
m_mac->SetWifiPhy (m_phy);
|
||||
m_device->SetMac (m_mac);
|
||||
m_mac->SetState (StaWifiMac::ASSOCIATED);
|
||||
|
||||
/*
|
||||
* Configure aggregation.
|
||||
|
||||
Reference in New Issue
Block a user