enb,nr: rewrite UL PDU processing to handle CEs in reverse order but SDUs in order

this makes sure that C-RNTI CE gets processed before any SDU gets processed.
but it also makes sure that all SDUs then are processed in-order to
avoid reordering at higher layers.
master
Andre Puschmann 3 years ago committed by Ismael Gomez
parent 6d0aafcf69
commit 5f837c0c67

@ -71,6 +71,7 @@ public:
private: private:
// helper methods // helper methods
uint32_t buff_size_field_to_bytes(uint32_t buff_size_index, const srsran::bsr_format_nr_t& format); uint32_t buff_size_field_to_bytes(uint32_t buff_size_index, const srsran::bsr_format_nr_t& format);
int process_ce_subpdu(srsran::mac_sch_subpdu_nr& subpdu);
rlc_interface_mac* rlc = nullptr; rlc_interface_mac* rlc = nullptr;
rrc_interface_mac_nr* rrc = nullptr; rrc_interface_mac_nr* rrc = nullptr;

@ -74,16 +74,30 @@ int ue_nr::process_pdu(srsran::unique_byte_buffer_t pdu)
logger.info("Rx PDU: rnti=0x%x, %s", rnti, srsran::to_c_str(str_buffer)); logger.info("Rx PDU: rnti=0x%x, %s", rnti, srsran::to_c_str(str_buffer));
} }
// Reverse the order in which MAC subPDUs get processed. // First, process MAC CEs in reverse order (CE like C-RNTI get handled first)
// First, process MAC CEs, then MAC MAC subPDUs with MAC SDUs
for (uint32_t n = mac_pdu_ul.get_num_subpdus(), i = mac_pdu_ul.get_num_subpdus() - 1; n > 0; --n, i = n - 1) { for (uint32_t n = mac_pdu_ul.get_num_subpdus(), i = mac_pdu_ul.get_num_subpdus() - 1; n > 0; --n, i = n - 1) {
srsran::mac_sch_subpdu_nr subpdu = mac_pdu_ul.get_subpdu(i); srsran::mac_sch_subpdu_nr subpdu = mac_pdu_ul.get_subpdu(i);
logger.debug("Handling subPDU %d/%d: lcid=%d, sdu_len=%d", if (not subpdu.is_sdu()) {
i, if (process_ce_subpdu(subpdu) != SRSRAN_SUCCESS) {
mac_pdu_ul.get_num_subpdus(), return SRSRAN_ERROR;
subpdu.get_lcid(), }
subpdu.get_sdu_length()); }
}
// Second, handle all SDUs in order to avoid unnecessary reordering at higher layers
for (uint32_t i = 0; i < mac_pdu_ul.get_num_subpdus(); ++i) {
srsran::mac_sch_subpdu_nr subpdu = mac_pdu_ul.get_subpdu(i);
if (subpdu.is_sdu()) {
rrc->set_activity_user(rnti);
rlc->write_pdu(rnti, subpdu.get_lcid(), subpdu.get_sdu(), subpdu.get_sdu_length());
}
}
return SRSRAN_SUCCESS;
}
int ue_nr::process_ce_subpdu(srsran::mac_sch_subpdu_nr& subpdu)
{
// Handle MAC CEs // Handle MAC CEs
switch (subpdu.get_lcid()) { switch (subpdu.get_lcid()) {
case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::CRNTI: { case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::CRNTI: {
@ -121,12 +135,9 @@ int ue_nr::process_pdu(srsran::unique_byte_buffer_t pdu)
} }
} break; } break;
default: default:
if (subpdu.is_sdu()) { logger.warning("Unhandled subPDU with LCID=%d", subpdu.get_lcid());
rrc->set_activity_user(rnti);
rlc->write_pdu(rnti, subpdu.get_lcid(), subpdu.get_sdu(), subpdu.get_sdu_length());
}
}
} }
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }

Loading…
Cancel
Save