@ -47,7 +47,7 @@ rrc::rrc(stack_interface_rrc* stack_, srslte::task_sched_handle task_sched_) :
state ( RRC_STATE_IDLE ) ,
state ( RRC_STATE_IDLE ) ,
last_state ( RRC_STATE_CONNECTED ) ,
last_state ( RRC_STATE_CONNECTED ) ,
drb_up ( false ) ,
drb_up ( false ) ,
rrc_log( " RRC " ) ,
logge r( s rslog: : fetch_basi c_logger ( " RRC " ) ) ,
measurements ( new rrc_meas ( ) ) ,
measurements ( new rrc_meas ( ) ) ,
cell_searcher ( this ) ,
cell_searcher ( this ) ,
si_acquirer ( this ) ,
si_acquirer ( this ) ,
@ -76,19 +76,19 @@ void rrc::log_rrc_message(const std::string source,
const T & msg ,
const T & msg ,
const std : : string & msg_type )
const std : : string & msg_type )
{
{
if ( rrc_log- > get_level ( ) = = srslte : : LOG_LEVEL_INFO ) {
if ( logger. info . enabled ( ) ) {
rrc_log- > info ( " %s - %s %s (%d B) \n " , source . c_str ( ) , ( dir = = Rx ) ? " Rx " : " Tx " , msg_type . c_str ( ) , pdu - > N_bytes ) ;
logger. info ( " %s - %s %s (%d B) " , source . c_str ( ) , ( dir = = Rx ) ? " Rx " : " Tx " , msg_type . c_str ( ) , pdu - > N_bytes ) ;
} else if ( rrc_log- > get_level ( ) > = srslte : : LOG_LEVEL_DEBUG ) {
} else if ( logger. debug . enabled ( ) ) {
asn1 : : json_writer json_writer ;
asn1 : : json_writer json_writer ;
msg . to_json ( json_writer ) ;
msg . to_json ( json_writer ) ;
rrc_log- > debug_hex ( pdu - > msg ,
logger. debug ( pdu - > msg ,
pdu - > N_bytes ,
pdu - > N_bytes ,
" %s - %s %s (%d B) \n " ,
" %s - %s %s (%d B) " ,
source . c_str ( ) ,
source . c_str ( ) ,
( dir = = Rx ) ? " Rx " : " Tx " ,
( dir = = Rx ) ? " Rx " : " Tx " ,
msg_type . c_str ( ) ,
msg_type . c_str ( ) ,
pdu - > N_bytes ) ;
pdu - > N_bytes ) ;
rrc_log- > debug_lon g( " Content: \n %s \n " , json_writer . to_string ( ) . c_str ( ) ) ;
logger. debu g( " Content: \n %s " , json_writer . to_string ( ) . c_str ( ) ) ;
}
}
}
}
@ -152,7 +152,7 @@ void rrc::init(phy_interface_rrc_lte* phy_,
struct timeval tv ;
struct timeval tv ;
gettimeofday ( & tv , NULL ) ;
gettimeofday ( & tv , NULL ) ;
rrc_log- > info ( " using srand seed of %ld \n " , tv . tv_usec ) ;
logger. info ( " using srand seed of %ld " , tv . tv_usec ) ;
// set seed (used in CHAP auth and attach)
// set seed (used in CHAP auth and attach)
srand ( tv . tv_usec ) ;
srand ( tv . tv_usec ) ;
@ -225,7 +225,7 @@ void rrc::run_tti()
// Log state changes
// Log state changes
if ( state ! = last_state ) {
if ( state ! = last_state ) {
rrc_log- > debug ( " State %s \n " , rrc_state_text [ state ] ) ;
logger. debug ( " State %s " , rrc_state_text [ state ] ) ;
last_state = state ;
last_state = state ;
}
}
@ -300,7 +300,7 @@ uint16_t rrc::get_mnc()
bool rrc : : plmn_search ( )
bool rrc : : plmn_search ( )
{
{
if ( not plmn_searcher . launch ( ) ) {
if ( not plmn_searcher . launch ( ) ) {
rrc_log- > error ( " Unable to initiate PLMN search \n " ) ;
logger. error ( " Unable to initiate PLMN search " ) ;
return false ;
return false ;
}
}
callback_list . add_proc ( plmn_searcher ) ;
callback_list . add_proc ( plmn_searcher ) ;
@ -315,7 +315,7 @@ void rrc::plmn_select(srslte::plmn_id_t plmn_id)
plmn_is_selected = true ;
plmn_is_selected = true ;
selected_plmn_id = plmn_id ;
selected_plmn_id = plmn_id ;
rrc_log- > info ( " PLMN Selected %s \n " , plmn_id . to_string ( ) . c_str ( ) ) ;
logger. info ( " PLMN Selected %s " , plmn_id . to_string ( ) . c_str ( ) ) ;
}
}
/* 5.3.3.2 Initiation of RRC Connection Establishment procedure
/* 5.3.3.2 Initiation of RRC Connection Establishment procedure
@ -329,7 +329,7 @@ void rrc::plmn_select(srslte::plmn_id_t plmn_id)
bool rrc : : connection_request ( srslte : : establishment_cause_t cause , srslte : : unique_byte_buffer_t dedicated_info_nas_ )
bool rrc : : connection_request ( srslte : : establishment_cause_t cause , srslte : : unique_byte_buffer_t dedicated_info_nas_ )
{
{
if ( not conn_req_proc . launch ( cause , std : : move ( dedicated_info_nas_ ) ) ) {
if ( not conn_req_proc . launch ( cause , std : : move ( dedicated_info_nas_ ) ) ) {
rrc_log- > error ( " Failed to initiate connection request procedure \n " ) ;
logger. error ( " Failed to initiate connection request procedure " ) ;
return false ;
return false ;
}
}
callback_list . add_proc ( conn_req_proc ) ;
callback_list . add_proc ( conn_req_proc ) ;
@ -340,8 +340,8 @@ void rrc::set_ue_identity(srslte::s_tmsi_t s_tmsi)
{
{
ue_identity_configured = true ;
ue_identity_configured = true ;
ue_identity = s_tmsi ;
ue_identity = s_tmsi ;
rrc_log- > info (
logger. info (
" Set ue-Identity to 0x% " PRIu64 " :0x% " PRIu64 " \n " , ( uint64_t ) ue_identity . mmec , ( uint64_t ) ue_identity . m_tmsi ) ;
" Set ue-Identity to 0x% " PRIu64 " :0x% " PRIu64 " " , ( uint64_t ) ue_identity . mmec , ( uint64_t ) ue_identity . m_tmsi ) ;
}
}
/*******************************************************************************
/*******************************************************************************
@ -391,7 +391,7 @@ void rrc::process_cell_meas_nr()
std : : vector < phy_meas_nr_t > m ;
std : : vector < phy_meas_nr_t > m ;
while ( cell_meas_nr_q . try_pop ( & m ) ) {
while ( cell_meas_nr_q . try_pop ( & m ) ) {
if ( cell_meas_nr_q . size ( ) > 0 ) {
if ( cell_meas_nr_q . size ( ) > 0 ) {
rrc_log- > debug ( " MEAS: Processing measurement. %zd measurements in queue \n " , cell_meas_q . size ( ) ) ;
logger. debug ( " MEAS: Processing measurement. %zd measurements in queue " , cell_meas_q . size ( ) ) ;
}
}
process_new_cell_meas_nr ( m ) ;
process_new_cell_meas_nr ( m ) ;
}
}
@ -417,7 +417,7 @@ void rrc::process_new_cell_meas_nr(const std::vector<phy_meas_nr_t>& meas)
c . set_cfo ( m . cfo_hz ) ;
c . set_cfo ( m . cfo_hz ) ;
} ;
} ;
rrc_log- > debug ( " MEAS: Processing measurement of %zd cells \n " , meas . size ( ) ) ;
logger. debug ( " MEAS: Processing measurement of %zd cells " , meas . size ( ) ) ;
bool neighbour_added = meas_cells_nr . process_new_cell_meas ( meas_lte , filter ) ;
bool neighbour_added = meas_cells_nr . process_new_cell_meas ( meas_lte , filter ) ;
}
}
@ -444,7 +444,7 @@ void rrc::process_cell_meas()
std : : vector < phy_meas_t > m ;
std : : vector < phy_meas_t > m ;
while ( cell_meas_q . try_pop ( & m ) ) {
while ( cell_meas_q . try_pop ( & m ) ) {
if ( cell_meas_q . size ( ) > 0 ) {
if ( cell_meas_q . size ( ) > 0 ) {
rrc_log- > debug ( " MEAS: Processing measurement. %zd measurements in queue \n " , cell_meas_q . size ( ) ) ;
logger. debug ( " MEAS: Processing measurement. %zd measurements in queue " , cell_meas_q . size ( ) ) ;
}
}
process_new_cell_meas ( m ) ;
process_new_cell_meas ( m ) ;
}
}
@ -459,7 +459,7 @@ void rrc::process_new_cell_meas(const std::vector<phy_meas_t>& meas)
c . set_cfo ( m . cfo_hz ) ;
c . set_cfo ( m . cfo_hz ) ;
} ;
} ;
rrc_log- > debug ( " MEAS: Processing measurement of %zd cells \n " , meas . size ( ) ) ;
logger. debug ( " MEAS: Processing measurement of %zd cells " , meas . size ( ) ) ;
bool neighbour_added = meas_cells . process_new_cell_meas ( meas , filter ) ;
bool neighbour_added = meas_cells . process_new_cell_meas ( meas , filter ) ;
@ -473,7 +473,7 @@ void rrc::process_new_cell_meas(const std::vector<phy_meas_t>& meas)
void rrc : : out_of_sync ( )
void rrc : : out_of_sync ( )
{
{
// CAUTION: We do not lock in this function since they are called from real-time threads
// CAUTION: We do not lock in this function since they are called from real-time threads
if ( meas_cells . serving_cell ( ) . is_valid ( ) & & rrc_log ) {
if ( meas_cells . serving_cell ( ) . is_valid ( ) ) {
phy_ctrl - > out_sync ( ) ;
phy_ctrl - > out_sync ( ) ;
// upon receiving N310 consecutive "out-of-sync" indications for the PCell from lower layers while neither T300,
// upon receiving N310 consecutive "out-of-sync" indications for the PCell from lower layers while neither T300,
@ -483,15 +483,15 @@ void rrc::out_of_sync()
// nor T311 is running
// nor T311 is running
bool t311_running = t311 . is_running ( ) | | connection_reest . is_busy ( ) ;
bool t311_running = t311 . is_running ( ) | | connection_reest . is_busy ( ) ;
if ( ! t300 . is_running ( ) and ! t301 . is_running ( ) and ! t304 . is_running ( ) and ! t310 . is_running ( ) and ! t311_running ) {
if ( ! t300 . is_running ( ) and ! t301 . is_running ( ) and ! t304 . is_running ( ) and ! t310 . is_running ( ) and ! t311_running ) {
rrc_log- > info ( " Received out-of-sync while in state %s. n310=%d, t311=%s, t310=%s \n " ,
logger. info ( " Received out-of-sync while in state %s. n310=%d, t311=%s, t310=%s " ,
rrc_state_text [ state ] ,
rrc_state_text [ state ] ,
n310_cnt ,
n310_cnt ,
t311 . is_running ( ) ? " running " : " stop " ,
t311 . is_running ( ) ? " running " : " stop " ,
t310 . is_running ( ) ? " running " : " stop " ) ;
t310 . is_running ( ) ? " running " : " stop " ) ;
n310_cnt + + ;
n310_cnt + + ;
if ( n310_cnt = = N310 ) {
if ( n310_cnt = = N310 ) {
rrc_log- > info (
logger. info (
" Detected %d out-of-sync from PHY. Trying to resync. Starting T310 timer %d ms \n " , N310 , t310 . duration ( ) ) ;
" Detected %d out-of-sync from PHY. Trying to resync. Starting T310 timer %d ms " , N310 , t310 . duration ( ) ) ;
t310 . run ( ) ;
t310 . run ( ) ;
n310_cnt = 0 ;
n310_cnt = 0 ;
}
}
@ -510,7 +510,7 @@ void rrc::in_sync()
if ( n311_cnt = = N311 ) {
if ( n311_cnt = = N311 ) {
t310 . stop ( ) ;
t310 . stop ( ) ;
n311_cnt = 0 ;
n311_cnt = 0 ;
rrc_log- > info ( " Detected %d in-sync from PHY. Stopping T310 timer \n " , N311 ) ;
logger. info ( " Detected %d in-sync from PHY. Stopping T310 timer " , N311 ) ;
}
}
}
}
}
}
@ -569,7 +569,7 @@ void rrc::set_serving_cell(phy_cell_t phy_cell, bool discard_serving)
int rrc : : start_cell_select ( )
int rrc : : start_cell_select ( )
{
{
if ( not cell_selector . launch ( ) ) {
if ( not cell_selector . launch ( ) ) {
rrc_log- > error ( " Failed to initiate a Cell Selection procedure... \n " ) ;
logger. error ( " Failed to initiate a Cell Selection procedure... " ) ;
return SRSLTE_ERROR ;
return SRSLTE_ERROR ;
}
}
callback_list . add_proc ( cell_selector ) ;
callback_list . add_proc ( cell_selector ) ;
@ -631,11 +631,11 @@ bool rrc::mbms_service_start(uint32_t serv, uint32_t port)
{
{
bool ret = false ;
bool ret = false ;
if ( ! meas_cells . serving_cell ( ) . has_mcch ) {
if ( ! meas_cells . serving_cell ( ) . has_mcch ) {
rrc_log- > error ( " MCCH not available at MBMS Service Start \n " ) ;
logger. error ( " MCCH not available at MBMS Service Start " ) ;
return ret ;
return ret ;
}
}
rrc_log- > info ( " %s \n " , print_mbms ( ) . c_str ( ) ) ;
logger. info ( " %s " , print_mbms ( ) . c_str ( ) ) ;
mcch_msg_type_c msg = meas_cells . serving_cell ( ) . mcch . msg ;
mcch_msg_type_c msg = meas_cells . serving_cell ( ) . mcch . msg ;
for ( uint32_t i = 0 ; i < msg . c1 ( ) . mbsfn_area_cfg_r9 ( ) . pmch_info_list_r9 . size ( ) ; i + + ) {
for ( uint32_t i = 0 ; i < msg . c1 ( ) . mbsfn_area_cfg_r9 ( ) . pmch_info_list_r9 . size ( ) ; i + + ) {
@ -687,14 +687,14 @@ void rrc::radio_link_failure_process()
if ( state = = RRC_STATE_CONNECTED ) {
if ( state = = RRC_STATE_CONNECTED ) {
if ( security_is_activated ) {
if ( security_is_activated ) {
rrc_log- > info ( " Detected Radio-Link Failure with active AS security. Starting ConnectionReestablishment... \n " ) ;
logger. info ( " Detected Radio-Link Failure with active AS security. Starting ConnectionReestablishment... " ) ;
start_con_restablishment ( reest_cause_e : : other_fail ) ;
start_con_restablishment ( reest_cause_e : : other_fail ) ;
} else {
} else {
rrc_log- > info ( " Detected Radio-Link Failure with AS security deactivated. Going to IDLE... \n " ) ;
logger. info ( " Detected Radio-Link Failure with AS security deactivated. Going to IDLE... " ) ;
start_go_idle ( ) ;
start_go_idle ( ) ;
}
}
} else {
} else {
rrc_log- > info ( " Detected Radio-Link Failure while RRC_IDLE. Ignoring it. \n " ) ;
logger. info ( " Detected Radio-Link Failure while RRC_IDLE. Ignoring it. " ) ;
}
}
}
}
@ -710,29 +710,29 @@ void rrc::release_pucch_srs()
void rrc : : ra_problem ( )
void rrc : : ra_problem ( )
{
{
if ( not t300 . is_running ( ) and not t301 . is_running ( ) and not t304 . is_running ( ) and not t311 . is_running ( ) ) {
if ( not t300 . is_running ( ) and not t301 . is_running ( ) and not t304 . is_running ( ) and not t311 . is_running ( ) ) {
rrc_log- > warning ( " MAC indicated RA problem. Starting RLF \n " ) ;
logger. warning ( " MAC indicated RA problem. Starting RLF " ) ;
radio_link_failure_push_cmd ( ) ;
radio_link_failure_push_cmd ( ) ;
} else {
} else {
rrc_log- > warning ( " MAC indicated RA problem but either T300, T301, T304 or T311 is running. Ignoring it. \n " ) ;
logger. warning ( " MAC indicated RA problem but either T300, T301, T304 or T311 is running. Ignoring it. " ) ;
}
}
}
}
void rrc : : max_retx_attempted ( )
void rrc : : max_retx_attempted ( )
{
{
// TODO: Handle the radio link failure
// TODO: Handle the radio link failure
rrc_log- > warning ( " Max RLC reTx attempted. Starting RLF \n " ) ;
logger. warning ( " Max RLC reTx attempted. Starting RLF " ) ;
radio_link_failure_push_cmd ( ) ;
radio_link_failure_push_cmd ( ) ;
}
}
void rrc : : timer_expired ( uint32_t timeout_id )
void rrc : : timer_expired ( uint32_t timeout_id )
{
{
if ( timeout_id = = t310 . id ( ) ) {
if ( timeout_id = = t310 . id ( ) ) {
rrc_log- > info ( " Timer T310 expired: Radio Link Failure \n " ) ;
logger. info ( " Timer T310 expired: Radio Link Failure " ) ;
radio_link_failure_push_cmd ( ) ;
radio_link_failure_push_cmd ( ) ;
} else if ( timeout_id = = t311 . id ( ) ) {
} else if ( timeout_id = = t311 . id ( ) ) {
srslte : : console ( " Timer T311 expired: Going to RRC IDLE \n " ) ;
srslte : : console ( " Timer T311 expired: Going to RRC IDLE \n " ) ;
if ( connection_reest . is_idle ( ) ) {
if ( connection_reest . is_idle ( ) ) {
rrc_log- > info ( " Timer T311 expired: Going to RRC IDLE \n " ) ;
logger. info ( " Timer T311 expired: Going to RRC IDLE " ) ;
start_go_idle ( ) ;
start_go_idle ( ) ;
} else {
} else {
// Do nothing, this is handled by the procedure
// Do nothing, this is handled by the procedure
@ -740,22 +740,22 @@ void rrc::timer_expired(uint32_t timeout_id)
}
}
} else if ( timeout_id = = t301 . id ( ) ) {
} else if ( timeout_id = = t301 . id ( ) ) {
if ( state = = RRC_STATE_IDLE ) {
if ( state = = RRC_STATE_IDLE ) {
rrc_log- > info ( " Timer T301 expired: Already in IDLE. \n " ) ;
logger. info ( " Timer T301 expired: Already in IDLE. " ) ;
} else {
} else {
rrc_log- > info ( " Timer T301 expired: Going to RRC IDLE \n " ) ;
logger. info ( " Timer T301 expired: Going to RRC IDLE " ) ;
connection_reest . trigger ( connection_reest_proc : : t301_expiry { } ) ;
connection_reest . trigger ( connection_reest_proc : : t301_expiry { } ) ;
}
}
} else if ( timeout_id = = t302 . id ( ) ) {
} else if ( timeout_id = = t302 . id ( ) ) {
rrc_log- > info ( " Timer T302 expired. Informing NAS about barrier alleviatio n\ n" ) ;
logger. info ( " Timer T302 expired. Informing NAS about barrier alleviatio n" ) ;
nas - > set_barring ( srslte : : barring_t : : none ) ;
nas - > set_barring ( srslte : : barring_t : : none ) ;
} else if ( timeout_id = = t300 . id ( ) ) {
} else if ( timeout_id = = t300 . id ( ) ) {
// Do nothing, handled in connection_request()
// Do nothing, handled in connection_request()
} else if ( timeout_id = = t304 . id ( ) ) {
} else if ( timeout_id = = t304 . id ( ) ) {
srslte : : console ( " Timer t304 expired: Handover failed \n " ) ;
srslte : : console ( " Timer t304 expired: Handover failed \n " ) ;
rrc_log- > info ( " Timer t304 expired: Handover failed \n " ) ;
logger. info ( " Timer t304 expired: Handover failed " ) ;
ho_failed ( ) ;
ho_failed ( ) ;
} else {
} else {
rrc_log- > error ( " Timeout from unknown timer id %d \n " , timeout_id ) ;
logger. error ( " Timeout from unknown timer id %d " , timeout_id ) ;
}
}
}
}
@ -827,7 +827,7 @@ bool rrc::nr_reconfiguration_proc(const rrc_conn_recfg_r8_ies_s& rx_recfg)
void rrc : : send_con_request ( srslte : : establishment_cause_t cause )
void rrc : : send_con_request ( srslte : : establishment_cause_t cause )
{
{
rrc_log- > debug ( " Preparing RRC Connection Request \n " ) ;
logger. debug ( " Preparing RRC Connection Request " ) ;
// Prepare ConnectionRequest packet
// Prepare ConnectionRequest packet
ul_ccch_msg_s ul_ccch_msg ;
ul_ccch_msg_s ul_ccch_msg ;
@ -877,8 +877,8 @@ void rrc::send_con_restablish_request(reest_cause_e cause, uint16_t crnti, uint1
uint32_t N_bits = ( uint32_t ) bref . distance ( varShortMAC_packed ) ;
uint32_t N_bits = ( uint32_t ) bref . distance ( varShortMAC_packed ) ;
uint32_t N_bytes = ( ( N_bits - 1 ) / 8 + 1 ) ;
uint32_t N_bytes = ( ( N_bits - 1 ) / 8 + 1 ) ;
rrc_log- > info (
logger. info (
" Encoded varShortMAC: cellId=0x%x, PCI=%d, rnti=0x%x (%d bytes, %d bits) \n " , cellid , pci , crnti , N_bytes , N_bits ) ;
" Encoded varShortMAC: cellId=0x%x, PCI=%d, rnti=0x%x (%d bytes, %d bits) " , cellid , pci , crnti , N_bytes , N_bits ) ;
// Compute MAC-I
// Compute MAC-I
uint8_t mac_key [ 4 ] = { } ;
uint8_t mac_key [ 4 ] = { } ;
@ -911,7 +911,7 @@ void rrc::send_con_restablish_request(reest_cause_e cause, uint16_t crnti, uint1
mac_key ) ;
mac_key ) ;
break ;
break ;
default :
default :
rrc_log- > info ( " Unsupported integrity algorithm during reestablishment \n " ) ;
logger. info ( " Unsupported integrity algorithm during reestablishment " ) ;
}
}
// Prepare ConnectionRestalishmentRequest packet
// Prepare ConnectionRestalishmentRequest packet
@ -928,7 +928,7 @@ void rrc::send_con_restablish_request(reest_cause_e cause, uint16_t crnti, uint1
meas_cells . serving_cell ( ) . phy_cell . pci ,
meas_cells . serving_cell ( ) . phy_cell . pci ,
meas_cells . serving_cell ( ) . phy_cell . earfcn ,
meas_cells . serving_cell ( ) . phy_cell . earfcn ,
cause . to_string ( ) . c_str ( ) ) ;
cause . to_string ( ) . c_str ( ) ) ;
rrc_log- > info ( " RRC Connection Reestablishment to PCI=%d, EARFCN=%d (Cause: \" %s \" ) \n " ,
logger. info ( " RRC Connection Reestablishment to PCI=%d, EARFCN=%d (Cause: \" %s \" ) " ,
meas_cells . serving_cell ( ) . phy_cell . pci ,
meas_cells . serving_cell ( ) . phy_cell . pci ,
meas_cells . serving_cell ( ) . phy_cell . earfcn ,
meas_cells . serving_cell ( ) . phy_cell . earfcn ,
cause . to_string ( ) . c_str ( ) ) ;
cause . to_string ( ) . c_str ( ) ) ;
@ -938,7 +938,7 @@ void rrc::send_con_restablish_request(reest_cause_e cause, uint16_t crnti, uint1
void rrc : : send_con_restablish_complete ( )
void rrc : : send_con_restablish_complete ( )
{
{
rrc_log- > debug ( " Preparing RRC Connection Reestablishment Complete \n " ) ;
logger. debug ( " Preparing RRC Connection Reestablishment Complete " ) ;
srslte : : console ( " RRC Connected \n " ) ;
srslte : : console ( " RRC Connected \n " ) ;
// Prepare ConnectionSetupComplete packet
// Prepare ConnectionSetupComplete packet
@ -953,7 +953,7 @@ void rrc::send_con_restablish_complete()
void rrc : : send_con_setup_complete ( srslte : : unique_byte_buffer_t nas_msg )
void rrc : : send_con_setup_complete ( srslte : : unique_byte_buffer_t nas_msg )
{
{
rrc_log- > debug ( " Preparing RRC Connection Setup Complete \n " ) ;
logger. debug ( " Preparing RRC Connection Setup Complete " ) ;
// Prepare ConnectionSetupComplete packet
// Prepare ConnectionSetupComplete packet
asn1 : : rrc : : ul_dcch_msg_s ul_dcch_msg ;
asn1 : : rrc : : ul_dcch_msg_s ul_dcch_msg ;
@ -987,7 +987,7 @@ void rrc::send_ul_info_transfer(unique_byte_buffer_t nas_msg)
void rrc : : send_security_mode_complete ( )
void rrc : : send_security_mode_complete ( )
{
{
rrc_log- > debug ( " Preparing Security Mode Complete \n " ) ;
logger. debug ( " Preparing Security Mode Complete " ) ;
// Prepare Security Mode Command Complete
// Prepare Security Mode Command Complete
ul_dcch_msg_s ul_dcch_msg ;
ul_dcch_msg_s ul_dcch_msg ;
@ -999,7 +999,7 @@ void rrc::send_security_mode_complete()
void rrc : : send_rrc_con_reconfig_complete ( bool contains_nr_complete )
void rrc : : send_rrc_con_reconfig_complete ( bool contains_nr_complete )
{
{
rrc_log- > debug ( " Preparing RRC Connection Reconfig Complete \n " ) ;
logger. debug ( " Preparing RRC Connection Reconfig Complete " ) ;
ul_dcch_msg_s ul_dcch_msg ;
ul_dcch_msg_s ul_dcch_msg ;
rrc_conn_recfg_complete_r8_ies_s * rrc_conn_recfg_complete_r8 =
rrc_conn_recfg_complete_r8_ies_s * rrc_conn_recfg_complete_r8 =
@ -1007,7 +1007,7 @@ void rrc::send_rrc_con_reconfig_complete(bool contains_nr_complete)
ul_dcch_msg . msg . c1 ( ) . rrc_conn_recfg_complete ( ) . rrc_transaction_id = transaction_id ;
ul_dcch_msg . msg . c1 ( ) . rrc_conn_recfg_complete ( ) . rrc_transaction_id = transaction_id ;
if ( contains_nr_complete = = true ) {
if ( contains_nr_complete = = true ) {
rrc_log- > debug ( " Preparing RRC Connection Reconfig Complete with NR Complete \n " ) ;
logger. debug ( " Preparing RRC Connection Reconfig Complete with NR Complete " ) ;
rrc_conn_recfg_complete_r8 - > non_crit_ext_present = true ;
rrc_conn_recfg_complete_r8 - > non_crit_ext_present = true ;
rrc_conn_recfg_complete_r8 - > non_crit_ext . non_crit_ext_present = true ;
rrc_conn_recfg_complete_r8 - > non_crit_ext . non_crit_ext_present = true ;
@ -1036,7 +1036,7 @@ void rrc::ra_completed()
bool rrc : : con_reconfig_ho ( const rrc_conn_recfg_s & reconfig )
bool rrc : : con_reconfig_ho ( const rrc_conn_recfg_s & reconfig )
{
{
if ( not ho_handler . launch ( reconfig ) ) {
if ( not ho_handler . launch ( reconfig ) ) {
rrc_log- > error ( " Unable to launch Handover Preparation procedure \n " ) ;
logger. error ( " Unable to launch Handover Preparation procedure " ) ;
return false ;
return false ;
}
}
callback_list . add_proc ( ho_handler ) ;
callback_list . add_proc ( ho_handler ) ;
@ -1046,7 +1046,7 @@ bool rrc::con_reconfig_ho(const rrc_conn_recfg_s& reconfig)
void rrc : : start_go_idle ( )
void rrc : : start_go_idle ( )
{
{
if ( not idle_setter . launch ( ) ) {
if ( not idle_setter . launch ( ) ) {
rrc_log- > info ( " Failed to set RRC to IDLE \n " ) ;
logger. info ( " Failed to set RRC to IDLE " ) ;
return ;
return ;
}
}
callback_list . add_proc ( idle_setter ) ;
callback_list . add_proc ( idle_setter ) ;
@ -1087,7 +1087,7 @@ void rrc::handle_rrc_con_reconfig(uint32_t lcid, const rrc_conn_recfg_s& reconfi
con_reconfig_ho ( reconfig ) ;
con_reconfig_ho ( reconfig ) ;
} else {
} else {
if ( not conn_recfg_proc . launch ( reconfig ) ) {
if ( not conn_recfg_proc . launch ( reconfig ) ) {
rrc_log- > error ( " Unable to launch Handover Preparation procedure \n " ) ;
logger. error ( " Unable to launch Handover Preparation procedure " ) ;
return ;
return ;
}
}
callback_list . add_proc ( conn_recfg_proc ) ;
callback_list . add_proc ( conn_recfg_proc ) ;
@ -1106,7 +1106,7 @@ void rrc::rrc_connection_release(const std::string& cause)
void rrc : : leave_connected ( )
void rrc : : leave_connected ( )
{
{
srslte : : console ( " RRC IDLE \n " ) ;
srslte : : console ( " RRC IDLE \n " ) ;
rrc_log- > info ( " Leaving RRC_CONNECTED state \n " ) ;
logger. info ( " Leaving RRC_CONNECTED state " ) ;
state = RRC_STATE_IDLE ;
state = RRC_STATE_IDLE ;
drb_up = false ;
drb_up = false ;
security_is_activated = false ;
security_is_activated = false ;
@ -1129,7 +1129,7 @@ void rrc::leave_connected()
// 1> if leaving RRC_CONNECTED was not triggered by reception of the MobilityFromEUTRACommand message:
// 1> if leaving RRC_CONNECTED was not triggered by reception of the MobilityFromEUTRACommand message:
// 2> enter RRC_IDLE by performing cell selection in accordance with the cell selection process, defined for the
// 2> enter RRC_IDLE by performing cell selection in accordance with the cell selection process, defined for the
// case of leaving RRC_CONNECTED, as specified in TS 36.304 [4];
// case of leaving RRC_CONNECTED, as specified in TS 36.304 [4];
rrc_log- > info ( " Going RRC_IDLE \n " ) ;
logger. info ( " Going RRC_IDLE " ) ;
if ( phy - > cell_is_camping ( ) ) {
if ( phy - > cell_is_camping ( ) ) {
// Receive paging
// Receive paging
mac - > pcch_start_rx ( ) ;
mac - > pcch_start_rx ( ) ;
@ -1159,7 +1159,7 @@ void rrc::stop_timers()
void rrc : : start_con_restablishment ( reest_cause_e cause )
void rrc : : start_con_restablishment ( reest_cause_e cause )
{
{
if ( not connection_reest . launch ( cause ) ) {
if ( not connection_reest . launch ( cause ) ) {
rrc_log- > info ( " Failed to launch connection re-establishment procedure \n " ) ;
logger. info ( " Failed to launch connection re-establishment procedure " ) ;
}
}
callback_list . add_proc ( connection_reest ) ;
callback_list . add_proc ( connection_reest ) ;
@ -1253,7 +1253,7 @@ void rrc::write_pdu_bcch_bch(unique_byte_buffer_t pdu)
asn1 : : SRSASN_CODE err = bch_msg . unpack ( bch_bref ) ;
asn1 : : SRSASN_CODE err = bch_msg . unpack ( bch_bref ) ;
if ( err ! = asn1 : : SRSASN_SUCCESS ) {
if ( err ! = asn1 : : SRSASN_SUCCESS ) {
rrc_log- > error ( " Could not unpack BCCH-BCH message. \n " ) ;
logger. error ( " Could not unpack BCCH-BCH message. " ) ;
return ;
return ;
}
}
@ -1277,14 +1277,14 @@ void rrc::parse_pdu_bcch_dlsch(unique_byte_buffer_t pdu)
asn1 : : SRSASN_CODE err = dlsch_msg . unpack ( dlsch_bref ) ;
asn1 : : SRSASN_CODE err = dlsch_msg . unpack ( dlsch_bref ) ;
if ( err ! = asn1 : : SRSASN_SUCCESS or dlsch_msg . msg . type ( ) . value ! = bcch_dl_sch_msg_type_c : : types_opts : : c1 ) {
if ( err ! = asn1 : : SRSASN_SUCCESS or dlsch_msg . msg . type ( ) . value ! = bcch_dl_sch_msg_type_c : : types_opts : : c1 ) {
rrc_log- > error_hex ( pdu - > msg , pdu - > N_bytes , " Could not unpack BCCH DL-SCH message (%d B). \n " , pdu - > N_bytes ) ;
logger. error ( pdu - > msg , pdu - > N_bytes , " Could not unpack BCCH DL-SCH message (%d B). " , pdu - > N_bytes ) ;
return ;
return ;
}
}
log_rrc_message ( " BCCH-DLSCH " , Rx , pdu . get ( ) , dlsch_msg , dlsch_msg . msg . c1 ( ) . type ( ) . to_string ( ) ) ;
log_rrc_message ( " BCCH-DLSCH " , Rx , pdu . get ( ) , dlsch_msg , dlsch_msg . msg . c1 ( ) . type ( ) . to_string ( ) ) ;
if ( dlsch_msg . msg . c1 ( ) . type ( ) = = bcch_dl_sch_msg_type_c : : c1_c_ : : types : : sib_type1 ) {
if ( dlsch_msg . msg . c1 ( ) . type ( ) = = bcch_dl_sch_msg_type_c : : c1_c_ : : types : : sib_type1 ) {
rrc_log- > info ( " Processing SIB1 (1/1) \n " ) ;
logger. info ( " Processing SIB1 (1/1) " ) ;
meas_cells . serving_cell ( ) . set_sib1 ( dlsch_msg . msg . c1 ( ) . sib_type1 ( ) ) ;
meas_cells . serving_cell ( ) . set_sib1 ( dlsch_msg . msg . c1 ( ) . sib_type1 ( ) ) ;
si_acquirer . trigger ( si_acquire_proc : : sib_received_ev { } ) ;
si_acquirer . trigger ( si_acquire_proc : : sib_received_ev { } ) ;
handle_sib1 ( ) ;
handle_sib1 ( ) ;
@ -1292,7 +1292,7 @@ void rrc::parse_pdu_bcch_dlsch(unique_byte_buffer_t pdu)
sys_info_r8_ies_s : : sib_type_and_info_l_ & sib_list =
sys_info_r8_ies_s : : sib_type_and_info_l_ & sib_list =
dlsch_msg . msg . c1 ( ) . sys_info ( ) . crit_exts . sys_info_r8 ( ) . sib_type_and_info ;
dlsch_msg . msg . c1 ( ) . sys_info ( ) . crit_exts . sys_info_r8 ( ) . sib_type_and_info ;
for ( uint32_t i = 0 ; i < sib_list . size ( ) ; + + i ) {
for ( uint32_t i = 0 ; i < sib_list . size ( ) ; + + i ) {
rrc_log- > info ( " Processing SIB%d (%d/%d) \n " , sib_list [ i ] . type ( ) . to_number ( ) , i , sib_list . size ( ) ) ;
logger. info ( " Processing SIB%d (%d/%d) " , sib_list [ i ] . type ( ) . to_number ( ) , i , sib_list . size ( ) ) ;
switch ( sib_list [ i ] . type ( ) . value ) {
switch ( sib_list [ i ] . type ( ) . value ) {
case sib_info_item_c : : types : : sib2 :
case sib_info_item_c : : types : : sib2 :
if ( not meas_cells . serving_cell ( ) . has_sib2 ( ) ) {
if ( not meas_cells . serving_cell ( ) . has_sib2 ( ) ) {
@ -1316,7 +1316,7 @@ void rrc::parse_pdu_bcch_dlsch(unique_byte_buffer_t pdu)
si_acquirer . trigger ( si_acquire_proc : : sib_received_ev { } ) ;
si_acquirer . trigger ( si_acquire_proc : : sib_received_ev { } ) ;
break ;
break ;
default :
default :
rrc_log- > warning ( " SIB%d is not supported \n " , sib_list [ i ] . type ( ) . to_number ( ) ) ;
logger. warning ( " SIB%d is not supported " , sib_list [ i ] . type ( ) . to_number ( ) ) ;
}
}
}
}
}
}
@ -1325,7 +1325,7 @@ void rrc::parse_pdu_bcch_dlsch(unique_byte_buffer_t pdu)
void rrc : : handle_sib1 ( )
void rrc : : handle_sib1 ( )
{
{
const sib_type1_s * sib1 = meas_cells . serving_cell ( ) . sib1ptr ( ) ;
const sib_type1_s * sib1 = meas_cells . serving_cell ( ) . sib1ptr ( ) ;
rrc_log- > info ( " SIB1 received, CellID=%d, si_window=%d, sib2_period=%d \n " ,
logger. info ( " SIB1 received, CellID=%d, si_window=%d, sib2_period=%d " ,
meas_cells . serving_cell ( ) . get_cell_id ( ) & 0xfff ,
meas_cells . serving_cell ( ) . get_cell_id ( ) & 0xfff ,
sib1 - > si_win_len . to_number ( ) ,
sib1 - > si_win_len . to_number ( ) ,
sib1 - > sched_info_list [ 0 ] . si_periodicity . to_number ( ) ) ;
sib1 - > sched_info_list [ 0 ] . si_periodicity . to_number ( ) ) ;
@ -1335,7 +1335,7 @@ void rrc::handle_sib1()
si_periodicity_r12_e p = sib1 - > sched_info_list [ i ] . si_periodicity ;
si_periodicity_r12_e p = sib1 - > sched_info_list [ i ] . si_periodicity ;
for ( uint32_t j = 0 ; j < sib1 - > sched_info_list [ i ] . sib_map_info . size ( ) ; + + j ) {
for ( uint32_t j = 0 ; j < sib1 - > sched_info_list [ i ] . sib_map_info . size ( ) ; + + j ) {
sib_type_e t = sib1 - > sched_info_list [ i ] . sib_map_info [ j ] ;
sib_type_e t = sib1 - > sched_info_list [ i ] . sib_map_info [ j ] ;
rrc_log- > debug ( " SIB scheduling info, sib_type=%d, si_periodicity=%d \n " , t . to_number ( ) , p . to_number ( ) ) ;
logger. debug ( " SIB scheduling info, sib_type=%d, si_periodicity=%d " , t . to_number ( ) , p . to_number ( ) ) ;
}
}
}
}
@ -1350,7 +1350,7 @@ void rrc::handle_sib1()
void rrc : : handle_sib2 ( )
void rrc : : handle_sib2 ( )
{
{
rrc_log- > info ( " SIB2 received \n " ) ;
logger. info ( " SIB2 received " ) ;
const sib_type2_s * sib2 = meas_cells . serving_cell ( ) . sib2ptr ( ) ;
const sib_type2_s * sib2 = meas_cells . serving_cell ( ) . sib2ptr ( ) ;
@ -1408,7 +1408,7 @@ void rrc::handle_sib2()
N310 = sib2 - > ue_timers_and_consts . n310 . to_number ( ) ;
N310 = sib2 - > ue_timers_and_consts . n310 . to_number ( ) ;
N311 = sib2 - > ue_timers_and_consts . n311 . to_number ( ) ;
N311 = sib2 - > ue_timers_and_consts . n311 . to_number ( ) ;
rrc_log- > info ( " Set Constants and Timers: N310=%d, N311=%d, t300=%d, t301=%d, t310=%d, t311=%d \n " ,
logger. info ( " Set Constants and Timers: N310=%d, N311=%d, t300=%d, t301=%d, t310=%d, t311=%d " ,
N310 ,
N310 ,
N311 ,
N311 ,
t300 . duration ( ) ,
t300 . duration ( ) ,
@ -1419,7 +1419,7 @@ void rrc::handle_sib2()
void rrc : : handle_sib3 ( )
void rrc : : handle_sib3 ( )
{
{
rrc_log- > info ( " SIB3 received \n " ) ;
logger. info ( " SIB3 received " ) ;
const sib_type3_s * sib3 = meas_cells . serving_cell ( ) . sib3ptr ( ) ;
const sib_type3_s * sib3 = meas_cells . serving_cell ( ) . sib3ptr ( ) ;
@ -1440,7 +1440,7 @@ void rrc::handle_sib3()
void rrc : : handle_sib13 ( )
void rrc : : handle_sib13 ( )
{
{
rrc_log- > info ( " SIB13 received \n " ) ;
logger. info ( " SIB13 received " ) ;
const sib_type13_r9_s * sib13 = meas_cells . serving_cell ( ) . sib13ptr ( ) ;
const sib_type13_r9_s * sib13 = meas_cells . serving_cell ( ) . sib13ptr ( ) ;
@ -1473,21 +1473,21 @@ void rrc::paging_completed(bool outcome)
void rrc : : process_pcch ( unique_byte_buffer_t pdu )
void rrc : : process_pcch ( unique_byte_buffer_t pdu )
{
{
if ( pdu - > N_bytes < = 0 or pdu - > N_bytes > = SRSLTE_MAX_BUFFER_SIZE_BITS ) {
if ( pdu - > N_bytes < = 0 or pdu - > N_bytes > = SRSLTE_MAX_BUFFER_SIZE_BITS ) {
rrc_log- > error_hex ( pdu - > msg , pdu - > N_bytes , " Dropping PCCH message with %d B \n " , pdu - > N_bytes ) ;
logger. error ( pdu - > msg , pdu - > N_bytes , " Dropping PCCH message with %d B " , pdu - > N_bytes ) ;
return ;
return ;
}
}
pcch_msg_s pcch_msg ;
pcch_msg_s pcch_msg ;
asn1 : : cbit_ref bref ( pdu - > msg , pdu - > N_bytes ) ;
asn1 : : cbit_ref bref ( pdu - > msg , pdu - > N_bytes ) ;
if ( pcch_msg . unpack ( bref ) ! = asn1 : : SRSASN_SUCCESS or pcch_msg . msg . type ( ) . value ! = pcch_msg_type_c : : types_opts : : c1 ) {
if ( pcch_msg . unpack ( bref ) ! = asn1 : : SRSASN_SUCCESS or pcch_msg . msg . type ( ) . value ! = pcch_msg_type_c : : types_opts : : c1 ) {
rrc_log- > error_hex ( pdu - > msg , pdu - > N_bytes , " Failed to unpack PCCH message (%d B) \n " , pdu - > N_bytes ) ;
logger. error ( pdu - > msg , pdu - > N_bytes , " Failed to unpack PCCH message (%d B) " , pdu - > N_bytes ) ;
return ;
return ;
}
}
log_rrc_message ( " PCCH " , Rx , pdu . get ( ) , pcch_msg , pcch_msg . msg . c1 ( ) . type ( ) . to_string ( ) ) ;
log_rrc_message ( " PCCH " , Rx , pdu . get ( ) , pcch_msg , pcch_msg . msg . c1 ( ) . type ( ) . to_string ( ) ) ;
if ( not ue_identity_configured ) {
if ( not ue_identity_configured ) {
rrc_log- > warning ( " Received paging message but no ue-Identity is configured \n " ) ;
logger. warning ( " Received paging message but no ue-Identity is configured " ) ;
return ;
return ;
}
}
@ -1497,7 +1497,7 @@ void rrc::process_pcch(unique_byte_buffer_t pdu)
}
}
if ( not pcch_processor . launch ( * paging ) ) {
if ( not pcch_processor . launch ( * paging ) ) {
rrc_log- > error ( " Failed to launch process PCCH procedure \n " ) ;
logger. error ( " Failed to launch process PCCH procedure " ) ;
return ;
return ;
}
}
@ -1522,7 +1522,7 @@ void rrc::parse_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
asn1 : : cbit_ref bref ( pdu - > msg , pdu - > N_bytes ) ;
asn1 : : cbit_ref bref ( pdu - > msg , pdu - > N_bytes ) ;
if ( meas_cells . serving_cell ( ) . mcch . unpack ( bref ) ! = asn1 : : SRSASN_SUCCESS or
if ( meas_cells . serving_cell ( ) . mcch . unpack ( bref ) ! = asn1 : : SRSASN_SUCCESS or
meas_cells . serving_cell ( ) . mcch . msg . type ( ) . value ! = mcch_msg_type_c : : types_opts : : c1 ) {
meas_cells . serving_cell ( ) . mcch . msg . type ( ) . value ! = mcch_msg_type_c : : types_opts : : c1 ) {
rrc_log- > error ( " Failed to unpack MCCH message \n " ) ;
logger. error ( " Failed to unpack MCCH message " ) ;
return ;
return ;
}
}
meas_cells . serving_cell ( ) . has_mcch = true ;
meas_cells . serving_cell ( ) . has_mcch = true ;
@ -1530,7 +1530,7 @@ void rrc::parse_pdu_mch(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
log_rrc_message (
log_rrc_message (
" MCH " , Rx , pdu . get ( ) , meas_cells . serving_cell ( ) . mcch , meas_cells . serving_cell ( ) . mcch . msg . c1 ( ) . type ( ) . to_string ( ) ) ;
" MCH " , Rx , pdu . get ( ) , meas_cells . serving_cell ( ) . mcch , meas_cells . serving_cell ( ) . mcch . msg . c1 ( ) . type ( ) . to_string ( ) ) ;
if ( args . mbms_service_id > = 0 ) {
if ( args . mbms_service_id > = 0 ) {
rrc_log- > info ( " Attempting to auto-start MBMS service %d \n " , args . mbms_service_id ) ;
logger. info ( " Attempting to auto-start MBMS service %d " , args . mbms_service_id ) ;
mbms_service_start ( args . mbms_service_id , args . mbms_service_port ) ;
mbms_service_start ( args . mbms_service_id , args . mbms_service_port ) ;
}
}
}
}
@ -1548,7 +1548,7 @@ void rrc::send_ul_ccch_msg(const ul_ccch_msg_s& msg)
// Reset and reuse sdu buffer if provided
// Reset and reuse sdu buffer if provided
unique_byte_buffer_t pdcp_buf = srslte : : allocate_unique_buffer ( * pool , true ) ;
unique_byte_buffer_t pdcp_buf = srslte : : allocate_unique_buffer ( * pool , true ) ;
if ( not pdcp_buf . get ( ) ) {
if ( not pdcp_buf . get ( ) ) {
rrc_log- > error ( " Fatal Error: Couldn't allocate PDU in byte_align_and_pack(). \n " ) ;
logger. error ( " Fatal Error: Couldn't allocate PDU in byte_align_and_pack(). " ) ;
return ;
return ;
}
}
@ -1566,7 +1566,7 @@ void rrc::send_ul_ccch_msg(const ul_ccch_msg_s& msg)
ue_cri_ptr [ nbytes - i - 1 ] = pdcp_buf - > msg [ i ] ;
ue_cri_ptr [ nbytes - i - 1 ] = pdcp_buf - > msg [ i ] ;
}
}
rrc_log- > debug ( " Setting UE contention resolution ID: % " PRIu64 " \n " , uecri ) ;
logger. debug ( " Setting UE contention resolution ID: % " PRIu64 " " , uecri ) ;
mac - > set_contention_id ( uecri ) ;
mac - > set_contention_id ( uecri ) ;
uint32_t lcid = RB_ID_SRB0 ;
uint32_t lcid = RB_ID_SRB0 ;
@ -1580,7 +1580,7 @@ void rrc::send_ul_dcch_msg(uint32_t lcid, const ul_dcch_msg_s& msg)
// Reset and reuse sdu buffer if provided
// Reset and reuse sdu buffer if provided
unique_byte_buffer_t pdcp_buf = srslte : : allocate_unique_buffer ( * pool , true ) ;
unique_byte_buffer_t pdcp_buf = srslte : : allocate_unique_buffer ( * pool , true ) ;
if ( not pdcp_buf . get ( ) ) {
if ( not pdcp_buf . get ( ) ) {
rrc_log- > error ( " Fatal Error: Couldn't allocate PDU in byte_align_and_pack(). \n " ) ;
logger. error ( " Fatal Error: Couldn't allocate PDU in byte_align_and_pack(). " ) ;
return ;
return ;
}
}
@ -1598,7 +1598,7 @@ void rrc::send_ul_dcch_msg(uint32_t lcid, const ul_dcch_msg_s& msg)
void rrc : : write_sdu ( srslte : : unique_byte_buffer_t sdu )
void rrc : : write_sdu ( srslte : : unique_byte_buffer_t sdu )
{
{
if ( state = = RRC_STATE_IDLE ) {
if ( state = = RRC_STATE_IDLE ) {
rrc_log- > warning ( " Received ULInformationTransfer SDU when in IDLE \n " ) ;
logger. warning ( " Received ULInformationTransfer SDU when in IDLE " ) ;
return ;
return ;
}
}
send_ul_info_transfer ( std : : move ( sdu ) ) ;
send_ul_info_transfer ( std : : move ( sdu ) ) ;
@ -1611,7 +1611,7 @@ void rrc::write_pdu(uint32_t lcid, unique_byte_buffer_t pdu)
void rrc : : process_pdu ( uint32_t lcid , srslte : : unique_byte_buffer_t pdu )
void rrc : : process_pdu ( uint32_t lcid , srslte : : unique_byte_buffer_t pdu )
{
{
rrc_log- > debug ( " RX PDU, LCID: %d \n " , lcid ) ;
logger. debug ( " RX PDU, LCID: %d " , lcid ) ;
switch ( lcid ) {
switch ( lcid ) {
case RB_ID_SRB0 :
case RB_ID_SRB0 :
parse_dl_ccch ( std : : move ( pdu ) ) ;
parse_dl_ccch ( std : : move ( pdu ) ) ;
@ -1621,7 +1621,7 @@ void rrc::process_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
parse_dl_dcch ( lcid , std : : move ( pdu ) ) ;
parse_dl_dcch ( lcid , std : : move ( pdu ) ) ;
break ;
break ;
default :
default :
rrc_log- > error ( " RX PDU with invalid bearer id: %d \n " , lcid ) ;
logger. error ( " RX PDU with invalid bearer id: %d " , lcid ) ;
break ;
break ;
}
}
}
}
@ -1632,7 +1632,7 @@ void rrc::parse_dl_ccch(unique_byte_buffer_t pdu)
asn1 : : rrc : : dl_ccch_msg_s dl_ccch_msg ;
asn1 : : rrc : : dl_ccch_msg_s dl_ccch_msg ;
if ( dl_ccch_msg . unpack ( bref ) ! = asn1 : : SRSASN_SUCCESS or
if ( dl_ccch_msg . unpack ( bref ) ! = asn1 : : SRSASN_SUCCESS or
dl_ccch_msg . msg . type ( ) . value ! = dl_ccch_msg_type_c : : types_opts : : c1 ) {
dl_ccch_msg . msg . type ( ) . value ! = dl_ccch_msg_type_c : : types_opts : : c1 ) {
rrc_log- > error_hex ( pdu - > msg , pdu - > N_bytes , " Failed to unpack DL-CCCH message (%d B) \n " , pdu - > N_bytes ) ;
logger. error ( pdu - > msg , pdu - > N_bytes , " Failed to unpack DL-CCCH message (%d B) " , pdu - > N_bytes ) ;
return ;
return ;
}
}
log_rrc_message ( get_rb_name ( RB_ID_SRB0 ) . c_str ( ) , Rx , pdu . get ( ) , dl_ccch_msg , dl_ccch_msg . msg . c1 ( ) . type ( ) . to_string ( ) ) ;
log_rrc_message ( get_rb_name ( RB_ID_SRB0 ) . c_str ( ) , Rx , pdu . get ( ) , dl_ccch_msg , dl_ccch_msg . msg . c1 ( ) . type ( ) . to_string ( ) ) ;
@ -1642,7 +1642,7 @@ void rrc::parse_dl_ccch(unique_byte_buffer_t pdu)
case dl_ccch_msg_type_c : : c1_c_ : : types : : rrc_conn_reject : {
case dl_ccch_msg_type_c : : c1_c_ : : types : : rrc_conn_reject : {
// 5.3.3.8
// 5.3.3.8
rrc_conn_reject_r8_ies_s * reject_r8 = & c1 - > rrc_conn_reject ( ) . crit_exts . c1 ( ) . rrc_conn_reject_r8 ( ) ;
rrc_conn_reject_r8_ies_s * reject_r8 = & c1 - > rrc_conn_reject ( ) . crit_exts . c1 ( ) . rrc_conn_reject_r8 ( ) ;
rrc_log- > info ( " Received ConnectionReject. Wait time: %d \n " , reject_r8 - > wait_time ) ;
logger. info ( " Received ConnectionReject. Wait time: %d " , reject_r8 - > wait_time ) ;
srslte : : console ( " Received ConnectionReject. Wait time: %d \n " , reject_r8 - > wait_time ) ;
srslte : : console ( " Received ConnectionReject. Wait time: %d \n " , reject_r8 - > wait_time ) ;
t300 . stop ( ) ;
t300 . stop ( ) ;
@ -1675,7 +1675,7 @@ void rrc::parse_dl_ccch(unique_byte_buffer_t pdu)
connection_reest . trigger ( c1 - > rrc_conn_reest_reject ( ) ) ;
connection_reest . trigger ( c1 - > rrc_conn_reest_reject ( ) ) ;
break ;
break ;
default :
default :
rrc_log- > error ( " The provided DL-CCCH message type is not recognized \n " ) ;
logger. error ( " The provided DL-CCCH message type is not recognized " ) ;
break ;
break ;
}
}
}
}
@ -1686,7 +1686,7 @@ void rrc::parse_dl_dcch(uint32_t lcid, unique_byte_buffer_t pdu)
asn1 : : rrc : : dl_dcch_msg_s dl_dcch_msg ;
asn1 : : rrc : : dl_dcch_msg_s dl_dcch_msg ;
if ( dl_dcch_msg . unpack ( bref ) ! = asn1 : : SRSASN_SUCCESS or
if ( dl_dcch_msg . unpack ( bref ) ! = asn1 : : SRSASN_SUCCESS or
dl_dcch_msg . msg . type ( ) . value ! = dl_dcch_msg_type_c : : types_opts : : c1 ) {
dl_dcch_msg . msg . type ( ) . value ! = dl_dcch_msg_type_c : : types_opts : : c1 ) {
rrc_log- > error_hex ( pdu - > msg , pdu - > N_bytes , " Failed to unpack DL-DCCH message (%d B) \n " , pdu - > N_bytes ) ;
logger. error ( pdu - > msg , pdu - > N_bytes , " Failed to unpack DL-DCCH message (%d B) " , pdu - > N_bytes ) ;
return ;
return ;
}
}
log_rrc_message ( get_rb_name ( lcid ) . c_str ( ) , Rx , pdu . get ( ) , dl_dcch_msg , dl_dcch_msg . msg . c1 ( ) . type ( ) . to_string ( ) ) ;
log_rrc_message ( get_rb_name ( lcid ) . c_str ( ) , Rx , pdu . get ( ) , dl_dcch_msg , dl_dcch_msg . msg . c1 ( ) . type ( ) . to_string ( ) ) ;
@ -1696,7 +1696,7 @@ void rrc::parse_dl_dcch(uint32_t lcid, unique_byte_buffer_t pdu)
case dl_dcch_msg_type_c : : c1_c_ : : types : : dl_info_transfer :
case dl_dcch_msg_type_c : : c1_c_ : : types : : dl_info_transfer :
pdu = srslte : : allocate_unique_buffer ( * pool , true ) ;
pdu = srslte : : allocate_unique_buffer ( * pool , true ) ;
if ( ! pdu . get ( ) ) {
if ( ! pdu . get ( ) ) {
rrc_log- > error ( " Fatal error: out of buffers in pool \n " ) ;
logger. error ( " Fatal error: out of buffers in pool " ) ;
return ;
return ;
}
}
pdu - > N_bytes = c1 - > dl_info_transfer ( ) . crit_exts . c1 ( ) . dl_info_transfer_r8 ( ) . ded_info_type . ded_info_nas ( ) . size ( ) ;
pdu - > N_bytes = c1 - > dl_info_transfer ( ) . crit_exts . c1 ( ) . dl_info_transfer_r8 ( ) . ded_info_type . ded_info_nas ( ) . size ( ) ;
@ -1717,7 +1717,7 @@ void rrc::parse_dl_dcch(uint32_t lcid, unique_byte_buffer_t pdu)
. security_mode_cmd_r8 ( )
. security_mode_cmd_r8 ( )
. security_cfg_smc . security_algorithm_cfg . integrity_prot_algorithm . value ;
. security_cfg_smc . security_algorithm_cfg . integrity_prot_algorithm . value ;
rrc_log- > info ( " Received Security Mode Command eea: %s, eia: %s \n " ,
logger. info ( " Received Security Mode Command eea: %s, eia: %s " ,
ciphering_algorithm_id_text [ sec_cfg . cipher_algo ] ,
ciphering_algorithm_id_text [ sec_cfg . cipher_algo ] ,
integrity_algorithm_id_text [ sec_cfg . integ_algo ] ) ;
integrity_algorithm_id_text [ sec_cfg . integ_algo ] ) ;
@ -1745,7 +1745,7 @@ void rrc::parse_dl_dcch(uint32_t lcid, unique_byte_buffer_t pdu)
rrc_connection_release ( c1 - > rrc_conn_release ( ) . crit_exts . c1 ( ) . rrc_conn_release_r8 ( ) . release_cause . to_string ( ) ) ;
rrc_connection_release ( c1 - > rrc_conn_release ( ) . crit_exts . c1 ( ) . rrc_conn_release_r8 ( ) . release_cause . to_string ( ) ) ;
break ;
break ;
default :
default :
rrc_log- > error ( " The provided DL-CCCH message type is not recognized or supported \n " ) ;
logger. error ( " The provided DL-CCCH message type is not recognized or supported " ) ;
break ;
break ;
}
}
}
}
@ -1755,12 +1755,12 @@ void rrc::generate_as_keys(void)
{
{
uint8_t k_asme [ 32 ] = { } ;
uint8_t k_asme [ 32 ] = { } ;
nas - > get_k_asme ( k_asme , 32 ) ;
nas - > get_k_asme ( k_asme , 32 ) ;
rrc_log- > debug_hex ( k_asme , 32 , " UE K_asme " ) ;
logger. debug ( k_asme , 32 , " UE K_asme " ) ;
rrc_log- > debug ( " Generating K_enb with UL NAS COUNT: %d \n " , nas - > get_k_enb_count ( ) ) ;
logger. debug ( " Generating K_enb with UL NAS COUNT: %d " , nas - > get_k_enb_count ( ) ) ;
usim - > generate_as_keys ( k_asme , nas - > get_k_enb_count ( ) , & sec_cfg ) ;
usim - > generate_as_keys ( k_asme , nas - > get_k_enb_count ( ) , & sec_cfg ) ;
rrc_log- > info_hex ( sec_cfg . k_rrc_enc . data ( ) , 32 , " RRC encryption key - k_rrc_enc " ) ;
logger. info ( sec_cfg . k_rrc_enc . data ( ) , 32 , " RRC encryption key - k_rrc_enc " ) ;
rrc_log- > info_hex ( sec_cfg . k_rrc_int . data ( ) , 32 , " RRC integrity key - k_rrc_int " ) ;
logger. info ( sec_cfg . k_rrc_int . data ( ) , 32 , " RRC integrity key - k_rrc_int " ) ;
rrc_log- > info_hex ( sec_cfg . k_up_enc . data ( ) , 32 , " UP encryption key - k_up_enc " ) ;
logger. info ( sec_cfg . k_up_enc . data ( ) , 32 , " UP encryption key - k_up_enc " ) ;
}
}
/*******************************************************************************
/*******************************************************************************
@ -1776,12 +1776,12 @@ void rrc::enable_capabilities()
{
{
bool enable_ul_64 = args . ue_category > = 5 & &
bool enable_ul_64 = args . ue_category > = 5 & &
meas_cells . serving_cell ( ) . sib2ptr ( ) - > rr_cfg_common . pusch_cfg_common . pusch_cfg_basic . enable64_qam ;
meas_cells . serving_cell ( ) . sib2ptr ( ) - > rr_cfg_common . pusch_cfg_common . pusch_cfg_basic . enable64_qam ;
rrc_log- > info ( " %s 64QAM PUSCH \n " , enable_ul_64 ? " Enabling " : " Disabling " ) ;
logger. info ( " %s 64QAM PUSCH " , enable_ul_64 ? " Enabling " : " Disabling " ) ;
}
}
void rrc : : handle_ue_capability_enquiry ( const ue_cap_enquiry_s & enquiry )
void rrc : : handle_ue_capability_enquiry ( const ue_cap_enquiry_s & enquiry )
{
{
rrc_log- > debug ( " Preparing UE Capability Info \n " ) ;
logger. debug ( " Preparing UE Capability Info " ) ;
ul_dcch_msg_s ul_dcch_msg ;
ul_dcch_msg_s ul_dcch_msg ;
ue_cap_info_r8_ies_s * info = & ul_dcch_msg . msg . set_c1 ( ) . set_ue_cap_info ( ) . crit_exts . set_c1 ( ) . set_ue_cap_info_r8 ( ) ;
ue_cap_info_r8_ies_s * info = & ul_dcch_msg . msg . set_c1 ( ) . set_ue_cap_info ( ) . crit_exts . set_c1 ( ) . set_ue_cap_info_r8 ( ) ;
@ -1799,7 +1799,7 @@ void rrc::handle_ue_capability_enquiry(const ue_cap_enquiry_s& enquiry)
// Check UE config arguments bounds
// Check UE config arguments bounds
if ( args . release < SRSLTE_RELEASE_MIN | | args . release > SRSLTE_RELEASE_MAX ) {
if ( args . release < SRSLTE_RELEASE_MIN | | args . release > SRSLTE_RELEASE_MAX ) {
uint32_t new_release = SRSLTE_MIN ( SRSLTE_RELEASE_MAX , SRSLTE_MAX ( SRSLTE_RELEASE_MIN , args . release ) ) ;
uint32_t new_release = SRSLTE_MIN ( SRSLTE_RELEASE_MAX , SRSLTE_MAX ( SRSLTE_RELEASE_MIN , args . release ) ) ;
rrc_log- > error ( " Release is %d. It is out of bounds (%d ... %d), setting it to %d \n " ,
logger. error ( " Release is %d. It is out of bounds (%d ... %d), setting it to %d " ,
args . release ,
args . release ,
SRSLTE_RELEASE_MIN ,
SRSLTE_RELEASE_MIN ,
SRSLTE_RELEASE_MAX ,
SRSLTE_RELEASE_MAX ,
@ -1811,7 +1811,7 @@ void rrc::handle_ue_capability_enquiry(const ue_cap_enquiry_s& enquiry)
if ( args . ue_category < SRSLTE_UE_CATEGORY_MIN | | args . ue_category > SRSLTE_UE_CATEGORY_MAX ) {
if ( args . ue_category < SRSLTE_UE_CATEGORY_MIN | | args . ue_category > SRSLTE_UE_CATEGORY_MAX ) {
uint32_t new_category =
uint32_t new_category =
SRSLTE_MIN ( SRSLTE_UE_CATEGORY_MAX , SRSLTE_MAX ( SRSLTE_UE_CATEGORY_MIN , args . ue_category ) ) ;
SRSLTE_MIN ( SRSLTE_UE_CATEGORY_MAX , SRSLTE_MAX ( SRSLTE_UE_CATEGORY_MIN , args . ue_category ) ) ;
rrc_log- > error ( " UE Category is %d. It is out of bounds (%d ... %d), setting it to %d \n " ,
logger. error ( " UE Category is %d. It is out of bounds (%d ... %d), setting it to %d " ,
args . ue_category ,
args . ue_category ,
SRSLTE_UE_CATEGORY_MIN ,
SRSLTE_UE_CATEGORY_MIN ,
SRSLTE_UE_CATEGORY_MAX ,
SRSLTE_UE_CATEGORY_MAX ,
@ -2081,18 +2081,18 @@ void rrc::handle_ue_capability_enquiry(const ue_cap_enquiry_s& enquiry)
# ifdef HAVE_5GNR
# ifdef HAVE_5GNR
else if ( enquiry . crit_exts . c1 ( ) . ue_cap_enquiry_r8 ( ) . ue_cap_request [ i ] = = rat_type_e : : eutra_nr & & has_nr_dc ( ) ) {
else if ( enquiry . crit_exts . c1 ( ) . ue_cap_enquiry_r8 ( ) . ue_cap_request [ i ] = = rat_type_e : : eutra_nr & & has_nr_dc ( ) ) {
info - > ue_cap_rat_container_list [ rat_idx ] = get_eutra_nr_capabilities ( ) ;
info - > ue_cap_rat_container_list [ rat_idx ] = get_eutra_nr_capabilities ( ) ;
rrc_log- > info ( " Including EUTRA-NR capabilities in UE Capability Info (%d B) \n " ,
logger. info ( " Including EUTRA-NR capabilities in UE Capability Info (%d B) " ,
info - > ue_cap_rat_container_list [ rat_idx ] . ue_cap_rat_container . size ( ) ) ;
info - > ue_cap_rat_container_list [ rat_idx ] . ue_cap_rat_container . size ( ) ) ;
rat_idx + + ;
rat_idx + + ;
} else if ( enquiry . crit_exts . c1 ( ) . ue_cap_enquiry_r8 ( ) . ue_cap_request [ i ] = = rat_type_e : : nr & & has_nr_dc ( ) ) {
} else if ( enquiry . crit_exts . c1 ( ) . ue_cap_enquiry_r8 ( ) . ue_cap_request [ i ] = = rat_type_e : : nr & & has_nr_dc ( ) ) {
info - > ue_cap_rat_container_list [ rat_idx ] = get_nr_capabilities ( ) ;
info - > ue_cap_rat_container_list [ rat_idx ] = get_nr_capabilities ( ) ;
rrc_log- > info ( " Including NR capabilities in UE Capability Info (%d B) \n " ,
logger. info ( " Including NR capabilities in UE Capability Info (%d B) " ,
info - > ue_cap_rat_container_list [ rat_idx ] . ue_cap_rat_container . size ( ) ) ;
info - > ue_cap_rat_container_list [ rat_idx ] . ue_cap_rat_container . size ( ) ) ;
rat_idx + + ;
rat_idx + + ;
}
}
# endif
# endif
else {
else {
rrc_log- > error ( " RAT Type of UE Cap request not supported or not configured \n " ) ;
logger. error ( " RAT Type of UE Cap request not supported or not configured " ) ;
}
}
}
}
// resize container back to the actually filled items
// resize container back to the actually filled items
@ -2110,7 +2110,7 @@ void rrc::handle_ue_capability_enquiry(const ue_cap_enquiry_s& enquiry)
. ue_cap_enquiry_r8 ( )
. ue_cap_enquiry_r8 ( )
. non_crit_ext . non_crit_ext . non_crit_ext . non_crit_ext . non_crit_ext
. non_crit_ext . non_crit_ext . non_crit_ext . non_crit_ext . non_crit_ext
. requested_freq_bands_nr_mrdc_r15_present ) {
. requested_freq_bands_nr_mrdc_r15_present ) {
rrc_log- > debug ( " Requested Freq Bands NR MRDC R15 present \n " ) ;
logger. debug ( " Requested Freq Bands NR MRDC R15 present " ) ;
}
}
}
}
}
}
@ -2134,25 +2134,25 @@ void rrc::handle_ue_capability_enquiry(const ue_cap_enquiry_s& enquiry)
void rrc : : log_rr_config_common ( )
void rrc : : log_rr_config_common ( )
{
{
rrc_log- > info ( " Set RACH ConfigCommon: NofPreambles=%d, ResponseWindow=%d, ContentionResolutionTimer=%d ms \n " ,
logger. info ( " Set RACH ConfigCommon: NofPreambles=%d, ResponseWindow=%d, ContentionResolutionTimer=%d ms " ,
current_mac_cfg . rach_cfg . nof_preambles ,
current_mac_cfg . rach_cfg . nof_preambles ,
current_mac_cfg . rach_cfg . responseWindowSize ,
current_mac_cfg . rach_cfg . responseWindowSize ,
current_mac_cfg . rach_cfg . contentionResolutionTimer ) ;
current_mac_cfg . rach_cfg . contentionResolutionTimer ) ;
const srslte : : phy_cfg_t & current_pcell = phy_ctrl - > current_cell_config ( ) [ 0 ] ;
const srslte : : phy_cfg_t & current_pcell = phy_ctrl - > current_cell_config ( ) [ 0 ] ;
rrc_log- > info ( " Set PUSCH ConfigCommon: P0_pusch=%f, DMRS cs=%d, delta_ss=%d, N_sb=%d \n " ,
logger. info ( " Set PUSCH ConfigCommon: P0_pusch=%f, DMRS cs=%d, delta_ss=%d, N_sb=%d " ,
current_pcell . ul_cfg . power_ctrl . p0_ue_pusch ,
current_pcell . ul_cfg . power_ctrl . p0_ue_pusch ,
current_pcell . ul_cfg . dmrs . cyclic_shift ,
current_pcell . ul_cfg . dmrs . cyclic_shift ,
current_pcell . ul_cfg . dmrs . delta_ss ,
current_pcell . ul_cfg . dmrs . delta_ss ,
current_pcell . ul_cfg . hopping . n_sb ) ;
current_pcell . ul_cfg . hopping . n_sb ) ;
rrc_log- > info ( " Set PUCCH ConfigCommon: DeltaShift=%d, CyclicShift=%d, N1=%d, NRB=%d \n " ,
logger. info ( " Set PUCCH ConfigCommon: DeltaShift=%d, CyclicShift=%d, N1=%d, NRB=%d " ,
current_pcell . ul_cfg . pucch . delta_pucch_shift ,
current_pcell . ul_cfg . pucch . delta_pucch_shift ,
current_pcell . ul_cfg . pucch . N_cs ,
current_pcell . ul_cfg . pucch . N_cs ,
current_pcell . ul_cfg . pucch . n1_pucch_an_cs [ 0 ] [ 0 ] ,
current_pcell . ul_cfg . pucch . n1_pucch_an_cs [ 0 ] [ 0 ] ,
current_pcell . ul_cfg . pucch . n_rb_2 ) ;
current_pcell . ul_cfg . pucch . n_rb_2 ) ;
rrc_log- > info ( " Set PRACH ConfigCommon: SeqIdx=%d, HS=%s, FreqOffset=%d, ZC=%d, ConfigIndex=%d \n " ,
logger. info ( " Set PRACH ConfigCommon: SeqIdx=%d, HS=%s, FreqOffset=%d, ZC=%d, ConfigIndex=%d " ,
current_pcell . prach_cfg . root_seq_idx ,
current_pcell . prach_cfg . root_seq_idx ,
current_pcell . prach_cfg . hs_flag ? " yes " : " no " ,
current_pcell . prach_cfg . hs_flag ? " yes " : " no " ,
current_pcell . prach_cfg . freq_offset ,
current_pcell . prach_cfg . freq_offset ,
@ -2160,7 +2160,7 @@ void rrc::log_rr_config_common()
current_pcell . prach_cfg . config_idx ) ;
current_pcell . prach_cfg . config_idx ) ;
if ( current_pcell . ul_cfg . srs . configured ) {
if ( current_pcell . ul_cfg . srs . configured ) {
rrc_log- > info ( " Set SRS ConfigCommon: BW-Configuration=%d, SF-Configuration=%d, Simult-ACKNACK=%s \n " ,
logger. info ( " Set SRS ConfigCommon: BW-Configuration=%d, SF-Configuration=%d, Simult-ACKNACK=%s " ,
current_pcell . ul_cfg . srs . bw_cfg ,
current_pcell . ul_cfg . srs . bw_cfg ,
current_pcell . ul_cfg . srs . subframe_config ,
current_pcell . ul_cfg . srs . subframe_config ,
current_pcell . ul_cfg . srs . simul_ack ? " yes " : " no " ) ;
current_pcell . ul_cfg . srs . simul_ack ? " yes " : " no " ) ;
@ -2169,7 +2169,7 @@ void rrc::log_rr_config_common()
void rrc : : apply_rr_config_common ( rr_cfg_common_s * config , bool send_lower_layers )
void rrc : : apply_rr_config_common ( rr_cfg_common_s * config , bool send_lower_layers )
{
{
rrc_log- > info ( " Applying MAC/PHY config commo n\ n" ) ;
logger. info ( " Applying MAC/PHY config commo n" ) ;
if ( config - > rach_cfg_common_present ) {
if ( config - > rach_cfg_common_present ) {
set_mac_cfg_t_rach_cfg_common ( & current_mac_cfg , config - > rach_cfg_common ) ;
set_mac_cfg_t_rach_cfg_common ( & current_mac_cfg , config - > rach_cfg_common ) ;
@ -2214,29 +2214,25 @@ void rrc::apply_rr_config_common(rr_cfg_common_s* config, bool send_lower_layers
void rrc : : log_phy_config_dedicated ( )
void rrc : : log_phy_config_dedicated ( )
{
{
if ( ! rrc_log ) {
return ;
}
srslte : : phy_cfg_t & current_pcell = phy_ctrl - > current_cell_config ( ) [ 0 ] ;
srslte : : phy_cfg_t & current_pcell = phy_ctrl - > current_cell_config ( ) [ 0 ] ;
if ( current_pcell . dl_cfg . cqi_report . periodic_configured ) {
if ( current_pcell . dl_cfg . cqi_report . periodic_configured ) {
rrc_log- > info ( " Set cqi-PUCCH-ResourceIndex=%d, cqi-pmi-ConfigIndex=%d, cqi-FormatIndicatorPeriodic=%d \n " ,
logger . info ( " Set cqi-PUCCH-ResourceIndex=%d, cqi-pmi-ConfigIndex=%d, cqi-FormatIndicatorPeriodic=%d " ,
current_pcell . ul_cfg . pucch . n_pucch_2 ,
current_pcell . ul_cfg . pucch . n_pucch_2 ,
current_pcell . dl_cfg . cqi_report . pmi_idx ,
current_pcell . dl_cfg . cqi_report . pmi_idx ,
current_pcell . dl_cfg . cqi_report . periodic_mode ) ;
current_pcell . dl_cfg . cqi_report . periodic_mode ) ;
}
}
if ( current_pcell . dl_cfg . cqi_report . aperiodic_configured ) {
if ( current_pcell . dl_cfg . cqi_report . aperiodic_configured ) {
rrc_log- > info ( " Set cqi-ReportModeAperiodic=%d \n " , current_pcell . dl_cfg . cqi_report . aperiodic_mode ) ;
logger. info ( " Set cqi-ReportModeAperiodic=%d " , current_pcell . dl_cfg . cqi_report . aperiodic_mode ) ;
}
}
if ( current_pcell . ul_cfg . pucch . sr_configured ) {
if ( current_pcell . ul_cfg . pucch . sr_configured ) {
rrc_log- > info ( " Set PHY config ded: SR-n_pucch=%d, SR-ConfigIndex=%d " ,
logger. info ( " Set PHY config ded: SR-n_pucch=%d, SR-ConfigIndex=%d " ,
current_pcell . ul_cfg . pucch . n_pucch_sr ,
current_pcell . ul_cfg . pucch . n_pucch_sr ,
current_pcell . ul_cfg . pucch . I_sr ) ;
current_pcell . ul_cfg . pucch . I_sr ) ;
}
}
if ( current_pcell . ul_cfg . srs . configured ) {
if ( current_pcell . ul_cfg . srs . configured ) {
rrc_log- > info ( " Set PHY config ded: SRS-ConfigIndex=%d, SRS-bw=%d, SRS-Nrcc=%d, SRS-hop=%d, SRS-Ncs=%d \n " ,
logger. info ( " Set PHY config ded: SRS-ConfigIndex=%d, SRS-bw=%d, SRS-Nrcc=%d, SRS-hop=%d, SRS-Ncs=%d " ,
current_pcell . ul_cfg . srs . I_srs ,
current_pcell . ul_cfg . srs . I_srs ,
current_pcell . ul_cfg . srs . B ,
current_pcell . ul_cfg . srs . B ,
current_pcell . ul_cfg . srs . n_rrc ,
current_pcell . ul_cfg . srs . n_rrc ,
@ -2251,14 +2247,14 @@ void rrc::set_phy_default()
if ( phy_ctrl ! = nullptr ) {
if ( phy_ctrl ! = nullptr ) {
phy_ctrl - > set_phy_to_default ( ) ;
phy_ctrl - > set_phy_to_default ( ) ;
} else {
} else {
rrc_log- > info ( " RRC not initialized. Skipping default PHY config. \n " ) ;
logger. info ( " RRC not initialized. Skipping default PHY config. " ) ;
}
}
}
}
// Apply provided PHY config
// Apply provided PHY config
void rrc : : apply_phy_config_dedicated ( const phys_cfg_ded_s & phy_cnfg , bool is_handover )
void rrc : : apply_phy_config_dedicated ( const phys_cfg_ded_s & phy_cnfg , bool is_handover )
{
{
rrc_log- > info ( " Applying PHY config dedicated \n " ) ;
logger. info ( " Applying PHY config dedicated " ) ;
srslte : : phy_cfg_t & current_pcell = phy_ctrl - > current_cell_config ( ) [ 0 ] ;
srslte : : phy_cfg_t & current_pcell = phy_ctrl - > current_cell_config ( ) [ 0 ] ;
set_phy_cfg_t_dedicated_cfg ( & current_pcell , phy_cnfg ) ;
set_phy_cfg_t_dedicated_cfg ( & current_pcell , phy_cnfg ) ;
@ -2279,11 +2275,11 @@ void rrc::apply_phy_scell_config(const scell_to_add_mod_r10_s& scell_config, boo
uint32_t earfcn = 0 ;
uint32_t earfcn = 0 ;
if ( phy = = nullptr ) {
if ( phy = = nullptr ) {
rrc_log- > info ( " RRC not initialized. Skipping PHY config. \n " ) ;
logger. info ( " RRC not initialized. Skipping PHY config. " ) ;
return ;
return ;
}
}
rrc_log- > info ( " Applying PHY config to scell \n " ) ;
logger. info ( " Applying PHY config to scell " ) ;
// Initialise default parameters from primary cell
// Initialise default parameters from primary cell
earfcn = meas_cells . serving_cell ( ) . get_earfcn ( ) ;
earfcn = meas_cells . serving_cell ( ) . get_earfcn ( ) ;
@ -2333,23 +2329,22 @@ void rrc::apply_phy_scell_config(const scell_to_add_mod_r10_s& scell_config, boo
}
}
if ( ! phy - > set_scell ( scell , scell_config . scell_idx_r10 , earfcn ) ) {
if ( ! phy - > set_scell ( scell , scell_config . scell_idx_r10 , earfcn ) ) {
rrc_log- > error ( " Adding SCell cc_idx=%d \n " , scell_config . scell_idx_r10 ) ;
logger. error ( " Adding SCell cc_idx=%d " , scell_config . scell_idx_r10 ) ;
} else if ( ! phy_ctrl - > set_cell_config ( scell_cfg , scell_config . scell_idx_r10 ) ) {
} else if ( ! phy_ctrl - > set_cell_config ( scell_cfg , scell_config . scell_idx_r10 ) ) {
rrc_log- > error ( " Setting SCell configuration for cc_idx=%d \n " , scell_config . scell_idx_r10 ) ;
logger. error ( " Setting SCell configuration for cc_idx=%d " , scell_config . scell_idx_r10 ) ;
}
}
}
}
void rrc : : log_mac_config_dedicated ( )
void rrc : : log_mac_config_dedicated ( )
{
{
rrc_log - > info (
logger . info ( " Set MAC main config: harq-MaxReTX=%d, bsr-TimerReTX=%d, bsr-TimerPeriodic=%d, SR %s (dsr-TransMax=%d) " ,
" Set MAC main config: harq-MaxReTX=%d, bsr-TimerReTX=%d, bsr-TimerPeriodic=%d, SR %s (dsr-TransMax=%d) \n " ,
current_mac_cfg . harq_cfg . max_harq_msg3_tx ,
current_mac_cfg . harq_cfg . max_harq_msg3_tx ,
current_mac_cfg . bsr_cfg . retx_timer ,
current_mac_cfg . bsr_cfg . retx_timer ,
current_mac_cfg . bsr_cfg . periodic_timer ,
current_mac_cfg . bsr_cfg . periodic_timer ,
current_mac_cfg . sr_cfg . enabled ? " enabled " : " disabled " ,
current_mac_cfg . sr_cfg . enabled ? " enabled " : " disabled " ,
current_mac_cfg . sr_cfg . dsr_transmax ) ;
current_mac_cfg . sr_cfg . dsr_transmax ) ;
if ( current_mac_cfg . phr_cfg . enabled ) {
if ( current_mac_cfg . phr_cfg . enabled ) {
rrc_log- > info ( " Set MAC PHR config: periodicPHR-Timer=%d, prohibitPHR-Timer=%d, dl-PathlossChange=%d \n " ,
logger. info ( " Set MAC PHR config: periodicPHR-Timer=%d, prohibitPHR-Timer=%d, dl-PathlossChange=%d " ,
current_mac_cfg . phr_cfg . periodic_timer ,
current_mac_cfg . phr_cfg . periodic_timer ,
current_mac_cfg . phr_cfg . prohibit_timer ,
current_mac_cfg . phr_cfg . prohibit_timer ,
current_mac_cfg . phr_cfg . db_pathloss_change ) ;
current_mac_cfg . phr_cfg . db_pathloss_change ) ;
@ -2359,7 +2354,7 @@ void rrc::log_mac_config_dedicated()
// 3GPP 36.331 v10 9.2.2 Default MAC main configuration
// 3GPP 36.331 v10 9.2.2 Default MAC main configuration
void rrc : : apply_mac_config_dedicated_default ( )
void rrc : : apply_mac_config_dedicated_default ( )
{
{
rrc_log- > info ( " Setting MAC default configuratio n\ n" ) ;
logger. info ( " Setting MAC default configuratio n" ) ;
current_mac_cfg . set_mac_main_cfg_default ( ) ;
current_mac_cfg . set_mac_main_cfg_default ( ) ;
mac - > set_config ( current_mac_cfg ) ;
mac - > set_config ( current_mac_cfg ) ;
log_mac_config_dedicated ( ) ;
log_mac_config_dedicated ( ) ;
@ -2382,7 +2377,7 @@ bool rrc::apply_rr_config_dedicated(const rr_cfg_ded_s* cnfg, bool is_handover)
}
}
}
}
rrc_log- > info ( " Applying MAC config dedicated \n " ) ;
logger. info ( " Applying MAC config dedicated " ) ;
if ( cnfg - > mac_main_cfg_present ) {
if ( cnfg - > mac_main_cfg_present ) {
if ( cnfg - > mac_main_cfg . type ( ) = = rr_cfg_ded_s : : mac_main_cfg_c_ : : types : : default_value ) {
if ( cnfg - > mac_main_cfg . type ( ) = = rr_cfg_ded_s : : mac_main_cfg_c_ : : types : : default_value ) {
@ -2409,7 +2404,7 @@ bool rrc::apply_rr_config_dedicated(const rr_cfg_ded_s* cnfg, bool is_handover)
N310 = cnfg - > rlf_timers_and_consts_r9 - > setup ( ) . n310_r9 . to_number ( ) ;
N310 = cnfg - > rlf_timers_and_consts_r9 - > setup ( ) . n310_r9 . to_number ( ) ;
N311 = cnfg - > rlf_timers_and_consts_r9 - > setup ( ) . n311_r9 . to_number ( ) ;
N311 = cnfg - > rlf_timers_and_consts_r9 - > setup ( ) . n311_r9 . to_number ( ) ;
rrc_log- > info ( " Updated Constants and Timers: N310=%d, N311=%d, t300=%u, t301=%u, t310=%u, t311=%u \n " ,
logger. info ( " Updated Constants and Timers: N310=%d, N311=%d, t300=%u, t301=%u, t310=%u, t311=%u " ,
N310 ,
N310 ,
N311 ,
N311 ,
t300 . duration ( ) ,
t300 . duration ( ) ,
@ -2433,7 +2428,7 @@ bool rrc::apply_rr_config_dedicated(const rr_cfg_ded_s* cnfg, bool is_handover)
bool rrc : : apply_rr_config_dedicated_on_ho_complete ( const rr_cfg_ded_s & cnfg )
bool rrc : : apply_rr_config_dedicated_on_ho_complete ( const rr_cfg_ded_s & cnfg )
{
{
rrc_log- > info ( " Applying MAC/PHY config dedicated on HO complete \n " ) ;
logger. info ( " Applying MAC/PHY config dedicated on HO complete " ) ;
// Apply SR+CQI configuration to PHY
// Apply SR+CQI configuration to PHY
if ( cnfg . phys_cfg_ded_present ) {
if ( cnfg . phys_cfg_ded_present ) {
@ -2537,7 +2532,7 @@ void rrc::handle_con_setup(const rrc_conn_setup_s& setup)
state = RRC_STATE_CONNECTED ;
state = RRC_STATE_CONNECTED ;
t300 . stop ( ) ;
t300 . stop ( ) ;
t302 . stop ( ) ;
t302 . stop ( ) ;
srslte : : console ( " RRC Connected \n " ) ;
srslte : : console ( " RRC Connected " ) ;
// Apply the Radio Resource configuration
// Apply the Radio Resource configuration
apply_rr_config_dedicated ( & setup . crit_exts . c1 ( ) . rrc_conn_setup_r8 ( ) . rr_cfg_ded ) ;
apply_rr_config_dedicated ( & setup . crit_exts . c1 ( ) . rrc_conn_setup_r8 ( ) . rr_cfg_ded ) ;
@ -2547,7 +2542,7 @@ void rrc::handle_con_setup(const rrc_conn_setup_s& setup)
if ( dedicated_info_nas . get ( ) ) {
if ( dedicated_info_nas . get ( ) ) {
send_con_setup_complete ( std : : move ( dedicated_info_nas ) ) ;
send_con_setup_complete ( std : : move ( dedicated_info_nas ) ) ;
} else {
} else {
rrc_log- > error ( " Pending to transmit a ConnectionSetupComplete but no dedicatedInfoNAS was in queue \n " ) ;
logger. error ( " Pending to transmit a ConnectionSetupComplete but no dedicatedInfoNAS was in queue " ) ;
}
}
}
}
@ -2584,7 +2579,7 @@ void rrc::add_srb(const srb_to_add_mod_s& srb_cnfg)
// Set default SRB values as defined in Table 9.2.1
// Set default SRB values as defined in Table 9.2.1
switch ( srb_cnfg . srb_id ) {
switch ( srb_cnfg . srb_id ) {
case RB_ID_SRB0 :
case RB_ID_SRB0 :
rrc_log- > error ( " Setting SRB0: Should not be set by RRC \n " ) ;
logger. error ( " Setting SRB0: Should not be set by RRC " ) ;
break ;
break ;
case RB_ID_SRB1 :
case RB_ID_SRB1 :
priority = 1 ;
priority = 1 ;
@ -2614,13 +2609,13 @@ void rrc::add_srb(const srb_to_add_mod_s& srb_cnfg)
}
}
srbs [ srb_cnfg . srb_id ] = srb_cnfg ;
srbs [ srb_cnfg . srb_id ] = srb_cnfg ;
rrc_log- > info ( " Added radio bearer %s \n " , get_rb_name ( srb_cnfg . srb_id ) . c_str ( ) ) ;
logger. info ( " Added radio bearer %s " , get_rb_name ( srb_cnfg . srb_id ) . c_str ( ) ) ;
}
}
void rrc : : add_drb ( const drb_to_add_mod_s & drb_cnfg )
void rrc : : add_drb ( const drb_to_add_mod_s & drb_cnfg )
{
{
if ( ! drb_cnfg . pdcp_cfg_present | | ! drb_cnfg . rlc_cfg_present | | ! drb_cnfg . lc_ch_cfg_present ) {
if ( ! drb_cnfg . pdcp_cfg_present | | ! drb_cnfg . rlc_cfg_present | | ! drb_cnfg . lc_ch_cfg_present ) {
rrc_log- > error ( " Cannot add DRB - incomplete configuratio n\ n" ) ;
logger. error ( " Cannot add DRB - incomplete configuratio n" ) ;
return ;
return ;
}
}
uint32_t lcid = 0 ;
uint32_t lcid = 0 ;
@ -2628,7 +2623,7 @@ void rrc::add_drb(const drb_to_add_mod_s& drb_cnfg)
lcid = drb_cnfg . lc_ch_id ;
lcid = drb_cnfg . lc_ch_id ;
} else {
} else {
lcid = RB_ID_SRB2 + drb_cnfg . drb_id ;
lcid = RB_ID_SRB2 + drb_cnfg . drb_id ;
rrc_log- > warning ( " LCID not present, using %d \n " , lcid ) ;
logger. warning ( " LCID not present, using %d " , lcid ) ;
}
}
// Setup RLC
// Setup RLC
@ -2649,7 +2644,7 @@ void rrc::add_drb(const drb_to_add_mod_s& drb_cnfg)
if ( drb_cnfg . lc_ch_cfg . ul_specific_params . lc_ch_group_present ) {
if ( drb_cnfg . lc_ch_cfg . ul_specific_params . lc_ch_group_present ) {
log_chan_group = drb_cnfg . lc_ch_cfg . ul_specific_params . lc_ch_group ;
log_chan_group = drb_cnfg . lc_ch_cfg . ul_specific_params . lc_ch_group ;
} else {
} else {
rrc_log- > warning ( " LCG not present, setting to 0 \n " ) ;
logger. warning ( " LCG not present, setting to 0 " ) ;
}
}
priority = drb_cnfg . lc_ch_cfg . ul_specific_params . prio ;
priority = drb_cnfg . lc_ch_cfg . ul_specific_params . prio ;
prioritized_bit_rate = drb_cnfg . lc_ch_cfg . ul_specific_params . prioritised_bit_rate . to_number ( ) ;
prioritized_bit_rate = drb_cnfg . lc_ch_cfg . ul_specific_params . prioritised_bit_rate . to_number ( ) ;
@ -2659,16 +2654,16 @@ void rrc::add_drb(const drb_to_add_mod_s& drb_cnfg)
drbs [ drb_cnfg . drb_id ] = drb_cnfg ;
drbs [ drb_cnfg . drb_id ] = drb_cnfg ;
drb_up = true ;
drb_up = true ;
rrc_log- > info ( " Added DRB Id %d (LCID=%d) \n " , drb_cnfg . drb_id , lcid ) ;
logger. info ( " Added DRB Id %d (LCID=%d) " , drb_cnfg . drb_id , lcid ) ;
}
}
void rrc : : release_drb ( uint32_t drb_id )
void rrc : : release_drb ( uint32_t drb_id )
{
{
if ( drbs . find ( drb_id ) ! = drbs . end ( ) ) {
if ( drbs . find ( drb_id ) ! = drbs . end ( ) ) {
rrc_log- > info ( " Releasing DRB Id %d \n " , drb_id ) ;
logger. info ( " Releasing DRB Id %d " , drb_id ) ;
drbs . erase ( drb_id ) ;
drbs . erase ( drb_id ) ;
} else {
} else {
rrc_log- > error ( " Couldn't release DRB Id %d. Doesn't exist. \n " , drb_id ) ;
logger. error ( " Couldn't release DRB Id %d. Doesn't exist. " , drb_id ) ;
}
}
}
}
@ -2683,7 +2678,7 @@ uint32_t rrc::get_lcid_for_eps_bearer(const uint32_t& eps_bearer_id)
lcid = drb_cnfg . lc_ch_id ;
lcid = drb_cnfg . lc_ch_id ;
} else {
} else {
lcid = RB_ID_SRB2 + drb_cnfg . drb_id ;
lcid = RB_ID_SRB2 + drb_cnfg . drb_id ;
rrc_log- > warning ( " LCID not present, using %d \n " , lcid ) ;
logger. warning ( " LCID not present, using %d " , lcid ) ;
}
}
return lcid ;
return lcid ;
}
}
@ -2714,7 +2709,7 @@ void rrc::add_mrb(uint32_t lcid, uint32_t port)
gw - > add_mch_port ( lcid , port ) ;
gw - > add_mch_port ( lcid , port ) ;
rlc - > add_bearer_mrb ( lcid ) ;
rlc - > add_bearer_mrb ( lcid ) ;
mac - > mch_start_rx ( lcid ) ;
mac - > mch_start_rx ( lcid ) ;
rrc_log- > info ( " Added MRB bearer for lcid:%d \n " , lcid ) ;
logger. info ( " Added MRB bearer for lcid:%d " , lcid ) ;
}
}
// PHY CONFIG DEDICATED Defaults (3GPP 36.331 v10 9.2.4)
// PHY CONFIG DEDICATED Defaults (3GPP 36.331 v10 9.2.4)
@ -2723,7 +2718,7 @@ void rrc::set_phy_default_pucch_srs()
if ( phy_ctrl ! = nullptr ) {
if ( phy_ctrl ! = nullptr ) {
phy_ctrl - > set_phy_to_default_pucch_srs ( ) ;
phy_ctrl - > set_phy_to_default_pucch_srs ( ) ;
} else {
} else {
rrc_log- > info ( " RRC not initialized. Skipping default PUCCH/SRS config. \n " ) ;
logger. info ( " RRC not initialized. Skipping default PUCCH/SRS config. " ) ;
}
}
// SR configuration affects to MAC SR too
// SR configuration affects to MAC SR too
@ -2757,7 +2752,7 @@ asn1::rrc::ue_cap_rat_container_s rrc::get_eutra_nr_capabilities()
# ifdef HAVE_5GNR
# ifdef HAVE_5GNR
rrc_nr - > get_eutra_nr_capabilities ( & caps_buf ) ;
rrc_nr - > get_eutra_nr_capabilities ( & caps_buf ) ;
# else
# else
rrc_log- > error ( " Not able to access get_eutra_nr_capabilities functio n\ n" ) ;
logger. error ( " Not able to access get_eutra_nr_capabilities functio n" ) ;
# endif
# endif
cap . rat_type = asn1 : : rrc : : rat_type_e : : eutra_nr ;
cap . rat_type = asn1 : : rrc : : rat_type_e : : eutra_nr ;
cap . ue_cap_rat_container . resize ( caps_buf . N_bytes ) ;
cap . ue_cap_rat_container . resize ( caps_buf . N_bytes ) ;
@ -2772,7 +2767,7 @@ asn1::rrc::ue_cap_rat_container_s rrc::get_nr_capabilities()
# ifdef HAVE_5GNR
# ifdef HAVE_5GNR
rrc_nr - > get_nr_capabilities ( & caps_buf ) ;
rrc_nr - > get_nr_capabilities ( & caps_buf ) ;
# else
# else
rrc_log- > error ( " Not able to access get_nr_capabilities functio n\ n" ) ;
logger. error ( " Not able to access get_nr_capabilities functio n" ) ;
# endif
# endif
cap . rat_type = asn1 : : rrc : : rat_type_e : : nr ;
cap . rat_type = asn1 : : rrc : : rat_type_e : : nr ;
cap . ue_cap_rat_container . resize ( caps_buf . N_bytes ) ;
cap . ue_cap_rat_container . resize ( caps_buf . N_bytes ) ;