|
Lines 186-212
LteRlcAm::DoTransmitPdcpPdu (Ptr<Packet> p)
|
Link Here
|
|---|
|
| 186 |
*/ |
186 |
*/ |
| 187 |
|
187 |
|
| 188 |
void |
188 |
void |
| 189 |
LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId, uint8_t componentCarrierId, uint16_t rnti, uint8_t lcid) |
189 |
LteRlcAm::DoNotifyTxOpportunity (LteMacSapUser::TxOpportunityParameters txOpParams) |
| 190 |
{ |
190 |
{ |
| 191 |
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << bytes); |
191 |
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << txOpParams.bytes); |
| 192 |
|
192 |
|
| 193 |
if (bytes < 4) |
193 |
if (txOpParams.bytes < 4) |
| 194 |
{ |
194 |
{ |
| 195 |
// Stingy MAC: In general, we need more bytes. |
195 |
// Stingy MAC: In general, we need more bytes. |
| 196 |
// There are a more restrictive test for each particular case |
196 |
// There are a more restrictive test for each particular case |
| 197 |
NS_LOG_LOGIC ("TxOpportunity (size = " << bytes << ") too small"); |
197 |
NS_LOG_LOGIC ("TxOpportunity (size = " << txOpParams.bytes << ") too small"); |
| 198 |
NS_ASSERT_MSG (false, "TxOpportunity (size = " << bytes << ") too small.\n" |
198 |
NS_ASSERT_MSG (false, "TxOpportunity (size = " << txOpParams.bytes << ") too small.\n" |
| 199 |
<< "Your MAC scheduler is assigned too few resource blocks."); |
199 |
<< "Your MAC scheduler is assigned too few resource blocks."); |
| 200 |
return; |
200 |
return; |
| 201 |
} |
201 |
} |
| 202 |
|
202 |
|
| 203 |
if ( m_statusPduRequested && ! m_statusProhibitTimer.IsRunning () ) |
203 |
if ( m_statusPduRequested && ! m_statusProhibitTimer.IsRunning () ) |
| 204 |
{ |
204 |
{ |
| 205 |
if (bytes < m_statusPduBufferSize) |
205 |
if (txOpParams.bytes < m_statusPduBufferSize) |
| 206 |
{ |
206 |
{ |
| 207 |
// Stingy MAC: We need more bytes for the STATUS PDU |
207 |
// Stingy MAC: We need more bytes for the STATUS PDU |
| 208 |
NS_LOG_LOGIC ("TxOpportunity (size = " << bytes << ") too small for the STATUS PDU (size = " << m_statusPduBufferSize << ")"); |
208 |
NS_LOG_LOGIC ("TxOpportunity (size = " << txOpParams.bytes << ") too small for the STATUS PDU (size = " << m_statusPduBufferSize << ")"); |
| 209 |
NS_ASSERT_MSG (false, "TxOpportunity (size = " << bytes << ") too small for the STATUS PDU (size = " << m_statusPduBufferSize << ")\n" |
209 |
NS_ASSERT_MSG (false, "TxOpportunity (size = " << txOpParams.bytes << ") too small for the STATUS PDU (size = " << m_statusPduBufferSize << ")\n" |
| 210 |
<< "Your MAC scheduler is assigned too few resource blocks."); |
210 |
<< "Your MAC scheduler is assigned too few resource blocks."); |
| 211 |
return; |
211 |
return; |
| 212 |
} |
212 |
} |
|
Lines 224-230
LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId,
|
Link Here
|
|---|
|
| 224 |
for (sn = m_vrR; sn < m_vrMs; sn++) |
224 |
for (sn = m_vrR; sn < m_vrMs; sn++) |
| 225 |
{ |
225 |
{ |
| 226 |
NS_LOG_LOGIC ("SN = " << sn); |
226 |
NS_LOG_LOGIC ("SN = " << sn); |
| 227 |
if (!rlcAmHeader.OneMoreNackWouldFitIn (bytes)) |
227 |
if (!rlcAmHeader.OneMoreNackWouldFitIn (txOpParams.bytes)) |
| 228 |
{ |
228 |
{ |
| 229 |
NS_LOG_LOGIC ("Can't fit more NACKs in STATUS PDU"); |
229 |
NS_LOG_LOGIC ("Can't fit more NACKs in STATUS PDU"); |
| 230 |
break; |
230 |
break; |
|
Lines 267-275
LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId,
|
Link Here
|
|---|
|
| 267 |
params.pdu = packet; |
267 |
params.pdu = packet; |
| 268 |
params.rnti = m_rnti; |
268 |
params.rnti = m_rnti; |
| 269 |
params.lcid = m_lcid; |
269 |
params.lcid = m_lcid; |
| 270 |
params.layer = layer; |
270 |
params.layer = txOpParams.layer; |
| 271 |
params.harqProcessId = harqId; |
271 |
params.harqProcessId = txOpParams.harqId; |
| 272 |
params.componentCarrierId = componentCarrierId; |
272 |
params.componentCarrierId = txOpParams.componentCarrierId; |
| 273 |
|
273 |
|
| 274 |
m_macSapProvider->TransmitPdu (params); |
274 |
m_macSapProvider->TransmitPdu (params); |
| 275 |
|
275 |
|
|
Lines 296-302
LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId,
|
Link Here
|
|---|
|
| 296 |
|
296 |
|
| 297 |
Ptr<Packet> packet = m_retxBuffer.at (seqNumberValue).m_pdu->Copy (); |
297 |
Ptr<Packet> packet = m_retxBuffer.at (seqNumberValue).m_pdu->Copy (); |
| 298 |
|
298 |
|
| 299 |
if (( packet->GetSize () <= bytes ) |
299 |
if (( packet->GetSize () <= txOpParams.bytes ) |
| 300 |
|| m_txOpportunityForRetxAlwaysBigEnough) |
300 |
|| m_txOpportunityForRetxAlwaysBigEnough) |
| 301 |
{ |
301 |
{ |
| 302 |
// According to 5.2.1, the data field is left as is, but we rebuild the header |
302 |
// According to 5.2.1, the data field is left as is, but we rebuild the header |
|
Lines 353-361
LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId,
|
Link Here
|
|---|
|
| 353 |
params.pdu = packet; |
353 |
params.pdu = packet; |
| 354 |
params.rnti = m_rnti; |
354 |
params.rnti = m_rnti; |
| 355 |
params.lcid = m_lcid; |
355 |
params.lcid = m_lcid; |
| 356 |
params.layer = layer; |
356 |
params.layer = txOpParams.layer; |
| 357 |
params.harqProcessId = harqId; |
357 |
params.harqProcessId = txOpParams.harqId; |
| 358 |
params.componentCarrierId = componentCarrierId; |
358 |
params.componentCarrierId = txOpParams.componentCarrierId; |
| 359 |
|
359 |
|
| 360 |
m_macSapProvider->TransmitPdu (params); |
360 |
m_macSapProvider->TransmitPdu (params); |
| 361 |
|
361 |
|
|
Lines 381-387
LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId,
|
Link Here
|
|---|
|
| 381 |
} |
381 |
} |
| 382 |
else |
382 |
else |
| 383 |
{ |
383 |
{ |
| 384 |
NS_LOG_LOGIC ("TxOpportunity (size = " << bytes << ") too small for retransmission of the packet (size = " << packet->GetSize () << ")"); |
384 |
NS_LOG_LOGIC ("TxOpportunity (size = " << txOpParams.bytes << ") too small for retransmission of the packet (size = " << packet->GetSize () << ")"); |
| 385 |
NS_LOG_LOGIC ("Waiting for bigger TxOpportunity"); |
385 |
NS_LOG_LOGIC ("Waiting for bigger TxOpportunity"); |
| 386 |
return; |
386 |
return; |
| 387 |
} |
387 |
} |
|
Lines 391-401
LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId,
|
Link Here
|
|---|
|
| 391 |
} |
391 |
} |
| 392 |
else if ( m_txonBufferSize > 0 ) |
392 |
else if ( m_txonBufferSize > 0 ) |
| 393 |
{ |
393 |
{ |
| 394 |
if (bytes < 7) |
394 |
if (txOpParams.bytes < 7) |
| 395 |
{ |
395 |
{ |
| 396 |
// Stingy MAC: We need more bytes for new DATA PDUs. |
396 |
// Stingy MAC: We need more bytes for new DATA PDUs. |
| 397 |
NS_LOG_LOGIC ("TxOpportunity (size = " << bytes << ") too small for DATA PDU"); |
397 |
NS_LOG_LOGIC ("TxOpportunity (size = " << txOpParams.bytes << ") too small for DATA PDU"); |
| 398 |
NS_ASSERT_MSG (false, "TxOpportunity (size = " << bytes << ") too small for DATA PDU\n" |
398 |
NS_ASSERT_MSG (false, "TxOpportunity (size = " << txOpParams.bytes << ") too small for DATA PDU\n" |
| 399 |
<< "Your MAC scheduler is assigned too few resource blocks."); |
399 |
<< "Your MAC scheduler is assigned too few resource blocks."); |
| 400 |
return; |
400 |
return; |
| 401 |
} |
401 |
} |
|
Lines 426-432
LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId,
|
Link Here
|
|---|
|
| 426 |
rlcAmHeader.SetDataPdu (); |
426 |
rlcAmHeader.SetDataPdu (); |
| 427 |
|
427 |
|
| 428 |
// Build Data field |
428 |
// Build Data field |
| 429 |
uint32_t nextSegmentSize = bytes - 4; |
429 |
uint32_t nextSegmentSize = txOpParams.bytes - 4; |
| 430 |
uint32_t nextSegmentId = 1; |
430 |
uint32_t nextSegmentId = 1; |
| 431 |
uint32_t dataFieldTotalSize = 0; |
431 |
uint32_t dataFieldTotalSize = 0; |
| 432 |
uint32_t dataFieldAddedSize = 0; |
432 |
uint32_t dataFieldAddedSize = 0; |
|
Lines 734-742
LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId,
|
Link Here
|
|---|
|
| 734 |
params.pdu = packet; |
734 |
params.pdu = packet; |
| 735 |
params.rnti = m_rnti; |
735 |
params.rnti = m_rnti; |
| 736 |
params.lcid = m_lcid; |
736 |
params.lcid = m_lcid; |
| 737 |
params.layer = layer; |
737 |
params.layer = txOpParams.layer; |
| 738 |
params.harqProcessId = harqId; |
738 |
params.harqProcessId = txOpParams.harqId; |
| 739 |
params.componentCarrierId = componentCarrierId; |
739 |
params.componentCarrierId = txOpParams.componentCarrierId; |
| 740 |
|
740 |
|
| 741 |
m_macSapProvider->TransmitPdu (params); |
741 |
m_macSapProvider->TransmitPdu (params); |
| 742 |
} |
742 |
} |
|
Lines 749-769
LteRlcAm::DoNotifyHarqDeliveryFailure ()
|
Link Here
|
|---|
|
| 749 |
|
749 |
|
| 750 |
|
750 |
|
| 751 |
void |
751 |
void |
| 752 |
LteRlcAm::DoReceivePdu (Ptr<Packet> p, uint16_t rnti, uint8_t lcid) |
752 |
LteRlcAm::DoReceivePdu (LteMacSapUser::ReceivePduParameters rxPduParams) |
| 753 |
{ |
753 |
{ |
| 754 |
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << p->GetSize ()); |
754 |
NS_LOG_FUNCTION (this << m_rnti << (uint32_t) m_lcid << rxPduParams.p->GetSize ()); |
| 755 |
|
755 |
|
| 756 |
// Receiver timestamp |
756 |
// Receiver timestamp |
| 757 |
RlcTag rlcTag; |
757 |
RlcTag rlcTag; |
| 758 |
Time delay; |
758 |
Time delay; |
| 759 |
NS_ASSERT_MSG (p->PeekPacketTag (rlcTag), "RlcTag is missing"); |
759 |
NS_ASSERT_MSG (rxPduParams.p->PeekPacketTag (rlcTag), "RlcTag is missing"); |
| 760 |
p->RemovePacketTag (rlcTag); |
760 |
rxPduParams.p->RemovePacketTag (rlcTag); |
| 761 |
delay = Simulator::Now() - rlcTag.GetSenderTimestamp (); |
761 |
delay = Simulator::Now() - rlcTag.GetSenderTimestamp (); |
| 762 |
m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ()); |
762 |
m_rxPdu (m_rnti, m_lcid, rxPduParams.p->GetSize (), delay.GetNanoSeconds ()); |
| 763 |
|
763 |
|
| 764 |
// Get RLC header parameters |
764 |
// Get RLC header parameters |
| 765 |
LteRlcAmHeader rlcAmHeader; |
765 |
LteRlcAmHeader rlcAmHeader; |
| 766 |
p->PeekHeader (rlcAmHeader); |
766 |
rxPduParams.p->PeekHeader (rlcAmHeader); |
| 767 |
NS_LOG_LOGIC ("RLC header: " << rlcAmHeader); |
767 |
NS_LOG_LOGIC ("RLC header: " << rlcAmHeader); |
| 768 |
|
768 |
|
| 769 |
if ( rlcAmHeader.IsDataPdu () ) |
769 |
if ( rlcAmHeader.IsDataPdu () ) |
|
Lines 889-895
LteRlcAm::DoReceivePdu (Ptr<Packet> p, uint16_t rnti, uint8_t lcid)
|
Link Here
|
|---|
|
| 889 |
else |
889 |
else |
| 890 |
{ |
890 |
{ |
| 891 |
NS_LOG_LOGIC ("Place PDU in the reception buffer ( SN = " << seqNumber << " )"); |
891 |
NS_LOG_LOGIC ("Place PDU in the reception buffer ( SN = " << seqNumber << " )"); |
| 892 |
m_rxonBuffer[ seqNumber.GetValue () ].m_byteSegments.push_back (p); |
892 |
m_rxonBuffer[ seqNumber.GetValue () ].m_byteSegments.push_back (rxPduParams.p); |
| 893 |
m_rxonBuffer[ seqNumber.GetValue () ].m_pduComplete = true; |
893 |
m_rxonBuffer[ seqNumber.GetValue () ].m_pduComplete = true; |
| 894 |
} |
894 |
} |
| 895 |
|
895 |
|