553 NS_LOG_FUNCTION (this); |
553 NS_LOG_FUNCTION (this); |
554 if (msg->GetMessageType () == LteControlMessage::UL_DCI) |
554 if (msg->GetMessageType () == LteControlMessage::UL_DCI) |
555 { |
555 { |
556 Ptr<UlDciLteControlMessage> msg2 = DynamicCast<UlDciLteControlMessage> (msg); |
556 Ptr<UlDciLteControlMessage> msg2 = DynamicCast<UlDciLteControlMessage> (msg); |
557 UlDciListElement_s dci = msg2->GetDci (); |
557 UlDciListElement_s dci = msg2->GetDci (); |
558 if (dci.m_ndi==1) |
558 if (dci.m_ndi == 1) |
559 { |
559 { |
560 // New transmission -> emtpy pkt buffer queue (for deleting eventual pkts not acked ) |
560 // New transmission -> emtpy pkt buffer queue (for deleting eventual pkts not acked ) |
561 Ptr<PacketBurst> pb = CreateObject <PacketBurst> (); |
561 Ptr<PacketBurst> pb = CreateObject <PacketBurst> (); |
562 m_miUlHarqProcessesPacket.at (m_harqProcessId) = pb; |
562 m_miUlHarqProcessesPacket.at (m_harqProcessId) = pb; |
563 // Retrieve data from RLC |
563 // Retrieve data from RLC |
567 for (itBsr = m_ulBsrReceived.begin (); itBsr != m_ulBsrReceived.end (); itBsr++) |
567 for (itBsr = m_ulBsrReceived.begin (); itBsr != m_ulBsrReceived.end (); itBsr++) |
568 { |
568 { |
569 if (((*itBsr).second.statusPduSize > 0) || ((*itBsr).second.retxQueueSize > 0) || ((*itBsr).second.txQueueSize > 0)) |
569 if (((*itBsr).second.statusPduSize > 0) || ((*itBsr).second.retxQueueSize > 0) || ((*itBsr).second.txQueueSize > 0)) |
570 { |
570 { |
571 activeLcs++; |
571 activeLcs++; |
572 if (((*itBsr).second.statusPduSize!=0)&&((*itBsr).second.statusPduSize < statusPduMinSize)) |
572 if (((*itBsr).second.statusPduSize != 0)&&((*itBsr).second.statusPduSize < statusPduMinSize)) |
573 { |
573 { |
574 statusPduMinSize = (*itBsr).second.statusPduSize; |
574 statusPduMinSize = (*itBsr).second.statusPduSize; |
575 } |
575 } |
576 if (((*itBsr).second.statusPduSize!=0)&&(statusPduMinSize == 0)) |
576 if (((*itBsr).second.statusPduSize != 0)&&(statusPduMinSize == 0)) |
577 { |
577 { |
578 statusPduMinSize = (*itBsr).second.statusPduSize; |
578 statusPduMinSize = (*itBsr).second.statusPduSize; |
579 } |
579 } |
580 } |
580 } |
581 } |
581 } |
596 { |
596 { |
597 NS_FATAL_ERROR ("Insufficient Tx Opportunity for sending a status message"); |
597 NS_FATAL_ERROR ("Insufficient Tx Opportunity for sending a status message"); |
598 } |
598 } |
599 } |
599 } |
600 NS_LOG_LOGIC (this << " UE " << m_rnti << ": UL-CQI notified TxOpportunity of " << dci.m_tbSize << " => " << bytesPerActiveLc << " bytes per active LC" << " statusPduMinSize " << statusPduMinSize); |
600 NS_LOG_LOGIC (this << " UE " << m_rnti << ": UL-CQI notified TxOpportunity of " << dci.m_tbSize << " => " << bytesPerActiveLc << " bytes per active LC" << " statusPduMinSize " << statusPduMinSize); |
601 for (it = m_lcInfoMap.begin (); it!=m_lcInfoMap.end (); it++) |
601 for (it = m_lcInfoMap.begin (); it != m_lcInfoMap.end (); it++) |
602 { |
602 { |
603 itBsr = m_ulBsrReceived.find ((*it).first); |
603 itBsr = m_ulBsrReceived.find ((*it).first); |
604 NS_LOG_DEBUG (this << " Processing LC " << (uint32_t)(*it).first << " bytesPerActiveLc " << bytesPerActiveLc); |
604 NS_LOG_DEBUG (this << " Processing LC " << (uint32_t)(*it).first << " bytesPerActiveLc " << bytesPerActiveLc); |
605 if ( (itBsr!=m_ulBsrReceived.end ()) && |
605 if ( (itBsr != m_ulBsrReceived.end ()) |
606 ( ((*itBsr).second.statusPduSize > 0) || |
606 && ( ((*itBsr).second.statusPduSize > 0) |
607 ((*itBsr).second.retxQueueSize > 0) || |
607 || ((*itBsr).second.retxQueueSize > 0) |
608 ((*itBsr).second.txQueueSize > 0)) ) |
608 || ((*itBsr).second.txQueueSize > 0)) ) |
609 { |
609 { |
610 if ((statusPduPriority) && ((*itBsr).second.statusPduSize == statusPduMinSize)) |
610 if ((statusPduPriority) && ((*itBsr).second.statusPduSize == statusPduMinSize)) |
611 { |
611 { |
612 (*it).second.macSapUser->NotifyTxOpportunity ((*itBsr).second.statusPduSize, 0, 0); |
612 (*it).second.macSapUser->NotifyTxOpportunity ((*itBsr).second.statusPduSize, 0, 0); |
613 NS_LOG_LOGIC (this << "\t" << bytesPerActiveLc << " send " << (*itBsr).second.statusPduSize << " status bytes to LC " << (uint32_t)(*it).first << " statusQueue " << (*itBsr).second.statusPduSize << " retxQueue" << (*itBsr).second.retxQueueSize << " txQueue" << (*itBsr).second.txQueueSize); |
613 NS_LOG_LOGIC (this << "\t" << bytesPerActiveLc << " send " << (*itBsr).second.statusPduSize << " status bytes to LC " << (uint32_t)(*it).first << " statusQueue " << (*itBsr).second.statusPduSize << " retxQueue" << (*itBsr).second.retxQueueSize << " txQueue" << (*itBsr).second.txQueueSize); |
625 NS_LOG_DEBUG (this << " serve STATUS " << (*itBsr).second.statusPduSize); |
625 NS_LOG_DEBUG (this << " serve STATUS " << (*itBsr).second.statusPduSize); |
626 (*itBsr).second.statusPduSize = 0; |
626 (*itBsr).second.statusPduSize = 0; |
627 } |
627 } |
628 else |
628 else |
629 { |
629 { |
630 if ((*itBsr).second.statusPduSize>bytesForThisLc) |
630 if ((*itBsr).second.statusPduSize > bytesForThisLc) |
631 { |
631 { |
632 NS_FATAL_ERROR ("Insufficient Tx Opportunity for sending a status message"); |
632 NS_FATAL_ERROR ("Insufficient Tx Opportunity for sending a status message"); |
633 } |
633 } |
634 } |
634 } |
635 |
635 |
636 if ((bytesForThisLc > 7) && // 7 is the min TxOpportunity useful for Rlc |
636 if ((bytesForThisLc > 7) // 7 is the min TxOpportunity useful for Rlc |
637 (((*itBsr).second.retxQueueSize > 0) || |
637 && (((*itBsr).second.retxQueueSize > 0) |
638 ((*itBsr).second.txQueueSize > 0))) |
638 || ((*itBsr).second.txQueueSize > 0))) |
639 { |
639 { |
640 if ((*itBsr).second.retxQueueSize > 0) |
640 if ((*itBsr).second.retxQueueSize > 0) |
641 { |
641 { |
642 NS_LOG_DEBUG (this << " serve retx DATA, bytes " << bytesForThisLc); |
642 NS_LOG_DEBUG (this << " serve retx DATA, bytes " << bytesForThisLc); |
643 (*it).second.macSapUser->NotifyTxOpportunity (bytesForThisLc, 0, 0); |
643 (*it).second.macSapUser->NotifyTxOpportunity (bytesForThisLc, 0, 0); |
767 { |
767 { |
768 NS_LOG_FUNCTION (this); |
768 NS_LOG_FUNCTION (this); |
769 m_frameNo = frameNo; |
769 m_frameNo = frameNo; |
770 m_subframeNo = subframeNo; |
770 m_subframeNo = subframeNo; |
771 RefreshHarqProcessesPacketBuffer (); |
771 RefreshHarqProcessesPacketBuffer (); |
772 if ((Simulator::Now () >= m_bsrLast + m_bsrPeriodicity) && (m_freshUlBsr==true)) |
772 if ((Simulator::Now () >= m_bsrLast + m_bsrPeriodicity) && (m_freshUlBsr == true)) |
773 { |
773 { |
774 SendReportBufferStatus (); |
774 SendReportBufferStatus (); |
775 m_bsrLast = Simulator::Now (); |
775 m_bsrLast = Simulator::Now (); |
776 m_freshUlBsr = false; |
776 m_freshUlBsr = false; |
777 m_harqProcessId = (m_harqProcessId + 1) % HARQ_PERIOD; |
777 m_harqProcessId = (m_harqProcessId + 1) % HARQ_PERIOD; |