Skip to content

Commit

Permalink
lte: (fixes #2308) PacketTag instead of ByteTag in LTE PDCP/RLC
Browse files Browse the repository at this point in the history
  • Loading branch information
mrequena committed Jun 10, 2016
1 parent 124665b commit 4c6ca8c
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 36 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Bugs fixed
- Bug 1939 - Aggregating the same object to two nodes produce unexpected results
- Bug 1977 - v4Ping verbose output when not explicitly stopped
- Bug 2057 - ARP and Ndisc caches should be updated by receiving valid L3 packets
- Bug 2308 - PacketTag instead of ByteTag in LTE PDCP/RLC
- Bug 2346 - SixLowPan ConpressionThreshold can be violated.
- Bug 2329 - TCP Veno implementation
- Bug 2333 - TCP Scalable implementation
Expand Down
9 changes: 4 additions & 5 deletions src/lte/model/lte-pdcp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ LtePdcp::DoTransmitPdcpSdu (Ptr<Packet> p)

// Sender timestamp
PdcpTag pdcpTag (Simulator::Now ());
p->AddByteTag (pdcpTag);
p->AddPacketTag (pdcpTag);
m_txPdu (m_rnti, m_lcid, p->GetSize ());

LteRlcSapProvider::TransmitPdcpPduParameters params;
Expand All @@ -207,10 +207,9 @@ LtePdcp::DoReceivePdu (Ptr<Packet> p)
// Receiver timestamp
PdcpTag pdcpTag;
Time delay;
if (p->FindFirstMatchingByteTag (pdcpTag))
{
delay = Simulator::Now() - pdcpTag.GetSenderTimestamp ();
}
NS_ASSERT_MSG (p->PeekPacketTag (pdcpTag), "PdcpTag is missing");
p->RemovePacketTag (pdcpTag);
delay = Simulator::Now() - pdcpTag.GetSenderTimestamp ();
m_rxPdu(m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ());

LtePdcpHeader pdcpHeader;
Expand Down
40 changes: 29 additions & 11 deletions src/lte/model/lte-rlc-am.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)
NS_LOG_LOGIC ("RLC header: " << rlcAmHeader);
packet->AddHeader (rlcAmHeader);

// Sender timestamp
RlcTag rlcTag (Simulator::Now ());
NS_ASSERT_MSG (!packet->PeekPacketTag (rlcTag), "RlcTag is already present");
packet->AddPacketTag (rlcTag);
m_txPdu (m_rnti, m_lcid, packet->GetSize ());

// Send RLC PDU to MAC layer
LteMacSapProvider::TransmitPduParameters params;
params.pdu = packet;
Expand Down Expand Up @@ -336,7 +342,13 @@ LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)

packet->AddHeader (rlcAmHeader);
NS_LOG_LOGIC ("new AM RLC header: " << rlcAmHeader);


// Sender timestamp
RlcTag rlcTag (Simulator::Now ());
NS_ASSERT_MSG (packet->PeekPacketTag (rlcTag), "RlcTag is missing");
packet->ReplacePacketTag (rlcTag);
m_txPdu (m_rnti, m_lcid, packet->GetSize ());

// Send RLC PDU to MAC layer
LteMacSapProvider::TransmitPduParameters params;
params.pdu = packet;
Expand Down Expand Up @@ -615,7 +627,8 @@ LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)

// FIRST SEGMENT
LteRlcSduStatusTag tag;
(*it)->RemovePacketTag (tag);
NS_ASSERT_MSG ((*it)->PeekPacketTag (tag), "LteRlcSduStatusTag is missing");
(*it)->PeekPacketTag (tag);
if ( (tag.GetStatus () == LteRlcSduStatusTag::FULL_SDU) ||
(tag.GetStatus () == LteRlcSduStatusTag::FIRST_SEGMENT)
)
Expand All @@ -626,20 +639,27 @@ LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)
{
framingInfo |= LteRlcAmHeader::NO_FIRST_BYTE;
}
(*it)->AddPacketTag (tag);

// Add all SDUs (in DataField) to the Packet
while (it < dataField.end ())
{
NS_LOG_LOGIC ("Adding SDU/segment to packet, length = " << (*it)->GetSize ());

packet->AddAtEnd (*it);
NS_ASSERT_MSG ((*it)->PeekPacketTag (tag), "LteRlcSduStatusTag is missing");
(*it)->RemovePacketTag (tag);
if (packet->GetSize () > 0)
{
packet->AddAtEnd (*it);
}
else
{
packet = (*it);
}
it++;
}

// LAST SEGMENT (Note: There could be only one and be the first one)
it--;
(*it)->RemovePacketTag (tag);
if ( (tag.GetStatus () == LteRlcSduStatusTag::FULL_SDU) ||
(tag.GetStatus () == LteRlcSduStatusTag::LAST_SEGMENT) )
{
Expand All @@ -649,7 +669,6 @@ LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)
{
framingInfo |= LteRlcAmHeader::NO_LAST_BYTE;
}
(*it)->AddPacketTag (tag);

// Set the FramingInfo flag after the calculation
rlcAmHeader.SetFramingInfo (framingInfo);
Expand Down Expand Up @@ -707,7 +726,7 @@ LteRlcAm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)

// Sender timestamp
RlcTag rlcTag (Simulator::Now ());
packet->AddByteTag (rlcTag);
packet->ReplacePacketTag (rlcTag);
m_txPdu (m_rnti, m_lcid, packet->GetSize ());

// Send RLC PDU to MAC layer
Expand Down Expand Up @@ -736,10 +755,9 @@ LteRlcAm::DoReceivePdu (Ptr<Packet> p)
// Receiver timestamp
RlcTag rlcTag;
Time delay;
if (p->FindFirstMatchingByteTag (rlcTag))
{
delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
}
NS_ASSERT_MSG (p->PeekPacketTag (rlcTag), "RlcTag is missing");
p->RemovePacketTag (rlcTag);
delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ());

// Get RLC header parameters
Expand Down
10 changes: 5 additions & 5 deletions src/lte/model/lte-rlc-tm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ LteRlcTm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)

// Sender timestamp
RlcTag rlcTag (Simulator::Now ());
packet->AddByteTag (rlcTag);
packet->ReplacePacketTag (rlcTag);
m_txPdu (m_rnti, m_lcid, packet->GetSize ());

// Send RLC PDU to MAC layer
Expand Down Expand Up @@ -174,10 +174,9 @@ LteRlcTm::DoReceivePdu (Ptr<Packet> p)
// Receiver timestamp
RlcTag rlcTag;
Time delay;
if (p->FindFirstMatchingByteTag (rlcTag))
{
delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
}
NS_ASSERT_MSG (p->PeekPacketTag (rlcTag), "RlcTag is missing");
p->RemovePacketTag (rlcTag);
delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ());

// 5.1.1.2 Receive operations
Expand All @@ -198,6 +197,7 @@ LteRlcTm::DoReportBufferStatus (void)
if (! m_txBuffer.empty ())
{
RlcTag holTimeTag;
NS_ASSERT_MSG (m_txBuffer.front ()->PeekPacketTag (holTimeTag), "RlcTag is missing");
m_txBuffer.front ()->PeekPacketTag (holTimeTag);
holDelay = Simulator::Now () - holTimeTag.GetSenderTimestamp ();

Expand Down
27 changes: 17 additions & 10 deletions src/lte/model/lte-rlc-um.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ LteRlcUm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)

// FIRST SEGMENT
LteRlcSduStatusTag tag;
(*it)->RemovePacketTag (tag);
NS_ASSERT_MSG ((*it)->PeekPacketTag (tag), "LteRlcSduStatusTag is missing");
(*it)->PeekPacketTag (tag);
if ( (tag.GetStatus () == LteRlcSduStatusTag::FULL_SDU) ||
(tag.GetStatus () == LteRlcSduStatusTag::FIRST_SEGMENT) )
{
Expand All @@ -341,19 +342,26 @@ LteRlcUm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)
{
framingInfo |= LteRlcHeader::NO_FIRST_BYTE;
}
(*it)->AddPacketTag (tag);

while (it < dataField.end ())
{
NS_LOG_LOGIC ("Adding SDU/segment to packet, length = " << (*it)->GetSize ());

packet->AddAtEnd (*it);
NS_ASSERT_MSG ((*it)->PeekPacketTag (tag), "LteRlcSduStatusTag is missing");
(*it)->RemovePacketTag (tag);
if (packet->GetSize () > 0)
{
packet->AddAtEnd (*it);
}
else
{
packet = (*it);
}
it++;
}

// LAST SEGMENT (Note: There could be only one and be the first one)
it--;
(*it)->RemovePacketTag (tag);
if ( (tag.GetStatus () == LteRlcSduStatusTag::FULL_SDU) ||
(tag.GetStatus () == LteRlcSduStatusTag::LAST_SEGMENT) )
{
Expand All @@ -363,7 +371,6 @@ LteRlcUm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)
{
framingInfo |= LteRlcHeader::NO_LAST_BYTE;
}
(*it)->AddPacketTag (tag);

rlcHeader.SetFramingInfo (framingInfo);

Expand All @@ -372,7 +379,7 @@ LteRlcUm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)

// Sender timestamp
RlcTag rlcTag (Simulator::Now ());
packet->AddByteTag (rlcTag);
packet->ReplacePacketTag (rlcTag);
m_txPdu (m_rnti, m_lcid, packet->GetSize ());

// Send RLC PDU to MAC layer
Expand Down Expand Up @@ -406,10 +413,9 @@ LteRlcUm::DoReceivePdu (Ptr<Packet> p)
// Receiver timestamp
RlcTag rlcTag;
Time delay;
if (p->FindFirstMatchingByteTag (rlcTag))
{
delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
}
NS_ASSERT_MSG (p->PeekPacketTag (rlcTag), "RlcTag is missing");
p->RemovePacketTag (rlcTag);
delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
m_rxPdu (m_rnti, m_lcid, p->GetSize (), delay.GetNanoSeconds ());

// 5.1.2.2 Receive operations
Expand Down Expand Up @@ -1117,6 +1123,7 @@ LteRlcUm::DoReportBufferStatus (void)
if (! m_txBuffer.empty ())
{
RlcTag holTimeTag;
NS_ASSERT_MSG (m_txBuffer.front ()->PeekPacketTag (holTimeTag), "RlcTag is missing");
m_txBuffer.front ()->PeekPacketTag (holTimeTag);
holDelay = Simulator::Now () - holTimeTag.GetSenderTimestamp ();

Expand Down
9 changes: 4 additions & 5 deletions src/lte/model/lte-rlc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,9 @@ LteRlcSm::DoReceivePdu (Ptr<Packet> p)
// RLC Performance evaluation
RlcTag rlcTag;
Time delay;
if (p->FindFirstMatchingByteTag(rlcTag))
{
delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
}
NS_ASSERT_MSG (p->PeekPacketTag (rlcTag), "RlcTag is missing");
p->RemovePacketTag (rlcTag);
delay = Simulator::Now() - rlcTag.GetSenderTimestamp ();
NS_LOG_LOGIC (" RNTI=" << m_rnti
<< " LCID=" << (uint32_t) m_lcid
<< " size=" << p->GetSize ()
Expand All @@ -243,7 +242,7 @@ LteRlcSm::DoNotifyTxOpportunity (uint32_t bytes, uint8_t layer, uint8_t harqId)

// RLC Performance evaluation
RlcTag tag (Simulator::Now());
params.pdu->AddByteTag (tag);
params.pdu->AddPacketTag (tag);
NS_LOG_LOGIC (" RNTI=" << m_rnti
<< " LCID=" << (uint32_t) m_lcid
<< " size=" << bytes);
Expand Down

0 comments on commit 4c6ca8c

Please sign in to comment.