LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) | 3 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 { | 194 { |
195 (*it).second = params.m_transmissionMode; | 195 (*it).second = params.m_transmissionMode; |
196 } | 196 } |
197 return; | 197 return; |
198 } | 198 } |
199 | 199 |
200 void | 200 void |
201 RrFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::Csch
edLcConfigReqParameters& params) | 201 RrFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::Csch
edLcConfigReqParameters& params) |
202 { | 202 { |
203 NS_LOG_FUNCTION (this); | 203 NS_LOG_FUNCTION (this); |
204 NS_UNUSED(params); | 204 NS_UNUSED (params); |
205 // Not used at this stage (LCs updated by DoSchedDlRlcBufferReq) | 205 // Not used at this stage (LCs updated by DoSchedDlRlcBufferReq) |
206 return; | 206 return; |
207 } | 207 } |
208 | 208 |
209 void | 209 void |
210 RrFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::Csc
hedLcReleaseReqParameters& params) | 210 RrFfMacScheduler::DoCschedLcReleaseReq (const struct FfMacCschedSapProvider::Csc
hedLcReleaseReqParameters& params) |
211 { | 211 { |
212 NS_LOG_FUNCTION (this); | 212 NS_LOG_FUNCTION (this); |
213 for (uint16_t i = 0; i < params.m_logicalChannelIdentity.size (); i++) | 213 for (uint16_t i = 0; i < params.m_logicalChannelIdentity.size (); i++) |
214 { | 214 { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 302 } |
303 | 303 |
304 return; | 304 return; |
305 } | 305 } |
306 | 306 |
307 void | 307 void |
308 RrFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::
SchedDlPagingBufferReqParameters& params) | 308 RrFfMacScheduler::DoSchedDlPagingBufferReq (const struct FfMacSchedSapProvider::
SchedDlPagingBufferReqParameters& params) |
309 { | 309 { |
310 NS_LOG_FUNCTION (this); | 310 NS_LOG_FUNCTION (this); |
311 NS_FATAL_ERROR ("method not implemented"); | 311 NS_FATAL_ERROR ("method not implemented"); |
312 NS_UNUSED(params); | 312 NS_UNUSED (params); |
313 return; | 313 return; |
314 } | 314 } |
315 | 315 |
316 void | 316 void |
317 RrFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::Sch
edDlMacBufferReqParameters& params) | 317 RrFfMacScheduler::DoSchedDlMacBufferReq (const struct FfMacSchedSapProvider::Sch
edDlMacBufferReqParameters& params) |
318 { | 318 { |
319 NS_LOG_FUNCTION (this); | 319 NS_LOG_FUNCTION (this); |
320 NS_FATAL_ERROR ("method not implemented"); | 320 NS_FATAL_ERROR ("method not implemented"); |
321 NS_UNUSED(params); | 321 NS_UNUSED (params); |
322 return; | 322 return; |
323 } | 323 } |
324 | 324 |
325 int | 325 int |
326 RrFfMacScheduler::GetRbgSize (int dlbandwidth) | 326 RrFfMacScheduler::GetRbgSize (int dlbandwidth) |
327 { | 327 { |
328 for (int i = 0; i < 4; i++) | 328 for (int i = 0; i < 4; i++) |
329 { | 329 { |
330 if (dlbandwidth < Type0AllocationRbg[i]) | 330 if (dlbandwidth < Type0AllocationRbg[i]) |
331 { | 331 { |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 } | 582 } |
583 std::vector <struct DlInfoListElement_s> dlInfoListUntxed; | 583 std::vector <struct DlInfoListElement_s> dlInfoListUntxed; |
584 for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++) | 584 for (uint16_t i = 0; i < m_dlInfoListBuffered.size (); i++) |
585 { | 585 { |
586 std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuf
fered.at (i).m_rnti); | 586 std::set <uint16_t>::iterator itRnti = rntiAllocated.find (m_dlInfoListBuf
fered.at (i).m_rnti); |
587 if (itRnti != rntiAllocated.end ()) | 587 if (itRnti != rntiAllocated.end ()) |
588 { | 588 { |
589 // RNTI already allocated for retx | 589 // RNTI already allocated for retx |
590 continue; | 590 continue; |
591 } | 591 } |
592 uint8_t nLayers = static_cast<uint8_t>(m_dlInfoListBuffered.at (i).m_harqS
tatus.size ()); | 592 uint8_t nLayers = static_cast<uint8_t> (m_dlInfoListBuffered.at (i).m_harq
Status.size ()); |
593 std::vector <bool> retx; | 593 std::vector <bool> retx; |
594 NS_LOG_INFO (this << " Processing DLHARQ feedback"); | 594 NS_LOG_INFO (this << " Processing DLHARQ feedback"); |
595 if (nLayers == 1) | 595 if (nLayers == 1) |
596 { | 596 { |
597 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); | 597 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); |
598 retx.push_back (false); | 598 retx.push_back (false); |
599 } | 599 } |
600 else | 600 else |
601 { | 601 { |
602 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); | 602 retx.push_back (m_dlInfoListBuffered.at (i).m_harqStatus.at (0) == DlI
nfoListElement_s::NACK); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 NS_LOG_INFO ("RBG " << dciRbg.at (j) << " assigned"); | 679 NS_LOG_INFO ("RBG " << dciRbg.at (j) << " assigned"); |
680 rbgAllocatedNum++; | 680 rbgAllocatedNum++; |
681 } | 681 } |
682 | 682 |
683 NS_LOG_INFO (this << " Send retx in the same RBGs"); | 683 NS_LOG_INFO (this << " Send retx in the same RBGs"); |
684 } | 684 } |
685 else | 685 else |
686 { | 686 { |
687 // find RBGs for sending HARQ retx | 687 // find RBGs for sending HARQ retx |
688 uint8_t j = 0; | 688 uint8_t j = 0; |
689 uint8_t rbgId = static_cast<uint8_t>((dciRbg.at (dciRbg.size () -
1) + 1) % rbgNum); | 689 uint8_t rbgId = static_cast<uint8_t> ((dciRbg.at (dciRbg.size () -
1) + 1) % rbgNum); |
690 uint8_t startRbg = static_cast<uint8_t>(dciRbg.at (dciRbg.size ()
- 1)); | 690 uint8_t startRbg = static_cast<uint8_t> (dciRbg.at (dciRbg.size ()
- 1)); |
691 std::vector <bool> rbgMapCopy = rbgMap; | 691 std::vector <bool> rbgMapCopy = rbgMap; |
692 while ((j < dciRbg.size ())&&(startRbg != rbgId)) | 692 while ((j < dciRbg.size ())&&(startRbg != rbgId)) |
693 { | 693 { |
694 if (rbgMapCopy.at (rbgId) == false) | 694 if (rbgMapCopy.at (rbgId) == false) |
695 { | 695 { |
696 rbgMapCopy.at (rbgId) = true; | 696 rbgMapCopy.at (rbgId) = true; |
697 dciRbg.at (j) = rbgId; | 697 dciRbg.at (j) = rbgId; |
698 j++; | 698 j++; |
699 } | 699 } |
700 rbgId = (rbgId + 1) % rbgNum; | 700 rbgId = (rbgId + 1) % rbgNum; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 if (itCqi == m_p10CqiRxed.end ()) | 977 if (itCqi == m_p10CqiRxed.end ()) |
978 { | 978 { |
979 newDci.m_mcs.push_back (0); // no info on this user -> lowest MCS | 979 newDci.m_mcs.push_back (0); // no info on this user -> lowest MCS |
980 } | 980 } |
981 else | 981 else |
982 { | 982 { |
983 newDci.m_mcs.push_back ( m_amc->GetMcsFromCqi ((*itCqi).second) ); | 983 newDci.m_mcs.push_back ( m_amc->GetMcsFromCqi ((*itCqi).second) ); |
984 } | 984 } |
985 } | 985 } |
986 int tbSize = (m_amc->GetDlTbSizeFromMcs (newDci.m_mcs.at (0), rbgPerTb * r
bgSize) / 8); | 986 int tbSize = (m_amc->GetDlTbSizeFromMcs (newDci.m_mcs.at (0), rbgPerTb * r
bgSize) / 8); |
987 uint16_t rlcPduSize = static_cast<uint16_t>(tbSize / lcNum); | 987 uint16_t rlcPduSize = static_cast<uint16_t> (tbSize / lcNum); |
988 while ((*it).m_rnti == newEl.m_rnti) | 988 while ((*it).m_rnti == newEl.m_rnti) |
989 { | 989 { |
990 if ( ((*it).m_rlcTransmissionQueueSize > 0) | 990 if ( ((*it).m_rlcTransmissionQueueSize > 0) |
991 || ((*it).m_rlcRetransmissionQueueSize > 0) | 991 || ((*it).m_rlcRetransmissionQueueSize > 0) |
992 || ((*it).m_rlcStatusPduSize > 0) ) | 992 || ((*it).m_rlcStatusPduSize > 0) ) |
993 { | 993 { |
994 std::vector <struct RlcPduListElement_s> newRlcPduLe; | 994 std::vector <struct RlcPduListElement_s> newRlcPduLe; |
995 for (uint8_t j = 0; j < nLayer; j++) | 995 for (uint8_t j = 0; j < nLayer; j++) |
996 { | 996 { |
997 RlcPduListElement_s newRlcEl; | 997 RlcPduListElement_s newRlcEl; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 i++; | 1037 i++; |
1038 rbgMap.at (rbgAllocated) = true; | 1038 rbgMap.at (rbgAllocated) = true; |
1039 rbgAllocatedNum++; | 1039 rbgAllocatedNum++; |
1040 } | 1040 } |
1041 rbgAllocated++; | 1041 rbgAllocated++; |
1042 } | 1042 } |
1043 newDci.m_rbBitmap = rbgMask; // (32 bit bitmap see 7.1.6 of 36.213) | 1043 newDci.m_rbBitmap = rbgMask; // (32 bit bitmap see 7.1.6 of 36.213) |
1044 | 1044 |
1045 for (i = 0; i < nLayer; i++) | 1045 for (i = 0; i < nLayer; i++) |
1046 { | 1046 { |
1047 newDci.m_tbsSize.push_back (static_cast<uint16_t>(tbSize)); | 1047 newDci.m_tbsSize.push_back (static_cast<uint16_t> (tbSize)); |
1048 newDci.m_ndi.push_back (1); | 1048 newDci.m_ndi.push_back (1); |
1049 newDci.m_rv.push_back (0); | 1049 newDci.m_rv.push_back (0); |
1050 } | 1050 } |
1051 | 1051 |
1052 newDci.m_tpc = 1; //1 is mapped to 0 in Accumulated Mode and to -1 in Abso
lute Mode | 1052 newDci.m_tpc = 1; //1 is mapped to 0 in Accumulated Mode and to -1 in Abso
lute Mode |
1053 | 1053 |
1054 newEl.m_dci = newDci; | 1054 newEl.m_dci = newDci; |
1055 if (m_harqOn == true) | 1055 if (m_harqOn == true) |
1056 { | 1056 { |
1057 // store DCI for HARQ | 1057 // store DCI for HARQ |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 if (ret.m_dciList.size () > 0) | 1258 if (ret.m_dciList.size () > 0) |
1259 { | 1259 { |
1260 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> >
(params.m_sfnSf, rbgAllocationMap)); | 1260 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> >
(params.m_sfnSf, rbgAllocationMap)); |
1261 m_schedSapUser->SchedUlConfigInd (ret); | 1261 m_schedSapUser->SchedUlConfigInd (ret); |
1262 } | 1262 } |
1263 return; // no flows to be scheduled | 1263 return; // no flows to be scheduled |
1264 } | 1264 } |
1265 | 1265 |
1266 | 1266 |
1267 // Divide the remaining resources equally among the active users starting from
the subsequent one served last scheduling trigger | 1267 // Divide the remaining resources equally among the active users starting from
the subsequent one served last scheduling trigger |
1268 uint16_t rbPerFlow = static_cast<uint16_t>((m_cschedCellConfig.m_ulBandwidth)
/ (nflows + rntiAllocated.size ())); | 1268 uint16_t rbPerFlow = static_cast<uint16_t> ((m_cschedCellConfig.m_ulBandwidth)
/ (nflows + rntiAllocated.size ())); |
1269 if (rbPerFlow < 3) | 1269 if (rbPerFlow < 3) |
1270 { | 1270 { |
1271 rbPerFlow = 3; // at least 3 rbg per flow (till available resource) to en
sure TxOpportunity >= 7 bytes | 1271 rbPerFlow = 3; // at least 3 rbg per flow (till available resource) to en
sure TxOpportunity >= 7 bytes |
1272 } | 1272 } |
1273 uint16_t rbAllocated = 0; | 1273 uint16_t rbAllocated = 0; |
1274 | 1274 |
1275 if (m_nextRntiUl != 0) | 1275 if (m_nextRntiUl != 0) |
1276 { | 1276 { |
1277 for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) | 1277 for (it = m_ceBsrRxed.begin (); it != m_ceBsrRxed.end (); it++) |
1278 { | 1278 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes | 1313 // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes |
1314 if (rbPerFlow < 3) | 1314 if (rbPerFlow < 3) |
1315 { | 1315 { |
1316 // terminate allocation | 1316 // terminate allocation |
1317 rbPerFlow = 0;······ | 1317 rbPerFlow = 0;······ |
1318 } | 1318 } |
1319 } | 1319 } |
1320 NS_LOG_INFO (this << " try to allocate " << (*it).first); | 1320 NS_LOG_INFO (this << " try to allocate " << (*it).first); |
1321 UlDciListElement_s uldci; | 1321 UlDciListElement_s uldci; |
1322 uldci.m_rnti = (*it).first; | 1322 uldci.m_rnti = (*it).first; |
1323 uldci.m_rbLen = static_cast<uint8_t>(rbPerFlow); | 1323 uldci.m_rbLen = static_cast<uint8_t> (rbPerFlow); |
1324 uldci.m_rbStart = 0; | 1324 uldci.m_rbStart = 0; |
1325 bool allocated = false; | 1325 bool allocated = false; |
1326 NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << r
bPerFlow << " flows " << nflows); | 1326 NS_LOG_INFO (this << " RB Allocated " << rbAllocated << " rbPerFlow " << r
bPerFlow << " flows " << nflows); |
1327 while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBa
ndwidth) < 1) && (rbPerFlow != 0)) | 1327 while ((!allocated)&&((rbAllocated + rbPerFlow - m_cschedCellConfig.m_ulBa
ndwidth) < 1) && (rbPerFlow != 0)) |
1328 { | 1328 { |
1329 // check availability | 1329 // check availability |
1330 bool free = true; | 1330 bool free = true; |
1331 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) | 1331 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) |
1332 { | 1332 { |
1333 if (rbMap.at (j) == true) | 1333 if (rbMap.at (j) == true) |
1334 { | 1334 { |
1335 free = false; | 1335 free = false; |
1336 break; | 1336 break; |
1337 } | 1337 } |
1338 } | 1338 } |
1339 if (free) | 1339 if (free) |
1340 { | 1340 { |
1341 uldci.m_rbStart = static_cast<uint8_t>(rbAllocated); | 1341 uldci.m_rbStart = static_cast<uint8_t> (rbAllocated); |
1342 | 1342 |
1343 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) | 1343 for (uint16_t j = rbAllocated; j < rbAllocated + rbPerFlow; j++) |
1344 { | 1344 { |
1345 rbMap.at (j) = true; | 1345 rbMap.at (j) = true; |
1346 // store info on allocation for managing ul-cqi interpretation | 1346 // store info on allocation for managing ul-cqi interpretation |
1347 rbgAllocationMap.at (j) = (*it).first; | 1347 rbgAllocationMap.at (j) = (*it).first; |
1348 NS_LOG_INFO ("\t " << j); | 1348 NS_LOG_INFO ("\t " << j); |
1349 } | 1349 } |
1350 rbAllocated += rbPerFlow; | 1350 rbAllocated += rbPerFlow; |
1351 allocated = true; | 1351 allocated = true; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params
.m_sfnSf, rbgAllocationMap)); | 1481 m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params
.m_sfnSf, rbgAllocationMap)); |
1482 | 1482 |
1483 m_schedSapUser->SchedUlConfigInd (ret); | 1483 m_schedSapUser->SchedUlConfigInd (ret); |
1484 return; | 1484 return; |
1485 } | 1485 } |
1486 | 1486 |
1487 void | 1487 void |
1488 RrFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvi
der::SchedUlNoiseInterferenceReqParameters& params) | 1488 RrFfMacScheduler::DoSchedUlNoiseInterferenceReq (const struct FfMacSchedSapProvi
der::SchedUlNoiseInterferenceReqParameters& params) |
1489 { | 1489 { |
1490 NS_LOG_FUNCTION (this); | 1490 NS_LOG_FUNCTION (this); |
1491 NS_UNUSED(params); | 1491 NS_UNUSED (params); |
1492 return; | 1492 return; |
1493 } | 1493 } |
1494 | 1494 |
1495 void | 1495 void |
1496 RrFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedU
lSrInfoReqParameters& params) | 1496 RrFfMacScheduler::DoSchedUlSrInfoReq (const struct FfMacSchedSapProvider::SchedU
lSrInfoReqParameters& params) |
1497 { | 1497 { |
1498 NS_LOG_FUNCTION (this); | 1498 NS_LOG_FUNCTION (this); |
1499 NS_UNUSED(params); | 1499 NS_UNUSED (params); |
1500 return; | 1500 return; |
1501 } | 1501 } |
1502 | 1502 |
1503 void | 1503 void |
1504 RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
chedUlMacCtrlInfoReqParameters& params) | 1504 RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
chedUlMacCtrlInfoReqParameters& params) |
1505 { | 1505 { |
1506 NS_LOG_FUNCTION (this); | 1506 NS_LOG_FUNCTION (this); |
1507 | 1507 |
1508 std::map <uint16_t,uint32_t>::iterator it; | 1508 std::map <uint16_t,uint32_t>::iterator it; |
1509 | 1509 |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode); | 1836 NS_LOG_FUNCTION (this << " RNTI " << rnti << " txMode " << (uint16_t)txMode); |
1837 FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params; | 1837 FfMacCschedSapUser::CschedUeConfigUpdateIndParameters params; |
1838 params.m_rnti = rnti; | 1838 params.m_rnti = rnti; |
1839 params.m_transmissionMode = txMode; | 1839 params.m_transmissionMode = txMode; |
1840 m_cschedSapUser->CschedUeConfigUpdateInd (params); | 1840 m_cschedSapUser->CschedUeConfigUpdateInd (params); |
1841 } | 1841 } |
1842 | 1842 |
1843 | 1843 |
1844 | 1844 |
1845 } | 1845 } |
LEFT | RIGHT |