mac_nr: add interface to set C-RNTI and contention ID from RRC

used during contention-based/free RA
This commit is contained in:
Andre Puschmann 2021-02-01 21:32:00 +01:00
parent cd68e604b0
commit f5c945dc2f
3 changed files with 35 additions and 2 deletions

View File

@ -60,6 +60,12 @@ 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;
// RRC informs MAC about the (randomly) selected ID used for contention-based RA
virtual void set_contention_id(const uint64_t ue_identity) = 0;
// RRC informs MAC about new UE identity for contention-free RA
virtual bool set_crnti(const uint16_t crnti) = 0;
};
class phy_interface_mac_nr

View File

@ -58,10 +58,12 @@ public:
void get_metrics(mac_metrics_t* metrics);
/******** Interface for RRC (RRC -> MAC) ****************/
/// 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);
void set_contention_id(const uint64_t ue_identity);
bool set_crnti(const uint16_t crnti);
/// stack interface
void process_pdus();
@ -76,6 +78,7 @@ private:
bool has_crnti();
uint16_t get_crnti();
bool is_valid_crnti(const uint16_t crnti);
/// Interaction with rest of the stack
phy_interface_mac_nr* phy = nullptr;
@ -89,7 +92,8 @@ private:
bool started = false;
uint16_t crnti = 0xdead;
uint16_t crnti = 0xdead;
uint64_t contention_id = 0;
static constexpr uint32_t MIN_RLC_PDU_LEN =
5; ///< minimum bytes that need to be available in a MAC PDU for attempting to add another RLC SDU

View File

@ -258,6 +258,29 @@ void mac_nr::set_config(const srslte::sr_cfg_t& sr_cfg)
logger.warning("Not Scheduling Request Config yet");
}
void mac_nr::set_contention_id(uint64_t ue_identity)
{
contention_id = ue_identity;
}
bool mac_nr::set_crnti(const uint16_t crnti_)
{
if (is_valid_crnti(crnti_)) {
logger.info("Setting C-RNTI to 0x%X", crnti_);
crnti = crnti_;
return true;
} else {
logger.warning("Failed to set C-RNTI, 0x%X is not valid.", crnti_);
return false;
}
}
bool mac_nr::is_valid_crnti(const uint16_t crnti)
{
// TS 38.321 15.3.0 Table 7.1-1
return (crnti >= 0x0001 && crnti <= 0xFFEF);
}
void mac_nr::get_metrics(mac_metrics_t m[SRSLTE_MAX_CARRIERS]) {}
/**