fix crnti mac ce handling in the rrc in normal (no handover) case

master
Francisco 4 years ago committed by Francisco Paisana
parent 0346564241
commit 290f39d805

@ -132,7 +132,7 @@ public:
}
uint32_t get_headroom() { return msg - buffer; }
// Returns the remaining space from what is reported to be the length of msg
uint32_t get_tailroom() { return (sizeof(buffer) - (msg - buffer) - N_bytes); }
uint32_t get_tailroom() const { return (sizeof(buffer) - (msg - buffer) - N_bytes); }
std::chrono::microseconds get_latency_us() const { return md.tp.get_latency_us(); }
std::chrono::high_resolution_clock::time_point get_timestamp() const { return md.tp.get_timestamp(); }
@ -147,6 +147,9 @@ public:
N_bytes += size;
}
// vector-like interface
void resize(size_t size) { N_bytes = size; }
size_t capacity() const { return get_tailroom(); }
uint8_t* data() { return msg; }
const uint8_t* data() const { return msg; }
uint32_t size() const { return N_bytes; }

@ -56,6 +56,7 @@ public:
void handle_ho_prep(const asn1::rrc::ho_prep_info_r8_ies_s& ho_prep);
const ue_cfg_t& get_ue_sched_cfg() const { return current_sched_ue_cfg; }
bool is_crnti_set() const { return crnti_set; }
void set_scell_activation(const std::bitset<SRSLTE_MAX_CARRIERS>& scell_mask);
void set_drb_activation(bool active);

@ -171,6 +171,7 @@ private:
void config_mac();
void parse_ul_dcch(uint16_t rnti, uint32_t lcid, srslte::unique_byte_buffer_t pdu);
void parse_ul_ccch(uint16_t rnti, srslte::unique_byte_buffer_t pdu);
void send_rrc_connection_reject(uint16_t rnti);
uint32_t paging_tti = INVALID_TTI;
srslte::byte_buffer_t byte_buf_paging;

@ -98,6 +98,7 @@ public:
int get_cqi(uint16_t* pmi_idx, uint16_t* n_pucch, uint32_t ue_cc_idx);
int get_ri(uint32_t m_ri, uint16_t* ri_idx);
bool is_allocated() const;
bool is_crnti_set() const { return mac_ctrl.is_crnti_set(); }
void send_dl_ccch(asn1::rrc::dl_ccch_msg_s* dl_ccch_msg);
bool send_dl_dcch(const asn1::rrc::dl_dcch_msg_s* dl_dcch_msg,

@ -193,18 +193,48 @@ void rrc::upd_user(uint16_t new_rnti, uint16_t old_rnti)
// Send Reconfiguration to old_rnti if is RRC_CONNECT or RRC Release if already released here
auto old_it = users.find(old_rnti);
if (old_it != users.end()) {
auto ue_ptr = old_it->second.get();
if (ue_ptr->mobility_handler->is_ho_running()) {
ue_ptr->mobility_handler->trigger(ue::rrc_mobility::user_crnti_upd_ev{old_rnti, new_rnti});
} else if (ue_ptr->is_connected()) {
if (old_it == users.end()) {
send_rrc_connection_reject(old_rnti);
return;
}
ue* ue_ptr = old_it->second.get();
if (ue_ptr->mobility_handler->is_ho_running()) {
ue_ptr->mobility_handler->trigger(ue::rrc_mobility::user_crnti_upd_ev{old_rnti, new_rnti});
} else {
logger.info("Resuming rnti=0x%x RRC connection due to received C-RNTI CE from rnti=0x%x.", old_rnti, new_rnti);
if (ue_ptr->is_connected()) {
// Send a new RRC Reconfiguration to overlay previous
old_it->second->send_connection_reconf();
} else {
old_it->second->send_connection_reject();
}
}
}
// Note: this method is not part of UE methods, because the UE context may not exist anymore when reject is sent
void rrc::send_rrc_connection_reject(uint16_t rnti)
{
dl_ccch_msg_s dl_ccch_msg;
dl_ccch_msg.msg.set_c1().set_rrc_conn_reject().crit_exts.set_c1().set_rrc_conn_reject_r8().wait_time = 10;
// Allocate a new PDU buffer, pack the message and send to PDCP
srslte::unique_byte_buffer_t pdu = srslte::make_byte_buffer();
if (pdu == nullptr) {
logger.error("Allocating pdu");
return;
}
asn1::bit_ref bref(pdu->msg, pdu->get_tailroom());
if (dl_ccch_msg.pack(bref) != asn1::SRSASN_SUCCESS) {
logger.error(pdu->msg, bref.distance_bytes(), "Failed to pack DL-CCCH-Msg:");
return;
}
pdu->N_bytes = bref.distance_bytes();
char buf[32] = {};
sprintf(buf, "SRB0 - rnti=0x%x", rnti);
log_rrc_message(buf, Tx, pdu.get(), dl_ccch_msg, dl_ccch_msg.msg.c1().type().to_string());
rlc->write_sdu(rnti, RB_ID_SRB0, std::move(pdu));
}
/*******************************************************************************
PDCP interface
*******************************************************************************/

Loading…
Cancel
Save