Added MAC NR to EUTRA and NR with stack interfaces including MAC config build

Moved MAC logical channel config to MAC interface types
master
David Rupprecht 4 years ago committed by David Rupprecht
parent e0420049e3
commit ceda458bb3

@ -13,6 +13,7 @@
#ifndef SRSLTE_RRC_NR_UTILS_H
#define SRSLTE_RRC_NR_UTILS_H
#include "srslte/interfaces/mac_interface_types.h"
#include "srslte/interfaces/pdcp_interface_types.h"
#include "srslte/interfaces/rlc_interface_types.h"
#include "srslte/interfaces/rrc_interface_types.h"
@ -28,6 +29,7 @@ struct plmn_id_s;
struct sib1_s;
struct rlc_cfg_c;
struct pdcp_cfg_s;
struct lc_ch_cfg_s;
} // namespace rrc_nr
} // namespace asn1
@ -40,6 +42,10 @@ namespace srslte {
plmn_id_t make_plmn_id_t(const asn1::rrc_nr::plmn_id_s& asn1_type);
void to_asn1(asn1::rrc_nr::plmn_id_s* asn1_type, const plmn_id_t& cfg);
/***************************
* MAC Config
**************************/
logical_channel_config_t make_mac_logical_channel_cfg_t(uint8_t lcid, const asn1::rrc_nr::lc_ch_cfg_s& asn1_type);
/***************************
* RLC Config
**************************/

@ -20,6 +20,23 @@ namespace srslte {
/***************************
* MAC Config
**************************/
/* Logical Channel Multiplexing and Prioritization + Msg3 Buffer */
class logical_channel_config_t
{
public:
uint8_t lcid;
uint8_t lcg;
int32_t Bj;
int32_t PBR; // in kByte/s, -1 sets to infinity
uint32_t bucket_size;
uint32_t BSD;
uint32_t priority;
int sched_len; // scheduled upper layer payload for this LCID
int buffer_len; // outstanding bytes for this LCID
};
struct bsr_cfg_t {
int periodic_timer;
int retx_timer;

@ -14,6 +14,7 @@
#define SRSLTE_UE_NR_INTERFACES_H
#include "srslte/common/interfaces_common.h"
#include "srslte/interfaces/mac_interface_types.h"
#include <string>
namespace srsue {
@ -54,7 +55,12 @@ public:
};
class mac_interface_rrc_nr
{};
{
public:
virtual void setup_lcid(const srslte::logical_channel_config_t& config) = 0;
virtual void set_config(const srslte::bsr_cfg_t& bsr_cfg) = 0;
virtual void set_config(const srslte::sr_cfg_t& sr_cfg) = 0;
};
class phy_interface_mac_nr
{

@ -50,6 +50,22 @@ void to_asn1(asn1::rrc_nr::plmn_id_s* asn1_type, const plmn_id_t& cfg)
std::copy(&cfg.mnc[0], &cfg.mnc[cfg.nof_mnc_digits], &asn1_type->mnc[0]);
}
logical_channel_config_t make_mac_logical_channel_cfg_t(uint8_t lcid, const lc_ch_cfg_s& asn1_type)
{
logical_channel_config_t logical_channel_config = {};
logical_channel_config.lcid = lcid;
if (asn1_type.ul_specific_params.lc_ch_group_present) {
logical_channel_config.lcg = asn1_type.ul_specific_params.lc_ch_group;
}
logical_channel_config.priority = asn1_type.ul_specific_params.prio;
logical_channel_config.PBR = asn1_type.ul_specific_params.prioritised_bit_rate.to_number();
logical_channel_config.BSD = asn1_type.ul_specific_params.bucket_size_dur.to_number();
logical_channel_config.bucket_size = logical_channel_config.PBR * logical_channel_config.BSD;
return logical_channel_config;
}
rlc_config_t make_rlc_config_t(const rlc_cfg_c& asn1_type)
{
rlc_config_t rlc_cfg = rlc_config_t::default_rlc_um_nr_config();

@ -16,6 +16,7 @@
#include "srslte/common/block_queue.h"
#include "srslte/common/logmap.h"
#include "srslte/common/mac_nr_pcap.h"
#include "srslte/interfaces/mac_interface_types.h"
#include "srslte/interfaces/ue_nr_interfaces.h"
#include "srslte/mac/mac_nr_pdu.h"
#include "srsue/hdr/stack/mac/mux.h"
@ -57,12 +58,15 @@ public:
void get_metrics(mac_metrics_t* metrics);
/******** Interface for RRC (RRC -> MAC) ****************/
void setup_lcid(const srslte::logical_channel_config_t& config);
void set_config(const srslte::bsr_cfg_t& bsr_cfg);
void set_config(const srslte::sr_cfg_t& sr_cfg);
/// stack interface
void process_pdus();
private:
void setup_lcid(uint32_t lcid, uint32_t lcg, uint32_t priority, int PBR_x_tti, uint32_t BSD);
void setup_lcid(const logical_channel_config_t& config);
void handle_pdu(srslte::unique_byte_buffer_t pdu);
void get_ul_data(const mac_nr_grant_ul_t& grant, phy_interface_stack_nr::tx_request_t* tx_request);

@ -21,24 +21,11 @@
#include "proc_phr.h"
#include "srslte/common/common.h"
#include "srslte/common/log.h"
#include "srslte/interfaces/mac_interface_types.h"
#include "srslte/interfaces/ue_interfaces.h"
#include "srslte/mac/pdu.h"
#include <mutex>
/* Logical Channel Multiplexing and Prioritization + Msg3 Buffer */
typedef struct {
uint8_t lcid;
uint8_t lcg;
int32_t Bj;
int32_t PBR; // in kByte/s, -1 sets to infinity
uint32_t bucket_size;
uint32_t BSD;
uint32_t priority;
int sched_len; // scheduled upper layer payload for this LCID
int buffer_len; // outstanding bytes for this LCID
} logical_channel_config_t;
namespace srsue {
class mux
@ -65,7 +52,7 @@ public:
void append_crnti_ce_next_tx(uint16_t crnti);
void setup_lcid(const logical_channel_config_t& config);
void setup_lcid(const srslte::logical_channel_config_t& config);
void print_logical_channel_state(const std::string& info);
@ -73,11 +60,11 @@ private:
bool has_logical_channel(const uint32_t& lcid);
bool pdu_move_to_msg3(uint32_t pdu_sz);
uint32_t allocate_sdu(uint32_t lcid, srslte::sch_pdu* pdu, int max_sdu_sz);
bool sched_sdu(logical_channel_config_t* ch, int* sdu_space, int max_sdu_sz);
bool sched_sdu(srslte::logical_channel_config_t* ch, int* sdu_space, int max_sdu_sz);
const static int MAX_NOF_SUBHEADERS = 20;
std::vector<logical_channel_config_t> logical_channels;
std::vector<srslte::logical_channel_config_t> logical_channels;
// Mutex for exclusive access
std::mutex mutex;

@ -126,7 +126,7 @@ private:
srslte::block_queue<cmd_msg_t> cmd_q;
phy_interface_rrc_nr* phy = nullptr;
// mac_interface_rrc* mac = nullptr;
mac_interface_rrc_nr* mac = nullptr;
rlc_interface_rrc* rlc = nullptr;
pdcp_interface_rrc* pdcp = nullptr;
gw_interface_rrc* gw = nullptr;

@ -23,6 +23,7 @@
#include <string>
#include "mac/mac.h"
#include "mac/mac_nr.h"
#include "rrc/rrc.h"
#include "srslte/radio/radio.h"
#include "srslte/upper/pdcp.h"
@ -168,6 +169,7 @@ private:
srslte::pdcp pdcp;
srsue::rrc rrc;
#ifdef HAVE_5GNR
srsue::mac_nr mac_nr;
srsue::rrc_nr rrc_nr;
#endif
srsue::nas nas;

@ -196,19 +196,7 @@ void mac_nr::timer_expired(uint32_t timer_id)
// not implemented
}
void mac_nr::setup_lcid(uint32_t lcid, uint32_t lcg, uint32_t priority, int PBR_x_tti, uint32_t BSD)
{
logical_channel_config_t config = {};
config.lcid = lcid;
config.lcg = lcg;
config.priority = priority;
config.PBR = PBR_x_tti;
config.BSD = BSD;
config.bucket_size = config.PBR * config.BSD;
setup_lcid(config);
}
void mac_nr::setup_lcid(const logical_channel_config_t& config)
void mac_nr::setup_lcid(const srslte::logical_channel_config_t& config)
{
Info("Logical Channel Setup: LCID=%d, LCG=%d, priority=%d, PBR=%d, BSD=%dms, bucket_size=%d\n",
config.lcid,
@ -221,6 +209,18 @@ void mac_nr::setup_lcid(const logical_channel_config_t& config)
// bsr_procedure.setup_lcid(config.lcid, config.lcg, config.priority);
}
void mac_nr::set_config(const srslte::bsr_cfg_t& bsr_cfg)
{
Info("BSR config periodic timer %d retx timer %d\n", bsr_cfg.periodic_timer, bsr_cfg.retx_timer);
Warning("Not handling BSR config yet\n");
}
void mac_nr::set_config(const srslte::sr_cfg_t& sr_cfg)
{
Info("Scheduling Request Config DSR tansmax %d\n", sr_cfg.dsr_transmax);
Warning("Not Scheduling Request Config yet\n");
}
void mac_nr::get_metrics(mac_metrics_t m[SRSLTE_MAX_CARRIERS]) {}
/**

@ -43,6 +43,7 @@ void rrc_nr::init(phy_interface_rrc_nr* phy_,
rlc = rlc_;
pdcp = pdcp_;
gw = gw_;
mac = mac_;
rrc_eutra = rrc_eutra_;
timers = timers_;
stack = stack_;
@ -484,29 +485,58 @@ bool rrc_nr::apply_rlc_add_mod(const rlc_bearer_cfg_s& rlc_bearer_cfg)
// Setup RLC
rlc->add_bearer(lc_ch_id, rlc_cfg);
uint8_t log_chan_group = 0;
uint8_t priority = 1;
int prioritized_bit_rate = -1;
int bucket_size_duration = -1;
if (rlc_bearer_cfg.mac_lc_ch_cfg_present == true && rlc_bearer_cfg.mac_lc_ch_cfg.ul_specific_params_present) {
lc_ch_cfg_s::ul_specific_params_s_ ul_specific_params = rlc_bearer_cfg.mac_lc_ch_cfg.ul_specific_params;
logical_channel_config_t logical_channel_cfg;
logical_channel_cfg = srslte::make_mac_logical_channel_cfg_t(lc_ch_id, rlc_bearer_cfg.mac_lc_ch_cfg);
mac->setup_lcid(logical_channel_cfg);
}
return true;
}
bool rrc_nr::apply_mac_cell_group(const mac_cell_group_cfg_s& mac_cell_group_cfg)
{
if (ul_specific_params.lc_ch_group_present) {
log_chan_group = ul_specific_params.lc_ch_group;
} else {
log_h->warning("LCG not present, setting to 0\n");
if (mac_cell_group_cfg.sched_request_cfg_present) {
sr_cfg_t sr_cfg;
if (mac_cell_group_cfg.sched_request_cfg.sched_request_to_add_mod_list_present) {
if (mac_cell_group_cfg.sched_request_cfg.sched_request_to_add_mod_list.size() > 1) {
log_h->warning("Only handling 1 scheduling request index to add\n");
sr_cfg.dsr_transmax = mac_cell_group_cfg.sched_request_cfg.sched_request_to_add_mod_list[1].sr_trans_max;
mac->set_config(sr_cfg);
}
}
priority = ul_specific_params.prio;
prioritized_bit_rate = ul_specific_params.prioritised_bit_rate.to_number();
bucket_size_duration = ul_specific_params.bucket_size_dur.to_number();
// TODO Setup MAC @andre
// mac->setup_lcid(lc_ch_id, log_chan_group, priority, prioritized_bit_rate, bucket_size_duration);
if (mac_cell_group_cfg.sched_request_cfg.sched_request_to_release_list_present) {
log_h->warning("Not handling sched request to release list\n");
}
}
if (mac_cell_group_cfg.sched_request_cfg_present)
if (mac_cell_group_cfg.bsr_cfg_present) {
log_h->debug("Handling MAC BSR config\n");
srslte::bsr_cfg_t bsr_cfg;
bsr_cfg.periodic_timer = mac_cell_group_cfg.bsr_cfg.periodic_bsr_timer.to_number();
bsr_cfg.retx_timer = mac_cell_group_cfg.bsr_cfg.retx_bsr_timer.to_number();
mac->set_config(bsr_cfg);
}
if (mac_cell_group_cfg.tag_cfg_present) {
log_h->warning("Not handling tag cfg in MAC cell group config\n");
}
if (mac_cell_group_cfg.phr_cfg_present) {
log_h->warning("Not handling phr cfg in MAC cell group config\n");
}
if (mac_cell_group_cfg.skip_ul_tx_dynamic) {
log_h->warning("Not handling phr cfg in skip_ul_tx_dynamic cell group config\n");
}
return true;
}
bool rrc_nr::apply_mac_cell_group(const mac_cell_group_cfg_s& mac_cell_group_cfg)
bool rrc_nr::apply_sp_cell_cfg(const sp_cell_cfg_s& sp_cell_cfg)
{
// TODO Setup PHY @andre and @phy interface?
log_h->warning("Not handling SP Cell config\n");
return true;
}
@ -520,6 +550,9 @@ bool rrc_nr::apply_cell_group_cfg(const cell_group_cfg_s& cell_group_cfg)
if (cell_group_cfg.mac_cell_group_cfg_present == true) {
apply_mac_cell_group(cell_group_cfg.mac_cell_group_cfg);
}
if (cell_group_cfg.phys_cell_group_cfg_present == true) {
log_h->warning("Not handling physical cell group config\n");
}
if (cell_group_cfg.sp_cell_cfg_present) {
// apply_sp_cell_cfg(cell_group_cfg.sp_cell_cfg);
}

@ -32,6 +32,7 @@ ue_stack_lte::ue_stack_lte() :
mac("MAC", &task_sched),
rrc(this, &task_sched),
#ifdef HAVE_5GNR
mac_nr(&task_sched),
rrc_nr(&task_sched),
#endif
pdcp(&task_sched, "PDCP"),
@ -122,7 +123,9 @@ int ue_stack_lte::init(const stack_args_t& args_, srslte::logger* logger_)
pdcp.init(&rlc, &rrc, gw);
nas.init(usim.get(), &rrc, gw, args.nas);
#ifdef HAVE_5GNR
rrc_nr.init(nullptr, nullptr, &rlc, &pdcp, gw, &rrc, task_sched.get_timer_handler(), nullptr, args.rrc_nr);
mac_nr_args_t mac_nr_args;
mac_nr.init(mac_nr_args, nullptr, &rlc);
rrc_nr.init(nullptr, &mac_nr, &rlc, &pdcp, gw, &rrc, task_sched.get_timer_handler(), nullptr, args.rrc_nr);
rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, &rrc_nr, args.rrc);
#else
rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, args.rrc);

@ -25,7 +25,7 @@ set(LINK_LIBRARIES srsue_stack
${Boost_LIBRARIES})
if (ENABLE_5GNR)
set(LINK_LIBRARIES ${LINK_LIBRARIES} rrc_nr_asn1)
set(LINK_LIBRARIES ${LINK_LIBRARIES} rrc_nr_asn1 srsue_mac_nr srslte_mac)
endif (ENABLE_5GNR)
target_link_libraries(ttcn3_dut ${LINK_LIBRARIES})

Loading…
Cancel
Save