wifi: Pass link ID to WifiMac::Receive()
This commit is contained in:
@@ -413,7 +413,7 @@ MeshWifiInterfaceMac::SendBeacon ()
|
||||
ScheduleNextBeacon ();
|
||||
}
|
||||
void
|
||||
MeshWifiInterfaceMac::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
MeshWifiInterfaceMac::Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId)
|
||||
{
|
||||
const WifiMacHeader* hdr = &mpdu->GetHeader ();
|
||||
Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
|
||||
|
||||
@@ -216,8 +216,9 @@ private:
|
||||
* Frame receive handler
|
||||
*
|
||||
* \param mpdu the received MPDU
|
||||
* \param linkId the ID of the link the frame was received over
|
||||
*/
|
||||
void Receive (Ptr<WifiMacQueueItem> mpdu);
|
||||
void Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId);
|
||||
/**
|
||||
* Send frame. Frame is supposed to be tagged by routing information.
|
||||
*
|
||||
|
||||
@@ -245,9 +245,9 @@ OcbWifiMac::Enqueue (Ptr<Packet> packet, Mac48Address to)
|
||||
* here we only care about data packet and vsa management frame
|
||||
*/
|
||||
void
|
||||
OcbWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
OcbWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << *mpdu);
|
||||
NS_LOG_FUNCTION (this << *mpdu << +linkId);
|
||||
const WifiMacHeader* hdr = &mpdu->GetHeader ();
|
||||
// Create a copy of the MPDU payload because non-const operations like RemovePacketTag
|
||||
// and RemoveHeader may need to be performed.
|
||||
@@ -331,7 +331,7 @@ OcbWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
// Invoke the receive handler of our parent class to deal with any
|
||||
// other frames. Specifically, this will handle Block Ack-related
|
||||
// Management Action frames.
|
||||
WifiMac::Receive (Create<WifiMacQueueItem> (packet, *hdr));
|
||||
WifiMac::Receive (Create<WifiMacQueueItem> (packet, *hdr), linkId);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -186,7 +186,7 @@ public:
|
||||
protected:
|
||||
virtual void DoDispose (void);
|
||||
private:
|
||||
virtual void Receive (Ptr<WifiMacQueueItem> mpdu);
|
||||
virtual void Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId);
|
||||
|
||||
VendorSpecificContentManager m_vscManager; ///< VSC manager
|
||||
};
|
||||
|
||||
@@ -179,9 +179,9 @@ AdhocWifiMac::SetLinkUpCallback (Callback<void> linkUp)
|
||||
}
|
||||
|
||||
void
|
||||
AdhocWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
AdhocWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << *mpdu);
|
||||
NS_LOG_FUNCTION (this << *mpdu << +linkId);
|
||||
const WifiMacHeader* hdr = &mpdu->GetHeader ();
|
||||
NS_ASSERT (!hdr->IsCtl ());
|
||||
Mac48Address from = hdr->GetAddr2 ();
|
||||
@@ -226,7 +226,7 @@ AdhocWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
//Invoke the receive handler of our parent class to deal with any
|
||||
//other frames. Specifically, this will handle Block Ack-related
|
||||
//Management Action frames.
|
||||
WifiMac::Receive (mpdu);
|
||||
WifiMac::Receive (mpdu, linkId);
|
||||
}
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
bool CanForwardPacketsTo (Mac48Address to) const override;
|
||||
|
||||
private:
|
||||
void Receive (Ptr<WifiMacQueueItem> mpdu) override;
|
||||
void Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId) override;
|
||||
};
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
@@ -1042,9 +1042,9 @@ ApWifiMac::TxFailed (WifiMacDropReason timeoutReason, Ptr<const WifiMacQueueItem
|
||||
}
|
||||
|
||||
void
|
||||
ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << *mpdu);
|
||||
NS_LOG_FUNCTION (this << *mpdu << +linkId);
|
||||
const WifiMacHeader* hdr = &mpdu->GetHeader ();
|
||||
Ptr<const Packet> packet = mpdu->GetPacket ();
|
||||
Mac48Address from = hdr->GetAddr2 ();
|
||||
@@ -1487,7 +1487,7 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
//Invoke the receive handler of our parent class to deal with any
|
||||
//other frames. Specifically, this will handle Block Ack-related
|
||||
//Management Action frames.
|
||||
WifiMac::Receive (Create<WifiMacQueueItem> (packet, *hdr));
|
||||
WifiMac::Receive (Create<WifiMacQueueItem> (packet, *hdr), linkId);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -164,7 +164,7 @@ protected:
|
||||
private:
|
||||
std::unique_ptr<LinkEntity> CreateLinkEntity (void) const override;
|
||||
|
||||
void Receive (Ptr<WifiMacQueueItem> mpdu) override;
|
||||
void Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId) override;
|
||||
/**
|
||||
* The packet we sent was successfully received by the receiver
|
||||
* (i.e. we received an Ack from the receiver). If the packet
|
||||
|
||||
@@ -973,7 +973,7 @@ FrameExchangeManager::Receive (Ptr<WifiPsdu> psdu, RxSignalInfo rxSignalInfo,
|
||||
{
|
||||
if (m_promisc && psdu->GetNMpdus () == 1 && psdu->GetHeader (0).IsData ())
|
||||
{
|
||||
m_rxMiddle->Receive (*psdu->begin ());
|
||||
m_rxMiddle->Receive (*psdu->begin (), m_linkId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1154,7 +1154,7 @@ FrameExchangeManager::ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu, RxSignalInfo rxSi
|
||||
this, hdr, txVector, rxSnr);
|
||||
}
|
||||
|
||||
m_rxMiddle->Receive (mpdu);
|
||||
m_rxMiddle->Receive (mpdu, m_linkId);
|
||||
}
|
||||
else if (hdr.IsData () && !hdr.IsQosData ())
|
||||
{
|
||||
@@ -1165,7 +1165,7 @@ FrameExchangeManager::ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu, RxSignalInfo rxSi
|
||||
this, hdr, txVector, rxSnr);
|
||||
}
|
||||
|
||||
m_rxMiddle->Receive (mpdu);
|
||||
m_rxMiddle->Receive (mpdu, m_linkId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -296,9 +296,9 @@ MacRxMiddle::HandleFragments (Ptr<const Packet> packet, const WifiMacHeader *hdr
|
||||
}
|
||||
|
||||
void
|
||||
MacRxMiddle::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
MacRxMiddle::Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId)
|
||||
{
|
||||
NS_LOG_FUNCTION (*mpdu);
|
||||
NS_LOG_FUNCTION (*mpdu << +linkId);
|
||||
const WifiMacHeader* hdr = &mpdu->GetHeader ();
|
||||
NS_ASSERT (hdr->IsData () || hdr->IsMgt ());
|
||||
|
||||
@@ -339,7 +339,7 @@ MacRxMiddle::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
}
|
||||
if (aggregate == mpdu->GetPacket ())
|
||||
{
|
||||
m_callback (mpdu);
|
||||
m_callback (mpdu, linkId);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -347,7 +347,7 @@ MacRxMiddle::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
// A-MSDUs saves us the time to deaggregate the A-MSDU in MSDUs (which are
|
||||
// kept separate in the received mpdu) and allows us to pass the originally
|
||||
// transmitted packets (i.e., with the same UID) to the receiver.
|
||||
m_callback (Create<WifiMacQueueItem> (aggregate, *hdr));
|
||||
m_callback (Create<WifiMacQueueItem> (aggregate, *hdr), linkId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
/**
|
||||
* typedef for callback
|
||||
*/
|
||||
typedef Callback<void, Ptr<WifiMacQueueItem>> ForwardUpCallback;
|
||||
typedef Callback<void, Ptr<WifiMacQueueItem>, uint8_t /* link ID */> ForwardUpCallback;
|
||||
|
||||
MacRxMiddle ();
|
||||
~MacRxMiddle ();
|
||||
@@ -57,11 +57,12 @@ public:
|
||||
void SetForwardCallback (ForwardUpCallback callback);
|
||||
|
||||
/**
|
||||
* Receive a packet.
|
||||
* Receive an MPDU on the given link.
|
||||
*
|
||||
* \param mpdu the MPDU
|
||||
* \param linkId the ID of the given link
|
||||
*/
|
||||
void Receive (Ptr<WifiMacQueueItem> mpdu);
|
||||
void Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@@ -708,7 +708,7 @@ QosFrameExchangeManager::ReceiveMpdu (Ptr<WifiMacQueueItem> mpdu, RxSignalInfo r
|
||||
// Forward up the frame if it is not a QoS Null frame
|
||||
if (hdr.HasData ())
|
||||
{
|
||||
m_rxMiddle->Receive (mpdu);
|
||||
m_rxMiddle->Receive (mpdu, m_linkId);
|
||||
}
|
||||
|
||||
// the received data frame has been processed
|
||||
|
||||
@@ -86,7 +86,7 @@ RecipientBlockAckAgreement::PassBufferedMpdusUntilFirstLost (void)
|
||||
while (it != m_bufferedMpdus.end () && it->first.first == m_winStartB)
|
||||
{
|
||||
NS_LOG_DEBUG ("Forwarding up: " << *it->second);
|
||||
m_rxMiddle->Receive (it->second);
|
||||
m_rxMiddle->Receive (it->second, WIFI_LINKID_UNDEFINED);
|
||||
it = m_bufferedMpdus.erase (it);
|
||||
m_winStartB = (m_winStartB + 1) % SEQNO_SPACE_SIZE;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ RecipientBlockAckAgreement::PassBufferedMpdusWithSeqNumberLessThan (uint16_t new
|
||||
&& GetDistance (it->first.first, m_winStartB) < GetDistance (newWinStartB, m_winStartB))
|
||||
{
|
||||
NS_LOG_DEBUG ("Forwarding up: " << *it->second);
|
||||
m_rxMiddle->Receive (it->second);
|
||||
m_rxMiddle->Receive (it->second, WIFI_LINKID_UNDEFINED);
|
||||
it = m_bufferedMpdus.erase (it);
|
||||
}
|
||||
m_winStartB = newWinStartB;
|
||||
|
||||
@@ -548,9 +548,9 @@ StaWifiMac::Enqueue (Ptr<Packet> packet, Mac48Address to)
|
||||
}
|
||||
|
||||
void
|
||||
StaWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
StaWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << *mpdu);
|
||||
NS_LOG_FUNCTION (this << *mpdu << +linkId);
|
||||
const WifiMacHeader* hdr = &mpdu->GetHeader ();
|
||||
Ptr<const Packet> packet = mpdu->GetPacket ();
|
||||
NS_ASSERT (!hdr->IsCtl ());
|
||||
@@ -745,7 +745,7 @@ StaWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
//Invoke the receive handler of our parent class to deal with any
|
||||
//other frames. Specifically, this will handle Block Ack-related
|
||||
//Management Action frames.
|
||||
WifiMac::Receive (Create<WifiMacQueueItem> (packet, *hdr));
|
||||
WifiMac::Receive (Create<WifiMacQueueItem> (packet, *hdr), linkId);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -180,12 +180,7 @@ private:
|
||||
*/
|
||||
bool GetActiveProbing (void) const;
|
||||
|
||||
/**
|
||||
* Handle a received packet.
|
||||
*
|
||||
* \param mpdu the received MPDU
|
||||
*/
|
||||
void Receive (Ptr<WifiMacQueueItem> mpdu) override;
|
||||
void Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId) override;
|
||||
/**
|
||||
* Update associated AP's information from beacon. If STA is not associated,
|
||||
* this information will used for the association process.
|
||||
|
||||
@@ -1025,9 +1025,9 @@ WifiMac::ForwardUp (Ptr<const Packet> packet, Mac48Address from, Mac48Address to
|
||||
}
|
||||
|
||||
void
|
||||
WifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
|
||||
WifiMac::Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << *mpdu);
|
||||
NS_LOG_FUNCTION (this << *mpdu << linkId);
|
||||
|
||||
const WifiMacHeader* hdr = &mpdu->GetHeader ();
|
||||
Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
|
||||
|
||||
@@ -536,8 +536,8 @@ protected:
|
||||
|
||||
/**
|
||||
* This method acts as the MacRxMiddle receive callback and is
|
||||
* invoked to notify us that a frame has been received. The
|
||||
* implementation is intended to capture logic that is going to be
|
||||
* invoked to notify us that a frame has been received on the given link.
|
||||
* The implementation is intended to capture logic that is going to be
|
||||
* common to all (or most) derived classes. Specifically, handling
|
||||
* of Block Ack management frames is dealt with here.
|
||||
*
|
||||
@@ -545,9 +545,16 @@ protected:
|
||||
* classes so that they can perform their data handling before
|
||||
* invoking the base version.
|
||||
*
|
||||
* The given link may be undefined in some cases (e.g., in case of
|
||||
* QoS Data frames received in the context of a Block Ack agreement --
|
||||
* because the BlockAckManager does not have to record the link each
|
||||
* buffered MPDU has been received on); in such a cases, the value
|
||||
* of <i>linkId</i> should be WIFI_LINKID_UNDEFINED.
|
||||
*
|
||||
* \param mpdu the MPDU that has been received.
|
||||
* \param linkId the ID of the given link
|
||||
*/
|
||||
virtual void Receive (Ptr<WifiMacQueueItem> mpdu);
|
||||
virtual void Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId);
|
||||
/**
|
||||
* Forward the packet up to the device.
|
||||
*
|
||||
|
||||
@@ -137,6 +137,9 @@ static constexpr uint16_t SEQNO_SPACE_HALF_SIZE = SEQNO_SPACE_SIZE / 2;
|
||||
/// ID is to be used to support multi-link operations)
|
||||
static constexpr uint8_t SINGLE_LINK_OP_ID = 0;
|
||||
|
||||
/// Invalid link identifier
|
||||
static constexpr uint8_t WIFI_LINKID_UNDEFINED = 0xff;
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* WIFI_UTILS_H */
|
||||
|
||||
@@ -668,11 +668,12 @@ public:
|
||||
void DoRun (void) override;
|
||||
|
||||
/**
|
||||
* Keep track of MPDUs that are forwarded up.
|
||||
* Keep track of MPDUs received on the given link that are forwarded up.
|
||||
*
|
||||
* \param mpdu an MPDU that is forwarded up
|
||||
* \param linkId the ID of the given link
|
||||
*/
|
||||
void ForwardUp (Ptr<WifiMacQueueItem> mpdu);
|
||||
void ForwardUp (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId);
|
||||
|
||||
private:
|
||||
uint16_t m_ssn; //!< the Starting Sequence Number used to initialize WinStartB
|
||||
@@ -690,7 +691,7 @@ BlockAckRecipientBufferTest::~BlockAckRecipientBufferTest ()
|
||||
}
|
||||
|
||||
void
|
||||
BlockAckRecipientBufferTest::ForwardUp (Ptr<WifiMacQueueItem> mpdu)
|
||||
BlockAckRecipientBufferTest::ForwardUp (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId)
|
||||
{
|
||||
m_fwup.push_back (mpdu);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user