src/lte/model/rr-ff-mac-scheduler.cc
changeset 9610 7719bb199e8b
parent 9587 8f669a9d4719
child 9625 f058482ae3ee
equal deleted inserted replaced
9609:13aed388469a 9610:7719bb199e8b
  1343     }
  1343     }
  1344 
  1344 
  1345 
  1345 
  1346   // Divide the remaining resources equally among the active users starting from the subsequent one served last scheduling trigger
  1346   // Divide the remaining resources equally among the active users starting from the subsequent one served last scheduling trigger
  1347   uint16_t rbPerFlow = (m_cschedCellConfig.m_ulBandwidth) / (nflows + rntiAllocated.size ());
  1347   uint16_t rbPerFlow = (m_cschedCellConfig.m_ulBandwidth) / (nflows + rntiAllocated.size ());
  1348   if (rbPerFlow == 0)
  1348   if (rbPerFlow < 3)
  1349     {
  1349     {
  1350       rbPerFlow = 1;              // at least 1 rbg per flow (till available resource)
  1350       rbPerFlow = 3;  // at least 3 rbg per flow (till available resource) to ensure TxOpportunity >= 7 bytes
  1351     }
  1351     }
  1352   uint16_t rbAllocated = 0;
  1352   uint16_t rbAllocated = 0;
  1353 
  1353 
  1354   if (m_nextRntiUl != 0)
  1354   if (m_nextRntiUl != 0)
  1355     {
  1355     {
  1387         }
  1387         }
  1388       if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth)
  1388       if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth)
  1389         {
  1389         {
  1390           // limit to physical resources last resource assignment
  1390           // limit to physical resources last resource assignment
  1391           rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
  1391           rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
       
  1392           // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes
       
  1393           if (rbPerFlow < 3)
       
  1394             {
       
  1395               // terminate allocation
       
  1396               rbPerFlow = 0;      
       
  1397             }
  1392         }
  1398         }
  1393       NS_LOG_INFO (this << " try to allocate " << (*it).first);
  1399       NS_LOG_INFO (this << " try to allocate " << (*it).first);
  1394       UlDciListElement_s uldci;
  1400       UlDciListElement_s uldci;
  1395       uldci.m_rnti = (*it).first;
  1401       uldci.m_rnti = (*it).first;
  1396       uldci.m_rbLen = rbPerFlow;
  1402       uldci.m_rbLen = rbPerFlow;
  1425           rbAllocated++;
  1431           rbAllocated++;
  1426           if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth)
  1432           if (rbAllocated + rbPerFlow - 1 > m_cschedCellConfig.m_ulBandwidth)
  1427             {
  1433             {
  1428               // limit to physical resources last resource assignment
  1434               // limit to physical resources last resource assignment
  1429               rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
  1435               rbPerFlow = m_cschedCellConfig.m_ulBandwidth - rbAllocated;
       
  1436               // at least 3 rbg per flow to ensure TxOpportunity >= 7 bytes
       
  1437               if (rbPerFlow < 3)
       
  1438                 {
       
  1439                   // terminate allocation
       
  1440                   rbPerFlow = 0;                 
       
  1441                 }
  1430             }
  1442             }
  1431         }
  1443         }
  1432       if (!allocated)
  1444       if (!allocated)
  1433         {
  1445         {
  1434           // unable to allocate new resource: finish scheduling
  1446           // unable to allocate new resource: finish scheduling
       
  1447           m_nextRntiUl = (*it).first;
  1435           if (ret.m_dciList.size () > 0)
  1448           if (ret.m_dciList.size () > 0)
  1436             {
  1449             {
  1437               m_schedSapUser->SchedUlConfigInd (ret);
  1450               m_schedSapUser->SchedUlConfigInd (ret);
  1438             }
  1451             }
  1439           m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
  1452           m_allocationMaps.insert (std::pair <uint16_t, std::vector <uint16_t> > (params.m_sfnSf, rbgAllocationMap));
  1518       if (it == m_ceBsrRxed.end ())
  1531       if (it == m_ceBsrRxed.end ())
  1519         {
  1532         {
  1520           // restart from the first
  1533           // restart from the first
  1521           it = m_ceBsrRxed.begin ();
  1534           it = m_ceBsrRxed.begin ();
  1522         }
  1535         }
  1523       if (rbAllocated == m_cschedCellConfig.m_ulBandwidth)
  1536       if ((rbAllocated == m_cschedCellConfig.m_ulBandwidth) || (rbPerFlow == 0))
  1524         {
  1537         {
  1525           // Stop allocation: no more PRBs
  1538           // Stop allocation: no more PRBs
  1526           m_nextRntiUl = (*it).first;
  1539           m_nextRntiUl = (*it).first;
  1527           break;
  1540           break;
  1528         }
  1541         }