View | Details | Raw Unified | Return to bug 2307
Collapse All | Expand All

(-)a/src/test/traced/traced-callback-typedef-test-suite.cc (-2 / +2 lines)
 Lines 610-617    Link Here 
610
         empty, empty, empty, empty);
610
         empty, empty, empty, empty);
611
611
612
  CHECK (WifiPhyStateHelper::RxEndErrorTracedCallback,
612
  CHECK (WifiPhyStateHelper::RxEndErrorTracedCallback,
613
         Ptr<const Packet>, double, bool,
613
         Ptr<const Packet>, double,
614
         empty, empty);
614
         empty, empty, empty);
615
615
616
  CHECK (WifiPhyStateHelper::RxOkTracedCallback,
616
  CHECK (WifiPhyStateHelper::RxOkTracedCallback,
617
         Ptr<const Packet>, double, WifiMode, WifiPreamble,
617
         Ptr<const Packet>, double, WifiMode, WifiPreamble,
(-)a/src/wifi/model/ampdu-tag.cc (-11 / +34 lines)
 Lines 15-21    Link Here 
15
 * along with this program; if not, write to the Free Software
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 *
17
 *
18
 * Author: Ghada Badawy <gbadawy@gmail.com>
18
 * Authors: Ghada Badawy <gbadawy@gmail.com>
19
 *          Sébastien Deronne <sebastien.deronne@gmail.com>
19
 */
20
 */
20
21
21
#include "ampdu-tag.h"
22
#include "ampdu-tag.h"
 Lines 48-54    Link Here 
48
}
49
}
49
50
50
AmpduTag::AmpduTag ()
51
AmpduTag::AmpduTag ()
51
  : m_ampdu (0)
52
  : m_ampdu (0),
53
    m_nbOfMpdus (0),
54
    m_duration (Seconds(0))
52
{
55
{
53
}
56
}
54
57
 Lines 59-88    Link Here 
59
}
62
}
60
63
61
void
64
void
62
AmpduTag::SetNoOfMpdus (uint8_t noofmpdus)
65
AmpduTag::SetRemainingNbOfMpdus (uint8_t nbofmpdus)
63
{
66
{
64
  NS_ASSERT (noofmpdus <= 64);
67
  NS_ASSERT (nbofmpdus <= 64);
65
  m_noOfMpdus = noofmpdus;
68
  m_nbOfMpdus = nbofmpdus;
69
}
70
71
void
72
AmpduTag::SetRemainingAmpduDuration (Time duration)
73
{
74
  NS_ASSERT (m_duration <= MilliSeconds(10));
75
  m_duration = duration;
66
}
76
}
67
77
68
uint32_t
78
uint32_t
69
AmpduTag::GetSerializedSize (void) const
79
AmpduTag::GetSerializedSize (void) const
70
{
80
{
71
  return 2;
81
  return (2 + sizeof (Time));
72
}
82
}
73
83
74
void
84
void
75
AmpduTag::Serialize (TagBuffer i) const
85
AmpduTag::Serialize (TagBuffer i) const
76
{
86
{
77
  i.WriteU8 (m_ampdu);
87
  i.WriteU8 (m_ampdu);
78
  i.WriteU8 (m_noOfMpdus);
88
  i.WriteU8 (m_nbOfMpdus);
89
  int64_t duration = m_duration.GetTimeStep ();
90
  i.Write ((const uint8_t *)&duration, sizeof(int64_t));
79
}
91
}
80
92
81
void
93
void
82
AmpduTag::Deserialize (TagBuffer i)
94
AmpduTag::Deserialize (TagBuffer i)
83
{
95
{
84
  m_ampdu = i.ReadU8 ();
96
  m_ampdu = i.ReadU8 ();
85
  m_noOfMpdus = i.ReadU8 ();
97
  m_nbOfMpdus = i.ReadU8 ();
98
  int64_t duration;
99
  i.Read ((uint8_t *)&duration, 8);
100
  m_duration = Time (duration);
86
}
101
}
87
102
88
bool
103
bool
 Lines 92-106    Link Here 
92
}
107
}
93
108
94
uint8_t
109
uint8_t
95
AmpduTag::GetNoOfMpdus () const
110
AmpduTag::GetRemainingNbOfMpdus () const
96
{
111
{
97
  return m_noOfMpdus;
112
  return m_nbOfMpdus;
113
}
114
115
Time
116
AmpduTag::GetRemainingAmpduDuration () const
117
{
118
  return m_duration;
98
}
119
}
99
120
100
void
121
void
101
AmpduTag::Print (std::ostream &os) const
122
AmpduTag::Print (std::ostream &os) const
102
{
123
{
103
  os << "A-MPDU exists=" << m_ampdu;
124
  os << "A-MPDU exists=" << m_ampdu
125
     << " Remaining number of MPDUs=" << m_nbOfMpdus
126
     << " Remaining A-MPDU duration=" << m_duration;
104
}
127
}
105
128
106
} //namespace ns3
129
} //namespace ns3
(-)a/src/wifi/model/ampdu-tag.h (-8 / +23 lines)
 Lines 15-27    Link Here 
15
 * along with this program; if not, write to the Free Software
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 *
17
 *
18
 * Author: Ghada Badawy <gbadawy@gmail.com>
18
 * Authors: Ghada Badawy <gbadawy@gmail.com>
19
 *          Sébastien Deronne <sebastien.deronne@gmail.com>
19
 */
20
 */
20
21
21
#ifndef AMPDU_TAG_H
22
#ifndef AMPDU_TAG_H
22
#define AMPDU_TAG_H
23
#define AMPDU_TAG_H
23
24
24
#include "ns3/packet.h"
25
#include "ns3/packet.h"
26
#include "ns3/nstime.h"
25
27
26
namespace ns3 {
28
namespace ns3 {
27
29
 Lines 48-58    Link Here 
48
   */
50
   */
49
  void SetAmpdu (bool supported);
51
  void SetAmpdu (bool supported);
50
  /**
52
  /**
51
   * \param noofmpdus the number of MPDUs
53
   * \param nbofmpdus the remaining number of MPDUs
52
   *
54
   *
53
   * Set the number of MPDUs in the A-MPDU.
55
   * Set the remaining number of MPDUs in the A-MPDU.
54
   */
56
   */
55
  void SetNoOfMpdus (uint8_t noofmpdus);
57
  void SetRemainingNbOfMpdus (uint8_t nbofmpdus);
58
  /**
59
   * \param duration the remaining duration of the A-MPDU
60
   *
61
   * Set the remaining duration of the A-MPDU.
62
   */
63
  void SetRemainingAmpduDuration (Time duration);
56
64
57
  virtual void Serialize (TagBuffer i) const;
65
  virtual void Serialize (TagBuffer i) const;
58
  virtual void Deserialize (TagBuffer i);
66
  virtual void Deserialize (TagBuffer i);
 Lines 67-81    Link Here 
67
   */
75
   */
68
  bool GetAmpdu (void) const;
76
  bool GetAmpdu (void) const;
69
  /**
77
  /**
70
   * \return the number of MPDUs in an A-MPDU
78
   * \return the remaining number of MPDUs in an A-MPDU
71
   *
79
   *
72
   * Returns the number of MPDUs in an A-MPDU
80
   * Returns the remaining number of MPDUs in an A-MPDU
73
   */
81
   */
74
  uint8_t GetNoOfMpdus (void) const;
82
  uint8_t GetRemainingNbOfMpdus (void) const;
83
  /**
84
   * \return the remaining duration of an A-MPDU
85
   *
86
   * Returns the remaining duration of an A-MPDU
87
   */
88
  Time GetRemainingAmpduDuration (void) const;
75
89
76
private:
90
private:
77
  uint8_t m_ampdu;     //!< Flag whether it is an A-MPDU
91
  uint8_t m_ampdu;     //!< Flag whether it is an A-MPDU
78
  uint8_t m_noOfMpdus; //!< number of MPDUs in the A-MPDU
92
  uint8_t m_nbOfMpdus; //!< Remaining number of MPDUs in the A-MPDU
93
  Time m_duration;     //!< Remaining duration of the A-MPDU in nanoseconds
79
};
94
};
80
95
81
} //namespace ns3
96
} //namespace ns3
(-)a/src/wifi/model/mac-low.cc (-64 / +38 lines)
 Lines 368-374    Link Here 
368
    m_listener (0),
368
    m_listener (0),
369
    m_phyMacLowListener (0),
369
    m_phyMacLowListener (0),
370
    m_ctsToSelfSupported (false),
370
    m_ctsToSelfSupported (false),
371
    m_receivedAtLeastOneMpdu (false),
372
    m_nTxMpdus (0)
371
    m_nTxMpdus (0)
373
{
372
{
374
  NS_LOG_FUNCTION (this);
373
  NS_LOG_FUNCTION (this);
 Lines 534-540    Link Here 
534
MacLow::ResetPhy (void)
533
MacLow::ResetPhy (void)
535
{
534
{
536
  m_phy->SetReceiveOkCallback (MakeNullCallback<void, Ptr<Packet>, double, WifiTxVector, enum WifiPreamble> ());
535
  m_phy->SetReceiveOkCallback (MakeNullCallback<void, Ptr<Packet>, double, WifiTxVector, enum WifiPreamble> ());
537
  m_phy->SetReceiveErrorCallback (MakeNullCallback<void, Ptr<Packet>, double, bool> ());
536
  m_phy->SetReceiveErrorCallback (MakeNullCallback<void, Ptr<Packet>, double> ());
538
  RemovePhyMacLowListener (m_phy);
537
  RemovePhyMacLowListener (m_phy);
539
  m_phy = 0;
538
  m_phy = 0;
540
}
539
}
 Lines 779-785    Link Here 
779
        {
778
        {
780
          AmpduTag ampdu;
779
          AmpduTag ampdu;
781
          m_currentPacket->PeekPacketTag (ampdu);
780
          m_currentPacket->PeekPacketTag (ampdu);
782
          if (ampdu.GetNoOfMpdus () > 1)
781
          if (ampdu.GetRemainingNbOfMpdus () > 0)
783
            {
782
            {
784
              m_txParams.EnableCompressedBlockAck ();
783
              m_txParams.EnableCompressedBlockAck ();
785
            }
784
            }
 Lines 839-877    Link Here 
839
}
838
}
840
839
841
void
840
void
842
MacLow::ReceiveError (Ptr<Packet> packet, double rxSnr, bool isEndOfFrame)
841
MacLow::ReceiveError (Ptr<Packet> packet, double rxSnr)
843
{
842
{
844
  NS_LOG_FUNCTION (this << packet << rxSnr << isEndOfFrame);
843
  NS_LOG_FUNCTION (this << packet << rxSnr);
845
  NS_LOG_DEBUG ("rx failed ");
844
  NS_LOG_DEBUG ("rx failed ");
846
  if (isEndOfFrame == true && m_receivedAtLeastOneMpdu == true)
847
    {
848
      WifiMacHeader hdr;
849
      AmpduTag ampdu;
850
      if (packet->RemovePacketTag (ampdu))
851
        {
852
          MpduAggregator::DeaggregatedMpdus mpdu = MpduAggregator::Deaggregate (packet);
853
          mpdu.begin ()->first->PeekHeader (hdr);
854
        }
855
      else
856
        {
857
          packet->PeekHeader (hdr);
858
        }
859
      if (hdr.GetAddr1 () != m_self)
860
        {
861
          NS_LOG_DEBUG ("hdr addr1 " << hdr.GetAddr1 () << "not for me (" << m_self << "); returning");
862
          return;
863
        }
864
      NS_ASSERT (m_lastReceivedHdr.IsQosData ());
865
      NS_LOG_DEBUG ("last a-mpdu subframe detected/sendImmediateBlockAck from=" << m_lastReceivedHdr.GetAddr2 ());
866
      m_sendAckEvent = Simulator::Schedule (GetSifs (),
867
                                            &MacLow::SendBlockAckAfterAmpdu, this,
868
                                            m_lastReceivedHdr.GetQosTid (),
869
                                            m_lastReceivedHdr.GetAddr2 (),
870
                                            m_lastReceivedHdr.GetDuration (),
871
                                            m_currentTxVector,
872
                                            rxSnr);
873
      m_receivedAtLeastOneMpdu = false;
874
    }
875
  if (m_txParams.MustWaitFastAck ())
845
  if (m_txParams.MustWaitFastAck ())
876
    {
846
    {
877
      NS_ASSERT (m_fastAckFailedTimeoutEvent.IsExpired ());
847
      NS_ASSERT (m_fastAckFailedTimeoutEvent.IsExpired ());
 Lines 1064-1070    Link Here 
1064
              NS_ASSERT (i != m_bAckCaches.end ());
1034
              NS_ASSERT (i != m_bAckCaches.end ());
1065
              (*i).second.UpdateWithBlockAckReq (blockAckReq.GetStartingSequence ());
1035
              (*i).second.UpdateWithBlockAckReq (blockAckReq.GetStartingSequence ());
1066
1036
1067
              NS_ASSERT (m_sendAckEvent.IsExpired ());
1037
              //NS_ASSERT (m_sendAckEvent.IsExpired ());
1038
              m_sendAckEvent.Cancel ();
1068
              /* See section 11.5.3 in IEEE 802.11 for mean of this timer */
1039
              /* See section 11.5.3 in IEEE 802.11 for mean of this timer */
1069
              ResetBlockAckInactivityTimerIfNeeded (it->second.first);
1040
              ResetBlockAckInactivityTimerIfNeeded (it->second.first);
1070
              if ((*it).second.first.IsImmediateBlockAck ())
1041
              if ((*it).second.first.IsImmediateBlockAck ())
 Lines 1082-1088    Link Here 
1082
                {
1053
                {
1083
                  NS_FATAL_ERROR ("Delayed block ack not supported.");
1054
                  NS_FATAL_ERROR ("Delayed block ack not supported.");
1084
                }
1055
                }
1085
              m_receivedAtLeastOneMpdu = false;
1086
            }
1056
            }
1087
          else
1057
          else
1088
            {
1058
            {
 Lines 1097-1103    Link Here 
1097
  else if (hdr.IsCtl ())
1067
  else if (hdr.IsCtl ())
1098
    {
1068
    {
1099
      NS_LOG_DEBUG ("rx drop " << hdr.GetTypeString ());
1069
      NS_LOG_DEBUG ("rx drop " << hdr.GetTypeString ());
1100
      m_receivedAtLeastOneMpdu = false;
1101
    }
1070
    }
1102
  else if (hdr.GetAddr1 () == m_self)
1071
  else if (hdr.GetAddr1 () == m_self)
1103
    {
1072
    {
 Lines 1125-1131    Link Here 
1125
                                                    hdr.GetDuration (),
1094
                                                    hdr.GetDuration (),
1126
                                                    txVector.GetMode (),
1095
                                                    txVector.GetMode (),
1127
                                                    rxSnr);
1096
                                                    rxSnr);
1128
              m_receivedAtLeastOneMpdu = false;
1129
            }
1097
            }
1130
          else if (hdr.IsQosBlockAck ())
1098
          else if (hdr.IsQosBlockAck ())
1131
            {
1099
            {
 Lines 1176-1182    Link Here 
1176
                                                    hdr.GetDuration (),
1144
                                                    hdr.GetDuration (),
1177
                                                    txVector.GetMode (),
1145
                                                    txVector.GetMode (),
1178
                                                    rxSnr);
1146
                                                    rxSnr);
1179
              m_receivedAtLeastOneMpdu = false;
1180
            }
1147
            }
1181
        }
1148
        }
1182
      goto rxPacket;
1149
      goto rxPacket;
 Lines 1192-1198    Link Here 
1192
          if (hdr.IsData () || hdr.IsMgt ())
1159
          if (hdr.IsData () || hdr.IsMgt ())
1193
            {
1160
            {
1194
              NS_LOG_DEBUG ("rx group from=" << hdr.GetAddr2 ());
1161
              NS_LOG_DEBUG ("rx group from=" << hdr.GetAddr2 ());
1195
              m_receivedAtLeastOneMpdu = false;
1196
              goto rxPacket;
1162
              goto rxPacket;
1197
            }
1163
            }
1198
          else
1164
          else
 Lines 1677-1682    Link Here 
1677
      AmpduTag ampdutag;
1643
      AmpduTag ampdutag;
1678
      ampdutag.SetAmpdu (true);
1644
      ampdutag.SetAmpdu (true);
1679
      Time delay = Seconds (0);
1645
      Time delay = Seconds (0);
1646
      Time remainingAmpduDuration = m_phy->CalculateTxDuration (packet->GetSize (), txVector, preamble, m_phy->GetFrequency ());
1680
      if (queueSize > 1 || vhtSingleMpdu)
1647
      if (queueSize > 1 || vhtSingleMpdu)
1681
        {
1648
        {
1682
          txVector.SetAggregation (true);
1649
          txVector.SetAggregation (true);
 Lines 1695-1704    Link Here 
1695
            }
1662
            }
1696
1663
1697
          listenerIt->second->GetMpduAggregator ()->AddHeaderAndPad (newPacket, last, vhtSingleMpdu);
1664
          listenerIt->second->GetMpduAggregator ()->AddHeaderAndPad (newPacket, last, vhtSingleMpdu);
1698
1665
          
1699
          ampdutag.SetNoOfMpdus (queueSize);
1700
          newPacket->AddPacketTag (ampdutag);
1701
1702
          if (delay == Seconds (0))
1666
          if (delay == Seconds (0))
1703
            {
1667
            {
1704
              if (!vhtSingleMpdu)
1668
              if (!vhtSingleMpdu)
 Lines 1710-1715    Link Here 
1710
                {
1674
                {
1711
                  mpdutype = NORMAL_MPDU;
1675
                  mpdutype = NORMAL_MPDU;
1712
                }
1676
                }
1677
            }
1678
          
1679
          Time mpduDuration = m_phy->CalculateTxDuration (newPacket->GetSize (), txVector, preamble, m_phy->GetFrequency (), mpdutype, 0);
1680
          remainingAmpduDuration -= mpduDuration;
1681
1682
          ampdutag.SetRemainingNbOfMpdus (queueSize - 1);
1683
          ampdutag.SetRemainingAmpduDuration (remainingAmpduDuration);
1684
          newPacket->AddPacketTag (ampdutag);
1685
1686
          if (delay == Seconds (0))
1687
            {
1713
              m_phy->SendPacket (newPacket, txVector, preamble, mpdutype);
1688
              m_phy->SendPacket (newPacket, txVector, preamble, mpdutype);
1714
            }
1689
            }
1715
          else
1690
          else
 Lines 1718-1725    Link Here 
1718
            }
1693
            }
1719
          if (queueSize > 1)
1694
          if (queueSize > 1)
1720
            {
1695
            {
1721
              delay = delay + m_phy->CalculateTxDuration (GetSize (newPacket, &newHdr), txVector, preamble, m_phy->GetFrequency (), mpdutype, 0);
1696
              delay = delay + mpduDuration;
1722
            }
1697
            }
1698
1723
          preamble = WIFI_PREAMBLE_NONE;
1699
          preamble = WIFI_PREAMBLE_NONE;
1724
        }
1700
        }
1725
    }
1701
    }
 Lines 2668-2674    Link Here 
2668
      StartDataTxTimers (blockAckReqTxVector);
2644
      StartDataTxTimers (blockAckReqTxVector);
2669
    }
2645
    }
2670
2646
2671
  NS_ASSERT (duration >= MicroSeconds (0));
2647
  NS_ASSERT (duration >= NanoSeconds (0));
2672
  hdr.SetDuration (duration);
2648
  hdr.SetDuration (duration);
2673
  //here should be present a control about immediate or delayed block ack
2649
  //here should be present a control about immediate or delayed block ack
2674
  //for now we assume immediate
2650
  //for now we assume immediate
 Lines 2813-2819    Link Here 
2813
  if (aggregatedPacket->RemovePacketTag (ampdu))
2789
  if (aggregatedPacket->RemovePacketTag (ampdu))
2814
    {
2790
    {
2815
      ampduSubframe = true;
2791
      ampduSubframe = true;
2816
      m_currentTxVector = txVector;
2817
      MpduAggregator::DeaggregatedMpdus packets = MpduAggregator::Deaggregate (aggregatedPacket);
2792
      MpduAggregator::DeaggregatedMpdus packets = MpduAggregator::Deaggregate (aggregatedPacket);
2818
      MpduAggregator::DeaggregatedMpdusCI n = packets.begin ();
2793
      MpduAggregator::DeaggregatedMpdusCI n = packets.begin ();
2819
2794
 Lines 2829-2841    Link Here 
2829
          NS_LOG_DEBUG ("Receive VHT single MPDU");
2804
          NS_LOG_DEBUG ("Receive VHT single MPDU");
2830
          ampduSubframe = false;
2805
          ampduSubframe = false;
2831
        }
2806
        }
2807
      else if (preamble != WIFI_PREAMBLE_NONE || !m_sendAckEvent.IsRunning ())
2808
        {
2809
          m_sendAckEvent = Simulator::Schedule (ampdu.GetRemainingAmpduDuration () + GetSifs (),
2810
                                                &MacLow::SendBlockAckAfterAmpdu, this,
2811
                                                firsthdr.GetQosTid (),
2812
                                                firsthdr.GetAddr2 (),
2813
                                                firsthdr.GetDuration (),
2814
                                                txVector,
2815
                                                rxSnr);
2816
        }
2832
2817
2833
      if (firsthdr.GetAddr1 () == m_self)
2818
      if (firsthdr.GetAddr1 () == m_self)
2834
        {
2819
        {
2835
          if (!vhtSingleMpdu)
2836
            {
2837
              m_receivedAtLeastOneMpdu = true;
2838
            }
2839
          if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ())
2820
          if (firsthdr.IsAck () || firsthdr.IsBlockAck () || firsthdr.IsBlockAckReq ())
2840
            {
2821
            {
2841
              ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe);
2822
              ReceiveOk ((*n).first, rxSnr, txVector, preamble, ampduSubframe);
 Lines 2856-2862    Link Here 
2856
            }
2837
            }
2857
        }
2838
        }
2858
2839
2859
      if (ampdu.GetNoOfMpdus () == 1 && !vhtSingleMpdu)
2840
      if (ampdu.GetRemainingNbOfMpdus () == 0 && !vhtSingleMpdu)
2860
        {
2841
        {
2861
          if (normalAck)
2842
          if (normalAck)
2862
            {
2843
            {
 Lines 2869-2892    Link Here 
2869
              AgreementsI it = m_bAckAgreements.find (std::make_pair (firsthdr.GetAddr2 (), tid));
2850
              AgreementsI it = m_bAckAgreements.find (std::make_pair (firsthdr.GetAddr2 (), tid));
2870
              if (it != m_bAckAgreements.end ())
2851
              if (it != m_bAckAgreements.end ())
2871
                {
2852
                {
2872
                  NS_ASSERT (m_sendAckEvent.IsExpired ());
2873
                  /* See section 11.5.3 in IEEE 802.11 for mean of this timer */
2853
                  /* See section 11.5.3 in IEEE 802.11 for mean of this timer */
2874
                  ResetBlockAckInactivityTimerIfNeeded (it->second.first);
2854
                  ResetBlockAckInactivityTimerIfNeeded (it->second.first);
2875
                  NS_LOG_DEBUG ("rx A-MPDU/sendImmediateBlockAck from=" << firsthdr.GetAddr2 ());
2855
                  NS_LOG_DEBUG ("rx A-MPDU/sendImmediateBlockAck from=" << firsthdr.GetAddr2 ());
2876
                  m_sendAckEvent = Simulator::Schedule (GetSifs (),
2856
                  NS_ASSERT (m_sendAckEvent.IsRunning ());
2877
                                                        &MacLow::SendBlockAckAfterAmpdu, this,
2878
                                                        firsthdr.GetQosTid (),
2879
                                                        firsthdr.GetAddr2 (),
2880
                                                        firsthdr.GetDuration (),
2881
                                                        txVector,
2882
                                                        rxSnr);
2883
                }
2857
                }
2884
              else
2858
              else
2885
                {
2859
                {
2886
                  NS_LOG_DEBUG ("There's not a valid agreement for this block ack request.");
2860
                  NS_LOG_DEBUG ("There's not a valid agreement for this block ack request.");
2887
                }
2861
                }
2888
            }
2862
            }
2889
          m_receivedAtLeastOneMpdu = false;
2890
        }
2863
        }
2891
    }
2864
    }
2892
  else
2865
  else
 Lines 3173-3188    Link Here 
3173
                      listenerIt->second->GetMpduAggregator ()->Aggregate (newPacket, currentAggregatedPacket);
3146
                      listenerIt->second->GetMpduAggregator ()->Aggregate (newPacket, currentAggregatedPacket);
3174
                      currentAggregatedPacket->AddHeader (blockAckReq);
3147
                      currentAggregatedPacket->AddHeader (blockAckReq);
3175
                    }
3148
                    }
3149
3176
                  if (qosPolicy == 0)
3150
                  if (qosPolicy == 0)
3177
                    {
3151
                    {
3178
                      listenerIt->second->CompleteTransfer (hdr.GetAddr1 (), tid);
3152
                      listenerIt->second->CompleteTransfer (hdr.GetAddr1 (), tid);
3179
                    }
3153
                    }
3154
3180
                  //Add packet tag
3155
                  //Add packet tag
3181
                  AmpduTag ampdutag;
3156
                  AmpduTag ampdutag;
3182
                  ampdutag.SetAmpdu (true);
3157
                  ampdutag.SetAmpdu (true);
3183
                  ampdutag.SetNoOfMpdus (i);
3158
                  ampdutag.SetRemainingNbOfMpdus (i - 1);
3184
                  newPacket = currentAggregatedPacket;
3159
                  newPacket = currentAggregatedPacket;
3185
                  newPacket->AddPacketTag (ampdutag);
3160
                  newPacket->AddPacketTag (ampdutag);
3161
3186
                  NS_LOG_DEBUG ("tx unicast A-MPDU");
3162
                  NS_LOG_DEBUG ("tx unicast A-MPDU");
3187
                  listenerIt->second->SetAmpdu (hdr.GetAddr1 (), true);
3163
                  listenerIt->second->SetAmpdu (hdr.GetAddr1 (), true);
3188
                }
3164
                }
 Lines 3217-3224    Link Here 
3217
              //Add packet tag
3193
              //Add packet tag
3218
              AmpduTag ampdutag;
3194
              AmpduTag ampdutag;
3219
              ampdutag.SetAmpdu (true);
3195
              ampdutag.SetAmpdu (true);
3220
              ampdutag.SetNoOfMpdus (1);
3221
3222
              newPacket = currentAggregatedPacket;
3196
              newPacket = currentAggregatedPacket;
3223
              newPacket->AddHeader (peekedHdr);
3197
              newPacket->AddHeader (peekedHdr);
3224
              WifiMacTrailer fcs;
3198
              WifiMacTrailer fcs;
(-)a/src/wifi/model/mac-low.h (-2 / +1 lines)
 Lines 736-742    Link Here 
736
   * This method is typically invoked by the lower PHY layer to notify
736
   * This method is typically invoked by the lower PHY layer to notify
737
   * the MAC layer that a packet was unsuccessfully received.
737
   * the MAC layer that a packet was unsuccessfully received.
738
   */
738
   */
739
  void ReceiveError (Ptr<Packet> packet, double rxSnr, bool isEndOfFrame);
739
  void ReceiveError (Ptr<Packet> packet, double rxSnr);
740
  /**
740
  /**
741
   * \param duration switching delay duration.
741
   * \param duration switching delay duration.
742
   *
742
   *
 Lines 1378-1384    Link Here 
1378
  uint8_t m_sentMpdus;                //!< Number of transmitted MPDUs in an A-MPDU that have not been acknowledged yet
1378
  uint8_t m_sentMpdus;                //!< Number of transmitted MPDUs in an A-MPDU that have not been acknowledged yet
1379
  Ptr<WifiMacQueue> m_aggregateQueue; //!< Queue used for MPDU aggregation
1379
  Ptr<WifiMacQueue> m_aggregateQueue; //!< Queue used for MPDU aggregation
1380
  WifiTxVector m_currentTxVector;     //!< TXVECTOR used for the current packet transmission
1380
  WifiTxVector m_currentTxVector;     //!< TXVECTOR used for the current packet transmission
1381
  bool m_receivedAtLeastOneMpdu;      //!< Flag whether an MPDU has already been successfully received while receiving an A-MPDU
1382
  std::vector<Item> m_txPackets;      //!< Contain temporary items to be sent with the next A-MPDU transmission, once RTS/CTS exchange has succeeded. It is not used in other cases.
1381
  std::vector<Item> m_txPackets;      //!< Contain temporary items to be sent with the next A-MPDU transmission, once RTS/CTS exchange has succeeded. It is not used in other cases.
1383
  uint32_t m_nTxMpdus;                //!<Holds the number of transmitted MPDUs in the last A-MPDU transmission
1382
  uint32_t m_nTxMpdus;                //!<Holds the number of transmitted MPDUs in the last A-MPDU transmission
1384
};
1383
};
(-)a/src/wifi/model/wifi-phy-state-helper.cc (-2 / +2 lines)
 Lines 442-455    Link Here 
442
}
442
}
443
443
444
void
444
void
445
WifiPhyStateHelper::SwitchFromRxEndError (Ptr<Packet> packet, double snr, bool isEndOfFrame)
445
WifiPhyStateHelper::SwitchFromRxEndError (Ptr<Packet> packet, double snr)
446
{
446
{
447
  m_rxErrorTrace (packet, snr);
447
  m_rxErrorTrace (packet, snr);
448
  NotifyRxEndError ();
448
  NotifyRxEndError ();
449
  DoSwitchFromRx ();
449
  DoSwitchFromRx ();
450
  if (!m_rxErrorCallback.IsNull ())
450
  if (!m_rxErrorCallback.IsNull ())
451
    {
451
    {
452
      m_rxErrorCallback (packet, snr, isEndOfFrame);
452
      m_rxErrorCallback (packet, snr);
453
    }
453
    }
454
}
454
}
455
455
(-)a/src/wifi/model/wifi-phy-state-helper.h (-4 / +2 lines)
 Lines 167-175    Link Here 
167
   *
167
   *
168
   * \param packet the packet that we failed to received
168
   * \param packet the packet that we failed to received
169
   * \param snr the SNR of the received packet
169
   * \param snr the SNR of the received packet
170
   * \param isEndOfFrame PHY-RXEND indication.
171
   */
170
   */
172
  void SwitchFromRxEndError (Ptr<Packet> packet, double snr, bool isEndOfFrame);
171
  void SwitchFromRxEndError (Ptr<Packet> packet, double snr);
173
  /**
172
  /**
174
   * Switch to CCA busy.
173
   * Switch to CCA busy.
175
   *
174
   *
 Lines 217-226    Link Here 
217
   *
216
   *
218
   * \param [in] packet       The received packet.
217
   * \param [in] packet       The received packet.
219
   * \param [in] snr          The SNR of the received packet.
218
   * \param [in] snr          The SNR of the received packet.
220
   * \param [in] isEndOfFrame PHY-RXEND indication..
221
   */
219
   */
222
  typedef void (* RxEndErrorTracedCallback)
220
  typedef void (* RxEndErrorTracedCallback)
223
    (Ptr<const Packet> packet, double snr, bool isEndOfFrame);
221
    (Ptr<const Packet> packet, double snr);
224
222
225
  /**
223
  /**
226
   * TracedCallback signature for transmit event.
224
   * TracedCallback signature for transmit event.
(-)a/src/wifi/model/wifi-phy.h (-2 / +1 lines)
 Lines 192-200    Link Here 
192
  /**
192
  /**
193
   * arg1: packet received unsuccessfully
193
   * arg1: packet received unsuccessfully
194
   * arg2: snr of packet
194
   * arg2: snr of packet
195
   * arg3: PHY-RXEND flag
196
   */
195
   */
197
  typedef Callback<void, Ptr<Packet>, double, bool> RxErrorCallback;
196
  typedef Callback<void, Ptr<Packet>, double> RxErrorCallback;
198
197
199
  static TypeId GetTypeId (void);
198
  static TypeId GetTypeId (void);
200
199
(-)a/src/wifi/model/yans-wifi-phy.cc (-8 / +6 lines)
 Lines 655-670    Link Here 
655
          else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0)
655
          else if (preamble != WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum == 0)
656
            {
656
            {
657
              //received the first MPDU in an MPDU
657
              //received the first MPDU in an MPDU
658
              m_mpdusNum = ampduTag.GetNoOfMpdus () - 1;
658
              m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
659
              m_rxMpduReferenceNumber++;
659
              m_rxMpduReferenceNumber++;
660
            }
660
            }
661
          else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
661
          else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
662
            {
662
            {
663
              //received the other MPDUs that are part of the A-MPDU
663
              //received the other MPDUs that are part of the A-MPDU
664
              if (ampduTag.GetNoOfMpdus () < m_mpdusNum)
664
              if (ampduTag.GetRemainingNbOfMpdus () < (m_mpdusNum - 1))
665
                {
665
                {
666
                  NS_LOG_DEBUG ("Missing MPDU from the A-MPDU " << m_mpdusNum - ampduTag.GetNoOfMpdus ());
666
                  NS_LOG_DEBUG ("Missing MPDU from the A-MPDU " << m_mpdusNum - ampduTag.GetRemainingNbOfMpdus ());
667
                  m_mpdusNum = ampduTag.GetNoOfMpdus ();
667
                  m_mpdusNum = ampduTag.GetRemainingNbOfMpdus ();
668
                }
668
                }
669
              else
669
              else
670
                {
670
                {
 Lines 1235-1248    Link Here 
1235
        {
1235
        {
1236
          /* failure. */
1236
          /* failure. */
1237
          NotifyRxDrop (packet);
1237
          NotifyRxDrop (packet);
1238
          bool isEndOfFrame = ((mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE) || (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE));
1238
          m_state->SwitchFromRxEndError (packet, snrPer.snr);
1239
          m_state->SwitchFromRxEndError (packet, snrPer.snr, isEndOfFrame);
1240
        }
1239
        }
1241
    }
1240
    }
1242
  else
1241
  else
1243
    {
1242
    {
1244
      bool isEndOfFrame = ((mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE) || (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE));
1243
      m_state->SwitchFromRxEndError (packet, snrPer.snr);
1245
      m_state->SwitchFromRxEndError (packet, snrPer.snr, isEndOfFrame);
1246
    }
1244
    }
1247
1245
1248
  if (preamble == WIFI_PREAMBLE_NONE && mpdutype == LAST_MPDU_IN_AGGREGATE)
1246
  if (preamble == WIFI_PREAMBLE_NONE && mpdutype == LAST_MPDU_IN_AGGREGATE)

Return to bug 2307