mac_nr,sched: handle C-RNTI CE

master
Andre Puschmann 3 years ago
parent 272fc47bc2
commit 88bb92dc0d

@ -135,6 +135,7 @@ public:
/// User management /// User management
virtual int add_user(uint16_t rnti) = 0; virtual int add_user(uint16_t rnti) = 0;
virtual int update_user(uint16_t new_rnti, uint16_t old_rnti) = 0;
}; };
// NR interface is almost identical to EUTRA version // NR interface is almost identical to EUTRA version

@ -47,7 +47,7 @@ public:
void dl_ack_info(uint16_t rnti, uint32_t cc, uint32_t pid, uint32_t tb_idx, bool ack) override; void dl_ack_info(uint16_t rnti, uint32_t cc, uint32_t pid, uint32_t tb_idx, bool ack) override;
void ul_crc_info(uint16_t rnti, uint32_t cc, uint32_t pid, bool crc) override; void ul_crc_info(uint16_t rnti, uint32_t cc, uint32_t pid, bool crc) override;
void ul_sr_info(slot_point slot_rx, uint16_t rnti) override; void ul_sr_info(slot_point slot_rx, uint16_t rnti) override;
void ul_bsr(uint16_t rnti, uint32_t lcg_id, uint32_t bsr); void ul_bsr(uint16_t rnti, uint32_t lcg_id, uint32_t bsr) override;
void dl_buffer_state(uint16_t rnti, uint32_t lcid, uint32_t newtx, uint32_t retx); void dl_buffer_state(uint16_t rnti, uint32_t lcid, uint32_t newtx, uint32_t retx);
int get_dl_sched(slot_point pdsch_tti, uint32_t cc, dl_sched_res_t& result) override; int get_dl_sched(slot_point pdsch_tti, uint32_t cc, dl_sched_res_t& result) override;

@ -125,6 +125,7 @@ public:
virtual void dl_ack_info(uint16_t rnti, uint32_t cc, uint32_t pid, uint32_t tb_idx, bool ack) = 0; virtual void dl_ack_info(uint16_t rnti, uint32_t cc, uint32_t pid, uint32_t tb_idx, bool ack) = 0;
virtual void ul_crc_info(uint16_t rnti, uint32_t cc, uint32_t pid, bool crc) = 0; virtual void ul_crc_info(uint16_t rnti, uint32_t cc, uint32_t pid, bool crc) = 0;
virtual void ul_sr_info(slot_point, uint16_t rnti) = 0; virtual void ul_sr_info(slot_point, uint16_t rnti) = 0;
virtual void ul_bsr(uint16_t rnti, uint32_t lcg_id, uint32_t bsr) = 0;
}; };
} // namespace srsenb } // namespace srsenb

@ -14,7 +14,7 @@
#define SRSENB_UE_NR_H #define SRSENB_UE_NR_H
#include "srsenb/hdr/stack/mac/common/mac_metrics.h" #include "srsenb/hdr/stack/mac/common/mac_metrics.h"
#include "srsenb/hdr/stack/mac/sched_interface.h" #include "srsenb/hdr/stack/mac/nr/sched_nr_interface.h"
#include "srsran/common/block_queue.h" #include "srsran/common/block_queue.h"
#include "srsran/common/interfaces_common.h" #include "srsran/common/interfaces_common.h"
#include "srsran/interfaces/enb_rlc_interfaces.h" #include "srsran/interfaces/enb_rlc_interfaces.h"
@ -33,7 +33,7 @@ class ue_nr : public srsran::read_pdu_interface
public: public:
ue_nr(uint16_t rnti, ue_nr(uint16_t rnti,
uint32_t enb_cc_idx, uint32_t enb_cc_idx,
sched_interface* sched_, sched_nr_interface* sched_,
rrc_interface_mac_nr* rrc_, rrc_interface_mac_nr* rrc_,
rlc_interface_mac* rlc, rlc_interface_mac* rlc,
phy_interface_stack_nr* phy_, phy_interface_stack_nr* phy_,
@ -68,7 +68,7 @@ private:
rrc_interface_mac_nr* rrc = nullptr; rrc_interface_mac_nr* rrc = nullptr;
phy_interface_stack_nr* phy = nullptr; phy_interface_stack_nr* phy = nullptr;
srslog::basic_logger& logger; srslog::basic_logger& logger;
sched_interface* sched = nullptr; sched_nr_interface* sched = nullptr;
uint64_t conres_id = 0; uint64_t conres_id = 0;
uint16_t rnti = 0; uint16_t rnti = 0;

@ -187,8 +187,7 @@ uint16_t mac_nr::alloc_ue(uint32_t enb_cc_idx)
} }
// Allocate and initialize UE object // Allocate and initialize UE object
// TODO: add sched interface std::unique_ptr<ue_nr> ue_ptr = std::unique_ptr<ue_nr>(new ue_nr(rnti, enb_cc_idx, &sched, rrc, rlc, phy, logger));
std::unique_ptr<ue_nr> ue_ptr = std::unique_ptr<ue_nr>(new ue_nr(rnti, enb_cc_idx, nullptr, rrc, rlc, phy, logger));
// Add UE to rnti map // Add UE to rnti map
srsran::rwlock_write_guard rw_lock(rwlock); srsran::rwlock_write_guard rw_lock(rwlock);

@ -24,7 +24,7 @@ namespace srsenb {
ue_nr::ue_nr(uint16_t rnti_, ue_nr::ue_nr(uint16_t rnti_,
uint32_t enb_cc_idx, uint32_t enb_cc_idx,
sched_interface* sched_, sched_nr_interface* sched_,
rrc_interface_mac_nr* rrc_, rrc_interface_mac_nr* rrc_,
rlc_interface_mac* rlc_, rlc_interface_mac* rlc_,
phy_interface_stack_nr* phy_, phy_interface_stack_nr* phy_,
@ -81,9 +81,20 @@ int ue_nr::process_pdu(srsran::unique_byte_buffer_t pdu)
// Handle MAC CEs // Handle MAC CEs
switch (subpdu.get_lcid()) { switch (subpdu.get_lcid()) {
case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::CRNTI: case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::CRNTI: {
logger.info("CRNTI CE not implemented."); uint16_t c_rnti = subpdu.get_c_rnti();
break; if (true /*sched->ue_exists(c_crnti)*/) {
rrc->update_user(rnti, c_rnti);
rnti = c_rnti;
sched->ul_bsr(rnti, 0, 1); // provide UL grant regardless of other BSR content for UE to complete RA
} else {
logger.warning("Updating user C-RNTI: rnti=0x%x already released.", c_rnti);
// Disable scheduling for all bearers. The new rnti will be removed on msg3 timer expiry in the RRC
for (uint32_t lcid = 0; lcid < sched_interface::MAX_LC; ++lcid) {
// sched->bearer_ue_rem(rnti, lcid);
}
}
} break;
case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::SHORT_BSR: case srsran::mac_sch_subpdu_nr::nr_lcid_sch_t::SHORT_BSR:
logger.info("SHORT_BSR CE not implemented."); logger.info("SHORT_BSR CE not implemented.");
break; break;
@ -144,8 +155,8 @@ int ue_nr::generate_pdu(srsran::byte_buffer_t* pdu, uint32_t grant_size)
/******* METRICS interface ***************/ /******* METRICS interface ***************/
void ue_nr::metrics_read(mac_ue_metrics_t* metrics_) void ue_nr::metrics_read(mac_ue_metrics_t* metrics_)
{ {
uint32_t ul_buffer = sched->get_ul_buffer(rnti); uint32_t ul_buffer = 0; // sched->get_ul_buffer(rnti);
uint32_t dl_buffer = sched->get_dl_buffer(rnti); uint32_t dl_buffer = 0; // sched->get_dl_buffer(rnti);
std::lock_guard<std::mutex> lock(metrics_mutex); std::lock_guard<std::mutex> lock(metrics_mutex);
ue_metrics.rnti = rnti; ue_metrics.rnti = rnti;
@ -153,7 +164,7 @@ void ue_nr::metrics_read(mac_ue_metrics_t* metrics_)
ue_metrics.dl_buffer = dl_buffer; ue_metrics.dl_buffer = dl_buffer;
// set PCell sector id // set PCell sector id
std::array<int, SRSRAN_MAX_CARRIERS> cc_list = sched->get_enb_ue_cc_map(rnti); std::array<int, SRSRAN_MAX_CARRIERS> cc_list; //= sched->get_enb_ue_cc_map(rnti);
auto it = std::find(cc_list.begin(), cc_list.end(), 0); auto it = std::find(cc_list.begin(), cc_list.end(), 0);
ue_metrics.cc_idx = std::distance(cc_list.begin(), it); ue_metrics.cc_idx = std::distance(cc_list.begin(), it);

@ -24,6 +24,7 @@ public:
int read_pdu_bcch_bch(const uint32_t tti, srsran::unique_byte_buffer_t& buffer) { return SRSRAN_SUCCESS; } 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_dlsch(uint32_t sib_index, srsran::unique_byte_buffer_t& buffer) { return SRSRAN_SUCCESS; }
int add_user(uint16_t rnti) { return SRSRAN_SUCCESS; } int add_user(uint16_t rnti) { return SRSRAN_SUCCESS; }
int update_user(uint16_t new_rnti, uint16_t old_rnti) { return SRSRAN_SUCCESS; }
}; };
class rlc_nr_dummy : public rlc_interface_mac_nr class rlc_nr_dummy : public rlc_interface_mac_nr

Loading…
Cancel
Save