@ -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 ;
}
}