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

(-)a/src/test/traced/traced-callback-typedef-test-suite.cc (-1 / +3 lines)
 Lines 609-615    Link Here 
609
         const WifiMacHeader &,
609
         const WifiMacHeader &,
610
         empty, empty, empty, empty);
610
         empty, empty, empty, empty);
611
611
612
  DUPE   (WifiPhyStateHelper::RxEndErrorTracedCallback, Packet::SinrTracedCallback);
612
  CHECK (WifiPhyStateHelper::RxEndErrorTracedCallback,
613
         Ptr<const Packet>, double, bool,
614
         empty, empty);
613
615
614
  CHECK (WifiPhyStateHelper::RxOkTracedCallback,
616
  CHECK (WifiPhyStateHelper::RxOkTracedCallback,
615
         Ptr<const Packet>, double, WifiMode, WifiPreamble,
617
         Ptr<const Packet>, double, WifiMode, WifiPreamble,
(-)a/src/wifi/model/mac-low.cc (-34 / +15 lines)
 Lines 531-537    Link Here 
531
MacLow::ResetPhy (void)
531
MacLow::ResetPhy (void)
532
{
532
{
533
  m_phy->SetReceiveOkCallback (MakeNullCallback<void, Ptr<Packet>, double, WifiTxVector, enum WifiPreamble> ());
533
  m_phy->SetReceiveOkCallback (MakeNullCallback<void, Ptr<Packet>, double, WifiTxVector, enum WifiPreamble> ());
534
  m_phy->SetReceiveErrorCallback (MakeNullCallback<void, Ptr<const Packet>, double> ());
534
  m_phy->SetReceiveErrorCallback (MakeNullCallback<void, Ptr<const Packet>, double, bool> ());
535
  RemovePhyMacLowListener (m_phy);
535
  RemovePhyMacLowListener (m_phy);
536
  m_phy = 0;
536
  m_phy = 0;
537
}
537
}
 Lines 818-860    Link Here 
818
}
818
}
819
819
820
void
820
void
821
MacLow::ReceiveError (Ptr<const Packet> packet, double rxSnr)
821
MacLow::ReceiveError (Ptr<const Packet> packet, double rxSnr, bool isEndOfFrame)
822
{
822
{
823
  NS_LOG_FUNCTION (this << packet << rxSnr);
823
  NS_LOG_FUNCTION (this << packet << rxSnr << isEndOfFrame);
824
  NS_LOG_DEBUG ("rx failed ");
824
  NS_LOG_DEBUG ("rx failed ");
825
  AmpduTag ampdu;
825
  if (isEndOfFrame == true && m_receivedAtLeastOneMpdu == true)
826
  Ptr<Packet> pkt = packet->Copy ();
827
  bool isInAmpdu = pkt->RemovePacketTag (ampdu);
828
829
  if (isInAmpdu && m_receivedAtLeastOneMpdu && (ampdu.GetNoOfMpdus () == 1))
830
    {
826
    {
831
      MpduAggregator::DeaggregatedMpdus packets = MpduAggregator::Deaggregate (pkt);
827
      NS_ASSERT (m_lastReceivedHdr.IsQosData ());
832
      MpduAggregator::DeaggregatedMpdusCI n = packets.begin ();
828
      NS_LOG_DEBUG ("last a-mpdu subframe detected/sendImmediateBlockAck from=" << m_lastReceivedHdr.GetAddr2 ());
833
      WifiMacHeader hdr;
829
      m_sendAckEvent = Simulator::Schedule (GetSifs (),
834
      (*n).first->PeekHeader (hdr);
830
                                            &MacLow::SendBlockAckAfterAmpdu, this,
835
      if (hdr.IsQosData ())
831
                                            m_lastReceivedHdr.GetQosTid (),
836
        {
832
                                            m_lastReceivedHdr.GetAddr2 (),
837
          uint8_t tid = hdr.GetQosTid ();
833
                                            m_lastReceivedHdr.GetDuration (),
838
          AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAddr2 (), tid));
834
                                            m_currentTxVector);
839
          if (it != m_bAckAgreements.end ())
835
      m_receivedAtLeastOneMpdu = false;
840
            {
841
              NS_LOG_DEBUG ("last a-mpdu subframe detected/sendImmediateBlockAck from=" << hdr.GetAddr2 ());
842
              m_sendAckEvent = Simulator::Schedule (GetSifs (),
843
                                                    &MacLow::SendBlockAckAfterAmpdu, this,
844
                                                    hdr.GetQosTid (),
845
                                                    hdr.GetAddr2 (),
846
                                                    hdr.GetDuration (),
847
                                                    m_currentTxVector);
848
              m_receivedAtLeastOneMpdu = false;
849
            }
850
        }
851
      else if (hdr.IsBlockAckReq ())
852
        {
853
          NS_LOG_DEBUG ("last a-mpdu subframe is BAR");
854
          m_receivedAtLeastOneMpdu = false;
855
        }
856
    }
836
    }
857
  else if (m_txParams.MustWaitFastAck ())
837
  if (m_txParams.MustWaitFastAck ())
858
    {
838
    {
859
      NS_ASSERT (m_fastAckFailedTimeoutEvent.IsExpired ());
839
      NS_ASSERT (m_fastAckFailedTimeoutEvent.IsExpired ());
860
      m_fastAckFailedTimeoutEvent = Simulator::Schedule (GetSifs (),
840
      m_fastAckFailedTimeoutEvent = Simulator::Schedule (GetSifs (),
 Lines 905-910    Link Here 
905
   */
885
   */
906
  WifiMacHeader hdr;
886
  WifiMacHeader hdr;
907
  packet->RemoveHeader (hdr);
887
  packet->RemoveHeader (hdr);
888
  m_lastReceivedHdr = hdr;
908
889
909
  bool isPrevNavZero = IsNavZero ();
890
  bool isPrevNavZero = IsNavZero ();
910
  NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ());
891
  NS_LOG_DEBUG ("duration/id=" << hdr.GetDuration ());
(-)a/src/wifi/model/mac-low.h (-2 / +4 lines)
 Lines 733-743    Link Here 
733
  /**
733
  /**
734
   * \param packet packet received.
734
   * \param packet packet received.
735
   * \param rxSnr snr of packet received.
735
   * \param rxSnr snr of packet received.
736
   * \param isEndOfFrame PHY-RXEND indication.
736
   *
737
   *
737
   * This method is typically invoked by the lower PHY layer to notify
738
   * This method is typically invoked by the lower PHY layer to notify
738
   * the MAC layer that a packet was unsuccessfully received.
739
   * the MAC layer that a packet was unsuccessfully received.
739
   */
740
   */
740
  void ReceiveError (Ptr<const Packet> packet, double rxSnr);
741
  void ReceiveError (Ptr<const Packet> packet, double rxSnr, bool isEndOfFrame);
741
  /**
742
  /**
742
   * \param duration switching delay duration.
743
   * \param duration switching delay duration.
743
   *
744
   *
 Lines 1325-1331    Link Here 
1325
  Ptr<MpduAggregator> m_mpduAggregator; //!<
1326
  Ptr<MpduAggregator> m_mpduAggregator; //!<
1326
1327
1327
  Ptr<Packet> m_currentPacket;              //!< Current packet transmitted/to be transmitted
1328
  Ptr<Packet> m_currentPacket;              //!< Current packet transmitted/to be transmitted
1328
  WifiMacHeader m_currentHdr;               //!< Header of the current packet
1329
  WifiMacHeader m_currentHdr;               //!< Header of the current transmitted packet
1330
  WifiMacHeader m_lastReceivedHdr;          //!< Header of the last received packet
1329
  MacLowTransmissionParameters m_txParams;  //!< Transmission parameters of the current packet
1331
  MacLowTransmissionParameters m_txParams;  //!< Transmission parameters of the current packet
1330
  MacLowTransmissionListener *m_listener;   //!< Transmission listener for the current packet
1332
  MacLowTransmissionListener *m_listener;   //!< Transmission listener for the current packet
1331
  Mac48Address m_self;                      //!< Address of this MacLow (Mac48Address)
1333
  Mac48Address m_self;                      //!< Address of this MacLow (Mac48Address)
(-)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<const Packet> packet, double snr)
445
WifiPhyStateHelper::SwitchFromRxEndError (Ptr<const Packet> packet, double snr, bool isEndOfFrame)
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);
452
      m_rxErrorCallback (packet, snr, isEndOfFrame);
453
    }
453
    }
454
}
454
}
455
455
(-)a/src/wifi/model/wifi-phy-state-helper.h (-4 / +6 lines)
 Lines 167-174    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.
170
   */
171
   */
171
  void SwitchFromRxEndError (Ptr<const Packet> packet, double snr);
172
  void SwitchFromRxEndError (Ptr<const Packet> packet, double snr, bool isEndOfFrame);
172
  /**
173
  /**
173
   * Switch to CCA busy.
174
   * Switch to CCA busy.
174
   *
175
   *
 Lines 214-224    Link Here 
214
  /**
215
  /**
215
   * TracedCallback signature for receive end error event.
216
   * TracedCallback signature for receive end error event.
216
   *
217
   *
217
   * \param [in] packet The received packet.
218
   * \param [in] packet       The received packet.
218
   * \param [in] snr    The SNR of the received packet.
219
   * \param [in] snr          The SNR of the received packet.
220
   * \param [in] isEndOfFrame PHY-RXEND indication..
219
   */
221
   */
220
  typedef void (* RxEndErrorTracedCallback)
222
  typedef void (* RxEndErrorTracedCallback)
221
    (Ptr<const Packet> packet, double snr);
223
    (Ptr<const Packet> packet, double snr, bool isEndOfFrame);
222
224
223
  /**
225
  /**
224
   * TracedCallback signature for transmit event.
226
   * TracedCallback signature for transmit event.
(-)a/src/wifi/model/wifi-phy.h (-1 / +2 lines)
 Lines 192-199    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
195
   */
196
   */
196
  typedef Callback<void, Ptr<const Packet>, double> RxErrorCallback;
197
  typedef Callback<void, Ptr<const Packet>, double, bool> RxErrorCallback;
197
198
198
  static TypeId GetTypeId (void);
199
  static TypeId GetTypeId (void);
199
200
(-)a/src/wifi/model/yans-wifi-phy.cc (-2 / +4 lines)
 Lines 1190-1201    Link Here 
1190
        {
1190
        {
1191
          /* failure. */
1191
          /* failure. */
1192
          NotifyRxDrop (packet);
1192
          NotifyRxDrop (packet);
1193
          m_state->SwitchFromRxEndError (packet, snrPer.snr);
1193
          bool isEndOfFrame = ((mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE) || (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE));
1194
          m_state->SwitchFromRxEndError (packet, snrPer.snr, isEndOfFrame);
1194
        }
1195
        }
1195
    }
1196
    }
1196
  else
1197
  else
1197
    {
1198
    {
1198
      m_state->SwitchFromRxEndError (packet, snrPer.snr);
1199
      bool isEndOfFrame = ((mpdutype == NORMAL_MPDU && preamble != WIFI_PREAMBLE_NONE) || (mpdutype == LAST_MPDU_IN_AGGREGATE && preamble == WIFI_PREAMBLE_NONE));
1200
      m_state->SwitchFromRxEndError (packet, snrPer.snr, isEndOfFrame);
1199
    }
1201
    }
1200
1202
1201
  if (preamble == WIFI_PREAMBLE_NONE && mpdutype == LAST_MPDU_IN_AGGREGATE)
1203
  if (preamble == WIFI_PREAMBLE_NONE && mpdutype == LAST_MPDU_IN_AGGREGATE)

Return to bug 2185