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

(-)a/src/wave/helper/wave-helper.cc (-5 / +4 lines)
 Lines 205-215    Link Here 
205
205
206
            header.SetMcsFields (mcsKnown, mcsFlags, mcsRate);
206
            header.SetMcsFields (mcsKnown, mcsFlags, mcsRate);
207
          }
207
          }
208
208
          
209
        if (txVector.IsAggregation ())
209
        if (txVector.IsAggregation ())
210
          {
210
          {
211
            uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
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;
212
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
214
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
213
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
215
            AmpduSubframeHeader hdr;
214
            AmpduSubframeHeader hdr;
 Lines 221-227    Link Here 
221
              {
220
              {
222
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
221
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
223
              }
222
              }
224
            header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
223
            header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.GetCrc ());
225
          }
224
          }
226
225
227
        if (preamble == WIFI_PREAMBLE_VHT)
226
        if (preamble == WIFI_PREAMBLE_VHT)
 Lines 405-411    Link Here 
405
404
406
        if (txVector.IsAggregation ())
405
        if (txVector.IsAggregation ())
407
          {
406
          {
408
            uint16_t ampduStatusFlags = 0;
407
            uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
409
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
408
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
410
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
409
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
411
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
410
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
 Lines 418-424    Link Here 
418
              {
417
              {
419
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
418
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
420
              }
419
              }
421
            header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
420
            header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.GetCrc ());
422
          }
421
          }
423
422
424
        if (preamble == WIFI_PREAMBLE_VHT)
423
        if (preamble == WIFI_PREAMBLE_VHT)
(-)a/src/wifi/examples/test-interference-helper.cc (-2 / +2 lines)
 Lines 106-112    Link Here 
106
  WifiTxVector txVector;
106
  WifiTxVector txVector;
107
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
107
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
108
  txVector.SetMode (WifiMode (m_input.txModeA));
108
  txVector.SetMode (WifiMode (m_input.txModeA));
109
  m_txA->SendPacket (p, txVector, m_input.preamble, 0, 0);
109
  m_txA->SendPacket (p, txVector, m_input.preamble, 0);
110
}
110
}
111
111
112
void
112
void
 Lines 116-122    Link Here 
116
  WifiTxVector txVector;
116
  WifiTxVector txVector;
117
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
117
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
118
  txVector.SetMode (WifiMode (m_input.txModeB));
118
  txVector.SetMode (WifiMode (m_input.txModeB));
119
  m_txB->SendPacket (p, txVector, m_input.preamble, 0, 0);
119
  m_txB->SendPacket (p, txVector, m_input.preamble, 0);
120
}
120
}
121
121
122
InterferenceExperiment::InterferenceExperiment ()
122
InterferenceExperiment::InterferenceExperiment ()
(-)a/src/wifi/examples/wifi-phy-test.cc (-3 / +3 lines)
 Lines 74-80    Link Here 
74
  WifiTxVector txVector;
74
  WifiTxVector txVector;
75
  txVector.SetTxPowerLevel (m_input.txPowerLevel);
75
  txVector.SetTxPowerLevel (m_input.txPowerLevel);
76
  txVector.SetMode (mode);
76
  txVector.SetMode (mode);
77
  m_tx->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0, 0);
77
  m_tx->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0);
78
}
78
}
79
79
80
void
80
void
 Lines 182-188    Link Here 
182
  WifiTxVector txVector;
182
  WifiTxVector txVector;
183
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
183
  txVector.SetTxPowerLevel (m_input.txPowerLevelA);
184
  txVector.SetMode (WifiMode (m_input.txModeA));
184
  txVector.SetMode (WifiMode (m_input.txModeA));
185
  m_txA->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0, 0);
185
  m_txA->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0);
186
}
186
}
187
187
188
void
188
void
 Lines 193-199    Link Here 
193
  WifiTxVector txVector;
193
  WifiTxVector txVector;
194
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
194
  txVector.SetTxPowerLevel (m_input.txPowerLevelB);
195
  txVector.SetMode (WifiMode (m_input.txModeB));
195
  txVector.SetMode (WifiMode (m_input.txModeB));
196
  m_txB->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0, 0);
196
  m_txB->SendPacket (p, txVector, WIFI_PREAMBLE_LONG, 0);
197
}
197
}
198
198
199
void
199
void
(-)a/src/wifi/helper/yans-wifi-helper.cc (-5 / +4 lines)
 Lines 367-377    Link Here 
367
367
368
            header.SetMcsFields (mcsKnown, mcsFlags, mcsRate);
368
            header.SetMcsFields (mcsKnown, mcsFlags, mcsRate);
369
          }
369
          }
370
370
          
371
        if (txVector.IsAggregation ())
371
        if (txVector.IsAggregation ())
372
          {
372
          {
373
            uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
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;
374
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
376
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
375
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
377
            AmpduSubframeHeader hdr;
376
            AmpduSubframeHeader hdr;
 Lines 383-389    Link Here 
383
              {
382
              {
384
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
383
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
385
              }
384
              }
386
            header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
385
            header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.GetCrc ());
387
          }
386
          }
388
387
389
        if (preamble == WIFI_PREAMBLE_VHT)
388
        if (preamble == WIFI_PREAMBLE_VHT)
 Lines 567-573    Link Here 
567
566
568
        if (txVector.IsAggregation ())
567
        if (txVector.IsAggregation ())
569
          {
568
          {
570
            uint16_t ampduStatusFlags = 0;
569
            uint16_t ampduStatusFlags = RadiotapHeader::A_MPDU_STATUS_NONE;
571
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
570
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_DELIMITER_CRC_KNOWN;
572
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
571
            ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST_KNOWN;
573
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
572
            /* For PCAP file, MPDU Delimiter and Padding should be removed by the MAC Driver */
 Lines 580-586    Link Here 
580
              {
579
              {
581
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
580
                ampduStatusFlags |= RadiotapHeader::A_MPDU_STATUS_LAST;
582
              }
581
              }
583
            header.SetAmpduStatus (aMpdu.referenceNumber, ampduStatusFlags, hdr.GetCrc ());
582
            header.SetAmpduStatus (aMpdu.mpduRefNumber, ampduStatusFlags, hdr.GetCrc ());
584
          }
583
          }
585
584
586
        if (preamble == WIFI_PREAMBLE_VHT)
585
        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 1605-1611    Link Here 
1605
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1604
                ", seq=0x" << std::hex << m_currentHdr.GetSequenceControl () << std::dec);
1606
  if (!m_ampdu || hdr->IsRts ())
1605
  if (!m_ampdu || hdr->IsRts ())
1607
    {
1606
    {
1608
      m_phy->SendPacket (packet, txVector, preamble, 0, 0);
1607
      m_phy->SendPacket (packet, txVector, preamble, 0);
1609
    }
1608
    }
1610
  else
1609
  else
1611
    {
1610
    {
 Lines 1658-1668    Link Here 
1658
                {
1657
                {
1659
                  packetType = 0;
1658
                  packetType = 0;
1660
                }
1659
                }
1661
              m_phy->SendPacket (newPacket, txVector, preamble, packetType, m_mpduReferenceNumber);
1660
              m_phy->SendPacket (newPacket, txVector, preamble, packetType);
1662
            }
1661
            }
1663
          else
1662
          else
1664
            {
1663
            {
1665
              Simulator::Schedule (delay, &MacLow::SendPacket, this, newPacket, txVector, preamble, packetType, m_mpduReferenceNumber);
1664
              Simulator::Schedule (delay, &MacLow::SendPacket, this, newPacket, txVector, preamble, packetType);
1666
            }
1665
            }
1667
          if (queueSize > 1)
1666
          if (queueSize > 1)
1668
            {
1667
            {
 Lines 1670-1684    Link Here 
1670
            }
1669
            }
1671
          preamble = WIFI_PREAMBLE_NONE;
1670
          preamble = WIFI_PREAMBLE_NONE;
1672
        }
1671
        }
1673
      m_mpduReferenceNumber = ((m_mpduReferenceNumber + 1) % 4294967296);
1674
    }
1672
    }
1675
}
1673
}
1676
1674
1677
void
1675
void
1678
MacLow::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber)
1676
MacLow::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
1679
{
1677
{
1680
  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1678
  NS_LOG_DEBUG ("Sending MPDU as part of A-MPDU");
1681
  m_phy->SendPacket (packet, txVector, preamble, packetType, mpduReferenceNumber);
1679
  m_phy->SendPacket (packet, txVector, preamble, packetType);
1682
}
1680
}
1683
1681
1684
void
1682
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.h (-9 / +5 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 1298-1305    Link Here 
1298
   * const  references because of their sizes.
1296
   * const  references because of their sizes.
1299
   */
1297
   */
1300
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
1298
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
1301
                 WifiPreamble, WifiTxVector,
1299
                 WifiPreamble, WifiTxVector, struct mpduInfo, struct signalNoiseDbm> m_phyMonitorSniffRxTrace;
1302
                 struct mpduInfo, struct signalNoiseDbm> m_phyMonitorSniffRxTrace;
1303
1300
1304
  /**
1301
  /**
1305
   * A trace source that emulates a wifi device in monitor mode
1302
   * A trace source that emulates a wifi device in monitor mode
 Lines 1314-1321    Link Here 
1314
   * of its size.
1311
   * of its size.
1315
   */
1312
   */
1316
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
1313
  TracedCallback<Ptr<const Packet>, uint16_t, uint16_t, uint32_t,
1317
                 WifiPreamble, WifiTxVector,
1314
                 WifiPreamble, WifiTxVector, struct mpduInfo> m_phyMonitorSniffTxTrace;
1318
                 struct mpduInfo> m_phyMonitorSniffTxTrace;
1319
1315
1320
  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
1316
  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
1321
  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
1317
  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 (-12 / +24 lines)
 Lines 190-196    Link Here 
190
    m_endPlcpRxEvent (),
190
    m_endPlcpRxEvent (),
191
    m_channelStartingFrequency (0),
191
    m_channelStartingFrequency (0),
192
    m_mpdusNum (0),
192
    m_mpdusNum (0),
193
    m_plcpSuccess (false)
193
    m_plcpSuccess (false),
194
    m_txMpduReferenceNumber (0xffffffff),
195
    m_rxMpduReferenceNumber (0xffffffff)
194
{
196
{
195
  NS_LOG_FUNCTION (this);
197
  NS_LOG_FUNCTION (this);
196
  m_random = CreateObject<UniformRandomVariable> ();
198
  m_random = CreateObject<UniformRandomVariable> ();
 Lines 572-582    Link Here 
572
                                            double rxPowerDbm,
574
                                            double rxPowerDbm,
573
                                            WifiTxVector txVector,
575
                                            WifiTxVector txVector,
574
                                            enum WifiPreamble preamble,
576
                                            enum WifiPreamble preamble,
575
                                            struct mpduInfo aMpdu, Time rxDuration)
577
                                            uint8_t packetType,
578
                                            Time rxDuration)
576
{
579
{
577
  //This function should be later split to check separately whether plcp preamble and plcp header can be successfully received.
580
  //This function should be later split to check separately whether plcp preamble and plcp header can be successfully received.
578
  //Note: plcp preamble reception is not yet modeled.
581
  //Note: plcp preamble reception is not yet modeled.
579
  NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode () << preamble << (uint32_t)aMpdu.packetType);
582
  NS_LOG_FUNCTION (this << packet << rxPowerDbm << txVector.GetMode () << preamble << (uint32_t)packetType);
580
  AmpduTag ampduTag;
583
  AmpduTag ampduTag;
581
  rxPowerDbm += m_rxGainDb;
584
  rxPowerDbm += m_rxGainDb;
582
  double rxPowerW = DbmToW (rxPowerDbm);
585
  double rxPowerW = DbmToW (rxPowerDbm);
 Lines 653-658    Link Here 
653
            {
656
            {
654
              //received the first MPDU in an MPDU
657
              //received the first MPDU in an MPDU
655
              m_mpdusNum = ampduTag.GetNoOfMpdus () - 1;
658
              m_mpdusNum = ampduTag.GetNoOfMpdus () - 1;
659
              m_rxMpduReferenceNumber++;
656
            }
660
            }
657
          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)
658
            {
662
            {
 Lines 684-695    Link Here 
684
            {
688
            {
685
              NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
689
              NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
686
              m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this,
690
              m_endPlcpRxEvent = Simulator::Schedule (preambleAndHeaderDuration, &YansWifiPhy::StartReceivePacket, this,
687
                                                      packet, txVector, preamble, aMpdu, event);
691
                                                      packet, txVector, preamble, packetType, event);
688
            }
692
            }
689
693
690
          NS_ASSERT (m_endRxEvent.IsExpired ());
694
          NS_ASSERT (m_endRxEvent.IsExpired ());
691
          m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
695
          m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
692
                                              packet, preamble, aMpdu, event);
696
                                              packet, preamble, packetType, event);
693
        }
697
        }
694
      else
698
      else
695
        {
699
        {
 Lines 726-735    Link Here 
726
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
730
YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
727
                                 WifiTxVector txVector,
731
                                 WifiTxVector txVector,
728
                                 enum WifiPreamble preamble,
732
                                 enum WifiPreamble preamble,
729
                                 struct mpduInfo aMpdu,
733
                                 uint8_t packetType,
730
                                 Ptr<InterferenceHelper::Event> event)
734
                                 Ptr<InterferenceHelper::Event> event)
731
{
735
{
732
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)aMpdu.packetType);
736
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << preamble << (uint32_t)packetType);
733
  NS_ASSERT (IsStateRx ());
737
  NS_ASSERT (IsStateRx ());
734
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
738
  NS_ASSERT (m_endPlcpRxEvent.IsExpired ());
735
  AmpduTag ampduTag;
739
  AmpduTag ampduTag;
 Lines 763-769    Link Here 
763
}
767
}
764
768
765
void
769
void
766
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType, uint32_t mpduReferenceNumber)
770
YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiTxVector txVector, WifiPreamble preamble, uint8_t packetType)
767
{
771
{
768
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)packetType);
772
  NS_LOG_FUNCTION (this << packet << txVector.GetMode () << txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) << preamble << (uint32_t)txVector.GetTxPowerLevel () << (uint32_t)packetType);
769
  /* Transmission can happen if:
773
  /* Transmission can happen if:
 Lines 800-811    Link Here 
800
    {
804
    {
801
      dataRate500KbpsUnits = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000;
805
      dataRate500KbpsUnits = txVector.GetMode ().GetDataRate (txVector.GetChannelWidth (), txVector.IsShortGuardInterval (), 1) * txVector.GetNss () / 500000;
802
    }
806
    }
807
  if (packetType == 1 && preamble != WIFI_PREAMBLE_NONE)
808
    {
809
      //send the first MPDU in an MPDU
810
      m_txMpduReferenceNumber++;
811
    }
803
  struct mpduInfo aMpdu;
812
  struct mpduInfo aMpdu;
804
  aMpdu.packetType = packetType;
813
  aMpdu.packetType = packetType;
805
  aMpdu.referenceNumber = mpduReferenceNumber;
814
  aMpdu.mpduRefNumber = m_txMpduReferenceNumber;
806
  NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, preamble, txVector, aMpdu);
815
  NotifyMonitorSniffTx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, preamble, txVector, aMpdu);
807
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble);
816
  m_state->SwitchToTx (txDuration, packet, GetPowerDbm (txVector.GetTxPowerLevel ()), txVector, preamble);
808
  m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel ()) + m_txGainDb, txVector, preamble, aMpdu, txDuration);
817
  m_channel->Send (this, packet, GetPowerDbm (txVector.GetTxPowerLevel ()) + m_txGainDb, txVector, preamble, packetType, txDuration);
809
}
818
}
810
819
811
uint32_t
820
uint32_t
 Lines 1141-1147    Link Here 
1141
}
1150
}
1142
1151
1143
void
1152
void
1144
YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, struct mpduInfo aMpdu, Ptr<InterferenceHelper::Event> event)
1153
YansWifiPhy::EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t packetType, Ptr<InterferenceHelper::Event> event)
1145
{
1154
{
1146
  NS_LOG_FUNCTION (this << packet << event);
1155
  NS_LOG_FUNCTION (this << packet << event);
1147
  NS_ASSERT (IsStateRx ());
1156
  NS_ASSERT (IsStateRx ());
 Lines 1171-1176    Link Here 
1171
          struct signalNoiseDbm signalNoise;
1180
          struct signalNoiseDbm signalNoise;
1172
          signalNoise.signal = RatioToDb (event->GetRxPowerW ()) + 30;
1181
          signalNoise.signal = RatioToDb (event->GetRxPowerW ()) + 30;
1173
          signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
1182
          signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30;
1183
          struct mpduInfo aMpdu;
1184
          aMpdu.packetType = packetType;
1185
          aMpdu.mpduRefNumber = m_rxMpduReferenceNumber;
1174
          NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, event->GetPreambleType (), event->GetTxVector (), aMpdu, signalNoise);
1186
          NotifyMonitorSniffRx (packet, (uint16_t)GetChannelFrequencyMhz (), GetChannelNumber (), dataRate500KbpsUnits, event->GetPreambleType (), event->GetTxVector (), aMpdu, signalNoise);
1175
          m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ());
1187
          m_state->SwitchFromRxEndOk (packet, snrPer.snr, event->GetTxVector (), event->GetPreambleType ());
1176
        }
1188
        }
 Lines 1186-1192    Link Here 
1186
      m_state->SwitchFromRxEndError (packet, snrPer.snr);
1198
      m_state->SwitchFromRxEndError (packet, snrPer.snr);
1187
    }
1199
    }
1188
1200
1189
  if (preamble == WIFI_PREAMBLE_NONE && aMpdu.packetType == 2)
1201
  if (preamble == WIFI_PREAMBLE_NONE && packetType == 2)
1190
    {
1202
    {
1191
      m_plcpSuccess = false;
1203
      m_plcpSuccess = false;
1192
    }
1204
    }
(-)a/src/wifi/model/yans-wifi-phy.h (-10 / +9 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 513-523    Link Here 
513
   *
511
   *
514
   * \param packet the packet that the last bit has arrived
512
   * \param packet the packet that the last bit has arrived
515
   * \param preamble the preamble of the arriving packet
513
   * \param preamble the preamble of the arriving packet
516
   * \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)
514
   * \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)
517
   *        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)
518
   * \param event the corresponding event of the first time the packet arrives
515
   * \param event the corresponding event of the first time the packet arrives
519
   */
516
   */
520
  void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, struct mpduInfo aMpdu, Ptr<InterferenceHelper::Event> event);
517
  void EndReceive (Ptr<Packet> packet, enum WifiPreamble preamble, uint8_t packetType, Ptr<InterferenceHelper::Event> event);
521
518
522
  bool     m_initialized;         //!< Flag for runtime initialization
519
  bool     m_initialized;         //!< Flag for runtime initialization
523
  double   m_edThresholdW;        //!< Energy detection threshold in watts
520
  double   m_edThresholdW;        //!< Energy detection threshold in watts
 Lines 592-597    Link Here 
592
  Time m_channelSwitchDelay;            //!< Time required to switch between channel
589
  Time m_channelSwitchDelay;            //!< Time required to switch between channel
593
  uint16_t m_mpdusNum;                  //!< carries the number of expected mpdus that are part of an A-MPDU
590
  uint16_t m_mpdusNum;                  //!< carries the number of expected mpdus that are part of an A-MPDU
594
  bool m_plcpSuccess;                   //!< Flag if the PLCP of the packet or the first MPDU in an A-MPDU has been received
591
  bool m_plcpSuccess;                   //!< Flag if the PLCP of the packet or the first MPDU in an A-MPDU has been received
592
  uint32_t m_txMpduReferenceNumber;     //!< A-MPDU reference number to identify all transmitted subframes belonging to the same received A-MPDU
593
  uint32_t m_rxMpduReferenceNumber;     //!< A-MPDU reference number to identify all received subframes belonging to the same received A-MPDU
595
};
594
};
596
595
597
} //namespace ns3
596
} //namespace ns3

Return to bug 2184