From eabfc6f5e270503607dac0b7dd53ef9d9edf1b08 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Thu, 28 Mar 2013 13:44:27 +0100 Subject: [PATCH] safer RLC overhead estimation for SRB1 --- src/lte/model/lte-ue-mac.cc | 23 +++++++++++++++++++---- src/lte/model/pf-ff-mac-scheduler.cc | 21 +++++++++++++++++---- src/lte/model/rr-ff-mac-scheduler.cc | 21 +++++++++++++++++---- 3 files changed, 53 insertions(+), 12 deletions(-) diff --git a/src/lte/model/lte-ue-mac.cc b/src/lte/model/lte-ue-mac.cc index e086393ab..0e27a7e2d 100644 --- a/src/lte/model/lte-ue-mac.cc +++ b/src/lte/model/lte-ue-mac.cc @@ -633,11 +633,26 @@ LteUeMac::DoReceiveLteControlMessage (Ptr msg) } else if ((*itBsr).second.txQueueSize > 0) { - NS_LOG_DEBUG (this << " serve tx DATA, bytes " << bytesForThisLc); - (*it).second.macSapUser->NotifyTxOpportunity (bytesForThisLc, 0, 0); - if ((*itBsr).second.txQueueSize >= bytesForThisLc - 2) + uint16_t lcid = (*it).first; + uint32_t rlcOverhead; + if (lcid == 1) { - (*itBsr).second.txQueueSize -= bytesForThisLc - 2; + // for SRB1 (using RLC AM) it's better to + // overestimate RLC overhead rather than + // underestimate it and risk unneeded + // segmentation which increases delay + rlcOverhead = 4; + } + else + { + // minimum RLC overhead due to header + rlcOverhead = 2; + } + NS_LOG_DEBUG (this << " serve tx DATA, bytes " << bytesForThisLc << ", RLC overhead " << rlcOverhead); + (*it).second.macSapUser->NotifyTxOpportunity (bytesForThisLc, 0, 0); + if ((*itBsr).second.txQueueSize >= bytesForThisLc - rlcOverhead) + { + (*itBsr).second.txQueueSize -= bytesForThisLc - rlcOverhead; } else { diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index 9790c4398..36811be45 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -2058,15 +2058,28 @@ PfFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t s } else if ((*it).second.m_rlcTransmissionQueueSize > 0) { + uint32_t rlcOverhead; + if (lcid == 1) + { + // for SRB1 (using RLC AM) it's better to + // overestimate RLC overhead rather than + // underestimate it and risk unneeded + // segmentation which increases delay + rlcOverhead = 4; + } + else + { + // minimum RLC overhead due to header + rlcOverhead = 2; + } // update transmission queue - if ((*it).second.m_rlcTransmissionQueueSize <= size) + if ((*it).second.m_rlcTransmissionQueueSize <= size - rlcOverhead) { (*it).second.m_rlcTransmissionQueueSize = 0; } else - { - size -= 2; // remove minimun RLC overhead due to header - (*it).second.m_rlcTransmissionQueueSize -= size; + { + (*it).second.m_rlcTransmissionQueueSize -= size - rlcOverhead; } } } diff --git a/src/lte/model/rr-ff-mac-scheduler.cc b/src/lte/model/rr-ff-mac-scheduler.cc index 53173776f..3da530881 100644 --- a/src/lte/model/rr-ff-mac-scheduler.cc +++ b/src/lte/model/rr-ff-mac-scheduler.cc @@ -1840,15 +1840,28 @@ RrFfMacScheduler::UpdateDlRlcBufferInfo (uint16_t rnti, uint8_t lcid, uint16_t s } else if ((*it).m_rlcTransmissionQueueSize > 0) { + uint32_t rlcOverhead; + if (lcid == 1) + { + // for SRB1 (using RLC AM) it's better to + // overestimate RLC overhead rather than + // underestimate it and risk unneeded + // segmentation which increases delay + rlcOverhead = 4; + } + else + { + // minimum RLC overhead due to header + rlcOverhead = 2; + } // update transmission queue - if ((*it).m_rlcTransmissionQueueSize <= size) + if ((*it).m_rlcTransmissionQueueSize <= size - rlcOverhead) { (*it).m_rlcTransmissionQueueSize = 0; } else - { - size -= 2; // remove minimun RLC overhead due to header - (*it).m_rlcTransmissionQueueSize -= size; + { + (*it).m_rlcTransmissionQueueSize -= size - rlcOverhead; } } return;