Merge branch 'next' into agpl_next

master
Codebot 3 years ago committed by Your Name
commit 60fb9ae9a6

@ -235,16 +235,15 @@ public:
if (!suspended) { if (!suspended) {
return false; return false;
} }
pdu_t p; unique_byte_buffer_t rx_pdu;
// Do not block // Do not block
while (rx_pdu_resume_queue.try_pop(p)) { while (rx_pdu_resume_queue.try_pop(rx_pdu)) {
write_pdu(p.payload, p.nof_bytes); write_pdu(rx_pdu->msg, rx_pdu->N_bytes);
free(p.payload);
} }
unique_byte_buffer_t s; unique_byte_buffer_t tx_sdu;
while (tx_sdu_resume_queue.try_pop(s)) { while (tx_sdu_resume_queue.try_pop(tx_sdu)) {
write_sdu(std::move(s)); write_sdu(std::move(tx_sdu));
} }
suspended = false; suspended = false;
return true; return true;
@ -297,13 +296,22 @@ private:
// Enqueues the Rx PDU in the resume queue // Enqueues the Rx PDU in the resume queue
void queue_rx_pdu(uint8_t* payload, uint32_t nof_bytes) void queue_rx_pdu(uint8_t* payload, uint32_t nof_bytes)
{ {
pdu_t p = {}; unique_byte_buffer_t rx_pdu = srsran::make_byte_buffer();
p.nof_bytes = nof_bytes; if (rx_pdu == nullptr) {
p.payload = (uint8_t*)malloc(nof_bytes); srslog::fetch_basic_logger("RLC").warning("Couldn't allocate PDU in %s().", __FUNCTION__);
memcpy(p.payload, payload, nof_bytes); return;
}
if (rx_pdu->get_tailroom() < nof_bytes) {
srslog::fetch_basic_logger("RLC").warning("Not enough space to store PDU.");
return;
}
memcpy(rx_pdu->msg, payload, nof_bytes);
rx_pdu->N_bytes = nof_bytes;
// Do not block ever // Do not block ever
if (!rx_pdu_resume_queue.try_push(p)) { if (!rx_pdu_resume_queue.try_push(std::move(rx_pdu))) {
srslog::fetch_basic_logger("RLC").warning("Dropping SDUs while bearer suspended."); srslog::fetch_basic_logger("RLC").warning("Dropping SDUs while bearer suspended.");
return; return;
} }
@ -319,12 +327,7 @@ private:
} }
} }
typedef struct { static_blocking_queue<unique_byte_buffer_t, 256> rx_pdu_resume_queue;
uint8_t* payload;
uint32_t nof_bytes;
} pdu_t;
static_blocking_queue<pdu_t, 256> rx_pdu_resume_queue;
static_blocking_queue<unique_byte_buffer_t, 256> tx_sdu_resume_queue; static_blocking_queue<unique_byte_buffer_t, 256> tx_sdu_resume_queue;
}; };

@ -377,6 +377,50 @@ int test_cell_group_config()
// pack it again // pack it again
cell_group_cfg_s cell_group_cfg_pack; cell_group_cfg_s cell_group_cfg_pack;
// RLC for DRB1
cell_group_cfg_pack.rlc_bearer_to_add_mod_list_present = true;
cell_group_cfg_pack.rlc_bearer_to_add_mod_list.resize(1);
auto& rlc = cell_group_cfg_pack.rlc_bearer_to_add_mod_list[0];
rlc.lc_ch_id = 1;
rlc.served_radio_bearer_present = true;
rlc.served_radio_bearer.set_drb_id();
rlc.served_radio_bearer.drb_id() = 1;
rlc.rlc_cfg_present = true;
rlc.rlc_cfg.set_um_bi_dir();
rlc.rlc_cfg.um_bi_dir().ul_um_rlc.sn_field_len_present = true;
rlc.rlc_cfg.um_bi_dir().ul_um_rlc.sn_field_len = sn_field_len_um_opts::size12;
rlc.rlc_cfg.um_bi_dir().dl_um_rlc.sn_field_len_present = true;
rlc.rlc_cfg.um_bi_dir().dl_um_rlc.sn_field_len = sn_field_len_um_opts::size12;
rlc.rlc_cfg.um_bi_dir().dl_um_rlc.t_reassembly = t_reassembly_opts::ms50;
// MAC logical channel config
rlc.mac_lc_ch_cfg_present = true;
rlc.mac_lc_ch_cfg.ul_specific_params_present = true;
rlc.mac_lc_ch_cfg.ul_specific_params.prio = 11;
rlc.mac_lc_ch_cfg.ul_specific_params.prioritised_bit_rate =
asn1::rrc_nr::lc_ch_cfg_s::ul_specific_params_s_::prioritised_bit_rate_opts::kbps0;
rlc.mac_lc_ch_cfg.ul_specific_params.bucket_size_dur =
asn1::rrc_nr::lc_ch_cfg_s::ul_specific_params_s_::bucket_size_dur_opts::ms100;
rlc.mac_lc_ch_cfg.ul_specific_params.lc_ch_group_present = true;
rlc.mac_lc_ch_cfg.ul_specific_params.lc_ch_group = 6;
rlc.mac_lc_ch_cfg.ul_specific_params.sched_request_id_present = true;
rlc.mac_lc_ch_cfg.ul_specific_params.sched_request_id = 0;
// mac-CellGroup-Config
cell_group_cfg_pack.mac_cell_group_cfg_present = true;
auto& mac_cell_group = cell_group_cfg_pack.mac_cell_group_cfg;
mac_cell_group.sched_request_cfg_present = true;
mac_cell_group.sched_request_cfg.sched_request_to_add_mod_list_present = true;
mac_cell_group.sched_request_cfg.sched_request_to_add_mod_list.resize(1);
mac_cell_group.sched_request_cfg.sched_request_to_add_mod_list[0].sched_request_id = 0;
mac_cell_group.sched_request_cfg.sched_request_to_add_mod_list[0].sr_trans_max =
asn1::rrc_nr::sched_request_to_add_mod_s::sr_trans_max_opts::n64;
mac_cell_group.bsr_cfg_present = true;
mac_cell_group.bsr_cfg.periodic_bsr_timer = asn1::rrc_nr::bsr_cfg_s::periodic_bsr_timer_opts::sf20;
mac_cell_group.bsr_cfg.retx_bsr_timer = asn1::rrc_nr::bsr_cfg_s::retx_bsr_timer_opts::sf320;
// Skip TAG and PHR config
cell_group_cfg_pack.sp_cell_cfg_present = true; cell_group_cfg_pack.sp_cell_cfg_present = true;
cell_group_cfg_pack.sp_cell_cfg.serv_cell_idx_present = true; cell_group_cfg_pack.sp_cell_cfg.serv_cell_idx_present = true;
@ -453,7 +497,7 @@ int test_cell_group_config()
pdsch_cfg_dedicated.setup().zp_csi_rs_res_to_add_mod_list.resize(1); pdsch_cfg_dedicated.setup().zp_csi_rs_res_to_add_mod_list.resize(1);
pdsch_cfg_dedicated.setup().zp_csi_rs_res_to_add_mod_list[0].zp_csi_rs_res_id = 0; pdsch_cfg_dedicated.setup().zp_csi_rs_res_to_add_mod_list[0].zp_csi_rs_res_id = 0;
pdsch_cfg_dedicated.setup().zp_csi_rs_res_to_add_mod_list[0].res_map.freq_domain_alloc.set_row4(); pdsch_cfg_dedicated.setup().zp_csi_rs_res_to_add_mod_list[0].res_map.freq_domain_alloc.set_row4();
pdsch_cfg_dedicated.setup().zp_csi_rs_res_to_add_mod_list[0].res_map.freq_domain_alloc.row4().from_number(0x100); pdsch_cfg_dedicated.setup().zp_csi_rs_res_to_add_mod_list[0].res_map.freq_domain_alloc.row4().from_number(0b100);
pdsch_cfg_dedicated.setup().zp_csi_rs_res_to_add_mod_list[0].res_map.nrof_ports = pdsch_cfg_dedicated.setup().zp_csi_rs_res_to_add_mod_list[0].res_map.nrof_ports =
asn1::rrc_nr::csi_rs_res_map_s::nrof_ports_opts::p4; asn1::rrc_nr::csi_rs_res_map_s::nrof_ports_opts::p4;

@ -129,6 +129,8 @@ public:
// state // state
rrc_nr_state_t state = rrc_nr_state_t::RRC_IDLE; rrc_nr_state_t state = rrc_nr_state_t::RRC_IDLE;
uint8_t transaction_id = 0; uint8_t transaction_id = 0;
uint32_t drb1_lcid = 4;
}; };
private: private:

@ -221,7 +221,7 @@ bool slot_worker::work_ul()
logger.error("Couldn't allocate PDU in %s().", __FUNCTION__); logger.error("Couldn't allocate PDU in %s().", __FUNCTION__);
return false; return false;
} }
pusch_info.pdu->N_bytes = pusch.sch.grant.tb[0].tbs; pusch_info.pdu->N_bytes = pusch.sch.grant.tb[0].tbs / 8;
pusch_info.pusch_data.tb[0].payload = pusch_info.pdu->data(); pusch_info.pusch_data.tb[0].payload = pusch_info.pdu->data();
// Decode PUSCH // Decode PUSCH

@ -339,20 +339,23 @@ int mac_nr::pusch_info(const srsran_slot_cfg_t& slot_cfg, mac_interface_phy_nr::
sched.ul_crc_info(rnti, 0, pusch_info.pid, pusch_info.pusch_data.tb[0].crc); sched.ul_crc_info(rnti, 0, pusch_info.pid, pusch_info.pusch_data.tb[0].crc);
if (pusch_info.pusch_data.tb[0].crc && pcap) { // process only PDUs with CRC=OK
pcap->write_ul_crnti_nr( if (pusch_info.pusch_data.tb[0].crc) {
pusch_info.pdu->msg, pusch_info.pdu->N_bytes, pusch_info.rnti, pusch_info.pid, slot_cfg.idx); if (pcap) {
} pcap->write_ul_crnti_nr(
pusch_info.pdu->msg, pusch_info.pdu->N_bytes, pusch_info.rnti, pusch_info.pid, slot_cfg.idx);
auto process_pdu_task = [this, rnti](srsran::unique_byte_buffer_t& pdu) {
srsran::rwlock_read_guard lock(rwlock);
if (is_rnti_active_unsafe(rnti)) {
ue_db[rnti]->process_pdu(std::move(pdu));
} else {
logger.debug("Discarding PDU rnti=0x%x", rnti);
} }
};
stack_task_queue.try_push(std::bind(process_pdu_task, std::move(pusch_info.pdu))); auto process_pdu_task = [this, rnti](srsran::unique_byte_buffer_t& pdu) {
srsran::rwlock_read_guard lock(rwlock);
if (is_rnti_active_unsafe(rnti)) {
ue_db[rnti]->process_pdu(std::move(pdu));
} else {
logger.debug("Discarding PDU rnti=0x%x", rnti);
}
};
stack_task_queue.try_push(std::bind(process_pdu_task, std::move(pusch_info.pdu)));
}
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }

@ -88,7 +88,25 @@ int ue_nr::process_pdu(srsran::unique_byte_buffer_t pdu)
subpdu.get_lcid(), subpdu.get_lcid(),
subpdu.get_sdu_length()); subpdu.get_sdu_length());
rlc->write_pdu(rnti, subpdu.get_lcid(), subpdu.get_sdu(), subpdu.get_sdu_length()); // Handle MAC CEs
switch (subpdu.get_lcid()) {
case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::CRNTI:
logger.info("CRNTI CE not implemented.");
break;
case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::SHORT_BSR:
logger.info("SHORT_BSR CE not implemented.");
break;
case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::LONG_BSR:
logger.info("LONG_BSR CE not implemented.");
break;
case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::SHORT_TRUNC_BSR:
logger.info("SHORT_TRUNC_BSR CE not implemented.");
break;
default:
if (subpdu.is_sdu()) {
rlc->write_pdu(rnti, subpdu.get_lcid(), subpdu.get_sdu(), subpdu.get_sdu_length());
}
}
} }
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }

@ -134,6 +134,11 @@ bool rrc::ue::rrc_endc::fill_conn_recfg(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn
meas_cfg.meas_gap_cfg.set_setup(); meas_cfg.meas_gap_cfg.set_setup();
meas_cfg.meas_gap_cfg.setup().gap_offset.set_gp0() = 16; meas_cfg.meas_gap_cfg.setup().gap_offset.set_gp0() = 16;
} else if (is_in_state<prepare_recfg>()) { } else if (is_in_state<prepare_recfg>()) {
// FIXME: use bearer manager to remove EUTRA DRB
conn_recfg->rr_cfg_ded.drb_to_release_list_present = true;
conn_recfg->rr_cfg_ded.drb_to_release_list.resize(1);
conn_recfg->rr_cfg_ded.drb_to_release_list[0] = 1;
// only add reconfigure EN-DC extension/release 15.10 field if ENDC activation is active // only add reconfigure EN-DC extension/release 15.10 field if ENDC activation is active
conn_recfg->non_crit_ext_present = true; conn_recfg->non_crit_ext_present = true;
conn_recfg->non_crit_ext.non_crit_ext_present = true; conn_recfg->non_crit_ext.non_crit_ext_present = true;

@ -499,6 +499,50 @@ void rrc_nr::ue::send_dl_ccch(dl_ccch_msg_s* dl_ccch_msg)
int rrc_nr::ue::pack_secondary_cell_group_config(asn1::dyn_octstring& packed_secondary_cell_config) int rrc_nr::ue::pack_secondary_cell_group_config(asn1::dyn_octstring& packed_secondary_cell_config)
{ {
cell_group_cfg_s cell_group_cfg_pack; cell_group_cfg_s cell_group_cfg_pack;
// RLC for DRB1 (with fixed LCID)
cell_group_cfg_pack.rlc_bearer_to_add_mod_list_present = true;
cell_group_cfg_pack.rlc_bearer_to_add_mod_list.resize(1);
auto& rlc = cell_group_cfg_pack.rlc_bearer_to_add_mod_list[0];
rlc.lc_ch_id = drb1_lcid;
rlc.served_radio_bearer_present = true;
rlc.served_radio_bearer.set_drb_id();
rlc.served_radio_bearer.drb_id() = 1;
rlc.rlc_cfg_present = true;
rlc.rlc_cfg.set_um_bi_dir();
rlc.rlc_cfg.um_bi_dir().ul_um_rlc.sn_field_len_present = true;
rlc.rlc_cfg.um_bi_dir().ul_um_rlc.sn_field_len = sn_field_len_um_opts::size12;
rlc.rlc_cfg.um_bi_dir().dl_um_rlc.sn_field_len_present = true;
rlc.rlc_cfg.um_bi_dir().dl_um_rlc.sn_field_len = sn_field_len_um_opts::size12;
rlc.rlc_cfg.um_bi_dir().dl_um_rlc.t_reassembly = t_reassembly_opts::ms50;
// MAC logical channel config
rlc.mac_lc_ch_cfg_present = true;
rlc.mac_lc_ch_cfg.ul_specific_params_present = true;
rlc.mac_lc_ch_cfg.ul_specific_params.prio = 11;
rlc.mac_lc_ch_cfg.ul_specific_params.prioritised_bit_rate =
asn1::rrc_nr::lc_ch_cfg_s::ul_specific_params_s_::prioritised_bit_rate_opts::kbps0;
rlc.mac_lc_ch_cfg.ul_specific_params.bucket_size_dur =
asn1::rrc_nr::lc_ch_cfg_s::ul_specific_params_s_::bucket_size_dur_opts::ms100;
rlc.mac_lc_ch_cfg.ul_specific_params.lc_ch_group_present = true;
rlc.mac_lc_ch_cfg.ul_specific_params.lc_ch_group = 6;
rlc.mac_lc_ch_cfg.ul_specific_params.sched_request_id_present = true;
rlc.mac_lc_ch_cfg.ul_specific_params.sched_request_id = 0;
// mac-CellGroup-Config for BSR and SR
cell_group_cfg_pack.mac_cell_group_cfg_present = true;
auto& mac_cell_group = cell_group_cfg_pack.mac_cell_group_cfg;
mac_cell_group.sched_request_cfg_present = true;
mac_cell_group.sched_request_cfg.sched_request_to_add_mod_list_present = true;
mac_cell_group.sched_request_cfg.sched_request_to_add_mod_list.resize(1);
mac_cell_group.sched_request_cfg.sched_request_to_add_mod_list[0].sched_request_id = 0;
mac_cell_group.sched_request_cfg.sched_request_to_add_mod_list[0].sr_trans_max =
asn1::rrc_nr::sched_request_to_add_mod_s::sr_trans_max_opts::n64;
mac_cell_group.bsr_cfg_present = true;
mac_cell_group.bsr_cfg.periodic_bsr_timer = asn1::rrc_nr::bsr_cfg_s::periodic_bsr_timer_opts::sf20;
mac_cell_group.bsr_cfg.retx_bsr_timer = asn1::rrc_nr::bsr_cfg_s::retx_bsr_timer_opts::sf320;
// Skip TAG and PHR config
cell_group_cfg_pack.sp_cell_cfg_present = true; cell_group_cfg_pack.sp_cell_cfg_present = true;
cell_group_cfg_pack.sp_cell_cfg.serv_cell_idx_present = true; cell_group_cfg_pack.sp_cell_cfg.serv_cell_idx_present = true;

@ -465,17 +465,17 @@ bool rrc_nr::apply_rlc_add_mod(const rlc_bearer_cfg_s& rlc_bearer_cfg)
add_lcid_drb(lc_ch_id, drb_id); add_lcid_drb(lc_ch_id, drb_id);
} }
} else { } else {
logger.warning("In RLC bearer cfg does not contain served radio bearer"); logger.error("In RLC bearer cfg does not contain served radio bearer");
return false; return false;
} }
if (rlc_bearer_cfg.rlc_cfg_present == true) { if (rlc_bearer_cfg.rlc_cfg_present == true) {
if (srsran::make_rlc_config_t(rlc_bearer_cfg.rlc_cfg, &rlc_cfg) != SRSRAN_SUCCESS) { if (srsran::make_rlc_config_t(rlc_bearer_cfg.rlc_cfg, &rlc_cfg) != SRSRAN_SUCCESS) {
logger.warning("Failed to build RLC config"); logger.error("Failed to build RLC config");
return false; return false;
} }
} else { } else {
logger.warning("In RLC bearer cfg does not contain rlc cfg"); logger.error("In RLC bearer cfg does not contain rlc cfg");
return false; return false;
} }
@ -486,6 +486,9 @@ bool rrc_nr::apply_rlc_add_mod(const rlc_bearer_cfg_s& rlc_bearer_cfg)
logical_channel_config_t logical_channel_cfg; logical_channel_config_t logical_channel_cfg;
logical_channel_cfg = srsran::make_mac_logical_channel_cfg_t(lc_ch_id, rlc_bearer_cfg.mac_lc_ch_cfg); logical_channel_cfg = srsran::make_mac_logical_channel_cfg_t(lc_ch_id, rlc_bearer_cfg.mac_lc_ch_cfg);
mac->setup_lcid(logical_channel_cfg); mac->setup_lcid(logical_channel_cfg);
} else {
logger.error("Bearer config for LCID %d does not contain mac-LogicalChannelConfig.", lc_ch_id);
return false;
} }
return true; return true;
} }
@ -1345,6 +1348,10 @@ bool rrc_nr::apply_drb_add_mod(const drb_to_add_mod_s& drb_cfg)
} }
uint32_t lcid = get_lcid_for_drbid(drb_cfg.drb_id); uint32_t lcid = get_lcid_for_drbid(drb_cfg.drb_id);
if (lcid == 0) {
logger.error("Cannot find valid LCID for DRB %d", drb_cfg.drb_id);
return false;
}
// Setup PDCP // Setup PDCP
if (!(drb_cfg.pdcp_cfg.drb_present == true)) { if (!(drb_cfg.pdcp_cfg.drb_present == true)) {

Loading…
Cancel
Save