wifi: Remove PCF support

PCF has been deprecated and will be removed from the IEEE 802.11 standard.
This commit is contained in:
Stefano Avallone
2020-12-01 12:08:35 +01:00
parent 0719242888
commit 9a4a3ce716
14 changed files with 4 additions and 660 deletions

View File

@@ -57,9 +57,6 @@ cpp_examples = [
("wifi-80211e-txop --simulationTime=1 --verifyResults=1", "True", "True"),
("wifi-multi-tos --simulationTime=1 --nWifi=16 --useRts=1 --useShortGuardInterval=1", "True", "True"),
("wifi-tcp", "True", "True"),
("wifi-pcf --simulationTime=1 --withData=0", "True", "True"),
("wifi-pcf --simulationTime=1 --withData=1 --trafficDirection=upstream", "True", "True"),
("wifi-pcf --simulationTime=1 --withData=1 --trafficDirection=downstream", "True", "True"),
("wifi-hidden-terminal --wifiManager=Arf", "True", "True"),
("wifi-hidden-terminal --wifiManager=Aarf", "True", "True"),
("wifi-hidden-terminal --wifiManager=Aarfcd", "True", "True"),

View File

@@ -1,286 +0,0 @@
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2017
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Sebastien Deronne <sebastien.deronne@gmail.com>
*/
#include "ns3/log.h"
#include "ns3/config.h"
#include "ns3/command-line.h"
#include "ns3/uinteger.h"
#include "ns3/boolean.h"
#include "ns3/string.h"
#include "ns3/yans-wifi-helper.h"
#include "ns3/mobility-helper.h"
#include "ns3/internet-stack-helper.h"
#include "ns3/ipv4-address-helper.h"
#include "ns3/packet-sink-helper.h"
#include "ns3/on-off-helper.h"
#include "ns3/packet-sink.h"
#include "ns3/ssid.h"
#include "ns3/wifi-mac-header.h"
/* This is a simple example in order to show the frames exchanged in 802.11 PCF.
* The output prints the overal throughput as well as the number of different PCF frames that have been transmitted.
*
* It is possible to tune some parameters using the command line:
* - number of connected stations
* - enable/disable PCF
* - enable PCAP output file generation in order to vizualise frame exchange.
* - configure UDP data traffic:
* -> enable/disable data generation: --withData=<0|1>
* -> select traffic direction: --trafficDirection=<upstream|downstream>
*
* For example, one can observe the benefit of PCF over DCF when the number of stations increased:
* ./waf --run "wifi-pcf enablePcf=0 --nWifi=10" => DCF only
* ./waf --run "wifi-pcf enablePcf=1 --nWifi=10" => alternance of PCF and DCF
*
* One can also change the value of cfpMaxDuration: a shorter valer means the granted time for PCF is shorter, and so it's benefit is reduced.
* ./waf --run "wifi-pcf enablePcf=1 --nWifi=10 --cfpMaxDuration=10240"
*
* One can also see the different types of piggybacked frames depending on the traffic direction and whether PCF is enabled or not:
* ./waf --run "wifi-pcf enablePcf=0 --nWifi=1" => only CF_POLL and DATA_NULL frames should be seen
* ./waf --run "wifi-pcf enablePcf=1 --nWifi=1 --trafficDirection=upstream" => no DATA_NULL frames should be seen
* ./waf --run "wifi-pcf enablePcf=1 --nWifi=1 --trafficDirection=downstream" => no CF_END_ACK frames should be seen
*/
using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("WifiPcf");
uint64_t m_countBeacon;
uint64_t m_countCfPoll;
uint64_t m_countCfPollAck;
uint64_t m_countCfPollData;
uint64_t m_countCfPollDataAck;
uint64_t m_countCfEnd;
uint64_t m_countCfEndAck;
uint64_t m_countDataNull;
uint64_t m_countData;
void TxCallback (std::string context, Ptr<const Packet> p, double txPowerW)
{
WifiMacHeader hdr;
p->PeekHeader (hdr);
if (hdr.IsBeacon ())
{
m_countBeacon++;
}
else if (hdr.IsCfPoll ())
{
if (hdr.IsCfAck () && hdr.HasData ())
{
m_countCfPollDataAck++;
}
else if (!hdr.IsCfAck () && hdr.HasData ())
{
m_countCfPollData++;
}
else if (hdr.IsCfAck () && !hdr.HasData ())
{
m_countCfPollAck++;
}
else
{
m_countCfPoll++;
}
}
else if (hdr.IsCfEnd ())
{
if (hdr.IsCfAck ())
{
m_countCfEndAck++;
}
else
{
m_countCfEnd++;
}
}
else if (hdr.IsData ())
{
if (!hdr.HasData ())
{
m_countDataNull++;
}
else
{
m_countData++;
}
}
}
int main (int argc, char *argv[])
{
uint32_t nWifi = 1;
bool enablePcap = false;
bool enablePcf = true;
bool withData = true;
std::string trafficDirection = "upstream";
uint64_t cfpMaxDurationUs = 65536; //microseconds
double simulationTime = 10; //seconds
CommandLine cmd (__FILE__);
cmd.AddValue ("nWifi", "Number of wifi STA devices", nWifi);
cmd.AddValue ("enablePcf", "Enable/disable PCF mode", enablePcf);
cmd.AddValue ("withData", "Enable/disable UDP data packets generation", withData);
cmd.AddValue ("trafficDirection", "Data traffic direction (if withData is set to 1): upstream (all STAs -> AP) or downstream (AP -> all STAs)", trafficDirection);
cmd.AddValue ("cfpMaxDuration", "CFP max duration in microseconds", cfpMaxDurationUs);
cmd.AddValue ("simulationTime", "Simulation time in seconds", simulationTime);
cmd.AddValue ("enablePcap", "Enable/disable PCAP output", enablePcap);
cmd.Parse (argc, argv);
m_countBeacon = 0;
m_countCfEnd = 0;
m_countCfEndAck = 0;
m_countCfPoll = 0;
m_countCfPollAck = 0;
m_countCfPollData = 0;
m_countCfPollDataAck = 0;
m_countDataNull = 0;
m_countData = 0;
m_countDataNull = 0;
m_countData = 0;
NodeContainer wifiStaNodes;
wifiStaNodes.Create (nWifi);
NodeContainer wifiApNode;
wifiApNode.Create (1);
YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
YansWifiPhyHelper phy;
phy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
phy.SetChannel (channel.Create ());
WifiHelper wifi;
WifiMacHelper mac;
Ssid ssid = Ssid ("wifi-pcf");
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate54Mbps"), "ControlMode", StringValue ("OfdmRate24Mbps"));
NetDeviceContainer staDevices;
mac.SetType ("ns3::StaWifiMac",
"Ssid", SsidValue (ssid),
"ActiveProbing", BooleanValue (false),
"PcfSupported", BooleanValue (enablePcf));
staDevices = wifi.Install (phy, mac, wifiStaNodes);
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"PcfSupported", BooleanValue (enablePcf),
"CfpMaxDuration", TimeValue (MicroSeconds (cfpMaxDurationUs)));
NetDeviceContainer apDevice;
apDevice = wifi.Install (phy, mac, wifiApNode);
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
for (uint32_t i = 0; i < nWifi; i++)
{
positionAlloc->Add (Vector (1.0, 0.0, 0.0));
}
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (wifiApNode);
mobility.Install (wifiStaNodes);
InternetStackHelper stack;
stack.Install (wifiApNode);
stack.Install (wifiStaNodes);
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer StaInterface;
StaInterface = address.Assign (staDevices);
Ipv4InterfaceContainer ApInterface;
ApInterface = address.Assign (apDevice);
ApplicationContainer sourceApplications, sinkApplications;
if (withData)
{
uint32_t portNumber = 9;
for (uint32_t index = 0; index < nWifi; ++index)
{
auto ipv4 = (trafficDirection == "upstream") ? wifiApNode.Get (0)->GetObject<Ipv4> () : wifiStaNodes.Get (index)->GetObject<Ipv4> ();
const auto address = ipv4->GetAddress (1, 0).GetLocal ();
InetSocketAddress sinkSocket (address, portNumber++);
OnOffHelper onOffHelper ("ns3::UdpSocketFactory", sinkSocket);
onOffHelper.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
onOffHelper.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
onOffHelper.SetAttribute ("DataRate", DataRateValue (50000000 / nWifi));
onOffHelper.SetAttribute ("PacketSize", UintegerValue (1472)); //bytes
PacketSinkHelper packetSinkHelper ("ns3::UdpSocketFactory", sinkSocket);
if (trafficDirection == "upstream")
{
sourceApplications.Add (onOffHelper.Install (wifiStaNodes.Get (index)));
sinkApplications.Add (packetSinkHelper.Install (wifiApNode.Get (0)));
}
else if (trafficDirection == "downstream")
{
sinkApplications.Add (packetSinkHelper.Install (wifiStaNodes.Get (index)));
sourceApplications.Add (onOffHelper.Install (wifiApNode.Get (0)));
}
else
{
NS_ASSERT_MSG (false, "Invalid trafficDirection!");
}
}
sinkApplications.Start (Seconds (0.0));
sinkApplications.Stop (Seconds (simulationTime + 1));
sourceApplications.Start (Seconds (1.0));
sourceApplications.Stop (Seconds (simulationTime + 1));
}
Config::Connect ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxBegin", MakeCallback (&TxCallback));
if (enablePcap)
{
phy.EnablePcap ("wifi_pcf", apDevice.Get (0));
}
Simulator::Stop (Seconds (simulationTime + 1));
Simulator::Run ();
double throughput = 0;
for (uint32_t index = 0; index < sinkApplications.GetN (); ++index)
{
uint64_t totalPacketsThrough = DynamicCast<PacketSink> (sinkApplications.Get (index))->GetTotalRx ();
throughput += ((totalPacketsThrough * 8) / (simulationTime * 1000000.0)); //Mbit/s
}
std::cout << "Throughput: " << throughput << " Mbit/s" << std::endl;
std::cout << "# tx beacons: " << m_countBeacon << std::endl;
std::cout << "# tx CF-END: " << m_countCfEnd << std::endl;
std::cout << "# tx CF-END-ACK: " << m_countCfEndAck << std::endl;
std::cout << "# tx CF-POLL: " << m_countCfPoll << std::endl;
std::cout << "# tx CF-POLL-ACK: " << m_countCfPollAck << std::endl;
std::cout << "# tx CF-POLL-DATA: " << m_countCfPollData << std::endl;
std::cout << "# tx CF-POLL-DATA-ACK: " << m_countCfPollDataAck << std::endl;
std::cout << "# tx DATA-NULL: " << m_countDataNull << std::endl;
std::cout << "# tx DATA: " << m_countData << std::endl;
Simulator::Destroy ();
return 0;
}

View File

@@ -116,9 +116,6 @@ def build(bld):
obj = bld.create_ns3_program('wifi-backward-compatibility', ['wifi', 'applications'])
obj.source = 'wifi-backward-compatibility.cc'
obj = bld.create_ns3_program('wifi-pcf', ['wifi', 'applications'])
obj.source = 'wifi-pcf.cc'
obj = bld.create_ns3_program('wifi-spatial-reuse', ['wifi', 'applications'])
obj.source = 'wifi-spatial-reuse.cc'

View File

@@ -57,11 +57,6 @@ ApWifiMac::GetTypeId (void)
MakeTimeAccessor (&ApWifiMac::GetBeaconInterval,
&ApWifiMac::SetBeaconInterval),
MakeTimeChecker ())
.AddAttribute ("CfpMaxDuration", "The maximum size of the CFP (used when AP supports PCF)",
TimeValue (MicroSeconds (51200)),
MakeTimeAccessor (&ApWifiMac::GetCfpMaxDuration,
&ApWifiMac::SetCfpMaxDuration),
MakeTimeChecker ())
.AddAttribute ("BeaconJitter",
"A uniform random variable to cause the initial beacon starting time (after simulation time 0) "
"to be distributed between 0 and the BeaconInterval.",
@@ -104,7 +99,6 @@ ApWifiMac::ApWifiMac ()
m_beaconTxop->SetChannelAccessManager (m_channelAccessManager);
m_beaconTxop->SetTxMiddle (m_txMiddle);
m_beaconTxop->SetTxOkCallback (MakeCallback (&ApWifiMac::TxOk, this));
m_rxMiddle->SetPcfCallback (MakeCallback (&ApWifiMac::SendNextCfFrame, this));
//Let the lower layers know that we are acting as an AP.
SetTypeOfStation (AP);
@@ -165,13 +159,6 @@ ApWifiMac::GetBeaconInterval (void) const
return m_low->GetBeaconInterval ();
}
Time
ApWifiMac::GetCfpMaxDuration (void) const
{
NS_LOG_FUNCTION (this);
return m_low->GetCfpMaxDuration ();
}
void
ApWifiMac::SetWifiRemoteStationManager (const Ptr<WifiRemoteStationManager> stationManager)
{
@@ -208,17 +195,6 @@ ApWifiMac::SetBeaconInterval (Time interval)
m_low->SetBeaconInterval (interval);
}
void
ApWifiMac::SetCfpMaxDuration (Time duration)
{
NS_LOG_FUNCTION (this << duration);
if ((duration.GetMicroSeconds () % 1024) != 0)
{
NS_LOG_WARN ("CFP max duration should be multiple of 1024us (802.11 time unit)");
}
m_low->SetCfpMaxDuration (duration);
}
int64_t
ApWifiMac::AssignStreams (int64_t stream)
{
@@ -547,21 +523,6 @@ ApWifiMac::GetEdcaParameterSet (void) const
return edcaParameters;
}
CfParameterSet
ApWifiMac::GetCfParameterSet (void) const
{
CfParameterSet cfParameterSet;
if (GetPcfSupported () && !m_cfPollingList.empty ())
{
cfParameterSet.SetPcfSupported (1);
cfParameterSet.SetCFPCount (0);
cfParameterSet.SetCFPPeriod (1);
cfParameterSet.SetCFPMaxDurationUs (GetCfpMaxDuration ().GetMicroSeconds ());
cfParameterSet.SetCFPDurRemainingUs (GetCfpMaxDuration ().GetMicroSeconds ());
}
return cfParameterSet;
}
HtOperation
ApWifiMac::GetHtOperation (void) const
{
@@ -881,10 +842,6 @@ ApWifiMac::SendOneBeacon (void)
beacon.SetCapabilities (GetCapabilities ());
m_stationManager->SetShortPreambleEnabled (GetShortPreambleEnabled ());
m_stationManager->SetShortSlotTimeEnabled (GetShortSlotTimeEnabled ());
if (GetPcfSupported ())
{
beacon.SetCfParameterSet (GetCfParameterSet ());
}
if (GetDsssSupported ())
{
beacon.SetDsssParameterSet (GetDsssParameterSet ());
@@ -937,39 +894,6 @@ ApWifiMac::SendOneBeacon (void)
}
}
void
ApWifiMac::SendNextCfFrame (void)
{
if (!GetPcfSupported ())
{
return;
}
if (m_txop->CanStartNextPolling ())
{
SendCfPoll ();
}
else if (m_low->IsCfPeriod ())
{
SendCfEnd ();
}
}
void
ApWifiMac::SendCfPoll (void)
{
NS_LOG_FUNCTION (this);
NS_ASSERT (GetPcfSupported ());
m_txop->SendCfFrame (WIFI_MAC_DATA_NULL_CFPOLL, *m_itCfPollingList);
}
void
ApWifiMac::SendCfEnd (void)
{
NS_LOG_FUNCTION (this);
NS_ASSERT (GetPcfSupported ());
m_txop->SendCfFrame (WIFI_MAC_CTL_END, Mac48Address::GetBroadcast ());
}
void
ApWifiMac::TxOk (const WifiMacHeader &hdr)
{
@@ -981,21 +905,6 @@ ApWifiMac::TxOk (const WifiMacHeader &hdr)
NS_LOG_DEBUG ("associated with sta=" << hdr.GetAddr1 ());
m_stationManager->RecordGotAssocTxOk (hdr.GetAddr1 ());
}
else if (hdr.IsBeacon () && GetPcfSupported ())
{
if (!m_cfPollingList.empty ())
{
SendCfPoll ();
}
else
{
SendCfEnd ();
}
}
else if (hdr.IsCfPoll ())
{
IncrementPollingListIterator ();
}
}
void
@@ -1010,11 +919,6 @@ ApWifiMac::TxFailed (const WifiMacHeader &hdr)
NS_LOG_DEBUG ("association failed with sta=" << hdr.GetAddr1 ());
m_stationManager->RecordGotAssocTxFailed (hdr.GetAddr1 ());
}
else if (hdr.IsCfPoll ())
{
IncrementPollingListIterator ();
SendNextCfFrame ();
}
}
void
@@ -1234,14 +1138,6 @@ ApWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
m_stationManager->AddSupportedMode (from, mode);
}
}
if (GetPcfSupported () && capabilities.IsCfPollable ())
{
m_cfPollingList.push_back (from);
if (m_itCfPollingList == m_cfPollingList.end ())
{
IncrementPollingListIterator ();
}
}
if (GetHtSupported ())
{
HtCapabilities htCapabilities = assocReq.GetHtCapabilities ();
@@ -1608,17 +1504,6 @@ ApWifiMac::GetNextAssociationId (void)
return 0;
}
void
ApWifiMac::IncrementPollingListIterator (void)
{
NS_LOG_FUNCTION (this);
m_itCfPollingList++;
if (m_itCfPollingList == m_cfPollingList.end ())
{
m_itCfPollingList = m_cfPollingList.begin ();
}
}
uint8_t
ApWifiMac::GetBufferStatus (uint8_t tid, Mac48Address address) const
{

View File

@@ -73,14 +73,6 @@ public:
* \return the interval between two beacon transmissions.
*/
Time GetBeaconInterval (void) const;
/**
* \param duration the maximum duration for the CF period.
*/
void SetCfpMaxDuration (Time duration);
/**
* \return the maximum duration for the CF period.
*/
Time GetCfpMaxDuration (void) const;
/**
* Determine whether short slot time should be enabled or not in the BSS.
* Typically, true is returned only when there is no non-ERP stations associated
@@ -228,18 +220,6 @@ private:
* Forward a beacon packet to the beacon special DCF.
*/
void SendOneBeacon (void);
/**
* Determine what is the next PCF frame and trigger its transmission.
*/
void SendNextCfFrame (void);
/**
* Send a CF-Poll packet to the next polling STA.
*/
void SendCfPoll (void);
/**
* Send a CF-End packet.
*/
void SendCfEnd (void);
/**
* Return the Capability information of the current AP.
@@ -259,12 +239,6 @@ private:
* \return the EDCA Parameter Set that we support
*/
EdcaParameterSet GetEdcaParameterSet (void) const;
/**
* Return the CF parameter set of the current AP.
*
* \return the CF parameter set that we support
*/
CfParameterSet GetCfParameterSet (void) const;
/**
* Return the HT operation of the current AP.
*
@@ -309,11 +283,6 @@ private:
* false otherwise
*/
bool GetUseNonErpProtection (void) const;
/**
* Increment the PCF polling list iterator to indicate
* that the next polling station can be polled.
*/
void IncrementPollingListIterator (void);
void DoDispose (void);
void DoInitialize (void);

View File

@@ -298,7 +298,7 @@ ChannelAccessManager::NeedBackoffUponAccess (Ptr<Txop> txop)
}
void
ChannelAccessManager::RequestAccess (Ptr<Txop> txop, bool isCfPeriod)
ChannelAccessManager::RequestAccess (Ptr<Txop> txop)
{
NS_LOG_FUNCTION (this << txop);
if (m_phy)
@@ -310,13 +310,6 @@ ChannelAccessManager::RequestAccess (Ptr<Txop> txop, bool isCfPeriod)
{
return;
}
if (isCfPeriod)
{
txop->NotifyAccessRequested ();
Time delay = (MostRecent ({GetAccessGrantStart (true), Simulator::Now ()}) - Simulator::Now ());
m_accessTimeout = Simulator::Schedule (delay, &ChannelAccessManager::DoGrantPcfAccess, this, txop);
return;
}
/*
* EDCAF operations shall be performed at slot boundaries (Sec. 10.22.2.4 of 802.11-2016)
*/
@@ -339,12 +332,6 @@ ChannelAccessManager::RequestAccess (Ptr<Txop> txop, bool isCfPeriod)
DoRestartAccessTimeoutIfNeeded ();
}
void
ChannelAccessManager::DoGrantPcfAccess (Ptr<Txop> txop)
{
txop->NotifyAccessGranted ();
}
void
ChannelAccessManager::DoGrantDcfAccess (void)
{

View File

@@ -103,14 +103,13 @@ public:
/**
* \param txop a Txop
* \param isCfPeriod flag whether it is called during the CF period
*
* Notify the ChannelAccessManager that a specific Txop needs access to the
* medium. The ChannelAccessManager is then responsible for starting an access
* timer and, invoking Txop::DoNotifyAccessGranted when the access
* timer and, invoking FrameExchangeManager::StartTransmission when the access
* is granted if it ever gets granted.
*/
void RequestAccess (Ptr<Txop> txop, bool isCfPeriod = false);
void RequestAccess (Ptr<Txop> txop);
/**
* Access will never be granted to the medium _before_
@@ -268,12 +267,6 @@ private:
* Grant access to Txop using DCF/EDCF contention rules
*/
void DoGrantDcfAccess (void);
/**
* Grant access to Txop using PCF preemption
*
* \param txop the Txop
*/
void DoGrantPcfAccess (Ptr<Txop> txop);
/**
* Return the Short Interframe Space (SIFS) for this PHY.

View File

@@ -698,7 +698,6 @@ MacLow::ReceiveError (Ptr<WifiPsdu> psdu)
if (IsCfPeriod () && m_currentPacket->GetHeader (0).IsCfPoll ())
{
NS_ASSERT (m_currentTxop != 0);
m_currentTxop->MissedCfPollResponse (m_cfAckInfo.expectCfAck);
}
else if (m_cfAckInfo.expectCfAck)
{
@@ -956,10 +955,6 @@ MacLow::ReceiveOk (Ptr<WifiMacQueueItem> mpdu, double rxSnr, WifiTxVector txVect
m_currentTxop->MissedAck ();
}
}
if (m_currentTxop != 0)
{
m_currentTxop->GotCfEnd ();
}
m_cfAckInfo.expectCfAck = false;
}
else
@@ -1486,7 +1481,6 @@ MacLow::CfPollTimeout (void)
if (!busy)
{
NS_ASSERT (m_currentTxop != 0);
m_currentTxop->MissedCfPollResponse (m_cfAckInfo.expectCfAck);
m_cfAckInfo.expectCfAck = false;
}
}

View File

@@ -301,10 +301,7 @@ MacRxMiddle::Receive (Ptr<WifiMacQueueItem> mpdu)
NS_LOG_FUNCTION (*mpdu);
const WifiMacHeader* hdr = &mpdu->GetHeader ();
NS_ASSERT (hdr->IsData () || hdr->IsMgt ());
if (!m_pcfCallback.IsNull ())
{
m_pcfCallback ();
}
OriginatorRxStatus *originator = Lookup (hdr);
/**
* The check below is really unneeded because it can fail in a lot of
@@ -354,10 +351,4 @@ MacRxMiddle::Receive (Ptr<WifiMacQueueItem> mpdu)
}
}
void
MacRxMiddle::SetPcfCallback (Callback<void> callback)
{
m_pcfCallback = callback;
}
} //namespace ns3

View File

@@ -56,13 +56,6 @@ public:
*/
void SetForwardCallback (ForwardUpCallback callback);
/**
* Set a callback to trigger the next PCF frame.
*
* \param callback the callback to set
*/
void SetPcfCallback (Callback<void> callback);
/**
* Receive a packet.
*
@@ -133,8 +126,6 @@ private:
Originators m_originatorStatus; ///< originator status
QosOriginators m_qosOriginatorStatus; ///< QOS originator status
ForwardUpCallback m_callback; ///< forward up callback
Callback<void> m_pcfCallback; //!< PCF callback
};
} //namespace ns3

View File

@@ -263,14 +263,6 @@ StaWifiMac::SendAssociationRequest (bool isReassoc)
&StaWifiMac::AssocRequestTimeout, this);
}
void
StaWifiMac::SendCfPollResponse (void)
{
NS_LOG_FUNCTION (this);
NS_ASSERT (GetPcfSupported ());
m_txop->SendCfFrame (WIFI_MAC_DATA_NULL, GetBssid ());
}
void
StaWifiMac::TryToEnsureAssociated (void)
{
@@ -520,10 +512,6 @@ StaWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
NotifyRxDrop (packet);
return;
}
else if ((hdr->GetAddr1 () == GetAddress ()) && (hdr->GetAddr2 () == GetBssid ()) && hdr->IsCfPoll ())
{
SendCfPollResponse ();
}
if (hdr->IsData ())
{
if (!IsAssociated ())
@@ -586,19 +574,6 @@ StaWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu)
NS_LOG_LOGIC ("Beacon is for our SSID");
goodBeacon = true;
}
CfParameterSet cfParameterSet = beacon.GetCfParameterSet ();
if (cfParameterSet.GetCFPCount () == 0)
{
//see section 9.3.2.2 802.11-1999
if (GetPcfSupported ())
{
m_low->DoNavStartNow (MicroSeconds (cfParameterSet.GetCFPMaxDurationUs ()));
}
else
{
m_low->DoNavStartNow (MicroSeconds (cfParameterSet.GetCFPDurRemainingUs ()));
}
}
SupportedRates rates = beacon.GetSupportedRates ();
bool bssMembershipSelectorMatch = false;
for (uint8_t i = 0; i < m_phy->GetNBssMembershipSelectors (); i++)

View File

@@ -237,10 +237,6 @@ private:
*
*/
void SendAssociationRequest (bool isReassoc);
/**
* Forward a CF-Poll response packet to the CFP queue.
*/
void SendCfPollResponse (void);
/**
* Try to ensure that we are associated with an AP by taking an appropriate action
* depending on the current association status.

View File

@@ -714,46 +714,6 @@ Txop::MissedAck (void)
RestartAccessIfNeeded ();
}
void
Txop::GotCfEnd (void)
{
NS_LOG_FUNCTION (this);
if (m_currentPacket != 0)
{
RestartAccessIfNeeded ();
}
else
{
StartAccessIfNeeded ();
}
}
void
Txop::MissedCfPollResponse (bool expectedCfAck)
{
NS_LOG_FUNCTION (this);
NS_LOG_DEBUG ("missed response to CF-POLL");
if (expectedCfAck)
{
if (!NeedDataRetransmission (m_currentPacket, m_currentHdr))
{
NS_LOG_DEBUG ("Ack Fail");
m_stationManager->ReportFinalDataFailed (Create<const WifiMacQueueItem> (m_currentPacket,
m_currentHdr));
m_currentPacket = 0;
}
else
{
NS_LOG_DEBUG ("Retransmit");
m_currentHdr.SetRetry ();
}
}
if (!m_txFailedCallback.IsNull ())
{
m_txFailedCallback (m_currentHdr);
}
}
void
Txop::StartNextFragment (void)
{
@@ -798,84 +758,6 @@ Txop::EndTxNoAck (void)
StartAccessIfNeeded ();
}
void
Txop::SendCfFrame (WifiMacType frameType, Mac48Address addr)
{
NS_LOG_FUNCTION (this << frameType << addr);
NS_ASSERT (m_low->IsCfPeriod ());
if (m_currentPacket != 0 && frameType != WIFI_MAC_CTL_END)
{
if (!NeedDataRetransmission (m_currentPacket, m_currentHdr))
{
m_stationManager->ReportFinalDataFailed (Create<const WifiMacQueueItem> (m_currentPacket,
m_currentHdr));
m_currentPacket = 0;
}
else
{
m_currentHdr.SetRetry ();
}
}
else if ((m_queue->GetNPacketsByAddress (addr) > 0) && (frameType != WIFI_MAC_CTL_END)) //if no packet for that dest, send to another dest?
{
Ptr<WifiMacQueueItem> item = m_queue->DequeueByAddress (addr);
NS_ASSERT (item != 0);
m_currentPacket = item->GetPacket ();
m_currentHdr = item->GetHeader ();
uint16_t sequence = m_txMiddle->GetNextSequenceNumberFor (&m_currentHdr);
m_currentHdr.SetSequenceNumber (sequence);
m_currentHdr.SetFragmentNumber (0);
m_currentHdr.SetNoMoreFragments ();
m_currentHdr.SetNoRetry ();
}
else
{
m_currentPacket = Create<Packet> ();
m_currentHdr.SetNoRetry ();
}
if (m_currentPacket->GetSize () > 0)
{
switch (frameType)
{
case WIFI_MAC_DATA_NULL_CFPOLL:
m_currentHdr.SetType (WIFI_MAC_DATA_CFPOLL);
break;
case WIFI_MAC_DATA_NULL:
m_currentHdr.SetType (WIFI_MAC_DATA);
break;
default:
NS_ASSERT (false);
break;
}
}
else
{
m_currentHdr.SetType (frameType);
}
m_currentHdr.SetAddr1 (addr);
m_currentHdr.SetAddr2 (m_low->GetAddress ());
if (frameType == WIFI_MAC_DATA_NULL)
{
m_currentHdr.SetAddr3 (m_low->GetBssid ());
m_currentHdr.SetDsTo ();
m_currentHdr.SetDsNotFrom ();
}
else
{
m_currentHdr.SetAddr3 (m_low->GetAddress ());
m_currentHdr.SetDsNotTo ();
m_currentHdr.SetDsFrom ();
}
m_channelAccessManager->RequestAccess (this, true);
}
bool
Txop::CanStartNextPolling () const
{
return (!m_channelAccessManager->IsBusy () && GetLow ()->CanTransmitNextCfFrame ());
}
bool
Txop::IsQosTxop () const
{

View File

@@ -261,14 +261,6 @@ public:
*/
virtual void Queue (Ptr<Packet> packet, const WifiMacHeader &hdr);
/**
* Sends CF frame to STA with address <i>addr</i>.
*
* \param frameType the type of frame to be transmitted.
* \param addr address of the recipient.
*/
void SendCfFrame (WifiMacType frameType, Mac48Address addr);
/* Event handlers */
/**
* Event handler when a CTS timeout has occurred.
@@ -282,16 +274,6 @@ public:
* Event handler when an Ack is missed.
*/
virtual void MissedAck (void);
/**
* Event handler when a CF-END frame is received.
*/
void GotCfEnd (void);
/**
* Event handler when a response to a CF-POLL frame is missed.
*
* \param expectedCfAck flag to indicate whether a CF-Ack was expected in the response.
*/
void MissedCfPollResponse (bool expectedCfAck);
/**
* Event handler when a BlockAck is received.
*
@@ -352,15 +334,6 @@ public:
*/
virtual void NotifyChannelReleased (void);
/**
* Check if the next PCF transmission can fit in the remaining CFP duration.
*
* \return true if the next PCF transmission can fit in the remaining CFP duration,
* false otherwise
*/
bool CanStartNextPolling (void) const;
/**
* Assign a fixed random variable stream number to the random variables
* used by this model. Return the number of streams (possibly zero) that