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

(-)a/src/wifi/model/block-ack-agreement.cc (-1 / +9 lines)
 Lines 76-81    Link Here 
76
}
76
}
77
77
78
void
78
void
79
BlockAckAgreement::SetStartingSequenceControl (uint16_t seq)
80
{
81
  NS_LOG_FUNCTION (this << seq);
82
  NS_ASSERT (((seq >> 4) & 0x0fff) < 4096);
83
  m_startingSeq = (seq >> 4) & 0x0fff;
84
}
85
86
void
79
BlockAckAgreement::SetImmediateBlockAck (void)
87
BlockAckAgreement::SetImmediateBlockAck (void)
80
{
88
{
81
  NS_LOG_FUNCTION (this);
89
  NS_LOG_FUNCTION (this);
 Lines 135-141    Link Here 
135
BlockAckAgreement::GetStartingSequenceControl (void) const
143
BlockAckAgreement::GetStartingSequenceControl (void) const
136
{
144
{
137
  NS_LOG_FUNCTION (this);
145
  NS_LOG_FUNCTION (this);
138
  uint16_t seqControl = (m_startingSeq << 4) | 0xfff0;
146
  uint16_t seqControl = (m_startingSeq << 4) & 0xfff0;
139
  return seqControl;
147
  return seqControl;
140
}
148
}
141
149
(-)a/src/wifi/model/block-ack-agreement.h (-1 / +7 lines)
 Lines 63-68    Link Here 
63
   */
63
   */
64
  void SetStartingSequence (uint16_t seq);
64
  void SetStartingSequence (uint16_t seq);
65
  /**
65
  /**
66
   * Set starting sequence control.
67
   *
68
   * \param seq the starting sequence control
69
   */
70
  void SetStartingSequenceControl (uint16_t seq);
71
  /**
66
   * Set Block ACK policy to immediate ACK.
72
   * Set Block ACK policy to immediate ACK.
67
   */
73
   */
68
  void SetImmediateBlockAck (void);
74
  void SetImmediateBlockAck (void);
 Lines 113-119    Link Here 
113
   */
119
   */
114
  uint16_t GetStartingSequence (void) const;
120
  uint16_t GetStartingSequence (void) const;
115
  /**
121
  /**
116
   * Return the starting squence control
122
   * Return the starting sequence control
117
   *
123
   *
118
   * \return starting sequence control
124
   * \return starting sequence control
119
   */
125
   */
(-)a/src/wifi/model/mac-low.cc (-15 / +13 lines)
 Lines 1095-1101    Link Here 
1095
              NS_LOG_DEBUG ("rx QoS unicast/sendAck from=" << hdr.GetAddr2 ());
1095
              NS_LOG_DEBUG ("rx QoS unicast/sendAck from=" << hdr.GetAddr2 ());
1096
              AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAddr2 (), hdr.GetQosTid ()));
1096
              AgreementsI it = m_bAckAgreements.find (std::make_pair (hdr.GetAddr2 (), hdr.GetQosTid ()));
1097
1097
1098
              RxCompleteBufferedPacketsWithSmallerSequence (it->second.first.GetStartingSequence (),
1098
              RxCompleteBufferedPacketsWithSmallerSequence (it->second.first.GetStartingSequenceControl (),
1099
                                                            hdr.GetAddr2 (), hdr.GetQosTid ());
1099
                                                            hdr.GetAddr2 (), hdr.GetQosTid ());
1100
              RxCompleteBufferedPacketsUntilFirstLost (hdr.GetAddr2 (), hdr.GetQosTid ());
1100
              RxCompleteBufferedPacketsUntilFirstLost (hdr.GetAddr2 (), hdr.GetQosTid ());
1101
              NS_ASSERT (m_sendAckEvent.IsExpired ());
1101
              NS_ASSERT (m_sendAckEvent.IsExpired ());
 Lines 2325-2331    Link Here 
2325
                      int16_t bufferSize = (*it).second.first.GetBufferSize ();
2325
                      int16_t bufferSize = (*it).second.first.GetBufferSize ();
2326
                      uint16_t sum = ((uint16_t)(std::abs (winEnd - bufferSize + 1))) % 4096;
2326
                      uint16_t sum = ((uint16_t)(std::abs (winEnd - bufferSize + 1))) % 4096;
2327
                      (*it).second.first.SetStartingSequence (sum);
2327
                      (*it).second.first.SetStartingSequence (sum);
2328
                      RxCompleteBufferedPacketsWithSmallerSequence ((*it).second.first.GetStartingSequence (), originator, tid);
2328
                      RxCompleteBufferedPacketsWithSmallerSequence ((*it).second.first.GetStartingSequenceControl (), originator, tid);
2329
                    }
2329
                    }
2330
                }
2330
                }
2331
              RxCompleteBufferedPacketsUntilFirstLost (originator, tid); //forwards up packets starting from winstart and set winstart to last +1
2331
              RxCompleteBufferedPacketsUntilFirstLost (originator, tid); //forwards up packets starting from winstart and set winstart to last +1
 Lines 2418-2424    Link Here 
2418
  AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid));
2418
  AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid));
2419
  if (it != m_bAckAgreements.end ())
2419
  if (it != m_bAckAgreements.end ())
2420
    {
2420
    {
2421
      RxCompleteBufferedPacketsWithSmallerSequence (it->second.first.GetStartingSequence (), originator, tid);
2421
      RxCompleteBufferedPacketsWithSmallerSequence (it->second.first.GetStartingSequenceControl (), originator, tid);
2422
      RxCompleteBufferedPacketsUntilFirstLost (originator, tid);
2422
      RxCompleteBufferedPacketsUntilFirstLost (originator, tid);
2423
      m_bAckAgreements.erase (it);
2423
      m_bAckAgreements.erase (it);
2424
2424
 Lines 2440-2450    Link Here 
2440
      uint16_t guard = 0;
2440
      uint16_t guard = 0;
2441
      if (last != (*it).second.second.end ())
2441
      if (last != (*it).second.second.end ())
2442
        {
2442
        {
2443
          guard = (*it).second.second.begin ()->second.GetSequenceControl () & 0xfff0;
2443
          guard = (*it).second.second.begin ()->second.GetSequenceControl ();
2444
        }
2444
        }
2445
      BufferedPacketI i = (*it).second.second.begin ();
2445
      BufferedPacketI i = (*it).second.second.begin ();
2446
      for (; i != (*it).second.second.end ()
2446
      for (; i != (*it).second.second.end ()
2447
           && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceNumber (), endSequence) < mappedStart; )
2447
           && QosUtilsMapSeqControlToUniqueInteger ((*i).second.GetSequenceControl (), endSequence) < mappedStart; )
2448
        {
2448
        {
2449
          if (guard == (*i).second.GetSequenceControl ())
2449
          if (guard == (*i).second.GetSequenceControl ())
2450
            {
2450
            {
 Lines 2458-2470    Link Here 
2458
                  m_rxCallback ((*last).first, &(*last).second);
2458
                  m_rxCallback ((*last).first, &(*last).second);
2459
                  last++;
2459
                  last++;
2460
                  /* go to next packet */
2460
                  /* go to next packet */
2461
                  while (i != (*it).second.second.end () && ((guard >> 4) & 0x0fff) == (*i).second.GetSequenceNumber ())
2461
                  while (i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl ())
2462
                    {
2462
                    {
2463
                      i++;
2463
                      i++;
2464
                    }
2464
                    }
2465
                  if (i != (*it).second.second.end ())
2465
                  if (i != (*it).second.second.end ())
2466
                    {
2466
                    {
2467
                      guard = (*i).second.GetSequenceControl () & 0xfff0;
2467
                      guard = (*i).second.GetSequenceControl ();
2468
                      last = i;
2468
                      last = i;
2469
                    }
2469
                    }
2470
                }
2470
                }
 Lines 2476-2488    Link Here 
2476
          else
2476
          else
2477
            {
2477
            {
2478
              /* go to next packet */
2478
              /* go to next packet */
2479
              while (i != (*it).second.second.end () && ((guard >> 4) & 0x0fff) == (*i).second.GetSequenceNumber ())
2479
              while (i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl ())
2480
                {
2480
                {
2481
                  i++;
2481
                  i++;
2482
                }
2482
                }
2483
              if (i != (*it).second.second.end ())
2483
              if (i != (*it).second.second.end ())
2484
                {
2484
                {
2485
                  guard = (*i).second.GetSequenceControl () & 0xfff0;
2485
                  guard = (*i).second.GetSequenceControl ();
2486
                  last = i;
2486
                  last = i;
2487
                }
2487
                }
2488
            }
2488
            }
 Lines 2497-2505    Link Here 
2497
  AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid));
2497
  AgreementsI it = m_bAckAgreements.find (std::make_pair (originator, tid));
2498
  if (it != m_bAckAgreements.end ())
2498
  if (it != m_bAckAgreements.end ())
2499
    {
2499
    {
2500
      uint16_t startingSeqCtrl = ((*it).second.first.GetStartingSequence () << 4) & 0xfff0;
2500
      uint16_t guard = (*it).second.first.GetStartingSequenceControl ();
2501
      uint16_t guard = startingSeqCtrl;
2502
2503
      BufferedPacketI lastComplete = (*it).second.second.begin ();
2501
      BufferedPacketI lastComplete = (*it).second.second.begin ();
2504
      BufferedPacketI i = (*it).second.second.begin ();
2502
      BufferedPacketI i = (*it).second.second.begin ();
2505
      for (; i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl (); i++)
2503
      for (; i != (*it).second.second.end () && guard == (*i).second.GetSequenceControl (); i++)
 Lines 2516-2522    Link Here 
2516
            }
2514
            }
2517
          guard = (*i).second.IsMoreFragments () ? (guard + 1) : ((guard + 16) & 0xfff0);
2515
          guard = (*i).second.IsMoreFragments () ? (guard + 1) : ((guard + 16) & 0xfff0);
2518
        }
2516
        }
2519
      (*it).second.first.SetStartingSequence ((guard >> 4) & 0x0fff);
2517
      (*it).second.first.SetStartingSequenceControl (guard);
2520
      /* All packets already forwarded to WifiMac must be removed from buffer:
2518
      /* All packets already forwarded to WifiMac must be removed from buffer:
2521
      [begin (), lastComplete) */
2519
      [begin (), lastComplete) */
2522
      (*it).second.second.erase ((*it).second.second.begin (), lastComplete);
2520
      (*it).second.second.erase ((*it).second.second.begin (), lastComplete);
 Lines 2649-2655    Link Here 
2649
              /* All packets with smaller sequence than starting sequence control must be passed up to Wifimac
2647
              /* All packets with smaller sequence than starting sequence control must be passed up to Wifimac
2650
               * See 9.10.3 in IEEE 802.11e standard.
2648
               * See 9.10.3 in IEEE 802.11e standard.
2651
               */
2649
               */
2652
              RxCompleteBufferedPacketsWithSmallerSequence (reqHdr.GetStartingSequence (), originator, tid);
2650
              RxCompleteBufferedPacketsWithSmallerSequence (reqHdr.GetStartingSequenceControl (), originator, tid);
2653
              RxCompleteBufferedPacketsUntilFirstLost (originator, tid);
2651
              RxCompleteBufferedPacketsUntilFirstLost (originator, tid);
2654
            }
2652
            }
2655
          else
2653
          else
 Lines 2658-2664    Link Here 
2658
                {
2656
                {
2659
                  (*it).second.first.SetStartingSequence (reqHdr.GetStartingSequence ());
2657
                  (*it).second.first.SetStartingSequence (reqHdr.GetStartingSequence ());
2660
                  (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence () + (*it).second.first.GetBufferSize () - 1) % 4096);
2658
                  (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence () + (*it).second.first.GetBufferSize () - 1) % 4096);
2661
                  RxCompleteBufferedPacketsWithSmallerSequence (reqHdr.GetStartingSequence (), originator, tid);
2659
                  RxCompleteBufferedPacketsWithSmallerSequence (reqHdr.GetStartingSequenceControl (), originator, tid);
2662
                  RxCompleteBufferedPacketsUntilFirstLost (originator, tid);
2660
                  RxCompleteBufferedPacketsUntilFirstLost (originator, tid);
2663
                  (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence () + (*it).second.first.GetBufferSize () - 1) % 4096);
2661
                  (*it).second.first.SetWinEnd (((*it).second.first.GetStartingSequence () + (*it).second.first.GetBufferSize () - 1) % 4096);
2664
                }
2662
                }
(-)a/src/wifi/model/mac-low.h (-1 / +1 lines)
 Lines 1164-1170    Link Here 
1164
  /**
1164
  /**
1165
   * \param originator Address of peer participating in Block Ack mechanism.
1165
   * \param originator Address of peer participating in Block Ack mechanism.
1166
   * \param tid TID for which Block Ack was created.
1166
   * \param tid TID for which Block Ack was created.
1167
   * \param seq Starting sequence
1167
   * \param seq Starting sequence control
1168
   *
1168
   *
1169
   * This function forward up all completed "old" packets with sequence number
1169
   * This function forward up all completed "old" packets with sequence number
1170
   * smaller than <i>seq</i>. All comparison are performed circularly mod 4096.
1170
   * smaller than <i>seq</i>. All comparison are performed circularly mod 4096.
(-)a/src/wifi/model/mgt-headers.cc (-6 / +6 lines)
 Lines 988-993    Link Here 
988
}
988
}
989
989
990
void
990
void
991
MgtAddBaRequestHeader::SetStartingSequenceControl (uint16_t seqControl)
992
{
993
  m_startingSeq = (seqControl >> 4) & 0x0fff;
994
}
995
996
void
991
MgtAddBaRequestHeader::SetAmsduSupport (bool supported)
997
MgtAddBaRequestHeader::SetAmsduSupport (bool supported)
992
{
998
{
993
  m_amsduSupport = supported;
999
  m_amsduSupport = supported;
 Lines 1035-1046    Link Here 
1035
  return (m_startingSeq << 4) & 0xfff0;
1041
  return (m_startingSeq << 4) & 0xfff0;
1036
}
1042
}
1037
1043
1038
void
1039
MgtAddBaRequestHeader::SetStartingSequenceControl (uint16_t seqControl)
1040
{
1041
  m_startingSeq = (seqControl >> 4) & 0x0fff;
1042
}
1043
1044
uint16_t
1044
uint16_t
1045
MgtAddBaRequestHeader::GetParameterSet (void) const
1045
MgtAddBaRequestHeader::GetParameterSet (void) const
1046
{
1046
{

Return to bug 2104