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

(-)a/src/wifi/model/block-ack-manager.cc (-6 / +7 lines)
 Lines 536-541    Link Here 
536
      if (ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED))
536
      if (ExistsAgreementInState (recipient, tid, OriginatorBlockAckAgreement::ESTABLISHED))
537
        {
537
        {
538
          bool foundFirstLost = false;
538
          bool foundFirstLost = false;
539
          uint32_t nSuccessfulMpdus = 0;
540
          uint32_t nFailedMpdus = 0;
539
          AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
541
          AgreementsI it = m_agreements.find (std::make_pair (recipient, tid));
540
          PacketQueueI queueEnd = it->second.second.end ();
542
          PacketQueueI queueEnd = it->second.second.end ();
541
543
 Lines 558-563    Link Here 
558
                  if (blockAck->IsFragmentReceived ((*queueIt).hdr.GetSequenceNumber (),
560
                  if (blockAck->IsFragmentReceived ((*queueIt).hdr.GetSequenceNumber (),
559
                                                    (*queueIt).hdr.GetFragmentNumber ()))
561
                                                    (*queueIt).hdr.GetFragmentNumber ()))
560
                    {
562
                    {
563
                      nSuccessfulMpdus++;
561
                      queueIt = it->second.second.erase (queueIt);
564
                      queueIt = it->second.second.erase (queueIt);
562
                    }
565
                    }
563
                  else
566
                  else
 Lines 568-579    Link Here 
568
                          sequenceFirstLost = (*queueIt).hdr.GetSequenceNumber ();
571
                          sequenceFirstLost = (*queueIt).hdr.GetSequenceNumber ();
569
                          (*it).second.first.SetStartingSequence (sequenceFirstLost);
572
                          (*it).second.first.SetStartingSequence (sequenceFirstLost);
570
                        }
573
                        }
571
574
                      nFailedMpdus++;
572
                      if (!AlreadyExists ((*queueIt).hdr.GetSequenceNumber (),recipient,tid))
575
                      if (!AlreadyExists ((*queueIt).hdr.GetSequenceNumber (),recipient,tid))
573
                        {
576
                        {
574
                          InsertInRetryQueue (queueIt);
577
                          InsertInRetryQueue (queueIt);
575
                        }
578
                        }
576
577
                      queueIt++;
579
                      queueIt++;
578
                    }
580
                    }
579
                }
581
                }
 Lines 588-595    Link Here 
588
                      while (queueIt != queueEnd
590
                      while (queueIt != queueEnd
589
                             && (*queueIt).hdr.GetSequenceNumber () == currentSeq)
591
                             && (*queueIt).hdr.GetSequenceNumber () == currentSeq)
590
                        {
592
                        {
591
                          //notify remote station of successful transmission
593
                          nSuccessfulMpdus++;
592
                          m_stationManager->ReportDataOk ((*queueIt).hdr.GetAddr1 (), &(*queueIt).hdr, 0, txMode, 0);
593
                          if (!m_txOkCallback.IsNull ())
594
                          if (!m_txOkCallback.IsNull ())
594
                            {
595
                            {
595
                              m_txOkCallback ((*queueIt).hdr);
596
                              m_txOkCallback ((*queueIt).hdr);
 Lines 605-612    Link Here 
605
                          sequenceFirstLost = (*queueIt).hdr.GetSequenceNumber ();
606
                          sequenceFirstLost = (*queueIt).hdr.GetSequenceNumber ();
606
                          (*it).second.first.SetStartingSequence (sequenceFirstLost);
607
                          (*it).second.first.SetStartingSequence (sequenceFirstLost);
607
                        }
608
                        }
608
                      //notify remote station of unsuccessful transmission
609
                      nFailedMpdus++;
609
                      m_stationManager->ReportDataFailed ((*queueIt).hdr.GetAddr1 (), &(*queueIt).hdr);
610
                      if (!m_txFailedCallback.IsNull ())
610
                      if (!m_txFailedCallback.IsNull ())
611
                        {
611
                        {
612
                          m_txFailedCallback ((*queueIt).hdr);
612
                          m_txFailedCallback ((*queueIt).hdr);
 Lines 619-624    Link Here 
619
                    }
619
                    }
620
                }
620
                }
621
            }
621
            }
622
          m_stationManager->ReportAmpduTxStatus (recipient, tid, nSuccessfulMpdus, nFailedMpdus);
622
          uint16_t newSeq = m_txMiddle->GetNextSeqNumberByTidAndAddress (tid, recipient);
623
          uint16_t newSeq = m_txMiddle->GetNextSeqNumberByTidAndAddress (tid, recipient);
623
          if ((foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, sequenceFirstLost))
624
          if ((foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, sequenceFirstLost))
624
              || (!foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, newSeq)))
625
              || (!foundFirstLost && !SwitchToBlockAckIfNeeded (recipient, tid, newSeq)))
(-)a/src/wifi/model/edca-txop-n.cc (-7 / +24 lines)
 Lines 119-127    Link Here 
119
  {
119
  {
120
    m_txop->GotBlockAck (blockAck, source,txMode);
120
    m_txop->GotBlockAck (blockAck, source,txMode);
121
  }
121
  }
122
  virtual void MissedBlockAck (void)
122
  virtual void MissedBlockAck (uint32_t nMpdus)
123
  {
123
  {
124
    m_txop->MissedBlockAck ();
124
    m_txop->MissedBlockAck (nMpdus);
125
  }
125
  }
126
  virtual void StartNext (void)
126
  virtual void StartNext (void)
127
  {
127
  {
 Lines 864-873    Link Here 
864
}
864
}
865
865
866
void
866
void
867
EdcaTxopN::MissedBlockAck (void)
867
EdcaTxopN::MissedBlockAck (uint32_t nMpdus)
868
{
868
{
869
  NS_LOG_FUNCTION (this);
869
  NS_LOG_FUNCTION (this);
870
  NS_LOG_DEBUG ("missed block ack");
870
  NS_LOG_DEBUG ("missed block ack");
871
  uint8_t tid = 0;
872
  if (m_currentHdr.IsQosData ())
873
    {
874
      tid = m_currentHdr.GetQosTid ();
875
    }
876
  else if (m_currentHdr.IsBlockAckReq ())
877
    {
878
      CtrlBAckRequestHeader baReqHdr;
879
      m_currentPacket->PeekHeader (baReqHdr);
880
      tid = baReqHdr.GetTidInfo ();
881
    }
882
  else if (m_currentHdr.IsBlockAck ())
883
    {
884
      CtrlBAckResponseHeader baRespHdr;
885
      m_currentPacket->PeekHeader (baRespHdr);
886
      tid = baRespHdr.GetTidInfo ();
887
    }
888
  if (GetAmpduExist (m_currentHdr.GetAddr1 ()))
889
    {
890
      m_stationManager->ReportAmpduTxStatus (m_currentHdr.GetAddr1 (), tid, 0, nMpdus);
891
    }
871
  if (NeedBarRetransmission ())
892
  if (NeedBarRetransmission ())
872
    {
893
    {
873
      if (!GetAmpduExist (m_currentHdr.GetAddr1 ()))
894
      if (!GetAmpduExist (m_currentHdr.GetAddr1 ()))
 Lines 882-905    Link Here 
882
          NS_LOG_DEBUG ("Transmit Block Ack Request");
903
          NS_LOG_DEBUG ("Transmit Block Ack Request");
883
          CtrlBAckRequestHeader reqHdr;
904
          CtrlBAckRequestHeader reqHdr;
884
          reqHdr.SetType (COMPRESSED_BLOCK_ACK);
905
          reqHdr.SetType (COMPRESSED_BLOCK_ACK);
885
          uint8_t tid = 0;
886
          if (m_currentHdr.IsQosData ())
906
          if (m_currentHdr.IsQosData ())
887
            {
907
            {
888
              tid = m_currentHdr.GetQosTid ();
889
              reqHdr.SetStartingSequence (m_currentHdr.GetSequenceNumber ());
908
              reqHdr.SetStartingSequence (m_currentHdr.GetSequenceNumber ());
890
            }
909
            }
891
          else if (m_currentHdr.IsBlockAckReq ())
910
          else if (m_currentHdr.IsBlockAckReq ())
892
            {
911
            {
893
              CtrlBAckRequestHeader baReqHdr;
912
              CtrlBAckRequestHeader baReqHdr;
894
              m_currentPacket->PeekHeader (baReqHdr);
913
              m_currentPacket->PeekHeader (baReqHdr);
895
              tid = baReqHdr.GetTidInfo ();
896
              reqHdr.SetStartingSequence (baReqHdr.GetStartingSequence ());
914
              reqHdr.SetStartingSequence (baReqHdr.GetStartingSequence ());
897
            }
915
            }
898
          else if (m_currentHdr.IsBlockAck ())
916
          else if (m_currentHdr.IsBlockAck ())
899
            {
917
            {
900
              CtrlBAckResponseHeader baRespHdr;
918
              CtrlBAckResponseHeader baRespHdr;
901
              m_currentPacket->PeekHeader (baRespHdr);
919
              m_currentPacket->PeekHeader (baRespHdr);
902
              tid = baRespHdr.GetTidInfo ();
903
              reqHdr.SetStartingSequence (m_currentHdr.GetSequenceNumber ());
920
              reqHdr.SetStartingSequence (m_currentHdr.GetSequenceNumber ());
904
            }
921
            }
905
          reqHdr.SetTidInfo (tid);
922
          reqHdr.SetTidInfo (tid);
(-)a/src/wifi/model/edca-txop-n.h (-1 / +1 lines)
 Lines 268-274    Link Here 
268
  /**
268
  /**
269
   * Event handler when a Block ACK timeout has occurred.
269
   * Event handler when a Block ACK timeout has occurred.
270
   */
270
   */
271
  void MissedBlockAck (void);
271
  void MissedBlockAck (uint32_t nMpdus);
272
  void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient);
272
  void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient);
273
  void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient);
273
  void GotDelBaFrame (const MgtDelBaHeader *delBaHdr, Mac48Address recipient);
274
  /**
274
  /**
(-)a/src/wifi/model/mac-low.cc (-5 / +5 lines)
 Lines 55-61    Link Here 
55
{
55
{
56
}
56
}
57
void
57
void
58
MacLowTransmissionListener::MissedBlockAck (void)
58
MacLowTransmissionListener::MissedBlockAck (uint32_t nMpdus)
59
{
59
{
60
}
60
}
61
61
 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)
371
    m_receivedAtLeastOneMpdu (false),
372
    m_nTxMpdus (0)
372
{
373
{
373
  NS_LOG_FUNCTION (this);
374
  NS_LOG_FUNCTION (this);
374
  m_lastNavDuration = Seconds (0);
375
  m_lastNavDuration = Seconds (0);
 Lines 1645-1650    Link Here 
1645
      Ptr <const Packet> dequeuedPacket;
1646
      Ptr <const Packet> dequeuedPacket;
1646
      WifiMacHeader newHdr;
1647
      WifiMacHeader newHdr;
1647
      WifiMacTrailer fcs;
1648
      WifiMacTrailer fcs;
1649
      m_nTxMpdus = m_aggregateQueue->GetSize ();
1648
      uint32_t queueSize = m_aggregateQueue->GetSize ();
1650
      uint32_t queueSize = m_aggregateQueue->GetSize ();
1649
      bool vhtSingleMpdu = false;
1651
      bool vhtSingleMpdu = false;
1650
      bool last = false;
1652
      bool last = false;
 Lines 1778-1791    Link Here 
1778
{
1780
{
1779
  NS_LOG_FUNCTION (this);
1781
  NS_LOG_FUNCTION (this);
1780
  NS_LOG_DEBUG ("block ack timeout");
1782
  NS_LOG_DEBUG ("block ack timeout");
1781
1782
  m_stationManager->ReportDataFailed (m_currentHdr.GetAddr1 (), &m_currentHdr);
1783
  MacLowTransmissionListener *listener = m_listener;
1783
  MacLowTransmissionListener *listener = m_listener;
1784
  m_listener = 0;
1784
  m_listener = 0;
1785
  m_sentMpdus = 0;
1785
  m_sentMpdus = 0;
1786
  m_ampdu = false;
1786
  m_ampdu = false;
1787
  FlushAggregateQueue ();
1787
  FlushAggregateQueue ();
1788
  listener->MissedBlockAck ();
1788
  listener->MissedBlockAck (m_nTxMpdus);
1789
}
1789
}
1790
1790
1791
void
1791
void
(-)a/src/wifi/model/mac-low.h (-1 / +4 lines)
 Lines 109-114    Link Here 
109
   */
109
   */
110
  virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source, WifiMode txMode);
110
  virtual void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address source, WifiMode txMode);
111
  /**
111
  /**
112
   * \param nMpdus number of MPDUs that were transmitted in the unsuccesful A-MPDU transmission
113
   *
112
   * ns3::MacLow did not receive an expected BLOCK_ACK within
114
   * ns3::MacLow did not receive an expected BLOCK_ACK within
113
   * BlockAckTimeout. This method is used only for immediate
115
   * BlockAckTimeout. This method is used only for immediate
114
   * block ack variant. With delayed block ack, the MissedAck method will be
116
   * block ack variant. With delayed block ack, the MissedAck method will be
 Lines 117-123    Link Here 
117
   * will send the block ack back to the tx station which will reply with a
119
   * will send the block ack back to the tx station which will reply with a
118
   * normal ack to the rx station.
120
   * normal ack to the rx station.
119
   */
121
   */
120
  virtual void MissedBlockAck (void);
122
  virtual void MissedBlockAck (uint32_t nMpdus);
121
  /**
123
  /**
122
   * Invoked when ns3::MacLow wants to start a new transmission
124
   * Invoked when ns3::MacLow wants to start a new transmission
123
   * as configured by MacLowTransmissionParameters::EnableNextData.
125
   * as configured by MacLowTransmissionParameters::EnableNextData.
 Lines 1374-1379    Link Here 
1374
  WifiTxVector m_currentTxVector;     //!< TXVECTOR used for the current packet transmission
1376
  WifiTxVector m_currentTxVector;     //!< TXVECTOR used for the current packet transmission
1375
  bool m_receivedAtLeastOneMpdu;      //!< Flag whether an MPDU has already been successfully received while receiving an A-MPDU
1377
  bool m_receivedAtLeastOneMpdu;      //!< Flag whether an MPDU has already been successfully received while receiving an A-MPDU
1376
  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.
1378
  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.
1379
  uint32_t m_nTxMpdus;                //!<Holds the number of transmitted MPDUs in the last A-MPDU transmission
1377
};
1380
};
1378
1381
1379
} //namespace ns3
1382
} //namespace ns3
(-)a/src/wifi/model/wifi-remote-station-manager.cc (+16 lines)
 Lines 871-876    Link Here 
871
  DoReportRxOk (station, rxSnr, txMode);
871
  DoReportRxOk (station, rxSnr, txMode);
872
}
872
}
873
873
874
void
875
WifiRemoteStationManager::ReportAmpduTxStatus (Mac48Address address, uint8_t tid,
876
                                               uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus)
877
{
878
  NS_LOG_FUNCTION (this << address << (uint16_t)tid << nSuccessfulMpdus << nFailedMpdus);
879
  NS_ASSERT (!address.IsGroup ());
880
  WifiRemoteStation *station = Lookup (address, tid);
881
  DoReportAmpduTxStatus (station, nSuccessfulMpdus, nFailedMpdus);
882
}
883
874
bool
884
bool
875
WifiRemoteStationManager::NeedRts (Mac48Address address, const WifiMacHeader *header,
885
WifiRemoteStationManager::NeedRts (Mac48Address address, const WifiMacHeader *header,
876
                                   Ptr<const Packet> packet, WifiTxVector txVector)
886
                                   Ptr<const Packet> packet, WifiTxVector txVector)
 Lines 1705-1710    Link Here 
1705
  return normally;
1715
  return normally;
1706
}
1716
}
1707
1717
1718
void
1719
WifiRemoteStationManager::DoReportAmpduTxStatus (WifiRemoteStation *station, uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus)
1720
{
1721
  NS_LOG_DEBUG ("DoReportAmpduTxStatus received but the manager does not handle A-MPDUs!");
1722
}
1723
1708
WifiMode
1724
WifiMode
1709
WifiRemoteStationManager::GetSupported (const WifiRemoteStation *station, uint32_t i) const
1725
WifiRemoteStationManager::GetSupported (const WifiRemoteStation *station, uint32_t i) const
1710
{
1726
{
(-)a/src/wifi/model/wifi-remote-station-manager.h (+23 lines)
 Lines 585-590    Link Here 
585
   * \param header MAC header of the DATA packet
585
   * \param header MAC header of the DATA packet
586
   */
586
   */
587
  void ReportFinalDataFailed (Mac48Address address, const WifiMacHeader *header);
587
  void ReportFinalDataFailed (Mac48Address address, const WifiMacHeader *header);
588
  /**
589
   * Typically called per A-MPDU, either when a Block ACK was successfully 
590
   * received or when a BlockAckTimeout has elapsed.
591
   *
592
   * \param address the address of the receiver
593
   * \param tid TID of the DATA packet
594
   * \param nSuccessfulMpdus number of successfully transmitted MPDUs.
595
   * A value of 0 means that the Block ACK was missed.
596
   * \param nFailedMpdus number of unsuccessfully transmitted MPDUs.
597
   */
598
  void ReportAmpduTxStatus (Mac48Address address, uint8_t tid, uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus);
588
599
589
  /**
600
  /**
590
   * \param address remote address
601
   * \param address remote address
 Lines 1084-1089    Link Here 
1084
   */
1095
   */
1085
  virtual void DoReportRxOk (WifiRemoteStation *station,
1096
  virtual void DoReportRxOk (WifiRemoteStation *station,
1086
                             double rxSnr, WifiMode txMode) = 0;
1097
                             double rxSnr, WifiMode txMode) = 0;
1098
  /**
1099
   * Typically called per A-MPDU, either when a Block ACK was successfully received
1100
   * or when a BlockAckTimeout has elapsed. This method is a virtual method that must
1101
   * be implemented by the sub-class intended to handle A-MPDUs. This allows different
1102
   * types of WifiRemoteStationManager to respond differently.
1103
   *
1104
   * \param station the station that sent the DATA to us
1105
   * \param nSuccessfulMpdus number of successfully transmitted MPDUs.
1106
   *        A value of 0 means that the Block ACK was missed.
1107
   * \param nFailedMpdus number of unsuccessfully transmitted MPDUs.
1108
   */
1109
  virtual void DoReportAmpduTxStatus (WifiRemoteStation *station, uint32_t nSuccessfulMpdus, uint32_t nFailedMpdus);
1087
1110
1088
  /**
1111
  /**
1089
   * Return the state of the station associated with the given address.
1112
   * Return the state of the station associated with the given address.

Return to bug 2321