@ -14,8 +14,6 @@
namespace srsran {
namespace srsran {
mac_sch_subpdu_nr : : mac_sch_subpdu_nr ( mac_sch_pdu_nr * parent_ ) : parent ( parent_ ) { }
mac_sch_subpdu_nr : : nr_lcid_sch_t mac_sch_subpdu_nr : : get_type ( )
mac_sch_subpdu_nr : : nr_lcid_sch_t mac_sch_subpdu_nr : : get_type ( )
{
{
if ( lcid > = 32 ) {
if ( lcid > = 32 ) {
@ -85,11 +83,11 @@ void mac_sch_subpdu_nr::set_sdu(const uint32_t lcid_, const uint8_t* payload_, c
F_bit = false ;
F_bit = false ;
sdu_length = sizeof_ce ( lcid , parent - > is_ulsch ( ) ) ;
sdu_length = sizeof_ce ( lcid , parent - > is_ulsch ( ) ) ;
if ( len_ ! = static_cast < uint32_t > ( sdu_length ) ) {
if ( len_ ! = static_cast < uint32_t > ( sdu_length ) ) {
srslog: : fetch_basic_logger ( " MAC " ) . warning ( " Invalid SDU length of UL-SCH SDU (%d != %d) " , len_ , sdu_length ) ;
logger- > warning ( " Invalid SDU length of UL-SCH SDU (%d != %d) " , len_ , sdu_length ) ;
}
}
}
}
if ( sdu_length > = 256 ) {
if ( sdu_length > = MAC_SUBHEADER_LEN_THRESHOLD ) {
F_bit = true ;
F_bit = true ;
header_length + = 1 ;
header_length + = 1 ;
}
}
@ -160,7 +158,7 @@ uint32_t mac_sch_subpdu_nr::write_subpdu(const uint8_t* start_)
} else if ( header_length = = 1 ) {
} else if ( header_length = = 1 ) {
// do nothing
// do nothing
} else {
} else {
srslog: : fetch_basic_logger ( " MAC " ) . warning ( " Error while packing PDU. Unsupported header length (%d) " , header_length ) ;
logger- > error ( " Error while packing PDU. Unsupported header length (%d) " , header_length ) ;
}
}
// copy SDU payload
// copy SDU payload
@ -301,7 +299,7 @@ void mac_sch_pdu_nr::unpack(const uint8_t* payload, const uint32_t& len)
while ( offset < len ) {
while ( offset < len ) {
mac_sch_subpdu_nr sch_pdu ( this ) ;
mac_sch_subpdu_nr sch_pdu ( this ) ;
if ( sch_pdu . read_subheader ( payload + offset ) = = SRSRAN_ERROR ) {
if ( sch_pdu . read_subheader ( payload + offset ) = = SRSRAN_ERROR ) {
fprintf( stderr , " Error parsing NR MAC PDU (len=%d, offset=%d) \n " , len , offset ) ;
logger. error ( " Error parsing NR MAC PDU (len=%d, offset=%d) \n " , len , offset ) ;
return ;
return ;
}
}
offset + = sch_pdu . get_total_length ( ) ;
offset + = sch_pdu . get_total_length ( ) ;
@ -314,7 +312,7 @@ void mac_sch_pdu_nr::unpack(const uint8_t* payload, const uint32_t& len)
subpdus . push_back ( sch_pdu ) ;
subpdus . push_back ( sch_pdu ) ;
}
}
if ( offset ! = len ) {
if ( offset ! = len ) {
fprintf( stderr , " Error parsing NR MAC PDU (len=%d, offset=%d) \n " , len , offset ) ;
logger. error ( " Error parsing NR MAC PDU (len=%d, offset=%d) \n " , len , offset ) ;
}
}
}
}
@ -373,7 +371,7 @@ uint32_t mac_sch_pdu_nr::add_sdu(const uint32_t lcid_, const uint8_t* payload_,
{
{
int header_size = size_header_sdu ( lcid_ , len_ ) ;
int header_size = size_header_sdu ( lcid_ , len_ ) ;
if ( header_size + len_ > remaining_len ) {
if ( header_size + len_ > remaining_len ) {
printf( " Header and SDU exceed space in PDU (%d > %d). \n " , header_size + len_ , remaining_len ) ;
logger. error ( " Header and SDU exceed space in PDU (%d + %d > %d) " , header_size , len_ , remaining_len ) ;
return SRSRAN_ERROR ;
return SRSRAN_ERROR ;
}
}