From 07008cf638eb84c49f7dc72ada12447a595d107e Mon Sep 17 00:00:00 2001 From: Mirko Banchi Date: Wed, 3 Feb 2010 20:34:50 +0100 Subject: [PATCH] add support for block ack in MacLowTransmissionListener --- src/devices/wifi/edca-txop-n.cc | 14 ++++++++++++++ src/devices/wifi/edca-txop-n.h | 2 ++ src/devices/wifi/mac-low.cc | 4 ++++ src/devices/wifi/mac-low.h | 14 ++++++++++++++ 4 files changed, 34 insertions(+) diff --git a/src/devices/wifi/edca-txop-n.cc b/src/devices/wifi/edca-txop-n.cc index 7401bfae0..e178d5290 100644 --- a/src/devices/wifi/edca-txop-n.cc +++ b/src/devices/wifi/edca-txop-n.cc @@ -32,6 +32,7 @@ #include "wifi-mac-queue.h" #include "msdu-aggregator.h" #include "mgt-headers.h" +#include "ctrl-headers.h" NS_LOG_COMPONENT_DEFINE ("EdcaTxopN"); @@ -83,6 +84,9 @@ public: virtual void MissedAck (void) { m_txop->MissedAck (); } + virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source) { + m_txop->GotBlockAck (blockAck, source); + } virtual void StartNext (void) { m_txop->StartNext (); } @@ -709,4 +713,14 @@ EdcaTxopN::GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address RestartAccessIfNeeded (); } +void +EdcaTxopN::GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient) +{ + MY_DEBUG ("got block ack from="<ResetCw (); + m_dcf->StartBackoffNow (m_rng->GetNext (0, m_dcf->GetCw ())); + RestartAccessIfNeeded (); +} + } //namespace ns3 diff --git a/src/devices/wifi/edca-txop-n.h b/src/devices/wifi/edca-txop-n.h index eb37be8c2..fd06d7358 100644 --- a/src/devices/wifi/edca-txop-n.h +++ b/src/devices/wifi/edca-txop-n.h @@ -46,6 +46,7 @@ class WifiMacQueue; class RandomStream; class MsduAggregator; class MgtAddBaResponseHeader; +class CtrlBAckResponseHeader; /* This queue contains packets for a particular access class. @@ -112,6 +113,7 @@ public: void GotCts (double snr, WifiMode txMode); void MissedCts (void); void GotAck (double snr, WifiMode txMode); + void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient); void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient); void MissedAck (void); void StartNext (void); diff --git a/src/devices/wifi/mac-low.cc b/src/devices/wifi/mac-low.cc index 10b53bc9b..ee3e184d1 100644 --- a/src/devices/wifi/mac-low.cc +++ b/src/devices/wifi/mac-low.cc @@ -110,6 +110,10 @@ MacLowTransmissionListener::MacLowTransmissionListener () {} MacLowTransmissionListener::~MacLowTransmissionListener () {} +void +MacLowTransmissionListener::GotBlockAck (const CtrlBAckResponseHeader *blockAck, + Mac48Address source) +{} MacLowDcfListener::MacLowDcfListener () {} MacLowDcfListener::~MacLowDcfListener () diff --git a/src/devices/wifi/mac-low.h b/src/devices/wifi/mac-low.h index 5ffe14ece..6d3332774 100644 --- a/src/devices/wifi/mac-low.h +++ b/src/devices/wifi/mac-low.h @@ -28,6 +28,7 @@ #include "wifi-mode.h" #include "wifi-preamble.h" #include "wifi-remote-station-manager.h" +#include "ctrl-headers.h" #include "ns3/mac48-address.h" #include "ns3/callback.h" #include "ns3/event-id.h" @@ -75,6 +76,19 @@ public: * AckTimeout. */ virtual void MissedAck (void) = 0; + /** + * \param blockAck Block ack response header + * \param source Address of block ack sender + * + * Invoked when ns3::MacLow receives a block ack frame. + * Block ack frame is received after a block ack request + * and contains information about the correct reception + * of a set of packet for which a normal ack wasn't send. + * Default implementation for this method is empty. Every + * queue that intends to be notified by MacLow of reception + * of a block ack must redefine this function. + */ + virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source); /** * Invoked when ns3::MacLow wants to start a new transmission * as configured by MacLowTransmissionParameters::EnableNextData.