From 38c7bd4375589922dd96dd9980037feb5ea81422 Mon Sep 17 00:00:00 2001 From: Marco Miozzo Date: Thu, 8 Nov 2012 16:51:47 +0100 Subject: [PATCH] Introduce sanity checks on DoSchedUlTriggerReq of RR and PF schedulers --- src/lte/model/pf-ff-mac-scheduler.cc | 9 +++++++-- src/lte/model/rr-ff-mac-scheduler.cc | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index 89a0c31f0..9f143536e 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -1362,7 +1362,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched } continue; } - if (rbAllocated + rbPerFlow > m_cschedCellConfig.m_ulBandwidth) + if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) { // limit to physical resources last resource assignment rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; @@ -1372,7 +1372,7 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched uldci.m_rnti = (*it).first; uldci.m_rbLen = rbPerFlow; bool allocated = false; - while ((!allocated)&&(rbAllocated < m_cschedCellConfig.m_ulBandwidth)) + while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth)) { // check availability bool free = true; @@ -1399,6 +1399,11 @@ PfFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched break; } rbAllocated++; + if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) + { + // limit to physical resources last resource assignment + rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; + } } if (!allocated) { diff --git a/src/lte/model/rr-ff-mac-scheduler.cc b/src/lte/model/rr-ff-mac-scheduler.cc index 5eeb46e25..e2d6aac50 100644 --- a/src/lte/model/rr-ff-mac-scheduler.cc +++ b/src/lte/model/rr-ff-mac-scheduler.cc @@ -1205,7 +1205,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched } continue; } - if (rbAllocated + rbPerFlow > m_cschedCellConfig.m_ulBandwidth) + if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) { // limit to physical resources last resource assignment rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; @@ -1215,7 +1215,7 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched uldci.m_rnti = (*it).first; uldci.m_rbLen = rbPerFlow; bool allocated = false; - while ((!allocated)&&(rbAllocated < m_cschedCellConfig.m_ulBandwidth)) + while ((!allocated)&&((rbAllocated + rbPerFlow - 1) < m_cschedCellConfig.m_ulBandwidth)) { // check availability bool free = true; @@ -1243,6 +1243,11 @@ RrFfMacScheduler::DoSchedUlTriggerReq (const struct FfMacSchedSapProvider::Sched break; } rbAllocated++; + if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth) + { + // limit to physical resources last resource assignment + rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated; + } } if (!allocated) {