nr,gnb: small gnb interface refactors and fix of byte buffer operator=

master
Francisco 3 years ago committed by Francisco Paisana
parent 2a5d21164f
commit 96fd3aae3c

@ -13,7 +13,6 @@
#ifndef SRSRAN_RRC_NR_UTILS_H
#define SRSRAN_RRC_NR_UTILS_H
#include "srsenb/hdr/stack/mac/sched_interface.h"
#include "srsran/common/phy_cfg_nr.h"
#include "srsran/interfaces/mac_interface_types.h"
#include "srsran/interfaces/pdcp_interface_types.h"
@ -143,9 +142,4 @@ pdcp_config_t make_drb_pdcp_config_t(const uint8_t bearer_id, bool is_ue, const
} // namespace srsran
namespace srsenb {
int set_sched_cell_cfg_sib1(srsenb::sched_interface::cell_cfg_t* sched_cfg, const asn1::rrc_nr::sib1_s& sib1);
}
#endif // SRSRAN_RRC_NR_UTILS_H

@ -119,7 +119,7 @@ public:
// avoid self assignment
if (&buf == this)
return *this;
msg = &buffer[SRSRAN_BUFFER_HEADER_OFFSET];
msg = &buffer[buf.msg - &(*buf.buffer)];
N_bytes = buf.N_bytes;
md = buf.md;
memcpy(msg, buf.msg, N_bytes);

@ -132,8 +132,8 @@ class rrc_interface_mac_nr
{
public:
// Provides MIB packed message
virtual int read_pdu_bcch_bch(const uint32_t tti, srsran::unique_byte_buffer_t& buffer) = 0;
virtual int read_pdu_bcch_dlsch(uint32_t sib_index, srsran::unique_byte_buffer_t& buffer) = 0;
virtual int read_pdu_bcch_bch(const uint32_t tti, srsran::byte_buffer_t& buffer) = 0;
virtual int read_pdu_bcch_dlsch(uint32_t sib_index, srsran::byte_buffer_t& buffer) = 0;
/// User management
virtual int add_user(uint16_t rnti, const sched_nr_ue_cfg_t& uecfg) = 0;

@ -27,10 +27,10 @@ public:
virtual int ue_set_security_cfg_capabilities(uint16_t rnti, const asn1::ngap_nr::ue_security_cap_s& caps) = 0;
virtual int start_security_mode_procedure(uint16_t rnti) = 0;
virtual int
establish_rrc_bearer(uint16_t rnti, uint16_t pdu_session_id, srsran::const_byte_span nas_pdu, uint32_t lcid) = 0;
virtual int allocate_lcid(uint16_t rnti) = 0;
virtual int release_bearers(uint16_t rnti) = 0;
virtual void write_dl_info(uint16_t rnti, srsran::unique_byte_buffer_t sdu) = 0;
establish_rrc_bearer(uint16_t rnti, uint16_t pdu_session_id, srsran::const_byte_span nas_pdu, uint32_t lcid) = 0;
virtual int allocate_lcid(uint16_t rnti) = 0;
virtual int release_bearers(uint16_t rnti) = 0;
virtual void write_dl_info(uint16_t rnti, srsran::unique_byte_buffer_t sdu) = 0;
};
// Cell/Sector configuration for NR cells
@ -51,4 +51,4 @@ typedef std::vector<rrc_cell_cfg_nr_t> rrc_cell_list_nr_t;
} // namespace srsenb
#endif // SRSRAN_GNB_RRC_NR_INTERFACES_H
#endif // SRSRAN_GNB_RRC_NR_INTERFACES_H

@ -1595,32 +1595,3 @@ bool fill_phy_pdcch_cfg_common(const asn1::rrc_nr::pdcch_cfg_common_s& pdcch_cfg
}
} // namespace srsran
namespace srsenb {
int set_sched_cell_cfg_sib1(srsenb::sched_interface::cell_cfg_t* sched_cfg, const asn1::rrc_nr::sib1_s& sib1)
{
bzero(sched_cfg, sizeof(srsenb::sched_interface::cell_cfg_t));
// set SIB1 and SIB2+ period
sched_cfg->sibs[0].period_rf = 16; // SIB1 is always 16 rf
for (uint32_t i = 0; i < sib1.si_sched_info.sched_info_list.size(); i++) {
sched_cfg->sibs[i + 1].period_rf = sib1.si_sched_info.sched_info_list[i].si_periodicity.to_number();
}
// si-WindowLength
sched_cfg->si_window_ms = sib1.si_sched_info.si_win_len.to_number();
// setup PRACH
if (not sib1.si_sched_info.si_request_cfg.rach_occasions_si_present) {
asn1::log_warning("rach_occasions_si option not present");
return SRSRAN_ERROR;
}
sched_cfg->prach_rar_window = sib1.si_sched_info.si_request_cfg.rach_occasions_si.rach_cfg_si.ra_resp_win.to_number();
sched_cfg->prach_freq_offset = sib1.si_sched_info.si_request_cfg.rach_occasions_si.rach_cfg_si.msg1_freq_start;
sched_cfg->maxharq_msg3tx = sib1.si_sched_info.si_request_cfg.rach_occasions_si.rach_cfg_si.preamb_trans_max;
return SRSRAN_SUCCESS;
}
} // namespace srsenb

@ -65,8 +65,8 @@ public:
void config_phy();
void config_mac();
int32_t generate_sibs();
int read_pdu_bcch_bch(const uint32_t tti, srsran::unique_byte_buffer_t& buffer) final;
int read_pdu_bcch_dlsch(uint32_t sib_index, srsran::unique_byte_buffer_t& buffer) final;
int read_pdu_bcch_bch(const uint32_t tti, srsran::byte_buffer_t& buffer) final;
int read_pdu_bcch_dlsch(uint32_t sib_index, srsran::byte_buffer_t& buffer) final;
/// User manegement
int add_user(uint16_t rnti, const sched_nr_ue_cfg_t& uecfg);

@ -117,7 +117,7 @@ int mac_nr::cell_cfg(const std::vector<srsenb::sched_nr_interface::cell_cfg_t>&
logger.error("Couldn't allocate PDU in %s().", __FUNCTION__);
return SRSRAN_ERROR;
}
if (rrc->read_pdu_bcch_dlsch(sib.index, sib.payload) != SRSRAN_SUCCESS) {
if (rrc->read_pdu_bcch_dlsch(sib.index, *sib.payload) != SRSRAN_SUCCESS) {
logger.error("Couldn't read SIB %d from RRC", sib.index);
}

@ -307,22 +307,6 @@ void rrc_nr::config_mac()
ret2 = srsran::make_duplex_cfg_from_serv_cell(base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common, &cell.duplex);
srsran_assert(ret2, "Invalid NR cell configuration.");
// FIXME: entire SI configuration, etc needs to be ported to NR
sched_interface::cell_cfg_t cell_cfg;
set_sched_cell_cfg_sib1(&cell_cfg, cfg.sib1);
// set SIB length
for (uint32_t i = 0; i < nof_si_messages + 1; i++) {
cell_cfg.sibs[i].len = sib_buffer[i]->N_bytes;
}
// PUCCH width
cell_cfg.nrb_pucch = SRSRAN_MAX(cfg.sr_cfg.nof_prb, /* TODO: where is n_rb2 in NR? */ 0);
logger.info("Allocating %d PRBs for PUCCH", cell_cfg.nrb_pucch);
// Copy Cell configuration
// cell_cfg.cell = cfg.cell;
// Configure MAC/scheduler
mac->cell_cfg(sched_cells_cfg);
}
@ -397,33 +381,23 @@ int32_t rrc_nr::generate_sibs()
MAC interface
*******************************************************************************/
int rrc_nr::read_pdu_bcch_bch(const uint32_t tti, srsran::unique_byte_buffer_t& buffer)
int rrc_nr::read_pdu_bcch_bch(const uint32_t tti, srsran::byte_buffer_t& buffer)
{
if (mib_buffer == nullptr || buffer->get_tailroom() < mib_buffer->N_bytes) {
if (mib_buffer == nullptr || buffer.get_tailroom() < mib_buffer->N_bytes) {
return SRSRAN_ERROR;
}
memcpy(buffer->msg, mib_buffer->msg, mib_buffer->N_bytes);
buffer->N_bytes = mib_buffer->N_bytes;
buffer = *mib_buffer;
return SRSRAN_SUCCESS;
}
int rrc_nr::read_pdu_bcch_dlsch(uint32_t sib_index, srsran::unique_byte_buffer_t& buffer)
int rrc_nr::read_pdu_bcch_dlsch(uint32_t sib_index, srsran::byte_buffer_t& buffer)
{
if (sib_index >= sib_buffer.size()) {
logger.error("SIB %d is not a configured SIB.", sib_index);
return SRSRAN_ERROR;
}
if (buffer->get_tailroom() < sib_buffer[sib_index]->N_bytes) {
logger.error("Not enough space to fit SIB %d into buffer (%d < %d)",
sib_index,
buffer->get_tailroom(),
sib_buffer[sib_index]->N_bytes);
return SRSRAN_ERROR;
}
memcpy(buffer->msg, sib_buffer[sib_index]->msg, sib_buffer[sib_index]->N_bytes);
buffer->N_bytes = sib_buffer[sib_index]->N_bytes;
buffer = *sib_buffer[sib_index];
return SRSRAN_SUCCESS;
}
@ -527,9 +501,9 @@ void rrc_nr::sgnb_addition_request(uint16_t eutra_rnti, const sgnb_addition_req_
uecfg.carriers[0].cc = 0;
uecfg.ue_bearers[0].direction = mac_lc_ch_cfg_t::BOTH;
srsran::phy_cfg_nr_default_t::reference_cfg_t ref_args{};
ref_args.duplex = cfg.cell_list[0].duplex_mode == SRSRAN_DUPLEX_MODE_TDD
? srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_TDD_CUSTOM_6_4
: srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_FDD;
ref_args.duplex = cfg.cell_list[0].duplex_mode == SRSRAN_DUPLEX_MODE_TDD
? srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_TDD_CUSTOM_6_4
: srsran::phy_cfg_nr_default_t::reference_cfg_t::R_DUPLEX_FDD;
uecfg.phy_cfg = srsran::phy_cfg_nr_default_t{ref_args};
uecfg.phy_cfg.csi = {}; // disable CSI until RA is complete

@ -21,8 +21,8 @@ namespace srsenb {
class rrc_nr_dummy : public rrc_interface_mac_nr
{
public:
int read_pdu_bcch_bch(const uint32_t tti, srsran::unique_byte_buffer_t& buffer) { return SRSRAN_SUCCESS; }
int read_pdu_bcch_dlsch(uint32_t sib_index, srsran::unique_byte_buffer_t& buffer) { return SRSRAN_SUCCESS; }
int read_pdu_bcch_bch(const uint32_t tti, srsran::byte_buffer_t& buffer) { return SRSRAN_SUCCESS; }
int read_pdu_bcch_dlsch(uint32_t sib_index, srsran::byte_buffer_t& buffer) { return SRSRAN_SUCCESS; }
int add_user(uint16_t rnti, const sched_nr_ue_cfg_t& uecfg) { return SRSRAN_SUCCESS; }
int update_user(uint16_t new_rnti, uint16_t old_rnti) { return SRSRAN_SUCCESS; }
void set_activity_user(uint16_t rnti) {}

Loading…
Cancel
Save