bugfix,srsenb: fix intraenb handover softbuffer allocation during handover

master
Francisco 4 years ago committed by Francisco Paisana
parent d5234b5f65
commit 5a82a63bb5

@ -212,7 +212,7 @@ public:
virtual int cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg) = 0; virtual int cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg) = 0;
/* Manages UE configuration context */ /* Manages UE configuration context */
virtual int ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg) = 0; virtual int ue_cfg(uint16_t rnti, const sched_interface::ue_cfg_t* cfg) = 0;
virtual int ue_rem(uint16_t rnti) = 0; virtual int ue_rem(uint16_t rnti) = 0;
/** /**
@ -223,7 +223,7 @@ public:
* @param crnti chosen C-RNTI for the UE * @param crnti chosen C-RNTI for the UE
* @param cfg new UE scheduler configuration * @param cfg new UE scheduler configuration
*/ */
virtual int ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_cfg_t* cfg) = 0; virtual int ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, const sched_interface::ue_cfg_t& cfg) = 0;
/* Manages UE bearers and associated configuration */ /* Manages UE bearers and associated configuration */
virtual int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg) = 0; virtual int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg) = 0;

@ -77,9 +77,9 @@ public:
int cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg) override; int cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg) override;
/* Manages UE scheduling context */ /* Manages UE scheduling context */
int ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg) override; int ue_cfg(uint16_t rnti, const sched_interface::ue_cfg_t* cfg) override;
int ue_rem(uint16_t rnti) override; int ue_rem(uint16_t rnti) override;
int ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_cfg_t* cfg) override; int ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, const sched_interface::ue_cfg_t& cfg) override;
// Indicates that the PHY config dedicated has been enabled or not // Indicates that the PHY config dedicated has been enabled or not
void phy_config_enabled(uint16_t rnti, bool enabled) override; void phy_config_enabled(uint16_t rnti, bool enabled) override;

@ -135,6 +135,8 @@ public:
void reset(); void reset();
void start_pcap(srsran::mac_pcap* pcap_); void start_pcap(srsran::mac_pcap* pcap_);
void start_pcap_net(srsran::mac_pcap_net* pcap_net_); void start_pcap_net(srsran::mac_pcap_net* pcap_net_);
void ue_cfg(const sched_interface::ue_cfg_t& ue_cfg);
void set_tti(uint32_t tti); void set_tti(uint32_t tti);
uint16_t get_rnti() const { return rnti; } uint16_t get_rnti() const { return rnti; }
uint32_t set_ta(int ta) override; uint32_t set_ta(int ta) override;
@ -214,7 +216,7 @@ private:
std::mutex mutex; std::mutex mutex;
std::mutex rx_buffers_mutex; std::mutex rx_buffers_mutex;
const uint8_t UL_CC_IDX = 0; ///< Passed to write CC index in PCAP (TODO: use actual CC idx) static const uint8_t UL_CC_IDX = 0; ///< Passed to write CC index in PCAP
}; };
} // namespace srsenb } // namespace srsenb

@ -165,7 +165,7 @@ void mac::phy_config_enabled(uint16_t rnti, bool enabled)
} }
// Update UE configuration // Update UE configuration
int mac::ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg) int mac::ue_cfg(uint16_t rnti, const sched_interface::ue_cfg_t* cfg)
{ {
srsran::rwlock_read_guard lock(rwlock); srsran::rwlock_read_guard lock(rwlock);
if (not check_ue_active(rnti)) { if (not check_ue_active(rnti)) {
@ -177,10 +177,12 @@ int mac::ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg)
ue_ptr->start_ta(); ue_ptr->start_ta();
// Update Scheduler configuration // Update Scheduler configuration
if (cfg != nullptr and scheduler.ue_cfg(rnti, *cfg) == SRSRAN_ERROR) { if (scheduler.ue_cfg(rnti, *cfg) == SRSRAN_ERROR) {
logger.error("Registering new UE rnti=0x%x to SCHED", rnti); logger.error("Registering UE rnti=0x%x to SCHED", rnti);
return SRSRAN_ERROR; return SRSRAN_ERROR;
} }
ue_ptr->ue_cfg(*cfg);
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }
@ -211,7 +213,7 @@ int mac::ue_rem(uint16_t rnti)
} }
// Called after Msg3 // Called after Msg3
int mac::ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_cfg_t* cfg) int mac::ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, const sched_interface::ue_cfg_t& cfg)
{ {
srsran::rwlock_read_guard lock(rwlock); srsran::rwlock_read_guard lock(rwlock);
if (temp_crnti != crnti) { if (temp_crnti != crnti) {
@ -221,7 +223,7 @@ int mac::ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_c
// Schedule ConRes Msg4 // Schedule ConRes Msg4
scheduler.dl_mac_buffer_state(crnti, (uint32_t)srsran::dl_sch_lcid::CON_RES_ID); scheduler.dl_mac_buffer_state(crnti, (uint32_t)srsran::dl_sch_lcid::CON_RES_ID);
} }
return ue_cfg(crnti, cfg); return ue_cfg(crnti, &cfg);
} }
int mac::cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg_) int mac::cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg_)
@ -493,19 +495,17 @@ uint16_t mac::allocate_ue(uint32_t enb_cc_idx)
return rnti; return rnti;
} }
uint16_t mac::reserve_new_crnti(const sched_interface::ue_cfg_t& ue_cfg) uint16_t mac::reserve_new_crnti(const sched_interface::ue_cfg_t& uecfg)
{ {
uint16_t rnti = allocate_ue(ue_cfg.supported_cc_list[0].enb_cc_idx); uint16_t rnti = allocate_ue(uecfg.supported_cc_list[0].enb_cc_idx);
if (rnti == SRSRAN_INVALID_RNTI) { if (rnti == SRSRAN_INVALID_RNTI) {
return rnti; return rnti;
} }
// Add new user to the scheduler so that it can RX/TX SRB0 // Add new user to the scheduler so that it can RX/TX SRB0
if (scheduler.ue_cfg(rnti, ue_cfg) != SRSRAN_SUCCESS) { if (ue_cfg(rnti, &uecfg) != SRSRAN_SUCCESS) {
logger.error("Registering new user rnti=0x%x to SCHED", rnti);
return SRSRAN_INVALID_RNTI; return SRSRAN_INVALID_RNTI;
} }
return rnti; return rnti;
} }
@ -534,20 +534,18 @@ void mac::rach_detected(uint32_t tti, uint32_t enb_cc_idx, uint32_t preamble_idx
++detected_rachs[enb_cc_idx]; ++detected_rachs[enb_cc_idx];
// Add new user to the scheduler so that it can RX/TX SRB0 // Add new user to the scheduler so that it can RX/TX SRB0
sched_interface::ue_cfg_t ue_cfg = {}; sched_interface::ue_cfg_t uecfg = {};
ue_cfg.supported_cc_list.emplace_back(); uecfg.supported_cc_list.emplace_back();
ue_cfg.supported_cc_list.back().active = true; uecfg.supported_cc_list.back().active = true;
ue_cfg.supported_cc_list.back().enb_cc_idx = enb_cc_idx; uecfg.supported_cc_list.back().enb_cc_idx = enb_cc_idx;
ue_cfg.ue_bearers[0].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH; uecfg.ue_bearers[0].direction = srsenb::sched_interface::ue_bearer_cfg_t::BOTH;
ue_cfg.supported_cc_list[0].dl_cfg.tm = SRSRAN_TM1; uecfg.supported_cc_list[0].dl_cfg.tm = SRSRAN_TM1;
if (scheduler.ue_cfg(rnti, ue_cfg) != SRSRAN_SUCCESS) { if (ue_cfg(rnti, &uecfg) != SRSRAN_SUCCESS) {
logger.error("Registering new user rnti=0x%x to SCHED", rnti);
ue_rem(rnti);
return; return;
} }
// Register new user in RRC // Register new user in RRC
if (rrc_h->add_user(rnti, ue_cfg) == SRSRAN_ERROR) { if (rrc_h->add_user(rnti, uecfg) == SRSRAN_ERROR) {
ue_rem(rnti); ue_rem(rnti);
return; return;
} }
@ -924,6 +922,7 @@ int mac::get_ul_sched(uint32_t tti_tx_ul, ul_sched_list_t& ul_sched_res_list)
// If the Rx soft-buffer is not given, abort reception // If the Rx soft-buffer is not given, abort reception
if (phy_ul_sched_res->pusch[n].softbuffer_rx == nullptr) { if (phy_ul_sched_res->pusch[n].softbuffer_rx == nullptr) {
logger.warning("Failed to retrieve UL softbuffer for tti=%d, cc=%d", tti_tx_ul, enb_cc_idx);
continue; continue;
} }

@ -220,6 +220,16 @@ void ue::start_pcap(srsran::mac_pcap* pcap_)
pcap = pcap_; pcap = pcap_;
} }
void ue::ue_cfg(const sched_interface::ue_cfg_t& ue_cfg)
{
for (const auto& ue_cc : ue_cfg.supported_cc_list) {
// Allocate and initialize Rx/Tx softbuffers for new carriers (exclude PCell)
if (ue_cc.active and cc_buffers[ue_cc.enb_cc_idx].empty()) {
cc_buffers[ue_cc.enb_cc_idx].allocate_cc(softbuffer_pool->make());
}
}
}
srsran_softbuffer_rx_t* ue::get_rx_softbuffer(uint32_t enb_cc_idx, uint32_t tti) srsran_softbuffer_rx_t* ue::get_rx_softbuffer(uint32_t enb_cc_idx, uint32_t tti)
{ {
if ((size_t)enb_cc_idx >= cc_buffers.size() or cc_buffers[enb_cc_idx].empty()) { if ((size_t)enb_cc_idx >= cc_buffers.size() or cc_buffers[enb_cc_idx].empty()) {
@ -509,12 +519,6 @@ void ue::allocate_ce(srsran::sch_pdu* pdu, uint32_t lcid)
} }
if (pdu->get()->set_scell_activation_cmd(active_scell_list)) { if (pdu->get()->set_scell_activation_cmd(active_scell_list)) {
phy->set_activation_deactivation_scell(rnti, active_scell_list); phy->set_activation_deactivation_scell(rnti, active_scell_list);
// Allocate and initialize Rx/Tx softbuffers for new carriers (exclude PCell)
for (size_t cc = 0; cc < cc_buffers.size(); ++cc) {
if (active_ccs[cc] >= 0 and cc_buffers[cc].empty()) {
cc_buffers[cc].allocate_cc(softbuffer_pool->make());
}
}
} else { } else {
logger.error("CE: Setting SCell Activation CE"); logger.error("CE: Setting SCell Activation CE");
} }

@ -116,7 +116,7 @@ void mac_controller::handle_con_reject()
if (not crnti_set) { if (not crnti_set) {
crnti_set = true; crnti_set = true;
// Need to schedule ConRes CE for UE to see the Reject message // Need to schedule ConRes CE for UE to see the Reject message
mac->ue_set_crnti(rnti, rnti, &current_sched_ue_cfg); mac->ue_set_crnti(rnti, rnti, current_sched_ue_cfg);
} }
} }
@ -137,7 +137,7 @@ int mac_controller::handle_crnti_ce(uint32_t temp_crnti)
current_sched_ue_cfg.ue_bearers[i] = next_sched_ue_cfg.ue_bearers[i]; current_sched_ue_cfg.ue_bearers[i] = next_sched_ue_cfg.ue_bearers[i];
} }
return mac->ue_set_crnti(temp_crnti, rnti, &current_sched_ue_cfg); return mac->ue_set_crnti(temp_crnti, rnti, current_sched_ue_cfg);
} }
int mac_controller::apply_basic_conn_cfg(const asn1::rrc::rr_cfg_ded_s& rr_cfg) int mac_controller::apply_basic_conn_cfg(const asn1::rrc::rr_cfg_ded_s& rr_cfg)
@ -183,7 +183,7 @@ int mac_controller::apply_basic_conn_cfg(const asn1::rrc::rr_cfg_ded_s& rr_cfg)
// In case of RRC Connection Setup/Reest message (Msg4), we need to resolve the contention by sending a ConRes CE // In case of RRC Connection Setup/Reest message (Msg4), we need to resolve the contention by sending a ConRes CE
mac->phy_config_enabled(rnti, false); mac->phy_config_enabled(rnti, false);
crnti_set = true; crnti_set = true;
return mac->ue_set_crnti(rnti, rnti, &current_sched_ue_cfg); return mac->ue_set_crnti(rnti, rnti, current_sched_ue_cfg);
} }
void mac_controller::handle_con_setup_complete() void mac_controller::handle_con_setup_complete()

@ -28,9 +28,9 @@ class mac_dummy : public mac_interface_rrc
{ {
public: public:
int cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg) override { return 0; } int cell_cfg(const std::vector<sched_interface::cell_cfg_t>& cell_cfg) override { return 0; }
int ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg) override { return 0; } int ue_cfg(uint16_t rnti, const sched_interface::ue_cfg_t* cfg) override { return 0; }
int ue_rem(uint16_t rnti) override { return 0; } int ue_rem(uint16_t rnti) override { return 0; }
int ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_cfg_t* cfg) override { return 0; } int ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, const sched_interface::ue_cfg_t& cfg) override { return 0; }
int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg) override { return 0; } int bearer_ue_cfg(uint16_t rnti, uint32_t lc_id, sched_interface::ue_bearer_cfg_t* cfg) override { return 0; }
int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) override { return 0; } int bearer_ue_rem(uint16_t rnti, uint32_t lc_id) override { return 0; }
void phy_config_enabled(uint16_t rnti, bool enabled) override {} void phy_config_enabled(uint16_t rnti, bool enabled) override {}

@ -175,14 +175,14 @@ public:
class mac_mobility_dummy : public mac_dummy class mac_mobility_dummy : public mac_dummy
{ {
public: public:
int ue_cfg(uint16_t rnti, sched_interface::ue_cfg_t* cfg) override int ue_cfg(uint16_t rnti, const sched_interface::ue_cfg_t* cfg) override
{ {
ue_db[rnti] = *cfg; ue_db[rnti] = *cfg;
return 0; return 0;
} }
int ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_cfg_t* cfg) override int ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, const sched_interface::ue_cfg_t& cfg) override
{ {
ue_db[crnti] = *cfg; ue_db[crnti] = cfg;
return 0; return 0;
} }
std::map<uint16_t, sched_interface::ue_cfg_t> ue_db; std::map<uint16_t, sched_interface::ue_cfg_t> ue_db;

Loading…
Cancel
Save