author | Manuel Requena <manuel.requena@cttc.es> |
Wed, 09 May 2012 19:08:03 +0200 | |
changeset 8745 | b94de33b24d3 |
parent 8726 | f6f0e2531457 |
child 9351 | 6e074e67a1ad |
permissions | -rw-r--r-- |
8361 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License version 2 as |
|
7 |
* published by the Free Software Foundation; |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 |
* |
|
18 |
* Author: Manuel Requena <manuel.requena@cttc.es> |
|
19 |
*/ |
|
20 |
||
21 |
#include "ns3/simulator.h" |
|
22 |
#include "ns3/log.h" |
|
23 |
||
24 |
#include "ns3/lte-rlc-header.h" |
|
25 |
#include "ns3/lte-rlc-um.h" |
|
26 |
#include "ns3/lte-rlc-sdu-status-tag.h" |
|
8375
201d78643209
Add support for ReportBufferStatus parameters: txQueueSize and txQueueHolDelay
Manuel Requena <manuel.requena@cttc.es>
parents:
8361
diff
changeset
|
27 |
#include "ns3/lte-rlc-tag.h" |
8361 | 28 |
|
29 |
NS_LOG_COMPONENT_DEFINE ("LteRlcUm"); |
|
30 |
||
31 |
namespace ns3 { |
|
32 |
||
33 |
NS_OBJECT_ENSURE_REGISTERED (LteRlcUm); |
|
34 |
||
35 |
LteRlcUm::LteRlcUm () |
|
8745
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
36 |
: m_maxTxBufferSize (2 * 1024 * 1024), |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
37 |
m_txBufferSize (0), |
8375
201d78643209
Add support for ReportBufferStatus parameters: txQueueSize and txQueueHolDelay
Manuel Requena <manuel.requena@cttc.es>
parents:
8361
diff
changeset
|
38 |
m_sequenceNumber (0), |
8361 | 39 |
m_vrUr (0), |
40 |
m_vrUx (0), |
|
41 |
m_vrUh (0), |
|
42 |
m_windowSize (512), |
|
43 |
m_expectedSeqNumber (0) |
|
44 |
{ |
|
45 |
NS_LOG_FUNCTION (this); |
|
46 |
m_reassemblingState = WAITING_S0_FULL; |
|
47 |
||
48 |
Simulator::ScheduleNow (&LteRlcUm::Start, this); |
|
49 |
} |
|
50 |
||
51 |
LteRlcUm::~LteRlcUm () |
|
52 |
{ |
|
53 |
} |
|
54 |
||
55 |
TypeId |
|
56 |
LteRlcUm::GetTypeId (void) |
|
57 |
{ |
|
58 |
static TypeId tid = TypeId ("ns3::LteRlcUm") |
|
59 |
.SetParent<LteRlc> () |
|
60 |
.AddConstructor<LteRlcUm> () |
|
8745
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
61 |
.AddAttribute ("MaxTxBufferSize", |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
62 |
"Maximum Size of the Transmission Buffer (in Bytes)", |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
63 |
UintegerValue (2 * 1024 * 1024), |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
64 |
MakeUintegerAccessor (&LteRlcUm::m_maxTxBufferSize), |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
65 |
MakeUintegerChecker<uint32_t> ()) |
8361 | 66 |
; |
67 |
return tid; |
|
68 |
} |
|
69 |
||
70 |
||
71 |
/** |
|
72 |
* RLC SAP |
|
73 |
*/ |
|
74 |
||
75 |
void |
|
76 |
LteRlcUm::DoTransmitPdcpPdu (Ptr<Packet> p) |
|
77 |
{ |
|
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
78 |
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << p->GetSize ()); |
8361 | 79 |
|
8745
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
80 |
if (m_txBufferSize + p->GetSize () <= m_maxTxBufferSize) |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
81 |
{ |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
82 |
/** Store arrival time */ |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
83 |
RlcTag timeTag (Simulator::Now ()); |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
84 |
p->AddPacketTag (timeTag); |
8375
201d78643209
Add support for ReportBufferStatus parameters: txQueueSize and txQueueHolDelay
Manuel Requena <manuel.requena@cttc.es>
parents:
8361
diff
changeset
|
85 |
|
8745
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
86 |
/** Store PDCP PDU */ |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
87 |
|
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
88 |
LteRlcSduStatusTag tag; |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
89 |
tag.SetStatus (LteRlcSduStatusTag::FULL_SDU); |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
90 |
p->AddPacketTag (tag); |
8361 | 91 |
|
8745
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
92 |
NS_LOG_LOGIC ("Tx Buffer: New packet added"); |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
93 |
m_txBuffer.push_back (p); |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
94 |
m_txBufferSize += p->GetSize (); |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
95 |
NS_LOG_LOGIC ("NumOfBuffers = " << m_txBuffer.size() ); |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
96 |
NS_LOG_LOGIC ("txBufferSize = " << m_txBufferSize); |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
97 |
} |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
98 |
else |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
99 |
{ |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
100 |
// Discard full RLC SDU |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
101 |
NS_LOG_LOGIC ("TxBuffer is full. RLC SDU discarded"); |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
102 |
NS_LOG_LOGIC ("MaxTxBufferSize = " << m_maxTxBufferSize); |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
103 |
NS_LOG_LOGIC ("txBufferSize = " << m_txBufferSize); |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
104 |
NS_LOG_LOGIC ("packet size = " << p->GetSize ()); |
b94de33b24d3
Add maximum size to the RLC Transmission Buffer
Manuel Requena <manuel.requena@cttc.es>
parents:
8726
diff
changeset
|
105 |
} |
8361 | 106 |
|
107 |
/** Report Buffer Status */ |
|
8499
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
108 |
DoReportBufferStatus (); |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
109 |
m_rbsTimer.Cancel (); |
8361 | 110 |
} |
111 |
||
112 |
||
113 |
/** |
|
114 |
* MAC SAP |
|
115 |
*/ |
|
116 |
||
117 |
void |
|
8714
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8586
diff
changeset
|
118 |
LteRlcUm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer) |
8361 | 119 |
{ |
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
120 |
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << bytes); |
8361 | 121 |
|
122 |
if (bytes <= 2) |
|
123 |
{ |
|
8709
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
124 |
// Stingy MAC: Header fix part is 2 bytes, we need more bytes for the data |
8361 | 125 |
NS_LOG_LOGIC ("TX opportunity too small = " << bytes); |
126 |
return; |
|
127 |
} |
|
128 |
||
129 |
Ptr<Packet> packet = Create<Packet> (); |
|
130 |
LteRlcHeader rlcHeader; |
|
131 |
||
132 |
// Build Data field |
|
133 |
uint32_t nextSegmentSize = bytes - 2; |
|
134 |
uint32_t nextSegmentId = 1; |
|
135 |
uint32_t dataFieldTotalSize = 0; |
|
136 |
uint32_t dataFieldAddedSize = 0; |
|
137 |
std::vector < Ptr<Packet> > dataField; |
|
138 |
||
139 |
// Remove the first packet from the transmission buffer. |
|
140 |
// If only a segment of the packet is taken, then the remaining is given back later |
|
141 |
if ( m_txBuffer.size () == 0 ) |
|
142 |
{ |
|
143 |
NS_LOG_LOGIC ("No data pending"); |
|
144 |
return; |
|
145 |
} |
|
146 |
||
147 |
NS_LOG_LOGIC ("SDUs in TxBuffer = " << m_txBuffer.size ()); |
|
148 |
NS_LOG_LOGIC ("First SDU buffer = " << *(m_txBuffer.begin())); |
|
8375
201d78643209
Add support for ReportBufferStatus parameters: txQueueSize and txQueueHolDelay
Manuel Requena <manuel.requena@cttc.es>
parents:
8361
diff
changeset
|
149 |
NS_LOG_LOGIC ("First SDU size = " << (*(m_txBuffer.begin()))->GetSize ()); |
8361 | 150 |
NS_LOG_LOGIC ("Next segment size = " << nextSegmentSize); |
151 |
NS_LOG_LOGIC ("Remove SDU from TxBuffer"); |
|
152 |
Ptr<Packet> firstSegment = (*(m_txBuffer.begin ()))->Copy (); |
|
8375
201d78643209
Add support for ReportBufferStatus parameters: txQueueSize and txQueueHolDelay
Manuel Requena <manuel.requena@cttc.es>
parents:
8361
diff
changeset
|
153 |
m_txBufferSize -= (*(m_txBuffer.begin()))->GetSize (); |
8377
3ae363919ea3
Add estimated size of RLC headers in queue size
Manuel Requena <manuel.requena@cttc.es>
parents:
8375
diff
changeset
|
154 |
NS_LOG_LOGIC ("txBufferSize = " << m_txBufferSize ); |
8361 | 155 |
m_txBuffer.erase (m_txBuffer.begin ()); |
156 |
||
157 |
while ( firstSegment && (firstSegment->GetSize () > 0) && (nextSegmentSize > 0) ) |
|
158 |
{ |
|
8493
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
159 |
NS_LOG_LOGIC ("WHILE ( firstSegment && firstSegment->GetSize > 0 && nextSegmentSize > 0 )"); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
160 |
NS_LOG_LOGIC (" firstSegment size = " << firstSegment->GetSize ()); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
161 |
NS_LOG_LOGIC (" nextSegmentSize = " << nextSegmentSize); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
162 |
if ( (firstSegment->GetSize () > nextSegmentSize) || |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
163 |
// Segment larger than 2047 octets can only be mapped to the end of the Data field |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
164 |
(firstSegment->GetSize () > 2047) |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
165 |
) |
8361 | 166 |
{ |
8493
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
167 |
// Take the minimum size, due to the 2047-bytes 3GPP exception |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
168 |
// This exception is due to the length of the LI field (just 11 bits) |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
169 |
uint32_t currSegmentSize = std::min (firstSegment->GetSize (), nextSegmentSize); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
170 |
|
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
171 |
NS_LOG_LOGIC (" IF ( firstSegment > nextSegmentSize ||"); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
172 |
NS_LOG_LOGIC (" firstSegment > 2047 )"); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
173 |
|
8361 | 174 |
// Segment txBuffer.FirstBuffer and |
175 |
// Give back the remaining segment to the transmission buffer |
|
8493
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
176 |
Ptr<Packet> newSegment = firstSegment->CreateFragment (0, currSegmentSize); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
177 |
NS_LOG_LOGIC (" newSegment size = " << newSegment->GetSize ()); |
8361 | 178 |
|
179 |
// Status tag of the new and remaining segments |
|
180 |
// Note: This is the only place where a PDU is segmented and |
|
181 |
// therefore its status can change |
|
8493
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
182 |
LteRlcSduStatusTag oldTag, newTag; |
8361 | 183 |
firstSegment->RemovePacketTag (oldTag); |
184 |
newSegment->RemovePacketTag (newTag); |
|
185 |
if (oldTag.GetStatus () == LteRlcSduStatusTag::FULL_SDU) |
|
186 |
{ |
|
187 |
newTag.SetStatus (LteRlcSduStatusTag::FIRST_SEGMENT); |
|
188 |
oldTag.SetStatus (LteRlcSduStatusTag::LAST_SEGMENT); |
|
189 |
} |
|
190 |
else if (oldTag.GetStatus () == LteRlcSduStatusTag::LAST_SEGMENT) |
|
191 |
{ |
|
192 |
newTag.SetStatus (LteRlcSduStatusTag::MIDDLE_SEGMENT); |
|
193 |
//oldTag.SetStatus (LteRlcSduStatusTag::LAST_SEGMENT); |
|
194 |
} |
|
195 |
||
196 |
// Give back the remaining segment to the transmission buffer |
|
8493
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
197 |
firstSegment->RemoveAtStart (currSegmentSize); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
198 |
NS_LOG_LOGIC (" firstSegment size (after RemoveAtStart) = " << firstSegment->GetSize ()); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
199 |
if (firstSegment->GetSize () > 0) |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
200 |
{ |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
201 |
firstSegment->AddPacketTag (oldTag); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
202 |
|
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
203 |
m_txBuffer.insert (m_txBuffer.begin (), firstSegment); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
204 |
m_txBufferSize += (*(m_txBuffer.begin()))->GetSize (); |
8361 | 205 |
|
8493
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
206 |
NS_LOG_LOGIC (" TX buffer: Give back the remaining segment"); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
207 |
NS_LOG_LOGIC (" TX buffers = " << m_txBuffer.size ()); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
208 |
NS_LOG_LOGIC (" Front buffer size = " << (*(m_txBuffer.begin()))->GetSize ()); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
209 |
NS_LOG_LOGIC (" txBufferSize = " << m_txBufferSize ); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
210 |
} |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
211 |
else |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
212 |
{ |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
213 |
// Whole segment was taken, so adjust tag |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
214 |
if (newTag.GetStatus () == LteRlcSduStatusTag::FIRST_SEGMENT) |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
215 |
{ |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
216 |
newTag.SetStatus (LteRlcSduStatusTag::FULL_SDU); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
217 |
} |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
218 |
else if (newTag.GetStatus () == LteRlcSduStatusTag::MIDDLE_SEGMENT) |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
219 |
{ |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
220 |
newTag.SetStatus (LteRlcSduStatusTag::LAST_SEGMENT); |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
221 |
} |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
222 |
} |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
223 |
// Segment is completely taken or |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
224 |
// the remaining segment is given back to the transmission buffer |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
225 |
firstSegment = 0; |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
226 |
|
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
227 |
// Put status tag once it has been adjusted |
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
228 |
newSegment->AddPacketTag (newTag); |
8361 | 229 |
|
230 |
// Add Segment to Data field |
|
231 |
dataFieldAddedSize = newSegment->GetSize (); |
|
232 |
dataFieldTotalSize += dataFieldAddedSize; |
|
233 |
dataField.push_back (newSegment); |
|
8493
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
234 |
newSegment = 0; |
8361 | 235 |
|
236 |
// ExtensionBit (Next_Segment - 1) = 0 |
|
237 |
rlcHeader.PushExtensionBit (LteRlcHeader::DATA_FIELD_FOLLOWS); |
|
238 |
||
239 |
// no LengthIndicator for the last one |
|
240 |
||
241 |
nextSegmentSize -= dataFieldAddedSize; |
|
242 |
nextSegmentId++; |
|
243 |
||
8493
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
244 |
// nextSegmentSize MUST be zero (only if segment is smaller or equal to 2047) |
8361 | 245 |
|
246 |
// (NO more segments) → exit |
|
247 |
// break; |
|
248 |
} |
|
8586
6c6fdf44d58b
Process of very small segments at the end of a PDU
Manuel Requena <manuel.requena@cttc.es>
parents:
8572
diff
changeset
|
249 |
else if ( (nextSegmentSize - firstSegment->GetSize () <= 2) || (m_txBuffer.size () == 0) ) |
8361 | 250 |
{ |
8586
6c6fdf44d58b
Process of very small segments at the end of a PDU
Manuel Requena <manuel.requena@cttc.es>
parents:
8572
diff
changeset
|
251 |
NS_LOG_LOGIC (" IF nextSegmentSize - firstSegment->GetSize () <= 2 || txBuffer.size == 0"); |
8361 | 252 |
// Add txBuffer.FirstBuffer to DataField |
253 |
dataFieldAddedSize = firstSegment->GetSize (); |
|
254 |
dataFieldTotalSize += dataFieldAddedSize; |
|
255 |
dataField.push_back (firstSegment); |
|
8493
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
256 |
firstSegment = 0; |
8361 | 257 |
|
258 |
// ExtensionBit (Next_Segment - 1) = 0 |
|
259 |
rlcHeader.PushExtensionBit (LteRlcHeader::DATA_FIELD_FOLLOWS); |
|
260 |
||
261 |
// no LengthIndicator for the last one |
|
262 |
||
263 |
nextSegmentSize -= dataFieldAddedSize; |
|
264 |
nextSegmentId++; |
|
265 |
||
266 |
NS_LOG_LOGIC (" SDUs in TxBuffer = " << m_txBuffer.size ()); |
|
267 |
if (m_txBuffer.size () > 0) |
|
268 |
{ |
|
269 |
NS_LOG_LOGIC (" First SDU buffer = " << *(m_txBuffer.begin())); |
|
270 |
NS_LOG_LOGIC (" First SDU size = " << (*(m_txBuffer.begin()))->GetSize ()); |
|
271 |
} |
|
8493
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
272 |
NS_LOG_LOGIC (" Next segment size = " << nextSegmentSize); |
8361 | 273 |
|
8586
6c6fdf44d58b
Process of very small segments at the end of a PDU
Manuel Requena <manuel.requena@cttc.es>
parents:
8572
diff
changeset
|
274 |
// nextSegmentSize <= 2 (only if txBuffer is not empty) |
8361 | 275 |
|
276 |
// (NO more segments) → exit |
|
277 |
// break; |
|
278 |
} |
|
279 |
else // (firstSegment->GetSize () < m_nextSegmentSize) && (m_txBuffer.size () > 0) |
|
280 |
{ |
|
281 |
NS_LOG_LOGIC (" IF firstSegment < NextSegmentSize && txBuffer.size > 0"); |
|
282 |
// Add txBuffer.FirstBuffer to DataField |
|
283 |
dataFieldAddedSize = firstSegment->GetSize (); |
|
284 |
dataFieldTotalSize += dataFieldAddedSize; |
|
285 |
dataField.push_back (firstSegment); |
|
286 |
||
287 |
// ExtensionBit (Next_Segment - 1) = 1 |
|
288 |
rlcHeader.PushExtensionBit (LteRlcHeader::E_LI_FIELDS_FOLLOWS); |
|
289 |
||
290 |
// LengthIndicator (Next_Segment) = txBuffer.FirstBuffer.length() |
|
291 |
rlcHeader.PushLengthIndicator (firstSegment->GetSize ()); |
|
292 |
||
8586
6c6fdf44d58b
Process of very small segments at the end of a PDU
Manuel Requena <manuel.requena@cttc.es>
parents:
8572
diff
changeset
|
293 |
nextSegmentSize -= ((nextSegmentId % 2) ? (2) : (1)) + dataFieldAddedSize; |
8361 | 294 |
nextSegmentId++; |
295 |
||
296 |
NS_LOG_LOGIC (" SDUs in TxBuffer = " << m_txBuffer.size ()); |
|
297 |
if (m_txBuffer.size () > 0) |
|
298 |
{ |
|
299 |
NS_LOG_LOGIC (" First SDU buffer = " << *(m_txBuffer.begin())); |
|
300 |
NS_LOG_LOGIC (" First SDU size = " << (*(m_txBuffer.begin()))->GetSize ()); |
|
301 |
} |
|
302 |
NS_LOG_LOGIC (" Next segment size = " << nextSegmentSize); |
|
303 |
NS_LOG_LOGIC (" Remove SDU from TxBuffer"); |
|
304 |
||
305 |
// (more segments) |
|
306 |
firstSegment = (*(m_txBuffer.begin ()))->Copy (); |
|
8377
3ae363919ea3
Add estimated size of RLC headers in queue size
Manuel Requena <manuel.requena@cttc.es>
parents:
8375
diff
changeset
|
307 |
m_txBufferSize -= (*(m_txBuffer.begin()))->GetSize (); |
8361 | 308 |
m_txBuffer.erase (m_txBuffer.begin ()); |
8377
3ae363919ea3
Add estimated size of RLC headers in queue size
Manuel Requena <manuel.requena@cttc.es>
parents:
8375
diff
changeset
|
309 |
NS_LOG_LOGIC (" txBufferSize = " << m_txBufferSize ); |
8361 | 310 |
} |
311 |
||
312 |
} |
|
313 |
||
314 |
// Build RLC header |
|
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
315 |
rlcHeader.SetSequenceNumber (m_sequenceNumber++); |
8361 | 316 |
|
317 |
// Build RLC PDU with DataField and Header |
|
318 |
std::vector< Ptr<Packet> >::iterator it; |
|
319 |
it = dataField.begin (); |
|
320 |
||
321 |
uint8_t framingInfo = 0; |
|
322 |
||
323 |
// FIRST SEGMENT |
|
324 |
LteRlcSduStatusTag tag; |
|
325 |
(*it)->RemovePacketTag (tag); |
|
326 |
if ( (tag.GetStatus () == LteRlcSduStatusTag::FULL_SDU) || |
|
327 |
(tag.GetStatus () == LteRlcSduStatusTag::FIRST_SEGMENT) ) |
|
328 |
{ |
|
329 |
framingInfo |= LteRlcHeader::FIRST_BYTE; |
|
330 |
} |
|
331 |
else |
|
332 |
{ |
|
333 |
framingInfo |= LteRlcHeader::NO_FIRST_BYTE; |
|
334 |
} |
|
335 |
(*it)->AddPacketTag (tag); |
|
336 |
||
337 |
while (it < dataField.end ()) |
|
338 |
{ |
|
339 |
NS_LOG_LOGIC ("Adding SDU/segment to packet, length = " << (*it)->GetSize ()); |
|
340 |
||
341 |
packet->AddAtEnd (*it); |
|
342 |
it++; |
|
343 |
} |
|
344 |
||
345 |
// LAST SEGMENT (Note: There could be only one and be the first one) |
|
346 |
it--; |
|
347 |
(*it)->RemovePacketTag (tag); |
|
348 |
if ( (tag.GetStatus () == LteRlcSduStatusTag::FULL_SDU) || |
|
349 |
(tag.GetStatus () == LteRlcSduStatusTag::LAST_SEGMENT) ) |
|
350 |
{ |
|
351 |
framingInfo |= LteRlcHeader::LAST_BYTE; |
|
352 |
} |
|
353 |
else |
|
354 |
{ |
|
355 |
framingInfo |= LteRlcHeader::NO_LAST_BYTE; |
|
356 |
} |
|
357 |
(*it)->AddPacketTag (tag); |
|
358 |
||
359 |
rlcHeader.SetFramingInfo (framingInfo); |
|
360 |
||
361 |
NS_LOG_LOGIC ("RLC header: " << rlcHeader); |
|
362 |
packet->AddHeader (rlcHeader); |
|
363 |
||
8422 | 364 |
// Sender timestamp |
365 |
RlcTag rlcTag (Simulator::Now ()); |
|
366 |
packet->AddByteTag (rlcTag); |
|
367 |
m_txPdu (m_rnti, m_lcid, packet->GetSize ()); |
|
368 |
||
8361 | 369 |
// Send RLC PDU to MAC layer |
370 |
LteMacSapProvider::TransmitPduParameters params; |
|
371 |
params.pdu = packet; |
|
372 |
params.rnti = m_rnti; |
|
373 |
params.lcid = m_lcid; |
|
8714
398bbcbb3f42
Add MIMO model, test and documentation
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8586
diff
changeset
|
374 |
params.layer = layer; |
8361 | 375 |
|
376 |
m_macSapProvider->TransmitPdu (params); |
|
8499
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
377 |
|
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
378 |
if (! m_txBuffer.empty ()) |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
379 |
{ |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
380 |
m_rbsTimer.Cancel (); |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
381 |
m_rbsTimer = Simulator::Schedule (MilliSeconds (10), &LteRlcUm::ExpireRbsTimer, this); |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
382 |
} |
8361 | 383 |
} |
384 |
||
385 |
void |
|
386 |
LteRlcUm::DoNotifyHarqDeliveryFailure () |
|
387 |
{ |
|
388 |
NS_LOG_FUNCTION (this); |
|
389 |
} |
|
390 |
||
391 |
void |
|
392 |
LteRlcUm::DoReceivePdu (Ptr<Packet> p) |
|
393 |
{ |
|
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
394 |
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << p->GetSize ()); |
8361 | 395 |
|
8422 | 396 |
// Receiver timestamp |
397 |
RlcTag rlcTag; |
|
398 |
Time delay; |
|
399 |
if (p->FindFirstMatchingByteTag (rlcTag)) |
|
400 |
{ |
|
401 |
delay = Simulator::Now() - rlcTag.GetSenderTimestamp (); |
|
402 |
} |
|
8666 | 403 |
m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ()); |
8422 | 404 |
|
8361 | 405 |
// 5.1.2.2 Receive operations |
406 |
||
407 |
// Get RLC header parameters |
|
408 |
LteRlcHeader rlcHeader; |
|
409 |
p->PeekHeader (rlcHeader); |
|
8493
e6926c24bdd6
Support of PDU segments larger than 2047
Manuel Requena <manuel.requena@cttc.es>
parents:
8422
diff
changeset
|
410 |
NS_LOG_LOGIC ("RLC header: " << rlcHeader); |
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
411 |
SequenceNumber10 seqNumber = rlcHeader.GetSequenceNumber (); |
8361 | 412 |
|
413 |
// 5.1.2.2.1 General |
|
414 |
// The receiving UM RLC entity shall maintain a reordering window according to state variable VR(UH) as follows: |
|
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
415 |
// - a SN falls within the reordering window if (VR(UH) - UM_Window_Size) <= SN < VR(UH); |
8361 | 416 |
// - a SN falls outside of the reordering window otherwise. |
417 |
// When receiving an UMD PDU from lower layer, the receiving UM RLC entity shall: |
|
418 |
// - either discard the received UMD PDU or place it in the reception buffer (see sub clause 5.1.2.2.2); |
|
419 |
// - if the received UMD PDU was placed in the reception buffer: |
|
420 |
// - update state variables, reassemble and deliver RLC SDUs to upper layer and start/stop t-Reordering as needed (see sub clause 5.1.2.2.3); |
|
421 |
// When t-Reordering expires, the receiving UM RLC entity shall: |
|
422 |
// - update state variables, reassemble and deliver RLC SDUs to upper layer and start t-Reordering as needed (see sub clause 5.1.2.2.4). |
|
423 |
||
424 |
// 5.1.2.2.2 Actions when an UMD PDU is received from lower layer |
|
425 |
// When an UMD PDU with SN = x is received from lower layer, the receiving UM RLC entity shall: |
|
426 |
// - if VR(UR) < x < VR(UH) and the UMD PDU with SN = x has been received before; or |
|
427 |
// - if (VR(UH) - UM_Window_Size) <= x < VR(UR): |
|
428 |
// - discard the received UMD PDU; |
|
429 |
// - else: |
|
430 |
// - place the received UMD PDU in the reception buffer. |
|
431 |
||
432 |
NS_LOG_LOGIC ("VR(UR) = " << m_vrUr); |
|
433 |
NS_LOG_LOGIC ("VR(UX) = " << m_vrUx); |
|
434 |
NS_LOG_LOGIC ("VR(UH) = " << m_vrUh); |
|
435 |
NS_LOG_LOGIC ("SN = " << seqNumber); |
|
436 |
||
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
437 |
m_vrUr.SetModulusBase (m_vrUh - m_windowSize); |
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
438 |
m_vrUh.SetModulusBase (m_vrUh - m_windowSize); |
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
439 |
seqNumber.SetModulusBase (m_vrUh - m_windowSize); |
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
440 |
|
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
441 |
if ( ( (m_vrUr < seqNumber) && (seqNumber < m_vrUh) && (m_rxBuffer.count (seqNumber.GetValue ()) > 0) ) || |
8361 | 442 |
( ((m_vrUh - m_windowSize) <= seqNumber) && (seqNumber < m_vrUr) ) |
443 |
) |
|
444 |
{ |
|
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
445 |
NS_LOG_LOGIC ("PDU discarded"); |
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
446 |
p = 0; |
8361 | 447 |
return; |
448 |
} |
|
449 |
else |
|
450 |
{ |
|
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
451 |
NS_LOG_LOGIC ("Place PDU in the reception buffer"); |
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
452 |
m_rxBuffer[seqNumber.GetValue ()] = p; |
8361 | 453 |
} |
454 |
||
455 |
||
456 |
// 5.1.2.2.3 Actions when an UMD PDU is placed in the reception buffer |
|
457 |
// When an UMD PDU with SN = x is placed in the reception buffer, the receiving UM RLC entity shall: |
|
458 |
||
459 |
// - if x falls outside of the reordering window: |
|
460 |
// - update VR(UH) to x + 1; |
|
461 |
// - reassemble RLC SDUs from any UMD PDUs with SN that falls outside of the reordering window, remove |
|
462 |
// RLC headers when doing so and deliver the reassembled RLC SDUs to upper layer in ascending order of the |
|
463 |
// RLC SN if not delivered before; |
|
464 |
// - if VR(UR) falls outside of the reordering window: |
|
465 |
// - set VR(UR) to (VR(UH) - UM_Window_Size); |
|
466 |
||
467 |
if ( ! IsInsideReorderingWindow (seqNumber)) |
|
468 |
{ |
|
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
469 |
NS_LOG_LOGIC ("SN is outside the reordering window"); |
8361 | 470 |
|
471 |
m_vrUh = seqNumber + 1; |
|
472 |
NS_LOG_LOGIC ("New VR(UH) = " << m_vrUh); |
|
473 |
||
474 |
ReassembleOutsideWindow (); |
|
475 |
||
476 |
if ( ! IsInsideReorderingWindow (m_vrUr) ) |
|
477 |
{ |
|
478 |
m_vrUr = m_vrUh - m_windowSize; |
|
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
479 |
NS_LOG_LOGIC ("VR(UR) is outside the reordering window"); |
8361 | 480 |
NS_LOG_LOGIC ("New VR(UR) = " << m_vrUr); |
481 |
} |
|
482 |
} |
|
483 |
||
484 |
// - if the reception buffer contains an UMD PDU with SN = VR(UR): |
|
485 |
// - update VR(UR) to the SN of the first UMD PDU with SN > current VR(UR) that has not been received; |
|
486 |
// - reassemble RLC SDUs from any UMD PDUs with SN < updated VR(UR), remove RLC headers when doing |
|
487 |
// so and deliver the reassembled RLC SDUs to upper layer in ascending order of the RLC SN if not delivered |
|
488 |
// before; |
|
489 |
||
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
490 |
if ( m_rxBuffer.count (m_vrUr.GetValue ()) > 0 ) |
8361 | 491 |
{ |
492 |
NS_LOG_LOGIC ("Reception buffer contains SN = " << m_vrUr); |
|
493 |
||
494 |
std::map <uint16_t, Ptr<Packet> >::iterator it; |
|
495 |
uint16_t newVrUr; |
|
8709
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
496 |
SequenceNumber10 oldVrUr = m_vrUr; |
8361 | 497 |
|
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
498 |
it = m_rxBuffer.find (m_vrUr.GetValue ()); |
8361 | 499 |
newVrUr = (it->first) + 1; |
500 |
while ( m_rxBuffer.count (newVrUr) > 0 ) |
|
501 |
{ |
|
502 |
newVrUr++; |
|
503 |
} |
|
504 |
m_vrUr = newVrUr; |
|
505 |
NS_LOG_LOGIC ("New VR(UR) = " << m_vrUr); |
|
506 |
||
8709
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
507 |
ReassembleSnInterval (oldVrUr, m_vrUr); |
8361 | 508 |
} |
509 |
||
8618
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
510 |
// m_vrUh can change previously, set new modulus base |
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
511 |
// for the t-Reordering timer-related comparisons |
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
512 |
m_vrUr.SetModulusBase (m_vrUh - m_windowSize); |
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
513 |
m_vrUx.SetModulusBase (m_vrUh - m_windowSize); |
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
514 |
m_vrUh.SetModulusBase (m_vrUh - m_windowSize); |
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
515 |
|
8361 | 516 |
// - if t-Reordering is running: |
517 |
// - if VR(UX) <= VR(UR); or |
|
518 |
// - if VR(UX) falls outside of the reordering window and VR(UX) is not equal to VR(UH):: |
|
519 |
// - stop and reset t-Reordering; |
|
520 |
if ( m_reorderingTimer.IsRunning () ) |
|
521 |
{ |
|
522 |
NS_LOG_LOGIC ("Reordering timer is running"); |
|
523 |
||
524 |
if ( (m_vrUx <= m_vrUr) || |
|
525 |
((! IsInsideReorderingWindow (m_vrUx)) && (m_vrUx != m_vrUh)) ) |
|
526 |
{ |
|
527 |
NS_LOG_LOGIC ("Stop reordering timer"); |
|
528 |
m_reorderingTimer.Cancel (); |
|
529 |
} |
|
530 |
} |
|
531 |
||
532 |
// - if t-Reordering is not running (includes the case when t-Reordering is stopped due to actions above): |
|
533 |
// - if VR(UH) > VR(UR): |
|
534 |
// - start t-Reordering; |
|
535 |
// - set VR(UX) to VR(UH). |
|
536 |
if ( ! m_reorderingTimer.IsRunning () ) |
|
537 |
{ |
|
538 |
NS_LOG_LOGIC ("Reordering timer is not running"); |
|
539 |
||
8618
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
540 |
if ( m_vrUh > m_vrUr ) |
8361 | 541 |
{ |
8618
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
542 |
NS_LOG_LOGIC ("VR(UH) > VR(UR)"); |
8361 | 543 |
NS_LOG_LOGIC ("Start reordering timer"); |
8618
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
544 |
m_reorderingTimer = Simulator::Schedule (Time ("0.1s"), |
8361 | 545 |
&LteRlcUm::ExpireReorderingTimer ,this); |
546 |
m_vrUx = m_vrUh; |
|
547 |
NS_LOG_LOGIC ("New VR(UX) = " << m_vrUx); |
|
548 |
} |
|
549 |
} |
|
550 |
||
551 |
} |
|
552 |
||
553 |
||
554 |
void |
|
555 |
LteRlcUm::Start () |
|
556 |
{ |
|
557 |
NS_LOG_FUNCTION (this); |
|
558 |
||
8499
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
559 |
DoReportBufferStatus (); |
8361 | 560 |
} |
561 |
||
562 |
||
563 |
bool |
|
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
564 |
LteRlcUm::IsInsideReorderingWindow (SequenceNumber10 seqNumber) |
8361 | 565 |
{ |
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
566 |
NS_LOG_FUNCTION (this << seqNumber); |
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
567 |
NS_LOG_LOGIC ("Reordering Window: " << |
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
568 |
m_vrUh << " - " << m_windowSize << " <= " << seqNumber << " < " << m_vrUh); |
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
569 |
|
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
570 |
m_vrUh.SetModulusBase (m_vrUh - m_windowSize); |
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
571 |
seqNumber.SetModulusBase (m_vrUh - m_windowSize); |
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
572 |
|
8361 | 573 |
if ( ((m_vrUh - m_windowSize) <= seqNumber) && (seqNumber < m_vrUh)) |
574 |
{ |
|
8618
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
575 |
NS_LOG_LOGIC (seqNumber << " is INSIDE the reordering window"); |
8361 | 576 |
return true; |
577 |
} |
|
578 |
else |
|
579 |
{ |
|
8618
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
580 |
NS_LOG_LOGIC (seqNumber << " is OUTSIDE the reordering window"); |
8361 | 581 |
return false; |
582 |
} |
|
583 |
} |
|
584 |
||
585 |
||
586 |
void |
|
587 |
LteRlcUm::ReassembleAndDeliver (Ptr<Packet> packet) |
|
588 |
{ |
|
589 |
LteRlcHeader rlcHeader; |
|
590 |
packet->RemoveHeader (rlcHeader); |
|
591 |
uint8_t framingInfo = rlcHeader.GetFramingInfo (); |
|
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
592 |
SequenceNumber10 currSeqNumber = rlcHeader.GetSequenceNumber (); |
8361 | 593 |
bool expectedSnLost; |
594 |
||
595 |
if ( currSeqNumber != m_expectedSeqNumber ) |
|
596 |
{ |
|
597 |
expectedSnLost = true; |
|
598 |
NS_LOG_LOGIC ("There are losses. Expected SN = " << m_expectedSeqNumber << ". Current SN = " << currSeqNumber); |
|
599 |
m_expectedSeqNumber = currSeqNumber + 1; |
|
600 |
} |
|
601 |
else |
|
602 |
{ |
|
603 |
expectedSnLost = false; |
|
604 |
NS_LOG_LOGIC ("No losses. Expected SN = " << m_expectedSeqNumber << ". Current SN = " << currSeqNumber); |
|
605 |
m_expectedSeqNumber++; |
|
606 |
} |
|
607 |
||
608 |
// Build list of SDUs |
|
609 |
uint8_t extensionBit; |
|
610 |
uint16_t lengthIndicator; |
|
611 |
do |
|
612 |
{ |
|
613 |
extensionBit = rlcHeader.PopExtensionBit (); |
|
614 |
NS_LOG_LOGIC ("E = " << (uint16_t)extensionBit); |
|
615 |
||
616 |
if ( extensionBit == 0 ) |
|
617 |
{ |
|
618 |
m_sdusBuffer.push_back (packet); |
|
619 |
} |
|
620 |
else // extensionBit == 1 |
|
621 |
{ |
|
622 |
lengthIndicator = rlcHeader.PopLengthIndicator (); |
|
623 |
NS_LOG_LOGIC ("LI = " << lengthIndicator); |
|
624 |
||
625 |
// Check if there is enough data in the packet |
|
626 |
if ( lengthIndicator >= packet->GetSize () ) |
|
627 |
{ |
|
628 |
NS_LOG_LOGIC ("INTERNAL ERROR: Not enough data in the packet (" << packet->GetSize () << "). Needed LI=" << lengthIndicator); |
|
629 |
} |
|
630 |
||
631 |
// Split packet in two fragments |
|
632 |
Ptr<Packet> data_field = packet->CreateFragment (0, lengthIndicator); |
|
633 |
packet->RemoveAtStart (lengthIndicator); |
|
634 |
||
635 |
m_sdusBuffer.push_back (data_field); |
|
636 |
} |
|
637 |
} |
|
638 |
while ( extensionBit == 1 ); |
|
639 |
||
640 |
std::list < Ptr<Packet> >::iterator it; |
|
641 |
||
642 |
// Current reassembling state |
|
643 |
if (m_reassemblingState == WAITING_S0_FULL) NS_LOG_LOGIC ("Reassembling State = 'WAITING_S0_FULL'"); |
|
644 |
else if (m_reassemblingState == WAITING_SI_SF) NS_LOG_LOGIC ("Reassembling State = 'WAITING_SI_SF'"); |
|
645 |
else NS_LOG_LOGIC ("Reassembling State = Unknown state"); |
|
646 |
||
647 |
// Received framing Info |
|
648 |
NS_LOG_LOGIC ("Framing Info = " << (uint16_t)framingInfo); |
|
649 |
||
650 |
// Reassemble the list of SDUs (when there is no losses) |
|
651 |
if (!expectedSnLost) |
|
652 |
{ |
|
653 |
switch (m_reassemblingState) |
|
654 |
{ |
|
655 |
case WAITING_S0_FULL: |
|
656 |
switch (framingInfo) |
|
657 |
{ |
|
658 |
case (LteRlcHeader::FIRST_BYTE | LteRlcHeader::LAST_BYTE): |
|
659 |
m_reassemblingState = WAITING_S0_FULL; |
|
660 |
||
661 |
/** |
|
662 |
* Deliver one or multiple PDUs |
|
663 |
*/ |
|
664 |
for ( it = m_sdusBuffer.begin () ; it != m_sdusBuffer.end () ; it++ ) |
|
665 |
{ |
|
666 |
m_rlcSapUser->ReceivePdcpPdu (*it); |
|
667 |
} |
|
668 |
m_sdusBuffer.clear (); |
|
669 |
break; |
|
670 |
||
671 |
case (LteRlcHeader::FIRST_BYTE | LteRlcHeader::NO_LAST_BYTE): |
|
672 |
m_reassemblingState = WAITING_SI_SF; |
|
673 |
||
674 |
/** |
|
675 |
* Deliver full PDUs |
|
676 |
*/ |
|
677 |
while ( m_sdusBuffer.size () > 1 ) |
|
678 |
{ |
|
679 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
|
680 |
m_sdusBuffer.pop_front (); |
|
681 |
} |
|
682 |
||
683 |
/** |
|
684 |
* Keep S0 |
|
685 |
*/ |
|
686 |
m_keepS0 = m_sdusBuffer.front (); |
|
687 |
m_sdusBuffer.pop_front (); |
|
688 |
break; |
|
689 |
||
690 |
case (LteRlcHeader::NO_FIRST_BYTE | LteRlcHeader::LAST_BYTE): |
|
8638
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
691 |
m_reassemblingState = WAITING_S0_FULL; |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
692 |
|
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
693 |
/** |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
694 |
* Discard SI or SN |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
695 |
*/ |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
696 |
m_sdusBuffer.pop_front (); |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
697 |
|
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
698 |
/** |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
699 |
* Deliver zero, one or multiple PDUs |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
700 |
*/ |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
701 |
while ( ! m_sdusBuffer.empty () ) |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
702 |
{ |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
703 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
704 |
m_sdusBuffer.pop_front (); |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
705 |
} |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
706 |
break; |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
707 |
|
8361 | 708 |
case (LteRlcHeader::NO_FIRST_BYTE | LteRlcHeader::NO_LAST_BYTE): |
8638
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
709 |
if ( m_sdusBuffer.size () == 1 ) |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
710 |
{ |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
711 |
m_reassemblingState = WAITING_S0_FULL; |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
712 |
} |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
713 |
else |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
714 |
{ |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
715 |
m_reassemblingState = WAITING_SI_SF; |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
716 |
} |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
717 |
|
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
718 |
/** |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
719 |
* Discard SI or SN |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
720 |
*/ |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
721 |
m_sdusBuffer.pop_front (); |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
722 |
|
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
723 |
if ( m_sdusBuffer.size () > 0 ) |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
724 |
{ |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
725 |
/** |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
726 |
* Deliver zero, one or multiple PDUs |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
727 |
*/ |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
728 |
while ( m_sdusBuffer.size () > 1 ) |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
729 |
{ |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
730 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
731 |
m_sdusBuffer.pop_front (); |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
732 |
} |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
733 |
|
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
734 |
/** |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
735 |
* Keep S0 |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
736 |
*/ |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
737 |
m_keepS0 = m_sdusBuffer.front (); |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
738 |
m_sdusBuffer.pop_front (); |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
739 |
} |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
740 |
break; |
5a6544286265
Fix bad state transition in the SDU reassembling process
Manuel Requena <manuel.requena@cttc.es>
parents:
8618
diff
changeset
|
741 |
|
8361 | 742 |
default: |
743 |
/** |
|
744 |
* ERROR: Transition not possible |
|
745 |
*/ |
|
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
746 |
NS_LOG_LOGIC ("INTERNAL ERROR: Transition not possible. FI = " << (uint32_t) framingInfo); |
8361 | 747 |
break; |
748 |
} |
|
749 |
break; |
|
750 |
||
751 |
case WAITING_SI_SF: |
|
752 |
switch (framingInfo) |
|
753 |
{ |
|
754 |
case (LteRlcHeader::NO_FIRST_BYTE | LteRlcHeader::LAST_BYTE): |
|
755 |
m_reassemblingState = WAITING_S0_FULL; |
|
756 |
||
757 |
/** |
|
758 |
* Deliver (Kept)S0 + SN |
|
759 |
*/ |
|
760 |
m_keepS0->AddAtEnd (m_sdusBuffer.front ()); |
|
761 |
m_sdusBuffer.pop_front (); |
|
762 |
m_rlcSapUser->ReceivePdcpPdu (m_keepS0); |
|
763 |
||
764 |
/** |
|
765 |
* Deliver zero, one or multiple PDUs |
|
766 |
*/ |
|
767 |
while ( ! m_sdusBuffer.empty () ) |
|
768 |
{ |
|
769 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
|
770 |
m_sdusBuffer.pop_front (); |
|
771 |
} |
|
772 |
break; |
|
773 |
||
774 |
case (LteRlcHeader::NO_FIRST_BYTE | LteRlcHeader::NO_LAST_BYTE): |
|
775 |
m_reassemblingState = WAITING_SI_SF; |
|
776 |
||
777 |
/** |
|
778 |
* Keep SI |
|
779 |
*/ |
|
780 |
if ( m_sdusBuffer.size () == 1 ) |
|
781 |
{ |
|
782 |
m_keepS0->AddAtEnd (m_sdusBuffer.front ()); |
|
783 |
m_sdusBuffer.pop_front (); |
|
784 |
} |
|
785 |
else // m_sdusBuffer.size () > 1 |
|
786 |
{ |
|
787 |
/** |
|
788 |
* Deliver (Kept)S0 + SN |
|
789 |
*/ |
|
790 |
m_keepS0->AddAtEnd (m_sdusBuffer.front ()); |
|
791 |
m_sdusBuffer.pop_front (); |
|
792 |
m_rlcSapUser->ReceivePdcpPdu (m_keepS0); |
|
793 |
||
794 |
/** |
|
795 |
* Deliver zero, one or multiple PDUs |
|
796 |
*/ |
|
797 |
while ( m_sdusBuffer.size () > 1 ) |
|
798 |
{ |
|
799 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
|
800 |
m_sdusBuffer.pop_front (); |
|
801 |
} |
|
802 |
||
803 |
/** |
|
804 |
* Keep S0 |
|
805 |
*/ |
|
806 |
m_keepS0 = m_sdusBuffer.front (); |
|
807 |
m_sdusBuffer.pop_front (); |
|
808 |
} |
|
809 |
break; |
|
810 |
||
811 |
case (LteRlcHeader::FIRST_BYTE | LteRlcHeader::LAST_BYTE): |
|
812 |
case (LteRlcHeader::FIRST_BYTE | LteRlcHeader::NO_LAST_BYTE): |
|
813 |
default: |
|
814 |
/** |
|
815 |
* ERROR: Transition not possible |
|
816 |
*/ |
|
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
817 |
NS_LOG_LOGIC ("INTERNAL ERROR: Transition not possible. FI = " << (uint32_t) framingInfo); |
8361 | 818 |
break; |
819 |
} |
|
820 |
break; |
|
821 |
||
822 |
default: |
|
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
823 |
NS_LOG_LOGIC ("INTERNAL ERROR: Wrong reassembling state = " << (uint32_t) m_reassemblingState); |
8361 | 824 |
break; |
825 |
} |
|
826 |
} |
|
827 |
else // Reassemble the list of SDUs (when there are losses, i.e. the received SN is not the expected one) |
|
828 |
{ |
|
829 |
switch (m_reassemblingState) |
|
830 |
{ |
|
831 |
case WAITING_S0_FULL: |
|
832 |
switch (framingInfo) |
|
833 |
{ |
|
834 |
case (LteRlcHeader::FIRST_BYTE | LteRlcHeader::LAST_BYTE): |
|
835 |
m_reassemblingState = WAITING_S0_FULL; |
|
836 |
||
837 |
/** |
|
838 |
* Deliver one or multiple PDUs |
|
839 |
*/ |
|
840 |
for ( it = m_sdusBuffer.begin () ; it != m_sdusBuffer.end () ; it++ ) |
|
841 |
{ |
|
842 |
m_rlcSapUser->ReceivePdcpPdu (*it); |
|
843 |
} |
|
844 |
m_sdusBuffer.clear (); |
|
845 |
break; |
|
846 |
||
847 |
case (LteRlcHeader::FIRST_BYTE | LteRlcHeader::NO_LAST_BYTE): |
|
848 |
m_reassemblingState = WAITING_SI_SF; |
|
849 |
||
850 |
/** |
|
851 |
* Deliver full PDUs |
|
852 |
*/ |
|
853 |
while ( m_sdusBuffer.size () > 1 ) |
|
854 |
{ |
|
855 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
|
856 |
m_sdusBuffer.pop_front (); |
|
857 |
} |
|
858 |
||
859 |
/** |
|
860 |
* Keep S0 |
|
861 |
*/ |
|
862 |
m_keepS0 = m_sdusBuffer.front (); |
|
863 |
m_sdusBuffer.pop_front (); |
|
864 |
break; |
|
865 |
||
866 |
case (LteRlcHeader::NO_FIRST_BYTE | LteRlcHeader::LAST_BYTE): |
|
867 |
m_reassemblingState = WAITING_S0_FULL; |
|
868 |
||
869 |
/** |
|
870 |
* Discard SN |
|
871 |
*/ |
|
872 |
m_sdusBuffer.pop_front (); |
|
873 |
||
874 |
/** |
|
875 |
* Deliver zero, one or multiple PDUs |
|
876 |
*/ |
|
877 |
while ( ! m_sdusBuffer.empty () ) |
|
878 |
{ |
|
879 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
|
880 |
m_sdusBuffer.pop_front (); |
|
881 |
} |
|
882 |
break; |
|
883 |
||
884 |
case (LteRlcHeader::NO_FIRST_BYTE | LteRlcHeader::NO_LAST_BYTE): |
|
885 |
if ( m_sdusBuffer.size () == 1 ) |
|
886 |
{ |
|
887 |
m_reassemblingState = WAITING_S0_FULL; |
|
888 |
} |
|
889 |
else |
|
890 |
{ |
|
891 |
m_reassemblingState = WAITING_SI_SF; |
|
892 |
} |
|
893 |
||
894 |
/** |
|
895 |
* Discard SI or SN |
|
896 |
*/ |
|
897 |
m_sdusBuffer.pop_front (); |
|
898 |
||
899 |
if ( m_sdusBuffer.size () > 0 ) |
|
900 |
{ |
|
901 |
/** |
|
902 |
* Deliver zero, one or multiple PDUs |
|
903 |
*/ |
|
904 |
while ( m_sdusBuffer.size () > 1 ) |
|
905 |
{ |
|
906 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
|
907 |
m_sdusBuffer.pop_front (); |
|
908 |
} |
|
909 |
||
910 |
/** |
|
911 |
* Keep S0 |
|
912 |
*/ |
|
913 |
m_keepS0 = m_sdusBuffer.front (); |
|
914 |
m_sdusBuffer.pop_front (); |
|
915 |
} |
|
916 |
break; |
|
917 |
||
918 |
default: |
|
919 |
/** |
|
920 |
* ERROR: Transition not possible |
|
921 |
*/ |
|
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
922 |
NS_LOG_LOGIC ("INTERNAL ERROR: Transition not possible. FI = " << (uint32_t) framingInfo); |
8361 | 923 |
break; |
924 |
} |
|
925 |
break; |
|
926 |
||
927 |
case WAITING_SI_SF: |
|
928 |
switch (framingInfo) |
|
929 |
{ |
|
930 |
case (LteRlcHeader::FIRST_BYTE | LteRlcHeader::LAST_BYTE): |
|
931 |
m_reassemblingState = WAITING_S0_FULL; |
|
932 |
||
933 |
/** |
|
934 |
* Discard S0 |
|
935 |
*/ |
|
936 |
m_keepS0 = 0; |
|
937 |
||
938 |
/** |
|
939 |
* Deliver one or multiple PDUs |
|
940 |
*/ |
|
941 |
while ( ! m_sdusBuffer.empty () ) |
|
942 |
{ |
|
943 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
|
944 |
m_sdusBuffer.pop_front (); |
|
945 |
} |
|
946 |
break; |
|
947 |
||
948 |
case (LteRlcHeader::FIRST_BYTE | LteRlcHeader::NO_LAST_BYTE): |
|
949 |
m_reassemblingState = WAITING_SI_SF; |
|
950 |
||
951 |
/** |
|
952 |
* Discard S0 |
|
953 |
*/ |
|
954 |
m_keepS0 = 0; |
|
955 |
||
956 |
/** |
|
957 |
* Deliver zero, one or multiple PDUs |
|
958 |
*/ |
|
959 |
while ( m_sdusBuffer.size () > 1 ) |
|
960 |
{ |
|
961 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
|
962 |
m_sdusBuffer.pop_front (); |
|
963 |
} |
|
964 |
||
965 |
/** |
|
966 |
* Keep S0 |
|
967 |
*/ |
|
968 |
m_keepS0 = m_sdusBuffer.front (); |
|
969 |
m_sdusBuffer.pop_front (); |
|
970 |
||
971 |
break; |
|
972 |
||
973 |
case (LteRlcHeader::NO_FIRST_BYTE | LteRlcHeader::LAST_BYTE): |
|
974 |
m_reassemblingState = WAITING_S0_FULL; |
|
975 |
||
976 |
/** |
|
977 |
* Discard S0 |
|
978 |
*/ |
|
979 |
m_keepS0 = 0; |
|
980 |
||
981 |
/** |
|
982 |
* Discard SI or SN |
|
983 |
*/ |
|
984 |
m_sdusBuffer.pop_front (); |
|
985 |
||
986 |
/** |
|
987 |
* Deliver zero, one or multiple PDUs |
|
988 |
*/ |
|
989 |
while ( ! m_sdusBuffer.empty () ) |
|
990 |
{ |
|
991 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
|
992 |
m_sdusBuffer.pop_front (); |
|
993 |
} |
|
994 |
break; |
|
995 |
||
996 |
case (LteRlcHeader::NO_FIRST_BYTE | LteRlcHeader::NO_LAST_BYTE): |
|
997 |
if ( m_sdusBuffer.size () == 1 ) |
|
998 |
{ |
|
999 |
m_reassemblingState = WAITING_S0_FULL; |
|
1000 |
} |
|
1001 |
else |
|
1002 |
{ |
|
1003 |
m_reassemblingState = WAITING_SI_SF; |
|
1004 |
} |
|
1005 |
||
1006 |
/** |
|
1007 |
* Discard S0 |
|
1008 |
*/ |
|
1009 |
m_keepS0 = 0; |
|
1010 |
||
1011 |
/** |
|
1012 |
* Discard SI or SN |
|
1013 |
*/ |
|
1014 |
m_sdusBuffer.pop_front (); |
|
1015 |
||
1016 |
if ( m_sdusBuffer.size () > 0 ) |
|
1017 |
{ |
|
1018 |
/** |
|
1019 |
* Deliver zero, one or multiple PDUs |
|
1020 |
*/ |
|
1021 |
while ( m_sdusBuffer.size () > 1 ) |
|
1022 |
{ |
|
1023 |
m_rlcSapUser->ReceivePdcpPdu (m_sdusBuffer.front ()); |
|
1024 |
m_sdusBuffer.pop_front (); |
|
1025 |
} |
|
1026 |
||
1027 |
/** |
|
1028 |
* Keep S0 |
|
1029 |
*/ |
|
1030 |
m_keepS0 = m_sdusBuffer.front (); |
|
1031 |
m_sdusBuffer.pop_front (); |
|
1032 |
} |
|
1033 |
break; |
|
1034 |
||
1035 |
default: |
|
1036 |
/** |
|
1037 |
* ERROR: Transition not possible |
|
1038 |
*/ |
|
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
1039 |
NS_LOG_LOGIC ("INTERNAL ERROR: Transition not possible. FI = " << (uint32_t) framingInfo); |
8361 | 1040 |
break; |
1041 |
} |
|
1042 |
break; |
|
1043 |
||
1044 |
default: |
|
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
1045 |
NS_LOG_LOGIC ("INTERNAL ERROR: Wrong reassembling state = " << (uint32_t) m_reassemblingState); |
8361 | 1046 |
break; |
1047 |
} |
|
1048 |
} |
|
1049 |
||
1050 |
} |
|
1051 |
||
1052 |
||
1053 |
void |
|
1054 |
LteRlcUm::ReassembleOutsideWindow (void) |
|
1055 |
{ |
|
1056 |
NS_LOG_LOGIC ("Reassemble Outside Window"); |
|
1057 |
||
1058 |
std::map <uint16_t, Ptr<Packet> >::iterator it; |
|
1059 |
it = m_rxBuffer.begin (); |
|
1060 |
||
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
1061 |
while ( (it != m_rxBuffer.end ()) && ! IsInsideReorderingWindow (SequenceNumber10 (it->first)) ) |
8361 | 1062 |
{ |
1063 |
NS_LOG_LOGIC ("SN = " << it->first); |
|
1064 |
||
1065 |
// Reassemble RLC SDUs and deliver the PDCP PDU to upper layer |
|
1066 |
ReassembleAndDeliver (it->second); |
|
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
1067 |
|
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
1068 |
std::map <uint16_t, Ptr<Packet> >::iterator it_tmp = it; |
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
1069 |
++it; |
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
1070 |
m_rxBuffer.erase (it_tmp); |
8361 | 1071 |
} |
1072 |
||
1073 |
if (it != m_rxBuffer.end ()) |
|
1074 |
{ |
|
1075 |
NS_LOG_LOGIC ("(SN = " << it->first << ") is inside the reordering window"); |
|
1076 |
} |
|
1077 |
} |
|
1078 |
||
1079 |
void |
|
8709
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1080 |
LteRlcUm::ReassembleSnInterval (SequenceNumber10 lowSeqNumber, SequenceNumber10 highSeqNumber) |
8361 | 1081 |
{ |
8709
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1082 |
NS_LOG_LOGIC ("Reassemble SN between " << lowSeqNumber << " and " << highSeqNumber); |
8361 | 1083 |
|
1084 |
std::map <uint16_t, Ptr<Packet> >::iterator it; |
|
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
1085 |
|
8709
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1086 |
SequenceNumber10 reassembleSn = lowSeqNumber; |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1087 |
NS_LOG_LOGIC ("reassembleSN = " << reassembleSn); |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1088 |
NS_LOG_LOGIC ("highSeqNumber = " << highSeqNumber); |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1089 |
while (reassembleSn < highSeqNumber) |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1090 |
{ |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1091 |
NS_LOG_LOGIC ("reassembleSn < highSeqNumber"); |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1092 |
it = m_rxBuffer.find (reassembleSn.GetValue ()); |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1093 |
NS_LOG_LOGIC ("it->first = " << it->first); |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1094 |
NS_LOG_LOGIC ("it->second = " << it->second); |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1095 |
if (it != m_rxBuffer.end () ) |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1096 |
{ |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1097 |
NS_LOG_LOGIC ("SN = " << it->first); |
8361 | 1098 |
|
8709
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1099 |
// Reassemble RLC SDUs and deliver the PDCP PDU to upper layer |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1100 |
ReassembleAndDeliver (it->second); |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1101 |
|
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1102 |
m_rxBuffer.erase (it); |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1103 |
} |
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1104 |
|
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1105 |
reassembleSn++; |
8361 | 1106 |
} |
1107 |
} |
|
1108 |
||
1109 |
||
1110 |
void |
|
8499
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1111 |
LteRlcUm::DoReportBufferStatus (void) |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1112 |
{ |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1113 |
Time holDelay (0); |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1114 |
uint32_t queueSize = 0; |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1115 |
|
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1116 |
if (! m_txBuffer.empty ()) |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1117 |
{ |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1118 |
RlcTag holTimeTag; |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1119 |
m_txBuffer.front ()->PeekPacketTag (holTimeTag); |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1120 |
holDelay = Simulator::Now () - holTimeTag.GetSenderTimestamp (); |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1121 |
|
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1122 |
queueSize = m_txBufferSize + 2 * m_txBuffer.size (); // Data in tx queue + estimated headers size |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1123 |
} |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1124 |
|
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1125 |
LteMacSapProvider::ReportBufferStatusParameters r; |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1126 |
r.rnti = m_rnti; |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1127 |
r.lcid = m_lcid; |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1128 |
r.txQueueSize = queueSize; |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1129 |
r.txQueueHolDelay = holDelay.GetMilliSeconds () ; |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1130 |
r.retxQueueSize = 0; |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1131 |
r.retxQueueHolDelay = 0; |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1132 |
r.statusPduSize = 0; |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1133 |
|
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1134 |
NS_LOG_LOGIC ("Send ReportBufferStatus = " << r.txQueueSize << ", " << r.txQueueHolDelay ); |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1135 |
m_macSapProvider->ReportBufferStatus (r); |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1136 |
} |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1137 |
|
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1138 |
|
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1139 |
void |
8361 | 1140 |
LteRlcUm::ExpireReorderingTimer (void) |
1141 |
{ |
|
8708
108d9d416b4c
Add instance info for RlcUm
Manuel Requena <manuel.requena@cttc.es>
parents:
8666
diff
changeset
|
1142 |
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid); |
8618
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
1143 |
NS_LOG_LOGIC ("Reordering timer has expired"); |
8361 | 1144 |
|
1145 |
// 5.1.2.2.4 Actions when t-Reordering expires |
|
1146 |
// When t-Reordering expires, the receiving UM RLC entity shall: |
|
1147 |
// - update VR(UR) to the SN of the first UMD PDU with SN >= VR(UX) that has not been received; |
|
1148 |
// - reassemble RLC SDUs from any UMD PDUs with SN < updated VR(UR), remove RLC headers when doing so |
|
1149 |
// and deliver the reassembled RLC SDUs to upper layer in ascending order of the RLC SN if not delivered before; |
|
1150 |
// - if VR(UH) > VR(UR): |
|
1151 |
// - start t-Reordering; |
|
1152 |
// - set VR(UX) to VR(UH). |
|
1153 |
||
1154 |
std::map <uint16_t, Ptr<Packet> >::iterator it; |
|
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
1155 |
SequenceNumber10 newVrUr = m_vrUx; |
8361 | 1156 |
|
8572
ada66b065cc2
Fix processing of the sequence number
Manuel Requena <manuel.requena@cttc.es>
parents:
8499
diff
changeset
|
1157 |
while ( (it = m_rxBuffer.find (newVrUr.GetValue ())) != m_rxBuffer.end () ) |
8361 | 1158 |
{ |
1159 |
newVrUr++; |
|
1160 |
} |
|
8709
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1161 |
SequenceNumber10 oldVrUr = m_vrUr; |
8361 | 1162 |
m_vrUr = newVrUr; |
8618
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
1163 |
NS_LOG_LOGIC ("New VR(UR) = " << m_vrUr); |
8361 | 1164 |
|
8709
a64f5b0ff6f7
Fix bug in reassemble of RLC UM PDUs
Manuel Requena <manuel.requena@cttc.es>
parents:
8708
diff
changeset
|
1165 |
ReassembleSnInterval (oldVrUr, m_vrUr); |
8361 | 1166 |
|
1167 |
if ( m_vrUh > m_vrUr) |
|
1168 |
{ |
|
1169 |
NS_LOG_LOGIC ("Start reordering timer"); |
|
8618
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
1170 |
m_reorderingTimer = Simulator::Schedule (Time ("0.1s"), |
8361 | 1171 |
&LteRlcUm::ExpireReorderingTimer, this); |
1172 |
m_vrUx = m_vrUh; |
|
8618
e09a5d6ed1c5
Change some traces
Manuel Requena <manuel.requena@cttc.es>
parents:
8586
diff
changeset
|
1173 |
NS_LOG_LOGIC ("New VR(UX) = " << m_vrUx); |
8361 | 1174 |
} |
1175 |
} |
|
1176 |
||
1177 |
||
8499
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1178 |
void |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1179 |
LteRlcUm::ExpireRbsTimer (void) |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1180 |
{ |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1181 |
NS_LOG_LOGIC ("RBS Timer expires"); |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1182 |
|
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1183 |
if (! m_txBuffer.empty ()) |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1184 |
{ |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1185 |
DoReportBufferStatus (); |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1186 |
m_rbsTimer = Simulator::Schedule (MilliSeconds (10), &LteRlcUm::ExpireRbsTimer, this); |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1187 |
} |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1188 |
} |
c2658133775b
Add timer to send RBS to MAC
Manuel Requena <manuel.requena@cttc.es>
parents:
8493
diff
changeset
|
1189 |
|
8361 | 1190 |
} // namespace ns3 |