@ -21,7 +21,7 @@ rlc_tm::rlc_tm(srslog::basic_logger& logger,
uint32_t lcid_ ,
uint32_t lcid_ ,
srsue : : pdcp_interface_rlc * pdcp_ ,
srsue : : pdcp_interface_rlc * pdcp_ ,
srsue : : rrc_interface_rlc * rrc_ ) :
srsue : : rrc_interface_rlc * rrc_ ) :
logger ( logger ) , pdcp ( pdcp_ ) , rrc ( rrc_ ) , lcid ( lcid_ )
rlc_common ( logger ) , pdcp ( pdcp_ ) , rrc ( rrc_ ) , lcid ( lcid_ )
{
{
pool = byte_buffer_pool : : get_instance ( ) ;
pool = byte_buffer_pool : : get_instance ( ) ;
}
}
@ -34,7 +34,7 @@ rlc_tm::~rlc_tm()
bool rlc_tm : : configure ( const rlc_config_t & cnfg )
bool rlc_tm : : configure ( const rlc_config_t & cnfg )
{
{
logger. e rror( " Attempted to configure TM RLC entity " ) ;
RlcE rror( " Attempted to configure TM RLC entity " ) ;
return true ;
return true ;
}
}
@ -96,7 +96,7 @@ void rlc_tm::write_sdu(unique_byte_buffer_t sdu)
}
}
} else {
} else {
logger. w arning( " NULL SDU pointer in write_sdu() " ) ;
RlcW arning( " NULL SDU pointer in write_sdu() " ) ;
}
}
}
}
@ -105,7 +105,7 @@ void rlc_tm::discard_sdu(uint32_t discard_sn)
if ( ! tx_enabled ) {
if ( ! tx_enabled ) {
return ;
return ;
}
}
logger. w arning( " SDU discard not implemented on RLC TM " ) ;
RlcW arning( " SDU discard not implemented on RLC TM " ) ;
}
}
bool rlc_tm : : sdu_queue_is_full ( )
bool rlc_tm : : sdu_queue_is_full ( )
@ -153,16 +153,14 @@ uint32_t rlc_tm::read_pdu(uint8_t* payload, uint32_t nof_bytes)
{
{
uint32_t pdu_size = ul_queue . size_tail_bytes ( ) ;
uint32_t pdu_size = ul_queue . size_tail_bytes ( ) ;
if ( pdu_size > nof_bytes ) {
if ( pdu_size > nof_bytes ) {
logger. info ( " %s Tx PDU size larger than MAC opportunity (%d > %d)" , rrc - > get_rb_name ( lcid ) , pdu_size , nof_bytes ) ;
RlcInfo( " Tx PDU size larger than MAC opportunity (%d > %d)" , pdu_size , nof_bytes ) ;
return 0 ;
return 0 ;
}
}
unique_byte_buffer_t buf ;
unique_byte_buffer_t buf ;
if ( ul_queue . try_read ( & buf ) ) {
if ( ul_queue . try_read ( & buf ) ) {
pdu_size = buf - > N_bytes ;
pdu_size = buf - > N_bytes ;
memcpy ( payload , buf - > msg , buf - > N_bytes ) ;
memcpy ( payload , buf - > msg , buf - > N_bytes ) ;
logger . debug ( " %s Complete SDU scheduled for tx. Stack latency: % " PRIu64 " us " ,
RlcDebug ( " Complete SDU scheduled for tx. Stack latency: % " PRIu64 " us " , ( uint64_t ) buf - > get_latency_us ( ) . count ( ) ) ;
rrc - > get_rb_name ( lcid ) ,
( uint64_t ) buf - > get_latency_us ( ) . count ( ) ) ;
logger . info ( payload ,
logger . info ( payload ,
pdu_size ,
pdu_size ,
" %s Tx %s PDU, queue size=%d, bytes=%d " ,
" %s Tx %s PDU, queue size=%d, bytes=%d " ,
@ -174,13 +172,13 @@ uint32_t rlc_tm::read_pdu(uint8_t* payload, uint32_t nof_bytes)
std : : lock_guard < std : : mutex > lock ( metrics_mutex ) ;
std : : lock_guard < std : : mutex > lock ( metrics_mutex ) ;
metrics . num_tx_pdu_bytes + = pdu_size ;
metrics . num_tx_pdu_bytes + = pdu_size ;
return pdu_size ;
return pdu_size ;
} else {
if ( ul_queue . size_bytes ( ) > 0 ) {
logger . warning ( " Corrupted queue: empty but size_bytes > 0. Resetting queue " ) ;
ul_queue . reset ( ) ;
}
return 0 ;
}
}
if ( ul_queue . size_bytes ( ) > 0 ) {
RlcWarning ( " Corrupted queue: empty but size_bytes > 0. Resetting queue " ) ;
ul_queue . reset ( ) ;
}
return 0 ;
}
}
void rlc_tm : : write_pdu ( uint8_t * payload , uint32_t nof_bytes )
void rlc_tm : : write_pdu ( uint8_t * payload , uint32_t nof_bytes )
@ -201,7 +199,7 @@ void rlc_tm::write_pdu(uint8_t* payload, uint32_t nof_bytes)
pdcp - > write_pdu ( lcid , std : : move ( buf ) ) ;
pdcp - > write_pdu ( lcid , std : : move ( buf ) ) ;
}
}
} else {
} else {
logger. e rror( " Fatal Error: Couldn't allocate buffer in rlc_tm::write_pdu(). " ) ;
RlcE rror( " Fatal Error: Couldn't allocate buffer in rlc_tm::write_pdu(). " ) ;
}
}
}
}