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

(-)a/src/wave/helper/wave-helper.cc (-13 / +4 lines)
 Lines 94-101    Link Here 
94
  uint16_t             channelNumber,
94
  uint16_t             channelNumber,
95
  uint32_t             rate,
95
  uint32_t             rate,
96
  WifiPreamble         preamble,
96
  WifiPreamble         preamble,
97
  WifiTxVector         txVector,
97
  WifiTxVector         txVector)
98
  struct mpduInfo      aMpdu)
99
{
98
{
100
  uint32_t dlt = file->GetDataLinkType ();
99
  uint32_t dlt = file->GetDataLinkType ();
101
100
 Lines 205-227    Link Here 
205
204
206
            header.SetMcsFields (mcsKnown, mcsFlags, mcsRate);
205
            header.SetMcsFields (mcsKnown, mcsFlags, mcsRate);
207
          }
206
          }
208
207
          
209
        if (txVector.IsAggregation ())
208
        if (txVector.IsAggregation ())
210
          {
209
          {
211
            uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
212
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
213
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
214
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
215
            AmpduSubframeHeader hdr;
210
            AmpduSubframeHeader hdr;
216
            uint32_t extractedLength;
211
            uint32_t extractedLength;
217
            p->RemoveHeader (hdr);
212
            p->RemoveHeader (hdr);
218
            extractedLength = hdr.GetLength ();
213
            extractedLength = hdr.GetLength ();
219
            p = p->CreateFragment (0, static_cast<uint32_t> (extractedLength));
214
            p = p->CreateFragment (0, static_cast<uint32_t> (extractedLength));
220
            if (aMpdu.packetType == 2 || (hdr.GetEof () == true && hdr.GetLength () > 0))
215
            header.SetAmpduStatus (0, 0, 0);
221
              {
222
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
223
              }
224
            header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
225
          }
216
          }
226
217
227
        if (preamble == WIFI_PREAMBLE_VHT)
218
        if (preamble == WIFI_PREAMBLE_VHT)
 Lines 418-424    Link Here 
418
              {
409
              {
419
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
410
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
420
              }
411
              }
421
            header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
412
            header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.GetCrc ());
422
          }
413
          }
423
414
424
        if (preamble == WIFI_PREAMBLE_VHT)
415
        if (preamble == WIFI_PREAMBLE_VHT)
(-)a/src/wifi/helper/yans-wifi-helper.cc (-13 / +4 lines)
 Lines 256-263    Link Here 
256
  uint16_t             channelNumber,
256
  uint16_t             channelNumber,
257
  uint32_t             rate,
257
  uint32_t             rate,
258
  WifiPreamble         preamble,
258
  WifiPreamble         preamble,
259
  WifiTxVector         txVector,
259
  WifiTxVector         txVector)
260
  struct mpduInfo      aMpdu)
261
{
260
{
262
  uint32_t dlt = file->GetDataLinkType ();
261
  uint32_t dlt = file->GetDataLinkType ();
263
262
 Lines 367-389    Link Here 
367
366
368
            header.SetMcsFields (mcsKnown, mcsFlags, mcsRate);
367
            header.SetMcsFields (mcsKnown, mcsFlags, mcsRate);
369
          }
368
          }
370
369
          
371
        if (txVector.IsAggregation ())
370
        if (txVector.IsAggregation ())
372
          {
371
          {
373
            uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
374
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
375
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
376
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
377
            AmpduSubframeHeader hdr;
372
            AmpduSubframeHeader hdr;
378
            uint32_t extractedLength;
373
            uint32_t extractedLength;
379
            p->RemoveHeader (hdr);
374
            p->RemoveHeader (hdr);
380
            extractedLength = hdr.GetLength ();
375
            extractedLength = hdr.GetLength ();
381
            p = p->CreateFragment (0, static_cast<uint32_t> (extractedLength));
376
            p = p->CreateFragment (0, static_cast<uint32_t> (extractedLength));
382
            if (aMpdu.packetType == 2 || (hdr.GetEof () == true && hdr.GetLength () > 0))
377
            header.SetAmpduStatus (0, 0, 0);
383
              {
384
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
385
              }
386
            header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
387
          }
378
          }
388
379
389
        if (preamble == WIFI_PREAMBLE_VHT)
380
        if (preamble == WIFI_PREAMBLE_VHT)
 Lines 580-586    Link Here 
580
              {
571
              {
581
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
572
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
582
              }
573
              }
583
            header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
574
            header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.GetCrc ());
584
          }
575
          }
585
576
586
        if (preamble == WIFI_PREAMBLE_VHT)
577
        if (preamble == WIFI_PREAMBLE_VHT)
(-)a/src/wifi/model/mac-low.cc (-8 / +6 lines)
 Lines 365-372    Link Here 
365
    m_listener (0),
365
    m_listener (0),
366
    m_phyMacLowListener (0),
366
    m_phyMacLowListener (0),
367
    m_ctsToSelfSupported (false),
367
    m_ctsToSelfSupported (false),
368
    m_receivedAtLeastOneMpdu (false),
368
    m_receivedAtLeastOneMpdu (false)
369
    m_mpduReferenceNumber (0)
370
{
369
{
371
  NS_LOG_FUNCTION (this);
370
  NS_LOG_FUNCTION (this);
372
  m_lastNavDuration = Seconds (0);
371
  m_lastNavDuration = Seconds (0);
 Lines 1597-1603    Link Here 
1597
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1596
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1598
  if (!m_ampdu || hdr->IsRts ())
1597
  if (!m_ampdu || hdr->IsRts ())
1599
    {
1598
    {
1600
      m_phy->SendPacket (packet, txVector, preamble, 0, 0);
1599
      m_phy->SendPacket (packet, txVector, preamble, 0);
1601
    }
1600
    }
1602
  else
1601
  else
1603
    {
1602
    {
 Lines 1650-1660    Link Here 
1650
                {
1649
                {
1651
                  packetType = 0;
1650
                  packetType = 0;
1652
                }
1651
                }
1653
              m_phy->SendPacket (newPacket, txVector, preamble, packetType, m_mpduReferenceNumber);
1652
              m_phy->SendPacket (newPacket, txVector, preamble, packetType);
1654
            }
1653
            }
1655
          else
1654
          else
1656
            {
1655
            {
1657
              Simulator::Schedule (delay, &MacLow::SendPacket, this, newPacket, txVector, preamble, packetType, m_mpduReferenceNumber);
1656
              Simulator::Schedule (delay, &MacLow::SendPacket, this, newPacket, txVector, preamble, packetType);
1658
            }
1657
            }
1659
          if (queueSize > 1)
1658
          if (queueSize > 1)
1660
            {
1659
            {
 Lines 1662-1676    Link Here 
1662
            }
1661
            }
1663
          preamble = WIFI_PREAMBLE_NONE;
1662
          preamble = WIFI_PREAMBLE_NONE;
1664
        }
1663
        }
1665
      m_mpduReferenceNumber = ((m_mpduReferenceNumber + 1) % 4294967296);
1666
    }
1664
    }
1667
}
1665
}
1668
1666
1669
void
1667
void
1670
MacLow::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber)
1668
MacLow::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
1671
{
1669
{
1672
  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1670
  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1673
  m_phy->SendPacket (packet, txVector, preamble, packetType, mpduReferenceNumber);
1671
  m_phy->SendPacket (packet, txVector, preamble, packetType);
1674
}
1672
}
1675
1673
1676
void
1674
void
(-)a/src/wifi/model/mac-low.h (-3 / +1 lines)
 Lines 892-900    Link Here 
892
   * \param txVector
892
   * \param txVector
893
   * \param preamble
893
   * \param preamble
894
   * \param packetType
894
   * \param packetType
895
   * \param mpduReferenceNumber
896
   */
895
   */
897
  void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber);
896
  void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType);
898
  /**
897
  /**
899
   * Return a TXVECTOR for the RTS frame given the destination.
898
   * Return a TXVECTOR for the RTS frame given the destination.
900
   * The function consults WifiRemoteStationManager, which controls the rate
899
   * The function consults WifiRemoteStationManager, which controls the rate
 Lines 1373-1379    Link Here 
1373
  WifiTxVector m_currentTxVector;     //!< TXVECTOR used for the current packet transmission
1372
  WifiTxVector m_currentTxVector;     //!< TXVECTOR used for the current packet transmission
1374
  bool m_receivedAtLeastOneMpdu;      //!< Flag whether an MPDU has already been successfully received while receiving an A-MPDU
1373
  bool m_receivedAtLeastOneMpdu;      //!< Flag whether an MPDU has already been successfully received while receiving an A-MPDU
1375
  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.
1374
  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.
1376
  uint32_t m_mpduReferenceNumber;       //!< A-MPDU reference number to identify all subframes belonging to the same A-MPDU
1377
};
1375
};
1378
1376
1379
} //namespace ns3
1377
} //namespace ns3
(-)a/src/wifi/model/wifi-phy.cc (-2 / +2 lines)
 Lines 652-660    Link Here 
652
}
652
}
653
653
654
void
654
void
655
WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu)
655
WifiPhy::NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector)
656
{
656
{
657
  m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, preamble, txVector, aMpdu);
657
  m_phyMonitorSniffTxTrace (packet, channelFreqMhz, channelNumber, rate, preamble, txVector);
658
}
658
}
659
659
660
660
(-)a/src/wifi/model/wifi-phy.h (-15 / +7 lines)
 Lines 48-54    Link Here 
48
struct mpduInfo
48
struct mpduInfo
49
{
49
{
50
  uint8_t packetType;
50
  uint8_t packetType;
51
  uint32_t referenceNumber;
51
  uint32_t mpduRefNumber;
52
};
52
};
53
53
54
/**
54
/**
 Lines 222-230    Link Here 
222
   *        power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
222
   *        power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
223
   * \param preamble the type of preamble to use to send this packet.
223
   * \param preamble the type of preamble to use to send this packet.
224
   * \param packetType the type of the packet 0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU
224
   * \param packetType the type of the packet 0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU
225
   * \param mpduReferenceNumber the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
226
   */
225
   */
227
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber) = 0;
226
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, uint8_t packetType) = 0;
228
227
229
  /**
228
  /**
230
   * \param listener the new listener
229
   * \param listener the new listener
 Lines 1111-1118    Link Here 
1111
   */
1110
   */
1112
  typedef void (* MonitorSnifferRxCallback)(Ptr<const Packet> packet, uint16_t channelFreqMhz,
1111
  typedef void (* MonitorSnifferRxCallback)(Ptr<const Packet> packet, uint16_t channelFreqMhz,
1113
                                            uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1112
                                            uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1114
                                            WifiTxVector txVector, struct mpduInfo aMpdu,
1113
                                            WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise);
1115
                                            struct signalNoiseDbm signalNoise);
1116
1114
1117
  /**
1115
  /**
1118
   * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
1116
   * Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
 Lines 1126-1137    Link Here 
1126
   *        units used both for the radiotap and for the prism header)
1124
   *        units used both for the radiotap and for the prism header)
1127
   * \param preamble the preamble of the packet
1125
   * \param preamble the preamble of the packet
1128
   * \param txVector the TXVECTOR that holds tx parameters
1126
   * \param txVector the TXVECTOR that holds tx parameters
1129
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
1130
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
1131
   */
1127
   */
1132
  void NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
1128
  void NotifyMonitorSniffTx (Ptr<const Packet> packet, uint16_t channelFreqMhz,
1133
                             uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1129
                             uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1134
                             WifiTxVector txVector, struct mpduInfo aMpdu);
1130
                             WifiTxVector txVector);
1135
1131
1136
  /**
1132
  /**
1137
   * TracedCallback signature for monitor mode transmit events.
1133
   * TracedCallback signature for monitor mode transmit events.
 Lines 1144-1157    Link Here 
1144
   *        units used both for the radiotap and for the prism header)
1140
   *        units used both for the radiotap and for the prism header)
1145
   * \param preamble the preamble of the packet
1141
   * \param preamble the preamble of the packet
1146
   * \param txVector the TXVECTOR that holds tx parameters
1142
   * \param txVector the TXVECTOR that holds tx parameters
1147
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
1148
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
1149
   * \todo WifiTxVector should be passed by const reference because
1143
   * \todo WifiTxVector should be passed by const reference because
1150
   * of its size.
1144
   * of its size.
1151
   */
1145
   */
1152
  typedef void (* MonitorSnifferTxCallback)(const Ptr<const Packet> packet, uint16_t channelFreqMhz,
1146
  typedef void (* MonitorSnifferTxCallback)(const Ptr<const Packet> packet, uint16_t channelFreqMhz,
1153
                                            uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1147
                                            uint16_t channelNumber, uint32_t rate, WifiPreamble preamble,
1154
                                            WifiTxVector txVector, struct mpduInfo aMpdu);
1148
                                            WifiTxVector txVector);
1155
1149
1156
  /**
1150
  /**
1157
   * Assign a fixed random variable stream number to the random variables
1151
   * Assign a fixed random variable stream number to the random variables
 Lines 1290-1297    Link Here 
1290
   * const  references because of their sizes.
1284
   * const  references because of their sizes.
1291
   */
1285
   */
1292
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
1286
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
1293
                 WifiPreamble, WifiTxVector,
1287
                 WifiPreamble, WifiTxVector, struct mpduInfo, struct signalNoiseDbm> m_phyMonitorSniffRxTrace;
1294
                 struct mpduInfo, struct signalNoiseDbm> m_phyMonitorSniffRxTrace;
1295
1288
1296
  /**
1289
  /**
1297
   * A trace source that emulates a wifi device in monitor mode
1290
   * A trace source that emulates a wifi device in monitor mode
 Lines 1306-1313    Link Here 
1306
   * of its size.
1299
   * of its size.
1307
   */
1300
   */
1308
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
1301
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
1309
                 WifiPreamble, WifiTxVector,
1302
                 WifiPreamble, WifiTxVector> m_phyMonitorSniffTxTrace;
1310
                 struct mpduInfo> m_phyMonitorSniffTxTrace;
1311
1303
1312
  uint32_t m_totalAmpduNumSymbols; //!< Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
1304
  uint32_t m_totalAmpduNumSymbols; //!< Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
1313
  uint32_t m_totalAmpduSize;       //!< Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
1305
  uint32_t m_totalAmpduSize;       //!< Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number of symbols needed for the last MPDU in the A-MPDU
(-)a/src/wifi/model/yans-wifi-channel.cc (-3 / +3 lines)
 Lines 79-85    Link Here 
79
79
80
void
80
void
81
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
81
YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
82
                       WifiTxVector txVector, WifiPreamble preamble, struct mpduInfo aMpdu, Time duration) const
82
                       WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, Time duration) const
83
{
83
{
84
  Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<MobilityModel> ();
84
  Ptr<MobilityModel> senderMobility = sender->GetMobility ()->GetObject<MobilityModel> ();
85
  NS_ASSERT (senderMobility != 0);
85
  NS_ASSERT (senderMobility != 0);
 Lines 113-119    Link Here 
113
113
114
          struct Parameters parameters;
114
          struct Parameters parameters;
115
          parameters.rxPowerDbm = rxPowerDbm;
115
          parameters.rxPowerDbm = rxPowerDbm;
116
          parameters.aMpdu = aMpdu;
116
          parameters.packetType = packetType;
117
          parameters.duration = duration;
117
          parameters.duration = duration;
118
          parameters.txVector = txVector;
118
          parameters.txVector = txVector;
119
          parameters.preamble = preamble;
119
          parameters.preamble = preamble;
 Lines 128-134    Link Here 
128
void
128
void
129
YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, struct Parameters parameters) const
129
YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, struct Parameters parameters) const
130
{
130
{
131
  m_phyList[i]->StartReceivePreambleAndHeader (packet, parameters.rxPowerDbm, parameters.txVector, parameters.preamble, parameters.aMpdu, parameters.duration);
131
  m_phyList[i]->StartReceivePreambleAndHeader (packet, parameters.rxPowerDbm, parameters.txVector, parameters.preamble, parameters.packetType, parameters.duration);
132
}
132
}
133
133
134
uint32_t
134
uint32_t
(-)a/src/wifi/model/yans-wifi-channel.h (-4 / +3 lines)
 Lines 40-46    Link Here 
40
struct Parameters
40
struct Parameters
41
{
41
{
42
  double rxPowerDbm;
42
  double rxPowerDbm;
43
  struct mpduInfo aMpdu;
43
  uint8_t packetType;
44
  Time duration;
44
  Time duration;
45
  WifiTxVector txVector;
45
  WifiTxVector txVector;
46
  WifiPreamble preamble;
46
  WifiPreamble preamble;
 Lines 92-99    Link Here 
92
   * \param txPowerDbm the tx power associated to the packet
92
   * \param txPowerDbm the tx power associated to the packet
93
   * \param txVector the TXVECTOR associated to the packet
93
   * \param txVector the TXVECTOR associated to the packet
94
   * \param preamble the preamble associated to the packet
94
   * \param preamble the preamble associated to the packet
95
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
95
   * \param packetType The type of the packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
96
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
97
   * \param duration the transmission duration associated to the packet
96
   * \param duration the transmission duration associated to the packet
98
   *
97
   *
99
   * This method should not be invoked by normal users. It is
98
   * This method should not be invoked by normal users. It is
 Lines 102-108    Link Here 
102
   * e.g. PHYs that are operating on the same channel.
101
   * e.g. PHYs that are operating on the same channel.
103
   */
102
   */
104
  void Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
103
  void Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double txPowerDbm,
105
             WifiTxVector txVector, WifiPreamble preamble, struct mpduInfo aMpdu, Time duration) const;
104
             WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, Time duration) const;
106
105
107
  /**
106
  /**
108
   * Assign a fixed random variable stream number to the random variables
107
   * Assign a fixed random variable stream number to the random variables
(-)a/src/wifi/model/yans-wifi-phy.cc (-15 / +18 lines)
 Lines 184-190    Link Here 
184
    m_endPlcpRxEvent (),
184
    m_endPlcpRxEvent (),
185
    m_channelStartingFrequency (0),
185
    m_channelStartingFrequency (0),
186
    m_mpdusNum (0),
186
    m_mpdusNum (0),
187
    m_plcpSuccess (false)
187
    m_plcpSuccess (false),
188
    m_mpduReferenceNumber (0xffffffff)
188
{
189
{
189
  NS_LOG_FUNCTION (this);
190
  NS_LOG_FUNCTION (this);
190
  m_random = CreateObject<UniformRandomVariable> ();
191
  m_random = CreateObject<UniformRandomVariable> ();
 Lines 566-576    Link Here 
566
                                            double rxPowerDbm,
567
                                            double rxPowerDbm,
567
                                            WifiTxVector txVector,
568
                                            WifiTxVector txVector,
568
                                            enum WifiPreamble preamble,
569
                                            enum WifiPreamble preamble,
569
                                            struct mpduInfo aMpdu, Time rxDuration)
570
                                            uint8_t packetType,
571
                                            Time rxDuration)
570
{
572
{
571
  //This function should be later split to check separately whether plcp preamble and plcp header can be successfully received.
573
  //This function should be later split to check separately whether plcp preamble and plcp header can be successfully received.
572
  //Note: plcp preamble reception is not yet modeled.
574
  //Note: plcp preamble reception is not yet modeled.
573
  NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode () << preamble << (uint32_t)aMpdu.packetType);
575
  NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode () << preamble << (uint32_t)packetType);
574
  AmpduTag ampduTag;
576
  AmpduTag ampduTag;
575
  rxPowerDbm += m_rxGainDb;
577
  rxPowerDbm += m_rxGainDb;
576
  double rxPowerW = DbmToW (rxPowerDbm);
578
  double rxPowerW = DbmToW (rxPowerDbm);
 Lines 647-652    Link Here 
647
            {
649
            {
648
              //received the first MPDU in an MPDU
650
              //received the first MPDU in an MPDU
649
              m_mpdusNum = ampduTag.GetNoOfMpdus () - 1;
651
              m_mpdusNum = ampduTag.GetNoOfMpdus () - 1;
652
              m_mpduReferenceNumber++;
650
            }
653
            }
651
          else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
654
          else if (preamble == WIFI_PREAMBLE_NONE && packet->PeekPacketTag (ampduTag) && m_mpdusNum > 0)
652
            {
655
            {
 Lines 678-689    Link Here 
678
            {
681
            {
679
              NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
682
              NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
680
              m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this,
683
              m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this,
681
                                                      packet, txVector, preamble, aMpdu, event);
684
                                                      packet, txVector, preamble, packetType, event);
682
            }
685
            }
683
686
684
          NS_ASSERT (m_endRxEvent.IsExpired ());
687
          NS_ASSERT (m_endRxEvent.IsExpired ());
685
          m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
688
          m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
686
                                              packet, preamble, aMpdu, event);
689
                                              packet, preamble, packetType, event);
687
        }
690
        }
688
      else
691
      else
689
        {
692
        {
 Lines 720-729    Link Here 
720
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
723
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
721
                                 WifiTxVector txVector,
724
                                 WifiTxVector txVector,
722
                                 enum WifiPreamble preamble,
725
                                 enum WifiPreamble preamble,
723
                                 struct mpduInfo aMpdu,
726
                                 uint8_t packetType,
724
                                 Ptr<InterferenceHelper::Event> event)
727
                                 Ptr<InterferenceHelper::Event> event)
725
{
728
{
726
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)aMpdu.packetType);
729
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)packetType);
727
  NS_ASSERT (IsStateRx ());
730
  NS_ASSERT (IsStateRx ());
728
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
731
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
729
  AmpduTag ampduTag;
732
  AmpduTag ampduTag;
 Lines 757-763    Link Here 
757
}
760
}
758
761
759
void
762
void
760
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber)
763
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
761
{
764
{
762
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)packetType);
765
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)packetType);
763
  /* Transmission can happen if:
766
  /* Transmission can happen if:
 Lines 794-805    Link Here 
794
    {
797
    {
795
      dataRate500KbpsUnits = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000;
798
      dataRate500KbpsUnits = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000;
796
    }
799
    }
797
  struct mpduInfo aMpdu;
800
  NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, preamble, txVector);
798
  aMpdu.packetType = packetType;
799
  aMpdu.referenceNumber = mpduReferenceNumber;
800
  NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, preamble, txVector, aMpdu);
801
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble);
801
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble);
802
  m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel ()) + m_txGainDb, txVector, preamble, aMpdu, txDuration);
802
  m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel ()) + m_txGainDb, txVector, preamble, packetType, txDuration);
803
}
803
}
804
804
805
uint32_t
805
uint32_t
 Lines 1135-1141    Link Here 
1135
}
1135
}
1136
1136
1137
void
1137
void
1138
YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, struct mpduInfo aMpdu, Ptr<InterferenceHelper::Event> event)
1138
YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t packetType, Ptr<InterferenceHelper::Event> event)
1139
{
1139
{
1140
  NS_LOG_FUNCTION (this << packet << event);
1140
  NS_LOG_FUNCTION (this << packet << event);
1141
  NS_ASSERT (IsStateRx ());
1141
  NS_ASSERT (IsStateRx ());
 Lines 1165-1170    Link Here 
1165
          struct signalNoiseDbm signalNoise;
1165
          struct signalNoiseDbm signalNoise;
1166
          signalNoise.signal = RatioToDb (event->GetRxPowerW ()) + 30;
1166
          signalNoise.signal = RatioToDb (event->GetRxPowerW ()) + 30;
1167
          signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
1167
          signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
1168
          struct mpduInfo aMpdu;
1169
          aMpdu.packetType = packetType;
1170
          aMpdu.mpduRefNumber = m_mpduReferenceNumber;
1168
          NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, event->GetPreambleType (), event->GetTxVector (), aMpdu, signalNoise);
1171
          NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, event->GetPreambleType (), event->GetTxVector (), aMpdu, signalNoise);
1169
          m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ());
1172
          m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ());
1170
        }
1173
        }
 Lines 1180-1186    Link Here 
1180
      m_state->SwitchFromRxEndError (packet, snrPer.snr);
1183
      m_state->SwitchFromRxEndError (packet, snrPer.snr);
1181
    }
1184
    }
1182
1185
1183
  if (preamble == WIFI_PREAMBLE_NONE && aMpdu.packetType == 2)
1186
  if (preamble == WIFI_PREAMBLE_NONE && packetType == 2)
1184
    {
1187
    {
1185
      m_plcpSuccess = false;
1188
      m_plcpSuccess = false;
1186
    }
1189
    }
(-)a/src/wifi/model/yans-wifi-phy.h (-10 / +8 lines)
 Lines 107-121    Link Here 
107
   * \param rxPowerDbm the receive power in dBm
107
   * \param rxPowerDbm the receive power in dBm
108
   * \param txVector the TXVECTOR of the arriving packet
108
   * \param txVector the TXVECTOR of the arriving packet
109
   * \param preamble the preamble of the arriving packet
109
   * \param preamble the preamble of the arriving packet
110
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
110
   * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
111
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
112
   * \param rxDuration the duration needed for the reception of the packet
111
   * \param rxDuration the duration needed for the reception of the packet
113
   */
112
   */
114
  void StartReceivePreambleAndHeader (Ptr<Packet> packet,
113
  void StartReceivePreambleAndHeader (Ptr<Packet> packet,
115
                                      double rxPowerDbm,
114
                                      double rxPowerDbm,
116
                                      WifiTxVector txVector,
115
                                      WifiTxVector txVector,
117
                                      WifiPreamble preamble,
116
                                      WifiPreamble preamble,
118
                                      struct mpduInfo aMpdu,
117
                                      uint8_t packetType,
119
                                      Time rxDuration);
118
                                      Time rxDuration);
120
  /**
119
  /**
121
   * Starting receiving the payload of a packet (i.e. the first bit of the packet has arrived).
120
   * Starting receiving the payload of a packet (i.e. the first bit of the packet has arrived).
 Lines 123-136    Link Here 
123
   * \param packet the arriving packet
122
   * \param packet the arriving packet
124
   * \param txVector the TXVECTOR of the arriving packet
123
   * \param txVector the TXVECTOR of the arriving packet
125
   * \param preamble the preamble of the arriving packet
124
   * \param preamble the preamble of the arriving packet
126
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
125
   * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
127
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
128
   * \param event the corresponding event of the first time the packet arrives
126
   * \param event the corresponding event of the first time the packet arrives
129
   */
127
   */
130
  void StartReceivePacket (Ptr<Packet> packet,
128
  void StartReceivePacket (Ptr<Packet> packet,
131
                           WifiTxVector txVector,
129
                           WifiTxVector txVector,
132
                           WifiPreamble preamble,
130
                           WifiPreamble preamble,
133
                           struct mpduInfo aMpdu,
131
                           uint8_t packetType,
134
                           Ptr<InterferenceHelper::Event> event);
132
                           Ptr<InterferenceHelper::Event> event);
135
133
136
  /**
134
  /**
 Lines 281-287    Link Here 
281
279
282
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
280
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
283
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
281
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
284
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber);
282
  virtual void SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, enum WifiPreamble preamble, uint8_t packetType);
285
  virtual void RegisterListener (WifiPhyListener *listener);
283
  virtual void RegisterListener (WifiPhyListener *listener);
286
  virtual void UnregisterListener (WifiPhyListener *listener);
284
  virtual void UnregisterListener (WifiPhyListener *listener);
287
  virtual void SetSleepMode (void);
285
  virtual void SetSleepMode (void);
 Lines 501-511    Link Here 
501
   *
499
   *
502
   * \param packet the packet that the last bit has arrived
500
   * \param packet the packet that the last bit has arrived
503
   * \param preamble the preamble of the arriving packet
501
   * \param preamble the preamble of the arriving packet
504
   * \param aMpdu the type of the packet (0 is not A-MPDU, 1 is a MPDU that is part of an A-MPDU and 2 is the last MPDU in an A-MPDU)
502
   * \param packetType The type of the received packet (values: 0 not an A-MPDU, 1 corresponds to any packets in an A-MPDU except the last one, 2 is the last packet in an A-MPDU)
505
   *        and the A-MPDU reference number (must be a different value for each A-MPDU but the same for each subframe within one A-MPDU)
506
   * \param event the corresponding event of the first time the packet arrives
503
   * \param event the corresponding event of the first time the packet arrives
507
   */
504
   */
508
  void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, struct mpduInfo aMpdu, Ptr<InterferenceHelper::Event> event);
505
  void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t packetType, Ptr<InterferenceHelper::Event> event);
509
506
510
  bool     m_initialized;         //!< Flag for runtime initialization
507
  bool     m_initialized;         //!< Flag for runtime initialization
511
  double   m_edThresholdW;        //!< Energy detection threshold in watts
508
  double   m_edThresholdW;        //!< Energy detection threshold in watts
 Lines 580-585    Link Here 
580
  Time m_channelSwitchDelay;            //!< Time required to switch between channel
577
  Time m_channelSwitchDelay;            //!< Time required to switch between channel
581
  uint16_t m_mpdusNum;                  //!< carries the number of expected mpdus that are part of an A-MPDU
578
  uint16_t m_mpdusNum;                  //!< carries the number of expected mpdus that are part of an A-MPDU
582
  bool m_plcpSuccess;                   //!< Flag if the PLCP of the packet or the first MPDU in an A-MPDU has been received
579
  bool m_plcpSuccess;                   //!< Flag if the PLCP of the packet or the first MPDU in an A-MPDU has been received
580
  uint32_t m_mpduReferenceNumber;       //!< A-MPDU reference number to identify all subframes belonging to the same received A-MPDU
583
};
581
};
584
582
585
} //namespace ns3
583
} //namespace ns3

Return to bug 2184