extend ue cap handler to support multiple RATs

master
Andre Puschmann 6 years ago
parent aee59977d3
commit 7847c8da5e

@ -630,7 +630,6 @@ private:
void send_ul_info_transfer(srslte::unique_byte_buffer_t nas_msg); void send_ul_info_transfer(srslte::unique_byte_buffer_t nas_msg);
void send_security_mode_complete(); void send_security_mode_complete();
void send_rrc_con_reconfig_complete(); void send_rrc_con_reconfig_complete();
void send_rrc_ue_cap_info();
// Parsers // Parsers
void process_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu); void process_pdu(uint32_t lcid, srslte::unique_byte_buffer_t pdu);
@ -671,6 +670,7 @@ private:
void handle_con_setup(asn1::rrc::rrc_conn_setup_s* setup); void handle_con_setup(asn1::rrc::rrc_conn_setup_s* setup);
void handle_con_reest(asn1::rrc::rrc_conn_reest_s* setup); void handle_con_reest(asn1::rrc::rrc_conn_reest_s* setup);
void handle_rrc_con_reconfig(uint32_t lcid, asn1::rrc::rrc_conn_recfg_s* reconfig); void handle_rrc_con_reconfig(uint32_t lcid, asn1::rrc::rrc_conn_recfg_s* reconfig);
void handle_ue_capability_enquiry(const asn1::rrc::ue_cap_enquiry_s& enquiry);
void add_srb(asn1::rrc::srb_to_add_mod_s* srb_cnfg); void add_srb(asn1::rrc::srb_to_add_mod_s* srb_cnfg);
void add_drb(asn1::rrc::drb_to_add_mod_s* drb_cnfg); void add_drb(asn1::rrc::drb_to_add_mod_s* drb_cnfg);
void release_drb(uint32_t drb_id); void release_drb(uint32_t drb_id);

@ -2203,7 +2203,6 @@ void rrc::send_ul_dcch_msg(uint32_t lcid, const asn1::rrc::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"); rrc_log->warning("Received ULInformationTransfer SDU when in IDLE\n");
return; return;
@ -2372,12 +2371,7 @@ void rrc::parse_dl_dcch(uint32_t lcid, unique_byte_buffer_t pdu)
break; break;
case dl_dcch_msg_type_c::c1_c_::types::ue_cap_enquiry: case dl_dcch_msg_type_c::c1_c_::types::ue_cap_enquiry:
transaction_id = c1->ue_cap_enquiry().rrc_transaction_id; transaction_id = c1->ue_cap_enquiry().rrc_transaction_id;
for (uint32_t i = 0; i < c1->ue_cap_enquiry().crit_exts.c1().ue_cap_enquiry_r8().ue_cap_request.size(); i++) { handle_ue_capability_enquiry(c1->ue_cap_enquiry());
if (c1->ue_cap_enquiry().crit_exts.c1().ue_cap_enquiry_r8().ue_cap_request[i] == rat_type_e::eutra) {
send_rrc_ue_cap_info();
break;
}
}
break; break;
case dl_dcch_msg_type_c::c1_c_::types::rrc_conn_release: case dl_dcch_msg_type_c::c1_c_::types::rrc_conn_release:
rrc_connection_release(); rrc_connection_release();
@ -2404,7 +2398,7 @@ void rrc::enable_capabilities()
rrc_log->info("%s 64QAM PUSCH\n", enable_ul_64 ? "Enabling" : "Disabling"); rrc_log->info("%s 64QAM PUSCH\n", enable_ul_64 ? "Enabling" : "Disabling");
} }
void rrc::send_rrc_ue_cap_info() void rrc::handle_ue_capability_enquiry(const asn1::rrc::ue_cap_enquiry_s& enquiry)
{ {
rrc_log->debug("Preparing UE Capability Info\n"); rrc_log->debug("Preparing UE Capability Info\n");
@ -2412,7 +2406,13 @@ void rrc::send_rrc_ue_cap_info()
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();
ul_dcch_msg.msg.c1().ue_cap_info().rrc_transaction_id = transaction_id; ul_dcch_msg.msg.c1().ue_cap_info().rrc_transaction_id = transaction_id;
info->ue_cap_rat_container_list.resize(1); // resize container to fit all requested RATs
info->ue_cap_rat_container_list.resize(enquiry.crit_exts.c1().ue_cap_enquiry_r8().ue_cap_request.size());
uint32_t rat_idx = 0;
for (uint32_t i = 0; i < enquiry.crit_exts.c1().ue_cap_enquiry_r8().ue_cap_request.size(); i++) {
if (enquiry.crit_exts.c1().ue_cap_enquiry_r8().ue_cap_request[i] == rat_type_e::eutra) {
// adding EUTRA caps
info->ue_cap_rat_container_list[0].rat_type = rat_type_e::eutra; info->ue_cap_rat_container_list[0].rat_type = rat_type_e::eutra;
// Check UE config arguments bounds // Check UE config arguments bounds
@ -2428,7 +2428,8 @@ void rrc::send_rrc_ue_cap_info()
args.ue_category = (uint32_t)strtol(args.ue_category_str.c_str(), NULL, 10); args.ue_category = (uint32_t)strtol(args.ue_category_str.c_str(), NULL, 10);
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 = SRSLTE_MIN(SRSLTE_UE_CATEGORY_MAX, SRSLTE_MAX(SRSLTE_UE_CATEGORY_MIN, args.ue_category)); uint32_t new_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", rrc_log->error("UE Category is %d. It is out of bounds (%d ... %d), setting it to %d\n",
args.ue_category, args.ue_category,
SRSLTE_UE_CATEGORY_MIN, SRSLTE_UE_CATEGORY_MIN,
@ -2624,13 +2625,19 @@ void rrc::send_rrc_ue_cap_info()
} }
// Pack caps and copy to cap info // Pack caps and copy to cap info
uint8_t buf[64]; uint8_t buf[64] = {};
asn1::bit_ref bref(buf, sizeof(buf)); asn1::bit_ref bref(buf, sizeof(buf));
cap.pack(bref); cap.pack(bref);
bref.align_bytes_zero(); bref.align_bytes_zero();
uint32_t cap_len = (uint32_t)bref.distance_bytes(buf); uint32_t cap_len = (uint32_t)bref.distance_bytes(buf);
info->ue_cap_rat_container_list[0].ue_cap_rat_container.resize(cap_len); info->ue_cap_rat_container_list[rat_idx].ue_cap_rat_container.resize(cap_len);
memcpy(info->ue_cap_rat_container_list[0].ue_cap_rat_container.data(), buf, cap_len); memcpy(info->ue_cap_rat_container_list[rat_idx].ue_cap_rat_container.data(), buf, cap_len);
rat_idx++;
}
}
// resize container back to the actually filled items
info->ue_cap_rat_container_list.resize(rat_idx);
send_ul_dcch_msg(RB_ID_SRB1, ul_dcch_msg); send_ul_dcch_msg(RB_ID_SRB1, ul_dcch_msg);
} }

Loading…
Cancel
Save